@uxbertlabs/reportly 1.0.3 → 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
@@ -23,6 +23,10 @@ var Reportly = (function () {
23
23
  };
24
24
  }
25
25
  loadFromStorage() {
26
+ // Check if we're in a browser environment
27
+ if (typeof window === 'undefined' || typeof localStorage === 'undefined') {
28
+ return;
29
+ }
26
30
  try {
27
31
  const saved = localStorage.getItem('uxbert-config');
28
32
  if (saved) {
@@ -35,6 +39,10 @@ var Reportly = (function () {
35
39
  }
36
40
  }
37
41
  save() {
42
+ // Check if we're in a browser environment
43
+ if (typeof window === 'undefined' || typeof localStorage === 'undefined') {
44
+ return;
45
+ }
38
46
  try {
39
47
  localStorage.setItem('uxbert-config', JSON.stringify(this.config));
40
48
  }
@@ -339,24 +347,26 @@ var Reportly = (function () {
339
347
  }
340
348
 
341
349
  class Toolbar {
350
+ // private currentTool: AnnotationTool;
351
+ // private currentColor: string;
342
352
  constructor(callbacks) {
343
353
  this.callbacks = callbacks;
344
354
  this.toolbar = null;
345
355
  this.toggleButton = null;
346
356
  this.isToolbarExpanded = false;
347
- this.currentTool = 'pen';
348
- this.currentColor = '#ef4444';
357
+ // this.currentTool = "pen";
358
+ // this.currentColor = "#ef4444";
349
359
  }
350
360
  create() {
351
361
  // Create toggle button
352
- this.toggleButton = document.createElement('button');
353
- this.toggleButton.className = 'uxbert-toolbar-toggle';
354
- this.toggleButton.innerHTML = '🛠️';
355
- 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";
356
366
  document.body.appendChild(this.toggleButton);
357
367
  // Create toolbar
358
- this.toolbar = document.createElement('div');
359
- this.toolbar.className = 'uxbert-toolbar';
368
+ this.toolbar = document.createElement("div");
369
+ this.toolbar.className = "uxbert-toolbar";
360
370
  this.toolbar.innerHTML = `
361
371
  <div class="uxbert-toolbar-header">
362
372
  <div class="uxbert-toolbar-title">Annotation Tools</div>
@@ -396,19 +406,19 @@ var Reportly = (function () {
396
406
  if (!this.toolbar || !this.toggleButton)
397
407
  return;
398
408
  // Toggle button
399
- this.toggleButton.addEventListener('click', () => {
409
+ this.toggleButton.addEventListener("click", () => {
400
410
  this.toggleToolbar();
401
411
  });
402
412
  // Minimize button
403
- const minimizeBtn = this.toolbar.querySelector('#uxbert-minimize-btn');
404
- minimizeBtn.addEventListener('click', () => {
413
+ const minimizeBtn = this.toolbar.querySelector("#uxbert-minimize-btn");
414
+ minimizeBtn.addEventListener("click", () => {
405
415
  this.toggleToolbar();
406
416
  });
407
417
  // Tool buttons
408
- const toolBtns = this.toolbar.querySelectorAll('[data-tool]');
409
- toolBtns.forEach(btn => {
410
- btn.addEventListener('click', () => {
411
- 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");
412
422
  this.setTool(tool);
413
423
  if (this.callbacks.onToolChange) {
414
424
  this.callbacks.onToolChange(tool);
@@ -416,10 +426,10 @@ var Reportly = (function () {
416
426
  });
417
427
  });
418
428
  // Color buttons
419
- const colorBtns = this.toolbar.querySelectorAll('[data-color]');
420
- colorBtns.forEach(btn => {
421
- btn.addEventListener('click', () => {
422
- 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");
423
433
  this.setColor(color);
424
434
  if (this.callbacks.onColorChange) {
425
435
  this.callbacks.onColorChange(color);
@@ -427,57 +437,57 @@ var Reportly = (function () {
427
437
  });
428
438
  });
429
439
  // Action buttons
430
- const undoBtn = this.toolbar.querySelector('#uxbert-undo-btn');
431
- undoBtn.addEventListener('click', () => {
440
+ const undoBtn = this.toolbar.querySelector("#uxbert-undo-btn");
441
+ undoBtn.addEventListener("click", () => {
432
442
  if (this.callbacks.onUndo) {
433
443
  this.callbacks.onUndo();
434
444
  }
435
445
  });
436
- const clearBtn = this.toolbar.querySelector('#uxbert-clear-btn');
437
- clearBtn.addEventListener('click', () => {
446
+ const clearBtn = this.toolbar.querySelector("#uxbert-clear-btn");
447
+ clearBtn.addEventListener("click", () => {
438
448
  if (this.callbacks.onClear) {
439
449
  this.callbacks.onClear();
440
450
  }
441
451
  });
442
- const doneBtn = this.toolbar.querySelector('#uxbert-done-btn');
443
- doneBtn.addEventListener('click', () => {
452
+ const doneBtn = this.toolbar.querySelector("#uxbert-done-btn");
453
+ doneBtn.addEventListener("click", () => {
444
454
  if (this.callbacks.onDone) {
445
455
  this.callbacks.onDone();
446
456
  }
447
457
  });
448
458
  // Exit button
449
- const exitBtn = this.toolbar.querySelector('#uxbert-exit-btn');
450
- exitBtn.addEventListener('click', () => {
459
+ const exitBtn = this.toolbar.querySelector("#uxbert-exit-btn");
460
+ exitBtn.addEventListener("click", () => {
451
461
  if (this.callbacks.onExit) {
452
462
  this.callbacks.onExit();
453
463
  }
454
464
  });
455
465
  }
456
466
  setTool(tool) {
457
- this.currentTool = tool;
467
+ // this.currentTool = tool;
458
468
  if (!this.toolbar)
459
469
  return;
460
- const toolBtns = this.toolbar.querySelectorAll('[data-tool]');
461
- toolBtns.forEach(btn => {
462
- if (btn.getAttribute('data-tool') === tool) {
463
- 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");
464
474
  }
465
475
  else {
466
- btn.classList.remove('active');
476
+ btn.classList.remove("active");
467
477
  }
468
478
  });
469
479
  }
470
480
  setColor(color) {
471
- this.currentColor = color;
481
+ // this.currentColor = color;
472
482
  if (!this.toolbar)
473
483
  return;
474
- const colorBtns = this.toolbar.querySelectorAll('[data-color]');
475
- colorBtns.forEach(btn => {
476
- if (btn.getAttribute('data-color') === color) {
477
- 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");
478
488
  }
479
489
  else {
480
- btn.classList.remove('active');
490
+ btn.classList.remove("active");
481
491
  }
482
492
  });
483
493
  }
@@ -486,40 +496,40 @@ var Reportly = (function () {
486
496
  return;
487
497
  this.isToolbarExpanded = !this.isToolbarExpanded;
488
498
  if (this.isToolbarExpanded) {
489
- this.toolbar.classList.add('expanded');
490
- this.toggleButton.classList.add('hidden');
499
+ this.toolbar.classList.add("expanded");
500
+ this.toggleButton.classList.add("hidden");
491
501
  }
492
502
  else {
493
- this.toolbar.classList.remove('expanded');
494
- this.toggleButton.classList.remove('hidden');
503
+ this.toolbar.classList.remove("expanded");
504
+ this.toggleButton.classList.remove("hidden");
495
505
  }
496
506
  }
497
507
  show() {
498
508
  if (this.toolbar && this.toggleButton) {
499
- this.toolbar.classList.add('active');
500
- this.toggleButton.classList.add('active');
509
+ this.toolbar.classList.add("active");
510
+ this.toggleButton.classList.add("active");
501
511
  // Use setTimeout to ensure DOM is ready before checking width and applying classes
502
512
  setTimeout(() => {
503
513
  // Auto-expand on desktop, collapsed on mobile
504
514
  if (window.innerWidth > 768) {
505
515
  this.isToolbarExpanded = true;
506
- this.toolbar.classList.add('expanded');
507
- this.toggleButton.classList.add('hidden');
516
+ this.toolbar.classList.add("expanded");
517
+ this.toggleButton.classList.add("hidden");
508
518
  }
509
519
  else {
510
520
  this.isToolbarExpanded = false;
511
- this.toolbar.classList.remove('expanded');
512
- this.toggleButton.classList.remove('hidden');
521
+ this.toolbar.classList.remove("expanded");
522
+ this.toggleButton.classList.remove("hidden");
513
523
  }
514
524
  }, 50);
515
525
  }
516
526
  }
517
527
  hide() {
518
528
  if (this.toolbar && this.toggleButton) {
519
- this.toolbar.classList.remove('active');
520
- this.toolbar.classList.remove('expanded');
521
- this.toggleButton.classList.remove('active');
522
- 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");
523
533
  this.isToolbarExpanded = false;
524
534
  }
525
535
  }
@@ -536,11 +546,11 @@ var Reportly = (function () {
536
546
  }
537
547
 
538
548
  /*!
539
- * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
540
- * 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
541
551
  * Released under MIT License
542
552
  */
543
- /*! *****************************************************************************
553
+ /******************************************************************************
544
554
  Copyright (c) Microsoft Corporation.
545
555
 
546
556
  Permission to use, copy, modify, and/or distribute this software for any
@@ -554,7 +564,7 @@ var Reportly = (function () {
554
564
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
555
565
  PERFORMANCE OF THIS SOFTWARE.
556
566
  ***************************************************************************** */
557
- /* global Reflect, Promise */
567
+ /* global Reflect, Promise, SuppressedError, Symbol */
558
568
 
559
569
  var extendStatics = function(d, b) {
560
570
  extendStatics = Object.setPrototypeOf ||
@@ -598,7 +608,7 @@ var Reportly = (function () {
598
608
  function verb(n) { return function (v) { return step([n, v]); }; }
599
609
  function step(op) {
600
610
  if (f) throw new TypeError("Generator is already executing.");
601
- while (_) try {
611
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
602
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;
603
613
  if (y = 0, t) op = [op[0] & 2, t.value];
604
614
  switch (op[0]) {
@@ -627,8 +637,13 @@ var Reportly = (function () {
627
637
  ar[i] = from[i];
628
638
  }
629
639
  }
630
- return to.concat(ar || from);
631
- }
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
+ };
632
647
 
633
648
  var Bounds = /** @class */ (function () {
634
649
  function Bounds(left, top, width, height) {
@@ -1523,38 +1538,38 @@ var Reportly = (function () {
1523
1538
  return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
1524
1539
  };
1525
1540
  var LEFT_PARENTHESIS_TOKEN = {
1526
- type: 2 /* LEFT_PARENTHESIS_TOKEN */
1541
+ type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
1527
1542
  };
1528
1543
  var RIGHT_PARENTHESIS_TOKEN = {
1529
- type: 3 /* RIGHT_PARENTHESIS_TOKEN */
1530
- };
1531
- var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
1532
- var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
1533
- var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
1534
- var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
1535
- var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
1536
- 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 */ };
1537
1552
  var LEFT_CURLY_BRACKET_TOKEN = {
1538
- type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
1553
+ type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
1539
1554
  };
1540
1555
  var RIGHT_CURLY_BRACKET_TOKEN = {
1541
- type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
1542
- };
1543
- var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
1544
- var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
1545
- var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
1546
- var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
1547
- var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
1548
- var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
1549
- 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 */ };
1550
1565
  var LEFT_SQUARE_BRACKET_TOKEN = {
1551
- type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
1566
+ type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
1552
1567
  };
1553
1568
  var RIGHT_SQUARE_BRACKET_TOKEN = {
1554
- type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
1569
+ type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
1555
1570
  };
1556
- var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
1557
- 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 */ };
1558
1573
  var Tokenizer = /** @class */ (function () {
1559
1574
  function Tokenizer() {
1560
1575
  this._value = [];
@@ -1583,7 +1598,7 @@ var Reportly = (function () {
1583
1598
  if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
1584
1599
  var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
1585
1600
  var value = this.consumeName();
1586
- return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
1601
+ return { type: 5 /* TokenType.HASH_TOKEN */, value: value, flags: flags };
1587
1602
  }
1588
1603
  break;
1589
1604
  case DOLLAR_SIGN:
@@ -1672,7 +1687,7 @@ var Reportly = (function () {
1672
1687
  var a3 = this.peekCodePoint(2);
1673
1688
  if (isIdentifierStart(a1, a2, a3)) {
1674
1689
  var value = this.consumeName();
1675
- return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
1690
+ return { type: 7 /* TokenType.AT_KEYWORD_TOKEN */, value: value };
1676
1691
  }
1677
1692
  break;
1678
1693
  case LEFT_SQUARE_BRACKET:
@@ -1736,7 +1751,7 @@ var Reportly = (function () {
1736
1751
  this.reconsumeCodePoint(codePoint);
1737
1752
  return this.consumeIdentLikeToken();
1738
1753
  }
1739
- return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
1754
+ return { type: 6 /* TokenType.DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
1740
1755
  };
1741
1756
  Tokenizer.prototype.consumeCodePoint = function () {
1742
1757
  var value = this._value.shift();
@@ -1767,7 +1782,7 @@ var Reportly = (function () {
1767
1782
  if (questionMarks) {
1768
1783
  var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
1769
1784
  var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
1770
- return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
1785
+ return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start_1, end: end };
1771
1786
  }
1772
1787
  var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
1773
1788
  if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
@@ -1779,10 +1794,10 @@ var Reportly = (function () {
1779
1794
  codePoint = this.consumeCodePoint();
1780
1795
  }
1781
1796
  var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
1782
- return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
1797
+ return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: end };
1783
1798
  }
1784
1799
  else {
1785
- return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
1800
+ return { type: 30 /* TokenType.UNICODE_RANGE_TOKEN */, start: start, end: start };
1786
1801
  }
1787
1802
  };
1788
1803
  Tokenizer.prototype.consumeIdentLikeToken = function () {
@@ -1793,24 +1808,24 @@ var Reportly = (function () {
1793
1808
  }
1794
1809
  else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
1795
1810
  this.consumeCodePoint();
1796
- return { type: 19 /* FUNCTION_TOKEN */, value: value };
1811
+ return { type: 19 /* TokenType.FUNCTION_TOKEN */, value: value };
1797
1812
  }
1798
- return { type: 20 /* IDENT_TOKEN */, value: value };
1813
+ return { type: 20 /* TokenType.IDENT_TOKEN */, value: value };
1799
1814
  };
1800
1815
  Tokenizer.prototype.consumeUrlToken = function () {
1801
1816
  var value = [];
1802
1817
  this.consumeWhiteSpace();
1803
1818
  if (this.peekCodePoint(0) === EOF) {
1804
- return { type: 22 /* URL_TOKEN */, value: '' };
1819
+ return { type: 22 /* TokenType.URL_TOKEN */, value: '' };
1805
1820
  }
1806
1821
  var next = this.peekCodePoint(0);
1807
1822
  if (next === APOSTROPHE || next === QUOTATION_MARK) {
1808
1823
  var stringToken = this.consumeStringToken(this.consumeCodePoint());
1809
- if (stringToken.type === 0 /* STRING_TOKEN */) {
1824
+ if (stringToken.type === 0 /* TokenType.STRING_TOKEN */) {
1810
1825
  this.consumeWhiteSpace();
1811
1826
  if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
1812
1827
  this.consumeCodePoint();
1813
- return { type: 22 /* URL_TOKEN */, value: stringToken.value };
1828
+ return { type: 22 /* TokenType.URL_TOKEN */, value: stringToken.value };
1814
1829
  }
1815
1830
  }
1816
1831
  this.consumeBadUrlRemnants();
@@ -1819,13 +1834,13 @@ var Reportly = (function () {
1819
1834
  while (true) {
1820
1835
  var codePoint = this.consumeCodePoint();
1821
1836
  if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
1822
- 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) };
1823
1838
  }
1824
1839
  else if (isWhiteSpace(codePoint)) {
1825
1840
  this.consumeWhiteSpace();
1826
1841
  if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
1827
1842
  this.consumeCodePoint();
1828
- 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) };
1829
1844
  }
1830
1845
  this.consumeBadUrlRemnants();
1831
1846
  return BAD_URL_TOKEN;
@@ -1885,7 +1900,7 @@ var Reportly = (function () {
1885
1900
  var codePoint = this._value[i];
1886
1901
  if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
1887
1902
  value += this.consumeStringSlice(i);
1888
- return { type: 0 /* STRING_TOKEN */, value: value };
1903
+ return { type: 0 /* TokenType.STRING_TOKEN */, value: value };
1889
1904
  }
1890
1905
  if (codePoint === LINE_FEED) {
1891
1906
  this._value.splice(0, i);
@@ -1947,13 +1962,13 @@ var Reportly = (function () {
1947
1962
  var c3 = this.peekCodePoint(2);
1948
1963
  if (isIdentifierStart(c1, c2, c3)) {
1949
1964
  var unit = this.consumeName();
1950
- return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
1965
+ return { type: 15 /* TokenType.DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
1951
1966
  }
1952
1967
  if (c1 === PERCENTAGE_SIGN) {
1953
1968
  this.consumeCodePoint();
1954
- return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
1969
+ return { type: 16 /* TokenType.PERCENTAGE_TOKEN */, number: number, flags: flags };
1955
1970
  }
1956
- return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
1971
+ return { type: 17 /* TokenType.NUMBER_TOKEN */, number: number, flags: flags };
1957
1972
  };
1958
1973
  Tokenizer.prototype.consumeEscapedCodePoint = function () {
1959
1974
  var codePoint = this.consumeCodePoint();
@@ -2012,18 +2027,18 @@ var Reportly = (function () {
2012
2027
  };
2013
2028
  Parser.prototype.parseComponentValue = function () {
2014
2029
  var token = this.consumeToken();
2015
- while (token.type === 31 /* WHITESPACE_TOKEN */) {
2030
+ while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
2016
2031
  token = this.consumeToken();
2017
2032
  }
2018
- if (token.type === 32 /* EOF_TOKEN */) {
2033
+ if (token.type === 32 /* TokenType.EOF_TOKEN */) {
2019
2034
  throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
2020
2035
  }
2021
2036
  this.reconsumeToken(token);
2022
2037
  var value = this.consumeComponentValue();
2023
2038
  do {
2024
2039
  token = this.consumeToken();
2025
- } while (token.type === 31 /* WHITESPACE_TOKEN */);
2026
- if (token.type === 32 /* EOF_TOKEN */) {
2040
+ } while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
2041
+ if (token.type === 32 /* TokenType.EOF_TOKEN */) {
2027
2042
  return value;
2028
2043
  }
2029
2044
  throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
@@ -2032,7 +2047,7 @@ var Reportly = (function () {
2032
2047
  var values = [];
2033
2048
  while (true) {
2034
2049
  var value = this.consumeComponentValue();
2035
- if (value.type === 32 /* EOF_TOKEN */) {
2050
+ if (value.type === 32 /* TokenType.EOF_TOKEN */) {
2036
2051
  return values;
2037
2052
  }
2038
2053
  values.push(value);
@@ -2042,11 +2057,11 @@ var Reportly = (function () {
2042
2057
  Parser.prototype.consumeComponentValue = function () {
2043
2058
  var token = this.consumeToken();
2044
2059
  switch (token.type) {
2045
- case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
2046
- case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
2047
- 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 */:
2048
2063
  return this.consumeSimpleBlock(token.type);
2049
- case 19 /* FUNCTION_TOKEN */:
2064
+ case 19 /* TokenType.FUNCTION_TOKEN */:
2050
2065
  return this.consumeFunction(token);
2051
2066
  }
2052
2067
  return token;
@@ -2055,7 +2070,7 @@ var Reportly = (function () {
2055
2070
  var block = { type: type, values: [] };
2056
2071
  var token = this.consumeToken();
2057
2072
  while (true) {
2058
- if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
2073
+ if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
2059
2074
  return block;
2060
2075
  }
2061
2076
  this.reconsumeToken(token);
@@ -2067,11 +2082,11 @@ var Reportly = (function () {
2067
2082
  var cssFunction = {
2068
2083
  name: functionToken.value,
2069
2084
  values: [],
2070
- type: 18 /* FUNCTION */
2085
+ type: 18 /* TokenType.FUNCTION */
2071
2086
  };
2072
2087
  while (true) {
2073
2088
  var token = this.consumeToken();
2074
- 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 */) {
2075
2090
  return cssFunction;
2076
2091
  }
2077
2092
  this.reconsumeToken(token);
@@ -2087,22 +2102,22 @@ var Reportly = (function () {
2087
2102
  };
2088
2103
  return Parser;
2089
2104
  }());
2090
- var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
2091
- var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
2092
- var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
2093
- 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 */; };
2094
2109
  var isIdentWithValue = function (token, value) {
2095
2110
  return isIdentToken(token) && token.value === value;
2096
2111
  };
2097
- var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
2112
+ var nonWhiteSpace = function (token) { return token.type !== 31 /* TokenType.WHITESPACE_TOKEN */; };
2098
2113
  var nonFunctionArgSeparator = function (token) {
2099
- 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 */;
2100
2115
  };
2101
2116
  var parseFunctionArgs = function (tokens) {
2102
2117
  var args = [];
2103
2118
  var arg = [];
2104
2119
  tokens.forEach(function (token) {
2105
- if (token.type === 4 /* COMMA_TOKEN */) {
2120
+ if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
2106
2121
  if (arg.length === 0) {
2107
2122
  throw new Error("Error parsing function args, zero tokens for arg");
2108
2123
  }
@@ -2110,7 +2125,7 @@ var Reportly = (function () {
2110
2125
  arg = [];
2111
2126
  return;
2112
2127
  }
2113
- if (token.type !== 31 /* WHITESPACE_TOKEN */) {
2128
+ if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
2114
2129
  arg.push(token);
2115
2130
  }
2116
2131
  });
@@ -2120,37 +2135,37 @@ var Reportly = (function () {
2120
2135
  return args;
2121
2136
  };
2122
2137
  var isEndingTokenFor = function (token, type) {
2123
- 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 */) {
2124
2139
  return true;
2125
2140
  }
2126
- 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 */) {
2127
2142
  return true;
2128
2143
  }
2129
- 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 */;
2130
2145
  };
2131
2146
 
2132
2147
  var isLength = function (token) {
2133
- 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 */;
2134
2149
  };
2135
2150
 
2136
2151
  var isLengthPercentage = function (token) {
2137
- return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
2152
+ return token.type === 16 /* TokenType.PERCENTAGE_TOKEN */ || isLength(token);
2138
2153
  };
2139
2154
  var parseLengthPercentageTuple = function (tokens) {
2140
2155
  return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
2141
2156
  };
2142
2157
  var ZERO_LENGTH = {
2143
- type: 17 /* NUMBER_TOKEN */,
2158
+ type: 17 /* TokenType.NUMBER_TOKEN */,
2144
2159
  number: 0,
2145
2160
  flags: FLAG_INTEGER
2146
2161
  };
2147
2162
  var FIFTY_PERCENT = {
2148
- type: 16 /* PERCENTAGE_TOKEN */,
2163
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
2149
2164
  number: 50,
2150
2165
  flags: FLAG_INTEGER
2151
2166
  };
2152
2167
  var HUNDRED_PERCENT = {
2153
- type: 16 /* PERCENTAGE_TOKEN */,
2168
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
2154
2169
  number: 100,
2155
2170
  flags: FLAG_INTEGER
2156
2171
  };
@@ -2159,7 +2174,7 @@ var Reportly = (function () {
2159
2174
  return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
2160
2175
  };
2161
2176
  var getAbsoluteValue = function (token, parent) {
2162
- if (token.type === 16 /* PERCENTAGE_TOKEN */) {
2177
+ if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
2163
2178
  return (token.number / 100) * parent;
2164
2179
  }
2165
2180
  if (isDimensionToken(token)) {
@@ -2182,7 +2197,7 @@ var Reportly = (function () {
2182
2197
  var angle = {
2183
2198
  name: 'angle',
2184
2199
  parse: function (_context, value) {
2185
- if (value.type === 15 /* DIMENSION_TOKEN */) {
2200
+ if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
2186
2201
  switch (value.unit) {
2187
2202
  case DEG:
2188
2203
  return (Math.PI * value.number) / 180;
@@ -2198,7 +2213,7 @@ var Reportly = (function () {
2198
2213
  }
2199
2214
  };
2200
2215
  var isAngle = function (value) {
2201
- if (value.type === 15 /* DIMENSION_TOKEN */) {
2216
+ if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
2202
2217
  if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
2203
2218
  return true;
2204
2219
  }
@@ -2248,87 +2263,154 @@ var Reportly = (function () {
2248
2263
  };
2249
2264
  var deg = function (deg) { return (Math.PI * deg) / 180; };
2250
2265
 
2251
- var color$1 = {
2252
- name: 'color',
2253
- parse: function (context, value) {
2254
- if (value.type === 18 /* FUNCTION */) {
2255
- var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
2256
- if (typeof colorFunction === 'undefined') {
2257
- throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
2258
- }
2259
- return colorFunction(context, value.values);
2260
- }
2261
- if (value.type === 5 /* HASH_TOKEN */) {
2262
- if (value.value.length === 3) {
2263
- var r = value.value.substring(0, 1);
2264
- var g = value.value.substring(1, 2);
2265
- var b = value.value.substring(2, 3);
2266
- return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
2267
- }
2268
- if (value.value.length === 4) {
2269
- var r = value.value.substring(0, 1);
2270
- var g = value.value.substring(1, 2);
2271
- var b = value.value.substring(2, 3);
2272
- var a = value.value.substring(3, 4);
2273
- return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
2274
- }
2275
- if (value.value.length === 6) {
2276
- var r = value.value.substring(0, 2);
2277
- var g = value.value.substring(2, 4);
2278
- var b = value.value.substring(4, 6);
2279
- return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
2280
- }
2281
- if (value.value.length === 8) {
2282
- var r = value.value.substring(0, 2);
2283
- var g = value.value.substring(2, 4);
2284
- var b = value.value.substring(4, 6);
2285
- var a = value.value.substring(6, 8);
2286
- return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
2287
- }
2288
- }
2289
- if (value.type === 20 /* IDENT_TOKEN */) {
2290
- var namedColor = COLORS[value.value.toUpperCase()];
2291
- if (typeof namedColor !== 'undefined') {
2292
- return namedColor;
2293
- }
2294
- }
2295
- return COLORS.TRANSPARENT;
2296
- }
2297
- };
2298
2266
  var isTransparent = function (color) { return (0xff & color) === 0; };
2299
2267
  var asString = function (color) {
2300
2268
  var alpha = 0xff & color;
2301
2269
  var blue = 0xff & (color >> 8);
2302
2270
  var green = 0xff & (color >> 16);
2303
2271
  var red = 0xff & (color >> 24);
2304
- 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, ")");
2305
2273
  };
2306
2274
  var pack = function (r, g, b, a) {
2307
2275
  return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
2308
2276
  };
2309
2277
  var getTokenColorValue = function (token, i) {
2310
- if (token.type === 17 /* NUMBER_TOKEN */) {
2278
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
2311
2279
  return token.number;
2312
2280
  }
2313
- if (token.type === 16 /* PERCENTAGE_TOKEN */) {
2281
+ if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
2314
2282
  var max = i === 3 ? 1 : 255;
2315
2283
  return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
2316
2284
  }
2317
2285
  return 0;
2318
2286
  };
2319
- var rgb = function (_context, args) {
2320
- var tokens = args.filter(nonFunctionArgSeparator);
2321
- if (tokens.length === 3) {
2322
- var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
2323
- return pack(r, g, b, 1);
2324
- }
2325
- if (tokens.length === 4) {
2326
- var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
2327
- return pack(r, g, b, a);
2328
- }
2329
- 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);
2330
2292
  };
2331
- function hue2rgb(t1, t2, hue) {
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
+ ];
2299
+ };
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) {
2332
2414
  if (hue < 0) {
2333
2415
  hue += 1;
2334
2416
  }
@@ -2347,29 +2429,783 @@ var Reportly = (function () {
2347
2429
  else {
2348
2430
  return t1;
2349
2431
  }
2350
- }
2351
- var hsl = function (context, args) {
2352
- var tokens = args.filter(nonFunctionArgSeparator);
2353
- var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
2354
- var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
2355
- var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
2356
- var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
2357
- 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];
2358
2435
  if (s === 0) {
2359
- return pack(l * 255, l * 255, l * 255, 1);
2436
+ return [l * 255, l * 255, l * 255];
2437
+ }
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);
2360
3045
  }
2361
- var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
2362
- var t1 = l * 2 - t2;
2363
- var r = hue2rgb(t1, t2, h + 1 / 3);
2364
- var g = hue2rgb(t1, t2, h);
2365
- var b = hue2rgb(t1, t2, h - 1 / 3);
2366
- return pack(r * 255, g * 255, b * 255, a);
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
2367
3198
  };
2368
3199
  var SUPPORTED_COLOR_FUNCTIONS = {
2369
- hsl: hsl,
2370
- hsla: hsl,
3200
+ hsl: packHSL,
3201
+ hsla: packHSL,
2371
3202
  rgb: rgb,
2372
- rgba: rgb
3203
+ rgba: rgb,
3204
+ lch: packLch,
3205
+ oklch: packOkLch,
3206
+ oklab: packOkLab,
3207
+ lab: packLab,
3208
+ color: _color
2373
3209
  };
2374
3210
  var parseColor = function (context, value) {
2375
3211
  return color$1.parse(context, Parser.create(value).parseComponentValue());
@@ -2530,18 +3366,18 @@ var Reportly = (function () {
2530
3366
  name: 'background-clip',
2531
3367
  initialValue: 'border-box',
2532
3368
  prefix: false,
2533
- type: 1 /* LIST */,
3369
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
2534
3370
  parse: function (_context, tokens) {
2535
3371
  return tokens.map(function (token) {
2536
3372
  if (isIdentToken(token)) {
2537
3373
  switch (token.value) {
2538
3374
  case 'padding-box':
2539
- return 1 /* PADDING_BOX */;
3375
+ return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
2540
3376
  case 'content-box':
2541
- return 2 /* CONTENT_BOX */;
3377
+ return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
2542
3378
  }
2543
3379
  }
2544
- return 0 /* BORDER_BOX */;
3380
+ return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
2545
3381
  });
2546
3382
  }
2547
3383
  };
@@ -2550,7 +3386,7 @@ var Reportly = (function () {
2550
3386
  name: "background-color",
2551
3387
  initialValue: 'transparent',
2552
3388
  prefix: false,
2553
- type: 3 /* TYPE_VALUE */,
3389
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
2554
3390
  format: 'color'
2555
3391
  };
2556
3392
 
@@ -2653,24 +3489,24 @@ var Reportly = (function () {
2653
3489
  var rx = 0;
2654
3490
  var ry = 0;
2655
3491
  switch (gradient.size) {
2656
- case 0 /* CLOSEST_SIDE */:
3492
+ case 0 /* CSSRadialExtent.CLOSEST_SIDE */:
2657
3493
  // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
2658
3494
  // If the shape is an ellipse, it exactly meets the closest side in each dimension.
2659
- if (gradient.shape === 0 /* CIRCLE */) {
3495
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2660
3496
  rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
2661
3497
  }
2662
- else if (gradient.shape === 1 /* ELLIPSE */) {
3498
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2663
3499
  rx = Math.min(Math.abs(x), Math.abs(x - width));
2664
3500
  ry = Math.min(Math.abs(y), Math.abs(y - height));
2665
3501
  }
2666
3502
  break;
2667
- case 2 /* CLOSEST_CORNER */:
3503
+ case 2 /* CSSRadialExtent.CLOSEST_CORNER */:
2668
3504
  // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
2669
3505
  // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
2670
- if (gradient.shape === 0 /* CIRCLE */) {
3506
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2671
3507
  rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
2672
3508
  }
2673
- else if (gradient.shape === 1 /* ELLIPSE */) {
3509
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2674
3510
  // Compute the ratio ry/rx (which is to be the same as for "closest-side")
2675
3511
  var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
2676
3512
  var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
@@ -2678,23 +3514,23 @@ var Reportly = (function () {
2678
3514
  ry = c * rx;
2679
3515
  }
2680
3516
  break;
2681
- case 1 /* FARTHEST_SIDE */:
3517
+ case 1 /* CSSRadialExtent.FARTHEST_SIDE */:
2682
3518
  // Same as closest-side, except the ending shape is sized based on the farthest side(s)
2683
- if (gradient.shape === 0 /* CIRCLE */) {
3519
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2684
3520
  rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
2685
3521
  }
2686
- else if (gradient.shape === 1 /* ELLIPSE */) {
3522
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2687
3523
  rx = Math.max(Math.abs(x), Math.abs(x - width));
2688
3524
  ry = Math.max(Math.abs(y), Math.abs(y - height));
2689
3525
  }
2690
3526
  break;
2691
- case 3 /* FARTHEST_CORNER */:
3527
+ case 3 /* CSSRadialExtent.FARTHEST_CORNER */:
2692
3528
  // Same as closest-corner, except the ending shape is sized based on the farthest corner.
2693
3529
  // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
2694
- if (gradient.shape === 0 /* CIRCLE */) {
3530
+ if (gradient.shape === 0 /* CSSRadialShape.CIRCLE */) {
2695
3531
  rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
2696
3532
  }
2697
- else if (gradient.shape === 1 /* ELLIPSE */) {
3533
+ else if (gradient.shape === 1 /* CSSRadialShape.ELLIPSE */) {
2698
3534
  // Compute the ratio ry/rx (which is to be the same as for "farthest-side")
2699
3535
  var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
2700
3536
  var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
@@ -2716,7 +3552,7 @@ var Reportly = (function () {
2716
3552
  parseFunctionArgs(tokens).forEach(function (arg, i) {
2717
3553
  if (i === 0) {
2718
3554
  var firstToken = arg[0];
2719
- if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
3555
+ if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ && firstToken.value === 'to') {
2720
3556
  angle$1 = parseNamedSide(arg);
2721
3557
  return;
2722
3558
  }
@@ -2728,7 +3564,7 @@ var Reportly = (function () {
2728
3564
  var colorStop = parseColorStop(context, arg);
2729
3565
  stops.push(colorStop);
2730
3566
  });
2731
- return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
3567
+ return { angle: angle$1, stops: stops, type: 1 /* CSSImageType.LINEAR_GRADIENT */ };
2732
3568
  };
2733
3569
 
2734
3570
  var prefixLinearGradient = function (context, tokens) {
@@ -2737,7 +3573,7 @@ var Reportly = (function () {
2737
3573
  parseFunctionArgs(tokens).forEach(function (arg, i) {
2738
3574
  if (i === 0) {
2739
3575
  var firstToken = arg[0];
2740
- if (firstToken.type === 20 /* IDENT_TOKEN */ &&
3576
+ if (firstToken.type === 20 /* TokenType.IDENT_TOKEN */ &&
2741
3577
  ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
2742
3578
  angle$1 = parseNamedSide(arg);
2743
3579
  return;
@@ -2753,30 +3589,30 @@ var Reportly = (function () {
2753
3589
  return {
2754
3590
  angle: angle$1,
2755
3591
  stops: stops,
2756
- type: 1 /* LINEAR_GRADIENT */
3592
+ type: 1 /* CSSImageType.LINEAR_GRADIENT */
2757
3593
  };
2758
3594
  };
2759
3595
 
2760
3596
  var webkitGradient = function (context, tokens) {
2761
3597
  var angle = deg(180);
2762
3598
  var stops = [];
2763
- var type = 1 /* LINEAR_GRADIENT */;
2764
- var shape = 0 /* CIRCLE */;
2765
- 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 */;
2766
3602
  var position = [];
2767
3603
  parseFunctionArgs(tokens).forEach(function (arg, i) {
2768
3604
  var firstToken = arg[0];
2769
3605
  if (i === 0) {
2770
3606
  if (isIdentToken(firstToken) && firstToken.value === 'linear') {
2771
- type = 1 /* LINEAR_GRADIENT */;
3607
+ type = 1 /* CSSImageType.LINEAR_GRADIENT */;
2772
3608
  return;
2773
3609
  }
2774
3610
  else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
2775
- type = 2 /* RADIAL_GRADIENT */;
3611
+ type = 2 /* CSSImageType.RADIAL_GRADIENT */;
2776
3612
  return;
2777
3613
  }
2778
3614
  }
2779
- if (firstToken.type === 18 /* FUNCTION */) {
3615
+ if (firstToken.type === 18 /* TokenType.FUNCTION */) {
2780
3616
  if (firstToken.name === 'from') {
2781
3617
  var color = color$1.parse(context, firstToken.values[0]);
2782
3618
  stops.push({ stop: ZERO_LENGTH, color: color });
@@ -2792,7 +3628,7 @@ var Reportly = (function () {
2792
3628
  var stop_1 = values[0];
2793
3629
  if (isNumberToken(stop_1)) {
2794
3630
  stops.push({
2795
- 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 },
2796
3632
  color: color
2797
3633
  });
2798
3634
  }
@@ -2800,7 +3636,7 @@ var Reportly = (function () {
2800
3636
  }
2801
3637
  }
2802
3638
  });
2803
- return type === 1 /* LINEAR_GRADIENT */
3639
+ return type === 1 /* CSSImageType.LINEAR_GRADIENT */
2804
3640
  ? {
2805
3641
  angle: (angle + deg(180)) % deg(360),
2806
3642
  stops: stops,
@@ -2818,8 +3654,8 @@ var Reportly = (function () {
2818
3654
  var COVER = 'cover';
2819
3655
  var CONTAIN = 'contain';
2820
3656
  var radialGradient = function (context, tokens) {
2821
- var shape = 0 /* CIRCLE */;
2822
- var size = 3 /* FARTHEST_CORNER */;
3657
+ var shape = 0 /* CSSRadialShape.CIRCLE */;
3658
+ var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2823
3659
  var stops = [];
2824
3660
  var position = [];
2825
3661
  parseFunctionArgs(tokens).forEach(function (arg, i) {
@@ -2850,27 +3686,27 @@ var Reportly = (function () {
2850
3686
  else if (isIdentToken(token)) {
2851
3687
  switch (token.value) {
2852
3688
  case CIRCLE:
2853
- shape = 0 /* CIRCLE */;
3689
+ shape = 0 /* CSSRadialShape.CIRCLE */;
2854
3690
  return false;
2855
3691
  case ELLIPSE:
2856
- shape = 1 /* ELLIPSE */;
3692
+ shape = 1 /* CSSRadialShape.ELLIPSE */;
2857
3693
  return false;
2858
3694
  case 'at':
2859
3695
  isAtPosition_1 = true;
2860
3696
  return false;
2861
3697
  case CLOSEST_SIDE:
2862
- size = 0 /* CLOSEST_SIDE */;
3698
+ size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
2863
3699
  return false;
2864
3700
  case COVER:
2865
3701
  case FARTHEST_SIDE:
2866
- size = 1 /* FARTHEST_SIDE */;
3702
+ size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
2867
3703
  return false;
2868
3704
  case CONTAIN:
2869
3705
  case CLOSEST_CORNER:
2870
- size = 2 /* CLOSEST_CORNER */;
3706
+ size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
2871
3707
  return false;
2872
3708
  case FARTHEST_CORNER:
2873
- size = 3 /* FARTHEST_CORNER */;
3709
+ size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2874
3710
  return false;
2875
3711
  }
2876
3712
  }
@@ -2889,12 +3725,12 @@ var Reportly = (function () {
2889
3725
  stops.push(colorStop);
2890
3726
  }
2891
3727
  });
2892
- 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 */ };
2893
3729
  };
2894
3730
 
2895
3731
  var prefixRadialGradient = function (context, tokens) {
2896
- var shape = 0 /* CIRCLE */;
2897
- var size = 3 /* FARTHEST_CORNER */;
3732
+ var shape = 0 /* CSSRadialShape.CIRCLE */;
3733
+ var size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2898
3734
  var stops = [];
2899
3735
  var position = [];
2900
3736
  parseFunctionArgs(tokens).forEach(function (arg, i) {
@@ -2928,24 +3764,24 @@ var Reportly = (function () {
2928
3764
  if (isIdentToken(token)) {
2929
3765
  switch (token.value) {
2930
3766
  case CIRCLE:
2931
- shape = 0 /* CIRCLE */;
3767
+ shape = 0 /* CSSRadialShape.CIRCLE */;
2932
3768
  return false;
2933
3769
  case ELLIPSE:
2934
- shape = 1 /* ELLIPSE */;
3770
+ shape = 1 /* CSSRadialShape.ELLIPSE */;
2935
3771
  return false;
2936
3772
  case CONTAIN:
2937
3773
  case CLOSEST_SIDE:
2938
- size = 0 /* CLOSEST_SIDE */;
3774
+ size = 0 /* CSSRadialExtent.CLOSEST_SIDE */;
2939
3775
  return false;
2940
3776
  case FARTHEST_SIDE:
2941
- size = 1 /* FARTHEST_SIDE */;
3777
+ size = 1 /* CSSRadialExtent.FARTHEST_SIDE */;
2942
3778
  return false;
2943
3779
  case CLOSEST_CORNER:
2944
- size = 2 /* CLOSEST_CORNER */;
3780
+ size = 2 /* CSSRadialExtent.CLOSEST_CORNER */;
2945
3781
  return false;
2946
3782
  case COVER:
2947
3783
  case FARTHEST_CORNER:
2948
- size = 3 /* FARTHEST_CORNER */;
3784
+ size = 3 /* CSSRadialExtent.FARTHEST_CORNER */;
2949
3785
  return false;
2950
3786
  }
2951
3787
  }
@@ -2964,36 +3800,36 @@ var Reportly = (function () {
2964
3800
  stops.push(colorStop);
2965
3801
  }
2966
3802
  });
2967
- 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 */ };
2968
3804
  };
2969
3805
 
2970
3806
  var isLinearGradient = function (background) {
2971
- return background.type === 1 /* LINEAR_GRADIENT */;
3807
+ return background.type === 1 /* CSSImageType.LINEAR_GRADIENT */;
2972
3808
  };
2973
3809
  var isRadialGradient = function (background) {
2974
- return background.type === 2 /* RADIAL_GRADIENT */;
3810
+ return background.type === 2 /* CSSImageType.RADIAL_GRADIENT */;
2975
3811
  };
2976
3812
  var image = {
2977
3813
  name: 'image',
2978
3814
  parse: function (context, value) {
2979
- if (value.type === 22 /* URL_TOKEN */) {
2980
- 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 */ };
2981
3817
  context.cache.addImage(value.value);
2982
3818
  return image_1;
2983
3819
  }
2984
- if (value.type === 18 /* FUNCTION */) {
3820
+ if (value.type === 18 /* TokenType.FUNCTION */) {
2985
3821
  var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
2986
3822
  if (typeof imageFunction === 'undefined') {
2987
- 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, "\""));
2988
3824
  }
2989
3825
  return imageFunction(context, value.values);
2990
3826
  }
2991
- throw new Error("Unsupported image type " + value.type);
3827
+ throw new Error("Unsupported image type ".concat(value.type));
2992
3828
  }
2993
3829
  };
2994
3830
  function isSupportedImage(value) {
2995
- return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
2996
- (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]));
2997
3833
  }
2998
3834
  var SUPPORTED_IMAGE_FUNCTIONS = {
2999
3835
  'linear-gradient': linearGradient,
@@ -3012,14 +3848,14 @@ var Reportly = (function () {
3012
3848
  var backgroundImage = {
3013
3849
  name: 'background-image',
3014
3850
  initialValue: 'none',
3015
- type: 1 /* LIST */,
3851
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3016
3852
  prefix: false,
3017
3853
  parse: function (context, tokens) {
3018
3854
  if (tokens.length === 0) {
3019
3855
  return [];
3020
3856
  }
3021
3857
  var first = tokens[0];
3022
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
3858
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
3023
3859
  return [];
3024
3860
  }
3025
3861
  return tokens
@@ -3032,18 +3868,18 @@ var Reportly = (function () {
3032
3868
  name: 'background-origin',
3033
3869
  initialValue: 'border-box',
3034
3870
  prefix: false,
3035
- type: 1 /* LIST */,
3871
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3036
3872
  parse: function (_context, tokens) {
3037
3873
  return tokens.map(function (token) {
3038
3874
  if (isIdentToken(token)) {
3039
3875
  switch (token.value) {
3040
3876
  case 'padding-box':
3041
- return 1 /* PADDING_BOX */;
3877
+ return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
3042
3878
  case 'content-box':
3043
- return 2 /* CONTENT_BOX */;
3879
+ return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
3044
3880
  }
3045
3881
  }
3046
- return 0 /* BORDER_BOX */;
3882
+ return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
3047
3883
  });
3048
3884
  }
3049
3885
  };
@@ -3051,7 +3887,7 @@ var Reportly = (function () {
3051
3887
  var backgroundPosition = {
3052
3888
  name: 'background-position',
3053
3889
  initialValue: '0% 0%',
3054
- type: 1 /* LIST */,
3890
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3055
3891
  prefix: false,
3056
3892
  parse: function (_context, tokens) {
3057
3893
  return parseFunctionArgs(tokens)
@@ -3064,7 +3900,7 @@ var Reportly = (function () {
3064
3900
  name: 'background-repeat',
3065
3901
  initialValue: 'repeat',
3066
3902
  prefix: false,
3067
- type: 1 /* LIST */,
3903
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3068
3904
  parse: function (_context, tokens) {
3069
3905
  return parseFunctionArgs(tokens)
3070
3906
  .map(function (values) {
@@ -3079,16 +3915,16 @@ var Reportly = (function () {
3079
3915
  var parseBackgroundRepeat = function (value) {
3080
3916
  switch (value) {
3081
3917
  case 'no-repeat':
3082
- return 1 /* NO_REPEAT */;
3918
+ return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
3083
3919
  case 'repeat-x':
3084
3920
  case 'repeat no-repeat':
3085
- return 2 /* REPEAT_X */;
3921
+ return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
3086
3922
  case 'repeat-y':
3087
3923
  case 'no-repeat repeat':
3088
- return 3 /* REPEAT_Y */;
3924
+ return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
3089
3925
  case 'repeat':
3090
3926
  default:
3091
- return 0 /* REPEAT */;
3927
+ return 0 /* BACKGROUND_REPEAT.REPEAT */;
3092
3928
  }
3093
3929
  };
3094
3930
 
@@ -3102,7 +3938,7 @@ var Reportly = (function () {
3102
3938
  name: 'background-size',
3103
3939
  initialValue: '0',
3104
3940
  prefix: false,
3105
- type: 1 /* LIST */,
3941
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3106
3942
  parse: function (_context, tokens) {
3107
3943
  return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
3108
3944
  }
@@ -3112,10 +3948,10 @@ var Reportly = (function () {
3112
3948
  };
3113
3949
 
3114
3950
  var borderColorForSide = function (side) { return ({
3115
- name: "border-" + side + "-color",
3951
+ name: "border-".concat(side, "-color"),
3116
3952
  initialValue: 'transparent',
3117
3953
  prefix: false,
3118
- type: 3 /* TYPE_VALUE */,
3954
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3119
3955
  format: 'color'
3120
3956
  }); };
3121
3957
  var borderTopColor = borderColorForSide('top');
@@ -3124,10 +3960,10 @@ var Reportly = (function () {
3124
3960
  var borderLeftColor = borderColorForSide('left');
3125
3961
 
3126
3962
  var borderRadiusForSide = function (side) { return ({
3127
- name: "border-radius-" + side,
3963
+ name: "border-radius-".concat(side),
3128
3964
  initialValue: '0 0',
3129
3965
  prefix: false,
3130
- type: 1 /* LIST */,
3966
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3131
3967
  parse: function (_context, tokens) {
3132
3968
  return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
3133
3969
  }
@@ -3138,22 +3974,22 @@ var Reportly = (function () {
3138
3974
  var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
3139
3975
 
3140
3976
  var borderStyleForSide = function (side) { return ({
3141
- name: "border-" + side + "-style",
3977
+ name: "border-".concat(side, "-style"),
3142
3978
  initialValue: 'solid',
3143
3979
  prefix: false,
3144
- type: 2 /* IDENT_VALUE */,
3980
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3145
3981
  parse: function (_context, style) {
3146
3982
  switch (style) {
3147
3983
  case 'none':
3148
- return 0 /* NONE */;
3984
+ return 0 /* BORDER_STYLE.NONE */;
3149
3985
  case 'dashed':
3150
- return 2 /* DASHED */;
3986
+ return 2 /* BORDER_STYLE.DASHED */;
3151
3987
  case 'dotted':
3152
- return 3 /* DOTTED */;
3988
+ return 3 /* BORDER_STYLE.DOTTED */;
3153
3989
  case 'double':
3154
- return 4 /* DOUBLE */;
3990
+ return 4 /* BORDER_STYLE.DOUBLE */;
3155
3991
  }
3156
- return 1 /* SOLID */;
3992
+ return 1 /* BORDER_STYLE.SOLID */;
3157
3993
  }
3158
3994
  }); };
3159
3995
  var borderTopStyle = borderStyleForSide('top');
@@ -3162,9 +3998,9 @@ var Reportly = (function () {
3162
3998
  var borderLeftStyle = borderStyleForSide('left');
3163
3999
 
3164
4000
  var borderWidthForSide = function (side) { return ({
3165
- name: "border-" + side + "-width",
4001
+ name: "border-".concat(side, "-width"),
3166
4002
  initialValue: '0',
3167
- type: 0 /* VALUE */,
4003
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3168
4004
  prefix: false,
3169
4005
  parse: function (_context, token) {
3170
4006
  if (isDimensionToken(token)) {
@@ -3182,7 +4018,7 @@ var Reportly = (function () {
3182
4018
  name: "color",
3183
4019
  initialValue: 'transparent',
3184
4020
  prefix: false,
3185
- type: 3 /* TYPE_VALUE */,
4021
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3186
4022
  format: 'color'
3187
4023
  };
3188
4024
 
@@ -3190,14 +4026,14 @@ var Reportly = (function () {
3190
4026
  name: 'direction',
3191
4027
  initialValue: 'ltr',
3192
4028
  prefix: false,
3193
- type: 2 /* IDENT_VALUE */,
4029
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3194
4030
  parse: function (_context, direction) {
3195
4031
  switch (direction) {
3196
4032
  case 'rtl':
3197
- return 1 /* RTL */;
4033
+ return 1 /* DIRECTION.RTL */;
3198
4034
  case 'ltr':
3199
4035
  default:
3200
- return 0 /* LTR */;
4036
+ return 0 /* DIRECTION.LTR */;
3201
4037
  }
3202
4038
  }
3203
4039
  };
@@ -3206,97 +4042,97 @@ var Reportly = (function () {
3206
4042
  name: 'display',
3207
4043
  initialValue: 'inline-block',
3208
4044
  prefix: false,
3209
- type: 1 /* LIST */,
4045
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3210
4046
  parse: function (_context, tokens) {
3211
4047
  return tokens.filter(isIdentToken).reduce(function (bit, token) {
3212
- return bit | parseDisplayValue(token.value);
3213
- }, 0 /* NONE */);
4048
+ return bit | parseDisplayValue$1(token.value);
4049
+ }, 0 /* DISPLAY.NONE */);
3214
4050
  }
3215
4051
  };
3216
- var parseDisplayValue = function (display) {
4052
+ var parseDisplayValue$1 = function (display) {
3217
4053
  switch (display) {
3218
4054
  case 'block':
3219
4055
  case '-webkit-box':
3220
- return 2 /* BLOCK */;
4056
+ return 2 /* DISPLAY.BLOCK */;
3221
4057
  case 'inline':
3222
- return 4 /* INLINE */;
4058
+ return 4 /* DISPLAY.INLINE */;
3223
4059
  case 'run-in':
3224
- return 8 /* RUN_IN */;
4060
+ return 8 /* DISPLAY.RUN_IN */;
3225
4061
  case 'flow':
3226
- return 16 /* FLOW */;
4062
+ return 16 /* DISPLAY.FLOW */;
3227
4063
  case 'flow-root':
3228
- return 32 /* FLOW_ROOT */;
4064
+ return 32 /* DISPLAY.FLOW_ROOT */;
3229
4065
  case 'table':
3230
- return 64 /* TABLE */;
4066
+ return 64 /* DISPLAY.TABLE */;
3231
4067
  case 'flex':
3232
4068
  case '-webkit-flex':
3233
- return 128 /* FLEX */;
4069
+ return 128 /* DISPLAY.FLEX */;
3234
4070
  case 'grid':
3235
4071
  case '-ms-grid':
3236
- return 256 /* GRID */;
4072
+ return 256 /* DISPLAY.GRID */;
3237
4073
  case 'ruby':
3238
- return 512 /* RUBY */;
4074
+ return 512 /* DISPLAY.RUBY */;
3239
4075
  case 'subgrid':
3240
- return 1024 /* SUBGRID */;
4076
+ return 1024 /* DISPLAY.SUBGRID */;
3241
4077
  case 'list-item':
3242
- return 2048 /* LIST_ITEM */;
4078
+ return 2048 /* DISPLAY.LIST_ITEM */;
3243
4079
  case 'table-row-group':
3244
- return 4096 /* TABLE_ROW_GROUP */;
4080
+ return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
3245
4081
  case 'table-header-group':
3246
- return 8192 /* TABLE_HEADER_GROUP */;
4082
+ return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
3247
4083
  case 'table-footer-group':
3248
- return 16384 /* TABLE_FOOTER_GROUP */;
4084
+ return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
3249
4085
  case 'table-row':
3250
- return 32768 /* TABLE_ROW */;
4086
+ return 32768 /* DISPLAY.TABLE_ROW */;
3251
4087
  case 'table-cell':
3252
- return 65536 /* TABLE_CELL */;
4088
+ return 65536 /* DISPLAY.TABLE_CELL */;
3253
4089
  case 'table-column-group':
3254
- return 131072 /* TABLE_COLUMN_GROUP */;
4090
+ return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
3255
4091
  case 'table-column':
3256
- return 262144 /* TABLE_COLUMN */;
4092
+ return 262144 /* DISPLAY.TABLE_COLUMN */;
3257
4093
  case 'table-caption':
3258
- return 524288 /* TABLE_CAPTION */;
4094
+ return 524288 /* DISPLAY.TABLE_CAPTION */;
3259
4095
  case 'ruby-base':
3260
- return 1048576 /* RUBY_BASE */;
4096
+ return 1048576 /* DISPLAY.RUBY_BASE */;
3261
4097
  case 'ruby-text':
3262
- return 2097152 /* RUBY_TEXT */;
4098
+ return 2097152 /* DISPLAY.RUBY_TEXT */;
3263
4099
  case 'ruby-base-container':
3264
- return 4194304 /* RUBY_BASE_CONTAINER */;
4100
+ return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
3265
4101
  case 'ruby-text-container':
3266
- return 8388608 /* RUBY_TEXT_CONTAINER */;
4102
+ return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
3267
4103
  case 'contents':
3268
- return 16777216 /* CONTENTS */;
4104
+ return 16777216 /* DISPLAY.CONTENTS */;
3269
4105
  case 'inline-block':
3270
- return 33554432 /* INLINE_BLOCK */;
4106
+ return 33554432 /* DISPLAY.INLINE_BLOCK */;
3271
4107
  case 'inline-list-item':
3272
- return 67108864 /* INLINE_LIST_ITEM */;
4108
+ return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
3273
4109
  case 'inline-table':
3274
- return 134217728 /* INLINE_TABLE */;
4110
+ return 134217728 /* DISPLAY.INLINE_TABLE */;
3275
4111
  case 'inline-flex':
3276
- return 268435456 /* INLINE_FLEX */;
4112
+ return 268435456 /* DISPLAY.INLINE_FLEX */;
3277
4113
  case 'inline-grid':
3278
- return 536870912 /* INLINE_GRID */;
4114
+ return 536870912 /* DISPLAY.INLINE_GRID */;
3279
4115
  }
3280
- return 0 /* NONE */;
4116
+ return 0 /* DISPLAY.NONE */;
3281
4117
  };
3282
4118
 
3283
4119
  var float = {
3284
4120
  name: 'float',
3285
4121
  initialValue: 'none',
3286
4122
  prefix: false,
3287
- type: 2 /* IDENT_VALUE */,
4123
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3288
4124
  parse: function (_context, float) {
3289
4125
  switch (float) {
3290
4126
  case 'left':
3291
- return 1 /* LEFT */;
4127
+ return 1 /* FLOAT.LEFT */;
3292
4128
  case 'right':
3293
- return 2 /* RIGHT */;
4129
+ return 2 /* FLOAT.RIGHT */;
3294
4130
  case 'inline-start':
3295
- return 3 /* INLINE_START */;
4131
+ return 3 /* FLOAT.INLINE_START */;
3296
4132
  case 'inline-end':
3297
- return 4 /* INLINE_END */;
4133
+ return 4 /* FLOAT.INLINE_END */;
3298
4134
  }
3299
- return 0 /* NONE */;
4135
+ return 0 /* FLOAT.NONE */;
3300
4136
  }
3301
4137
  };
3302
4138
 
@@ -3304,15 +4140,15 @@ var Reportly = (function () {
3304
4140
  name: 'letter-spacing',
3305
4141
  initialValue: '0',
3306
4142
  prefix: false,
3307
- type: 0 /* VALUE */,
4143
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3308
4144
  parse: function (_context, token) {
3309
- if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
4145
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
3310
4146
  return 0;
3311
4147
  }
3312
- if (token.type === 17 /* NUMBER_TOKEN */) {
4148
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
3313
4149
  return token.number;
3314
4150
  }
3315
- if (token.type === 15 /* DIMENSION_TOKEN */) {
4151
+ if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
3316
4152
  return token.number;
3317
4153
  }
3318
4154
  return 0;
@@ -3328,7 +4164,7 @@ var Reportly = (function () {
3328
4164
  name: 'line-break',
3329
4165
  initialValue: 'normal',
3330
4166
  prefix: false,
3331
- type: 2 /* IDENT_VALUE */,
4167
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3332
4168
  parse: function (_context, lineBreak) {
3333
4169
  switch (lineBreak) {
3334
4170
  case 'strict':
@@ -3344,13 +4180,13 @@ var Reportly = (function () {
3344
4180
  name: 'line-height',
3345
4181
  initialValue: 'normal',
3346
4182
  prefix: false,
3347
- type: 4 /* TOKEN_VALUE */
4183
+ type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
3348
4184
  };
3349
4185
  var computeLineHeight = function (token, fontSize) {
3350
4186
  if (isIdentToken(token) && token.value === 'normal') {
3351
4187
  return 1.2 * fontSize;
3352
4188
  }
3353
- else if (token.type === 17 /* NUMBER_TOKEN */) {
4189
+ else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
3354
4190
  return fontSize * token.number;
3355
4191
  }
3356
4192
  else if (isLengthPercentage(token)) {
@@ -3362,10 +4198,10 @@ var Reportly = (function () {
3362
4198
  var listStyleImage = {
3363
4199
  name: 'list-style-image',
3364
4200
  initialValue: 'none',
3365
- type: 0 /* VALUE */,
4201
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3366
4202
  prefix: false,
3367
4203
  parse: function (context, token) {
3368
- if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
4204
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
3369
4205
  return null;
3370
4206
  }
3371
4207
  return image.parse(context, token);
@@ -3376,14 +4212,14 @@ var Reportly = (function () {
3376
4212
  name: 'list-style-position',
3377
4213
  initialValue: 'outside',
3378
4214
  prefix: false,
3379
- type: 2 /* IDENT_VALUE */,
4215
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3380
4216
  parse: function (_context, position) {
3381
4217
  switch (position) {
3382
4218
  case 'inside':
3383
- return 0 /* INSIDE */;
4219
+ return 0 /* LIST_STYLE_POSITION.INSIDE */;
3384
4220
  case 'outside':
3385
4221
  default:
3386
- return 1 /* OUTSIDE */;
4222
+ return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
3387
4223
  }
3388
4224
  }
3389
4225
  };
@@ -3392,127 +4228,127 @@ var Reportly = (function () {
3392
4228
  name: 'list-style-type',
3393
4229
  initialValue: 'none',
3394
4230
  prefix: false,
3395
- type: 2 /* IDENT_VALUE */,
4231
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3396
4232
  parse: function (_context, type) {
3397
4233
  switch (type) {
3398
4234
  case 'disc':
3399
- return 0 /* DISC */;
4235
+ return 0 /* LIST_STYLE_TYPE.DISC */;
3400
4236
  case 'circle':
3401
- return 1 /* CIRCLE */;
4237
+ return 1 /* LIST_STYLE_TYPE.CIRCLE */;
3402
4238
  case 'square':
3403
- return 2 /* SQUARE */;
4239
+ return 2 /* LIST_STYLE_TYPE.SQUARE */;
3404
4240
  case 'decimal':
3405
- return 3 /* DECIMAL */;
4241
+ return 3 /* LIST_STYLE_TYPE.DECIMAL */;
3406
4242
  case 'cjk-decimal':
3407
- return 4 /* CJK_DECIMAL */;
4243
+ return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
3408
4244
  case 'decimal-leading-zero':
3409
- return 5 /* DECIMAL_LEADING_ZERO */;
4245
+ return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
3410
4246
  case 'lower-roman':
3411
- return 6 /* LOWER_ROMAN */;
4247
+ return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
3412
4248
  case 'upper-roman':
3413
- return 7 /* UPPER_ROMAN */;
4249
+ return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
3414
4250
  case 'lower-greek':
3415
- return 8 /* LOWER_GREEK */;
4251
+ return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
3416
4252
  case 'lower-alpha':
3417
- return 9 /* LOWER_ALPHA */;
4253
+ return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
3418
4254
  case 'upper-alpha':
3419
- return 10 /* UPPER_ALPHA */;
4255
+ return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
3420
4256
  case 'arabic-indic':
3421
- return 11 /* ARABIC_INDIC */;
4257
+ return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
3422
4258
  case 'armenian':
3423
- return 12 /* ARMENIAN */;
4259
+ return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
3424
4260
  case 'bengali':
3425
- return 13 /* BENGALI */;
4261
+ return 13 /* LIST_STYLE_TYPE.BENGALI */;
3426
4262
  case 'cambodian':
3427
- return 14 /* CAMBODIAN */;
4263
+ return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
3428
4264
  case 'cjk-earthly-branch':
3429
- return 15 /* CJK_EARTHLY_BRANCH */;
4265
+ return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
3430
4266
  case 'cjk-heavenly-stem':
3431
- return 16 /* CJK_HEAVENLY_STEM */;
4267
+ return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
3432
4268
  case 'cjk-ideographic':
3433
- return 17 /* CJK_IDEOGRAPHIC */;
4269
+ return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
3434
4270
  case 'devanagari':
3435
- return 18 /* DEVANAGARI */;
4271
+ return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
3436
4272
  case 'ethiopic-numeric':
3437
- return 19 /* ETHIOPIC_NUMERIC */;
4273
+ return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
3438
4274
  case 'georgian':
3439
- return 20 /* GEORGIAN */;
4275
+ return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
3440
4276
  case 'gujarati':
3441
- return 21 /* GUJARATI */;
4277
+ return 21 /* LIST_STYLE_TYPE.GUJARATI */;
3442
4278
  case 'gurmukhi':
3443
- return 22 /* GURMUKHI */;
4279
+ return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
3444
4280
  case 'hebrew':
3445
- return 22 /* HEBREW */;
4281
+ return 52 /* LIST_STYLE_TYPE.HEBREW */;
3446
4282
  case 'hiragana':
3447
- return 23 /* HIRAGANA */;
4283
+ return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
3448
4284
  case 'hiragana-iroha':
3449
- return 24 /* HIRAGANA_IROHA */;
4285
+ return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
3450
4286
  case 'japanese-formal':
3451
- return 25 /* JAPANESE_FORMAL */;
4287
+ return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
3452
4288
  case 'japanese-informal':
3453
- return 26 /* JAPANESE_INFORMAL */;
4289
+ return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
3454
4290
  case 'kannada':
3455
- return 27 /* KANNADA */;
4291
+ return 27 /* LIST_STYLE_TYPE.KANNADA */;
3456
4292
  case 'katakana':
3457
- return 28 /* KATAKANA */;
4293
+ return 28 /* LIST_STYLE_TYPE.KATAKANA */;
3458
4294
  case 'katakana-iroha':
3459
- return 29 /* KATAKANA_IROHA */;
4295
+ return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
3460
4296
  case 'khmer':
3461
- return 30 /* KHMER */;
4297
+ return 30 /* LIST_STYLE_TYPE.KHMER */;
3462
4298
  case 'korean-hangul-formal':
3463
- return 31 /* KOREAN_HANGUL_FORMAL */;
4299
+ return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
3464
4300
  case 'korean-hanja-formal':
3465
- return 32 /* KOREAN_HANJA_FORMAL */;
4301
+ return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
3466
4302
  case 'korean-hanja-informal':
3467
- return 33 /* KOREAN_HANJA_INFORMAL */;
4303
+ return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
3468
4304
  case 'lao':
3469
- return 34 /* LAO */;
4305
+ return 34 /* LIST_STYLE_TYPE.LAO */;
3470
4306
  case 'lower-armenian':
3471
- return 35 /* LOWER_ARMENIAN */;
4307
+ return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
3472
4308
  case 'malayalam':
3473
- return 36 /* MALAYALAM */;
4309
+ return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
3474
4310
  case 'mongolian':
3475
- return 37 /* MONGOLIAN */;
4311
+ return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
3476
4312
  case 'myanmar':
3477
- return 38 /* MYANMAR */;
4313
+ return 38 /* LIST_STYLE_TYPE.MYANMAR */;
3478
4314
  case 'oriya':
3479
- return 39 /* ORIYA */;
4315
+ return 39 /* LIST_STYLE_TYPE.ORIYA */;
3480
4316
  case 'persian':
3481
- return 40 /* PERSIAN */;
4317
+ return 40 /* LIST_STYLE_TYPE.PERSIAN */;
3482
4318
  case 'simp-chinese-formal':
3483
- return 41 /* SIMP_CHINESE_FORMAL */;
4319
+ return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
3484
4320
  case 'simp-chinese-informal':
3485
- return 42 /* SIMP_CHINESE_INFORMAL */;
4321
+ return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
3486
4322
  case 'tamil':
3487
- return 43 /* TAMIL */;
4323
+ return 43 /* LIST_STYLE_TYPE.TAMIL */;
3488
4324
  case 'telugu':
3489
- return 44 /* TELUGU */;
4325
+ return 44 /* LIST_STYLE_TYPE.TELUGU */;
3490
4326
  case 'thai':
3491
- return 45 /* THAI */;
4327
+ return 45 /* LIST_STYLE_TYPE.THAI */;
3492
4328
  case 'tibetan':
3493
- return 46 /* TIBETAN */;
4329
+ return 46 /* LIST_STYLE_TYPE.TIBETAN */;
3494
4330
  case 'trad-chinese-formal':
3495
- return 47 /* TRAD_CHINESE_FORMAL */;
4331
+ return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
3496
4332
  case 'trad-chinese-informal':
3497
- return 48 /* TRAD_CHINESE_INFORMAL */;
4333
+ return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
3498
4334
  case 'upper-armenian':
3499
- return 49 /* UPPER_ARMENIAN */;
4335
+ return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
3500
4336
  case 'disclosure-open':
3501
- return 50 /* DISCLOSURE_OPEN */;
4337
+ return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
3502
4338
  case 'disclosure-closed':
3503
- return 51 /* DISCLOSURE_CLOSED */;
4339
+ return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
3504
4340
  case 'none':
3505
4341
  default:
3506
- return -1 /* NONE */;
4342
+ return -1 /* LIST_STYLE_TYPE.NONE */;
3507
4343
  }
3508
4344
  }
3509
4345
  };
3510
4346
 
3511
4347
  var marginForSide = function (side) { return ({
3512
- name: "margin-" + side,
4348
+ name: "margin-".concat(side),
3513
4349
  initialValue: '0',
3514
4350
  prefix: false,
3515
- type: 4 /* TOKEN_VALUE */
4351
+ type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
3516
4352
  }); };
3517
4353
  var marginTop = marginForSide('top');
3518
4354
  var marginRight = marginForSide('right');
@@ -3523,21 +4359,21 @@ var Reportly = (function () {
3523
4359
  name: 'overflow',
3524
4360
  initialValue: 'visible',
3525
4361
  prefix: false,
3526
- type: 1 /* LIST */,
4362
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3527
4363
  parse: function (_context, tokens) {
3528
4364
  return tokens.filter(isIdentToken).map(function (overflow) {
3529
4365
  switch (overflow.value) {
3530
4366
  case 'hidden':
3531
- return 1 /* HIDDEN */;
4367
+ return 1 /* OVERFLOW.HIDDEN */;
3532
4368
  case 'scroll':
3533
- return 2 /* SCROLL */;
4369
+ return 2 /* OVERFLOW.SCROLL */;
3534
4370
  case 'clip':
3535
- return 3 /* CLIP */;
4371
+ return 3 /* OVERFLOW.CLIP */;
3536
4372
  case 'auto':
3537
- return 4 /* AUTO */;
4373
+ return 4 /* OVERFLOW.AUTO */;
3538
4374
  case 'visible':
3539
4375
  default:
3540
- return 0 /* VISIBLE */;
4376
+ return 0 /* OVERFLOW.VISIBLE */;
3541
4377
  }
3542
4378
  });
3543
4379
  }
@@ -3547,23 +4383,23 @@ var Reportly = (function () {
3547
4383
  name: 'overflow-wrap',
3548
4384
  initialValue: 'normal',
3549
4385
  prefix: false,
3550
- type: 2 /* IDENT_VALUE */,
4386
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3551
4387
  parse: function (_context, overflow) {
3552
4388
  switch (overflow) {
3553
4389
  case 'break-word':
3554
- return "break-word" /* BREAK_WORD */;
4390
+ return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
3555
4391
  case 'normal':
3556
4392
  default:
3557
- return "normal" /* NORMAL */;
4393
+ return "normal" /* OVERFLOW_WRAP.NORMAL */;
3558
4394
  }
3559
4395
  }
3560
4396
  };
3561
4397
 
3562
4398
  var paddingForSide = function (side) { return ({
3563
- name: "padding-" + side,
4399
+ name: "padding-".concat(side),
3564
4400
  initialValue: '0',
3565
4401
  prefix: false,
3566
- type: 3 /* TYPE_VALUE */,
4402
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3567
4403
  format: 'length-percentage'
3568
4404
  }); };
3569
4405
  var paddingTop = paddingForSide('top');
@@ -3575,17 +4411,17 @@ var Reportly = (function () {
3575
4411
  name: 'text-align',
3576
4412
  initialValue: 'left',
3577
4413
  prefix: false,
3578
- type: 2 /* IDENT_VALUE */,
4414
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3579
4415
  parse: function (_context, textAlign) {
3580
4416
  switch (textAlign) {
3581
4417
  case 'right':
3582
- return 2 /* RIGHT */;
4418
+ return 2 /* TEXT_ALIGN.RIGHT */;
3583
4419
  case 'center':
3584
4420
  case 'justify':
3585
- return 1 /* CENTER */;
4421
+ return 1 /* TEXT_ALIGN.CENTER */;
3586
4422
  case 'left':
3587
4423
  default:
3588
- return 0 /* LEFT */;
4424
+ return 0 /* TEXT_ALIGN.LEFT */;
3589
4425
  }
3590
4426
  }
3591
4427
  };
@@ -3594,26 +4430,26 @@ var Reportly = (function () {
3594
4430
  name: 'position',
3595
4431
  initialValue: 'static',
3596
4432
  prefix: false,
3597
- type: 2 /* IDENT_VALUE */,
4433
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3598
4434
  parse: function (_context, position) {
3599
4435
  switch (position) {
3600
4436
  case 'relative':
3601
- return 1 /* RELATIVE */;
4437
+ return 1 /* POSITION.RELATIVE */;
3602
4438
  case 'absolute':
3603
- return 2 /* ABSOLUTE */;
4439
+ return 2 /* POSITION.ABSOLUTE */;
3604
4440
  case 'fixed':
3605
- return 3 /* FIXED */;
4441
+ return 3 /* POSITION.FIXED */;
3606
4442
  case 'sticky':
3607
- return 4 /* STICKY */;
4443
+ return 4 /* POSITION.STICKY */;
3608
4444
  }
3609
- return 0 /* STATIC */;
4445
+ return 0 /* POSITION.STATIC */;
3610
4446
  }
3611
4447
  };
3612
4448
 
3613
4449
  var textShadow = {
3614
4450
  name: 'text-shadow',
3615
4451
  initialValue: 'none',
3616
- type: 1 /* LIST */,
4452
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3617
4453
  prefix: false,
3618
4454
  parse: function (context, tokens) {
3619
4455
  if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
@@ -3654,17 +4490,17 @@ var Reportly = (function () {
3654
4490
  name: 'text-transform',
3655
4491
  initialValue: 'none',
3656
4492
  prefix: false,
3657
- type: 2 /* IDENT_VALUE */,
4493
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3658
4494
  parse: function (_context, textTransform) {
3659
4495
  switch (textTransform) {
3660
4496
  case 'uppercase':
3661
- return 2 /* UPPERCASE */;
4497
+ return 2 /* TEXT_TRANSFORM.UPPERCASE */;
3662
4498
  case 'lowercase':
3663
- return 1 /* LOWERCASE */;
4499
+ return 1 /* TEXT_TRANSFORM.LOWERCASE */;
3664
4500
  case 'capitalize':
3665
- return 3 /* CAPITALIZE */;
4501
+ return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
3666
4502
  }
3667
- return 0 /* NONE */;
4503
+ return 0 /* TEXT_TRANSFORM.NONE */;
3668
4504
  }
3669
4505
  };
3670
4506
 
@@ -3672,38 +4508,58 @@ var Reportly = (function () {
3672
4508
  name: 'transform',
3673
4509
  initialValue: 'none',
3674
4510
  prefix: true,
3675
- type: 0 /* VALUE */,
4511
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3676
4512
  parse: function (_context, token) {
3677
- if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
4513
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
3678
4514
  return null;
3679
4515
  }
3680
- if (token.type === 18 /* FUNCTION */) {
4516
+ if (token.type === 18 /* TokenType.FUNCTION */) {
3681
4517
  var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
3682
4518
  if (typeof transformFunction === 'undefined') {
3683
- 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, "\""));
3684
4520
  }
3685
- return transformFunction(token.values);
4521
+ return transformFunction(_context, token.values);
3686
4522
  }
3687
4523
  return null;
3688
4524
  }
3689
4525
  };
3690
- var matrix = function (args) {
3691
- 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; });
3692
4528
  return values.length === 6 ? values : null;
3693
4529
  };
3694
4530
  // doesn't support 3D transforms at the moment
3695
- var matrix3d = function (args) {
3696
- 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; });
3697
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];
3698
4534
  return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
3699
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
+ };
3700
4555
  var SUPPORTED_TRANSFORM_FUNCTIONS = {
3701
4556
  matrix: matrix,
3702
- matrix3d: matrix3d
4557
+ matrix3d: matrix3d,
4558
+ rotate: rotate$1
3703
4559
  };
3704
4560
 
3705
4561
  var DEFAULT_VALUE = {
3706
- type: 16 /* PERCENTAGE_TOKEN */,
4562
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
3707
4563
  number: 50,
3708
4564
  flags: FLAG_INTEGER
3709
4565
  };
@@ -3712,7 +4568,7 @@ var Reportly = (function () {
3712
4568
  name: 'transform-origin',
3713
4569
  initialValue: '50% 50%',
3714
4570
  prefix: true,
3715
- type: 1 /* LIST */,
4571
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3716
4572
  parse: function (_context, tokens) {
3717
4573
  var origins = tokens.filter(isLengthPercentage);
3718
4574
  if (origins.length !== 2) {
@@ -3722,20 +4578,44 @@ var Reportly = (function () {
3722
4578
  }
3723
4579
  };
3724
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
+
3725
4605
  var visibility = {
3726
4606
  name: 'visible',
3727
4607
  initialValue: 'none',
3728
4608
  prefix: false,
3729
- type: 2 /* IDENT_VALUE */,
4609
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3730
4610
  parse: function (_context, visibility) {
3731
4611
  switch (visibility) {
3732
4612
  case 'hidden':
3733
- return 1 /* HIDDEN */;
4613
+ return 1 /* VISIBILITY.HIDDEN */;
3734
4614
  case 'collapse':
3735
- return 2 /* COLLAPSE */;
4615
+ return 2 /* VISIBILITY.COLLAPSE */;
3736
4616
  case 'visible':
3737
4617
  default:
3738
- return 0 /* VISIBLE */;
4618
+ return 0 /* VISIBILITY.VISIBLE */;
3739
4619
  }
3740
4620
  }
3741
4621
  };
@@ -3750,7 +4630,7 @@ var Reportly = (function () {
3750
4630
  name: 'word-break',
3751
4631
  initialValue: 'normal',
3752
4632
  prefix: false,
3753
- type: 2 /* IDENT_VALUE */,
4633
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3754
4634
  parse: function (_context, wordBreak) {
3755
4635
  switch (wordBreak) {
3756
4636
  case 'break-all':
@@ -3768,9 +4648,9 @@ var Reportly = (function () {
3768
4648
  name: 'z-index',
3769
4649
  initialValue: 'auto',
3770
4650
  prefix: false,
3771
- type: 0 /* VALUE */,
4651
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3772
4652
  parse: function (_context, token) {
3773
- if (token.type === 20 /* IDENT_TOKEN */) {
4653
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
3774
4654
  return { auto: true, order: 0 };
3775
4655
  }
3776
4656
  if (isNumberToken(token)) {
@@ -3783,7 +4663,7 @@ var Reportly = (function () {
3783
4663
  var time = {
3784
4664
  name: 'time',
3785
4665
  parse: function (_context, value) {
3786
- if (value.type === 15 /* DIMENSION_TOKEN */) {
4666
+ if (value.type === 15 /* TokenType.DIMENSION_TOKEN */) {
3787
4667
  switch (value.unit.toLowerCase()) {
3788
4668
  case 's':
3789
4669
  return 1000 * value.number;
@@ -3798,7 +4678,7 @@ var Reportly = (function () {
3798
4678
  var opacity = {
3799
4679
  name: 'opacity',
3800
4680
  initialValue: '1',
3801
- type: 0 /* VALUE */,
4681
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3802
4682
  prefix: false,
3803
4683
  parse: function (_context, token) {
3804
4684
  if (isNumberToken(token)) {
@@ -3812,7 +4692,7 @@ var Reportly = (function () {
3812
4692
  name: "text-decoration-color",
3813
4693
  initialValue: 'transparent',
3814
4694
  prefix: false,
3815
- type: 3 /* TYPE_VALUE */,
4695
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3816
4696
  format: 'color'
3817
4697
  };
3818
4698
 
@@ -3820,24 +4700,24 @@ var Reportly = (function () {
3820
4700
  name: 'text-decoration-line',
3821
4701
  initialValue: 'none',
3822
4702
  prefix: false,
3823
- type: 1 /* LIST */,
4703
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3824
4704
  parse: function (_context, tokens) {
3825
4705
  return tokens
3826
4706
  .filter(isIdentToken)
3827
4707
  .map(function (token) {
3828
4708
  switch (token.value) {
3829
4709
  case 'underline':
3830
- return 1 /* UNDERLINE */;
4710
+ return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
3831
4711
  case 'overline':
3832
- return 2 /* OVERLINE */;
4712
+ return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
3833
4713
  case 'line-through':
3834
- return 3 /* LINE_THROUGH */;
4714
+ return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
3835
4715
  case 'none':
3836
- return 4 /* BLINK */;
4716
+ return 4 /* TEXT_DECORATION_LINE.BLINK */;
3837
4717
  }
3838
- return 0 /* NONE */;
4718
+ return 0 /* TEXT_DECORATION_LINE.NONE */;
3839
4719
  })
3840
- .filter(function (line) { return line !== 0 /* NONE */; });
4720
+ .filter(function (line) { return line !== 0 /* TEXT_DECORATION_LINE.NONE */; });
3841
4721
  }
3842
4722
  };
3843
4723
 
@@ -3845,20 +4725,20 @@ var Reportly = (function () {
3845
4725
  name: "font-family",
3846
4726
  initialValue: '',
3847
4727
  prefix: false,
3848
- type: 1 /* LIST */,
4728
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3849
4729
  parse: function (_context, tokens) {
3850
4730
  var accumulator = [];
3851
4731
  var results = [];
3852
4732
  tokens.forEach(function (token) {
3853
4733
  switch (token.type) {
3854
- case 20 /* IDENT_TOKEN */:
3855
- case 0 /* STRING_TOKEN */:
4734
+ case 20 /* TokenType.IDENT_TOKEN */:
4735
+ case 0 /* TokenType.STRING_TOKEN */:
3856
4736
  accumulator.push(token.value);
3857
4737
  break;
3858
- case 17 /* NUMBER_TOKEN */:
4738
+ case 17 /* TokenType.NUMBER_TOKEN */:
3859
4739
  accumulator.push(token.number.toString());
3860
4740
  break;
3861
- case 4 /* COMMA_TOKEN */:
4741
+ case 4 /* TokenType.COMMA_TOKEN */:
3862
4742
  results.push(accumulator.join(' '));
3863
4743
  accumulator.length = 0;
3864
4744
  break;
@@ -3867,7 +4747,7 @@ var Reportly = (function () {
3867
4747
  if (accumulator.length) {
3868
4748
  results.push(accumulator.join(' '));
3869
4749
  }
3870
- return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'" + result + "'"); });
4750
+ return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'".concat(result, "'")); });
3871
4751
  }
3872
4752
  };
3873
4753
 
@@ -3875,14 +4755,14 @@ var Reportly = (function () {
3875
4755
  name: "font-size",
3876
4756
  initialValue: '0',
3877
4757
  prefix: false,
3878
- type: 3 /* TYPE_VALUE */,
4758
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
3879
4759
  format: 'length'
3880
4760
  };
3881
4761
 
3882
4762
  var fontWeight = {
3883
4763
  name: 'font-weight',
3884
4764
  initialValue: 'normal',
3885
- type: 0 /* VALUE */,
4765
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
3886
4766
  prefix: false,
3887
4767
  parse: function (_context, token) {
3888
4768
  if (isNumberToken(token)) {
@@ -3904,7 +4784,7 @@ var Reportly = (function () {
3904
4784
  var fontVariant = {
3905
4785
  name: 'font-variant',
3906
4786
  initialValue: 'none',
3907
- type: 1 /* LIST */,
4787
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3908
4788
  prefix: false,
3909
4789
  parse: function (_context, tokens) {
3910
4790
  return tokens.filter(isIdentToken).map(function (token) { return token.value; });
@@ -3915,16 +4795,16 @@ var Reportly = (function () {
3915
4795
  name: 'font-style',
3916
4796
  initialValue: 'normal',
3917
4797
  prefix: false,
3918
- type: 2 /* IDENT_VALUE */,
4798
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
3919
4799
  parse: function (_context, overflow) {
3920
4800
  switch (overflow) {
3921
4801
  case 'oblique':
3922
- return "oblique" /* OBLIQUE */;
4802
+ return "oblique" /* FONT_STYLE.OBLIQUE */;
3923
4803
  case 'italic':
3924
- return "italic" /* ITALIC */;
4804
+ return "italic" /* FONT_STYLE.ITALIC */;
3925
4805
  case 'normal':
3926
4806
  default:
3927
- return "normal" /* NORMAL */;
4807
+ return "normal" /* FONT_STYLE.NORMAL */;
3928
4808
  }
3929
4809
  }
3930
4810
  };
@@ -3934,14 +4814,14 @@ var Reportly = (function () {
3934
4814
  var content = {
3935
4815
  name: 'content',
3936
4816
  initialValue: 'none',
3937
- type: 1 /* LIST */,
4817
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3938
4818
  prefix: false,
3939
4819
  parse: function (_context, tokens) {
3940
4820
  if (tokens.length === 0) {
3941
4821
  return [];
3942
4822
  }
3943
4823
  var first = tokens[0];
3944
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
4824
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
3945
4825
  return [];
3946
4826
  }
3947
4827
  return tokens;
@@ -3952,13 +4832,13 @@ var Reportly = (function () {
3952
4832
  name: 'counter-increment',
3953
4833
  initialValue: 'none',
3954
4834
  prefix: true,
3955
- type: 1 /* LIST */,
4835
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3956
4836
  parse: function (_context, tokens) {
3957
4837
  if (tokens.length === 0) {
3958
4838
  return null;
3959
4839
  }
3960
4840
  var first = tokens[0];
3961
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
4841
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
3962
4842
  return null;
3963
4843
  }
3964
4844
  var increments = [];
@@ -3966,7 +4846,7 @@ var Reportly = (function () {
3966
4846
  for (var i = 0; i < filtered.length; i++) {
3967
4847
  var counter = filtered[i];
3968
4848
  var next = filtered[i + 1];
3969
- if (counter.type === 20 /* IDENT_TOKEN */) {
4849
+ if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
3970
4850
  var increment = next && isNumberToken(next) ? next.number : 1;
3971
4851
  increments.push({ counter: counter.value, increment: increment });
3972
4852
  }
@@ -3979,7 +4859,7 @@ var Reportly = (function () {
3979
4859
  name: 'counter-reset',
3980
4860
  initialValue: 'none',
3981
4861
  prefix: true,
3982
- type: 1 /* LIST */,
4862
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
3983
4863
  parse: function (_context, tokens) {
3984
4864
  if (tokens.length === 0) {
3985
4865
  return [];
@@ -4002,7 +4882,7 @@ var Reportly = (function () {
4002
4882
  name: 'duration',
4003
4883
  initialValue: '0s',
4004
4884
  prefix: false,
4005
- type: 1 /* LIST */,
4885
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4006
4886
  parse: function (context, tokens) {
4007
4887
  return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
4008
4888
  }
@@ -4012,13 +4892,13 @@ var Reportly = (function () {
4012
4892
  name: 'quotes',
4013
4893
  initialValue: 'none',
4014
4894
  prefix: true,
4015
- type: 1 /* LIST */,
4895
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4016
4896
  parse: function (_context, tokens) {
4017
4897
  if (tokens.length === 0) {
4018
4898
  return null;
4019
4899
  }
4020
4900
  var first = tokens[0];
4021
- if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
4901
+ if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
4022
4902
  return null;
4023
4903
  }
4024
4904
  var quotes = [];
@@ -4048,7 +4928,7 @@ var Reportly = (function () {
4048
4928
  var boxShadow = {
4049
4929
  name: 'box-shadow',
4050
4930
  initialValue: 'none',
4051
- type: 1 /* LIST */,
4931
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4052
4932
  prefix: false,
4053
4933
  parse: function (context, tokens) {
4054
4934
  if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
@@ -4097,20 +4977,20 @@ var Reportly = (function () {
4097
4977
  name: 'paint-order',
4098
4978
  initialValue: 'normal',
4099
4979
  prefix: false,
4100
- type: 1 /* LIST */,
4980
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
4101
4981
  parse: function (_context, tokens) {
4102
- 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 */];
4103
4983
  var layers = [];
4104
4984
  tokens.filter(isIdentToken).forEach(function (token) {
4105
4985
  switch (token.value) {
4106
4986
  case 'stroke':
4107
- layers.push(1 /* STROKE */);
4987
+ layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
4108
4988
  break;
4109
4989
  case 'fill':
4110
- layers.push(0 /* FILL */);
4990
+ layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
4111
4991
  break;
4112
4992
  case 'markers':
4113
- layers.push(2 /* MARKERS */);
4993
+ layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
4114
4994
  break;
4115
4995
  }
4116
4996
  });
@@ -4127,14 +5007,14 @@ var Reportly = (function () {
4127
5007
  name: "-webkit-text-stroke-color",
4128
5008
  initialValue: 'currentcolor',
4129
5009
  prefix: false,
4130
- type: 3 /* TYPE_VALUE */,
5010
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
4131
5011
  format: 'color'
4132
5012
  };
4133
5013
 
4134
5014
  var webkitTextStrokeWidth = {
4135
5015
  name: "-webkit-text-stroke-width",
4136
5016
  initialValue: '0',
4137
- type: 0 /* VALUE */,
5017
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
4138
5018
  prefix: false,
4139
5019
  parse: function (_context, token) {
4140
5020
  if (isDimensionToken(token)) {
@@ -4144,6 +5024,31 @@ var Reportly = (function () {
4144
5024
  }
4145
5025
  };
4146
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
+
4147
5052
  var CSSParsedDeclaration = /** @class */ (function () {
4148
5053
  function CSSParsedDeclaration(context, declaration) {
4149
5054
  var _a, _b;
@@ -4209,37 +5114,39 @@ var Reportly = (function () {
4209
5114
  this.textTransform = parse(context, textTransform, declaration.textTransform);
4210
5115
  this.transform = parse(context, transform$1, declaration.transform);
4211
5116
  this.transformOrigin = parse(context, transformOrigin, declaration.transformOrigin);
5117
+ this.rotate = parse(context, rotate, declaration.rotate);
4212
5118
  this.visibility = parse(context, visibility, declaration.visibility);
4213
5119
  this.webkitTextStrokeColor = parse(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor);
4214
5120
  this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
4215
5121
  this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
4216
5122
  this.zIndex = parse(context, zIndex, declaration.zIndex);
5123
+ this.objectFit = parse(context, objectFit, declaration.objectFit);
4217
5124
  }
4218
5125
  CSSParsedDeclaration.prototype.isVisible = function () {
4219
- return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
5126
+ return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBILITY.VISIBLE */;
4220
5127
  };
4221
5128
  CSSParsedDeclaration.prototype.isTransparent = function () {
4222
5129
  return isTransparent(this.backgroundColor);
4223
5130
  };
4224
5131
  CSSParsedDeclaration.prototype.isTransformed = function () {
4225
- return this.transform !== null;
5132
+ return this.transform !== null || this.rotate !== null;
4226
5133
  };
4227
5134
  CSSParsedDeclaration.prototype.isPositioned = function () {
4228
- return this.position !== 0 /* STATIC */;
5135
+ return this.position !== 0 /* POSITION.STATIC */;
4229
5136
  };
4230
5137
  CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
4231
5138
  return this.isPositioned() && !this.zIndex.auto;
4232
5139
  };
4233
5140
  CSSParsedDeclaration.prototype.isFloating = function () {
4234
- return this.float !== 0 /* NONE */;
5141
+ return this.float !== 0 /* FLOAT.NONE */;
4235
5142
  };
4236
5143
  CSSParsedDeclaration.prototype.isInlineLevel = function () {
4237
- return (contains(this.display, 4 /* INLINE */) ||
4238
- contains(this.display, 33554432 /* INLINE_BLOCK */) ||
4239
- contains(this.display, 268435456 /* INLINE_FLEX */) ||
4240
- contains(this.display, 536870912 /* INLINE_GRID */) ||
4241
- contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
4242
- 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 */));
4243
5150
  };
4244
5151
  return CSSParsedDeclaration;
4245
5152
  }());
@@ -4264,16 +5171,16 @@ var Reportly = (function () {
4264
5171
  tokenizer.write(value);
4265
5172
  var parser = new Parser(tokenizer.read());
4266
5173
  switch (descriptor.type) {
4267
- case 2 /* IDENT_VALUE */:
5174
+ case 2 /* PropertyDescriptorParsingType.IDENT_VALUE */:
4268
5175
  var token = parser.parseComponentValue();
4269
5176
  return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
4270
- case 0 /* VALUE */:
5177
+ case 0 /* PropertyDescriptorParsingType.VALUE */:
4271
5178
  return descriptor.parse(context, parser.parseComponentValue());
4272
- case 1 /* LIST */:
5179
+ case 1 /* PropertyDescriptorParsingType.LIST */:
4273
5180
  return descriptor.parse(context, parser.parseComponentValues());
4274
- case 4 /* TOKEN_VALUE */:
5181
+ case 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */:
4275
5182
  return parser.parseComponentValue();
4276
- case 3 /* TYPE_VALUE */:
5183
+ case 3 /* PropertyDescriptorParsingType.TYPE_VALUE */:
4277
5184
  switch (descriptor.format) {
4278
5185
  case 'angle':
4279
5186
  return angle.parse(context, parser.parseComponentValue());
@@ -4299,20 +5206,20 @@ var Reportly = (function () {
4299
5206
  var attribute = element.getAttribute(elementDebuggerAttribute);
4300
5207
  switch (attribute) {
4301
5208
  case 'all':
4302
- return 1 /* ALL */;
5209
+ return 1 /* DebuggerType.ALL */;
4303
5210
  case 'clone':
4304
- return 2 /* CLONE */;
5211
+ return 2 /* DebuggerType.CLONE */;
4305
5212
  case 'parse':
4306
- return 3 /* PARSE */;
5213
+ return 3 /* DebuggerType.PARSE */;
4307
5214
  case 'render':
4308
- return 4 /* RENDER */;
5215
+ return 4 /* DebuggerType.RENDER */;
4309
5216
  default:
4310
- return 0 /* NONE */;
5217
+ return 0 /* DebuggerType.NONE */;
4311
5218
  }
4312
5219
  };
4313
5220
  var isDebugging = function (element, type) {
4314
5221
  var elementType = getElementDebugType(element);
4315
- return elementType === 1 /* ALL */ || type === elementType;
5222
+ return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
4316
5223
  };
4317
5224
 
4318
5225
  var ElementContainer = /** @class */ (function () {
@@ -4321,7 +5228,7 @@ var Reportly = (function () {
4321
5228
  this.textNodes = [];
4322
5229
  this.elements = [];
4323
5230
  this.flags = 0;
4324
- if (isDebugging(element, 3 /* PARSE */)) {
5231
+ if (isDebugging(element, 3 /* DebuggerType.PARSE */)) {
4325
5232
  debugger;
4326
5233
  }
4327
5234
  this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
@@ -4333,10 +5240,14 @@ var Reportly = (function () {
4333
5240
  // getBoundingClientRect takes transforms into account
4334
5241
  element.style.transform = 'none';
4335
5242
  }
5243
+ if (this.styles.rotate !== null) {
5244
+ // Handle rotate property similarly to transform
5245
+ element.style.rotate = 'none';
5246
+ }
4336
5247
  }
4337
5248
  this.bounds = parseBounds(this.context, element);
4338
- if (isDebugging(element, 4 /* RENDER */)) {
4339
- this.flags |= 16 /* DEBUG_RENDER */;
5249
+ if (isDebugging(element, 4 /* DebuggerType.RENDER */)) {
5250
+ this.flags |= 16 /* FLAGS.DEBUG_RENDER */;
4340
5251
  }
4341
5252
  }
4342
5253
  return ElementContainer;
@@ -4730,7 +5641,7 @@ var Reportly = (function () {
4730
5641
  var range = document.createRange();
4731
5642
  if (range.getBoundingClientRect) {
4732
5643
  var testElement = document.createElement('boundtest');
4733
- testElement.style.height = TEST_HEIGHT + "px";
5644
+ testElement.style.height = "".concat(TEST_HEIGHT, "px");
4734
5645
  testElement.style.display = 'block';
4735
5646
  document.body.appendChild(testElement);
4736
5647
  range.selectNode(testElement);
@@ -4820,8 +5731,8 @@ var Reportly = (function () {
4820
5731
  ctx.fillStyle = 'red';
4821
5732
  ctx.fillRect(0, 0, size, size);
4822
5733
  var node = document.createElement('div');
4823
- node.style.backgroundImage = "url(" + greenImageSrc + ")";
4824
- node.style.height = size + "px";
5734
+ node.style.backgroundImage = "url(".concat(greenImageSrc, ")");
5735
+ node.style.height = "".concat(size, "px");
4825
5736
  // Firefox 55 does not render inline <img /> tags
4826
5737
  return isGreenPixel(data)
4827
5738
  ? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
@@ -4854,7 +5765,7 @@ var Reportly = (function () {
4854
5765
  var img = new Image();
4855
5766
  img.onload = function () { return resolve(img); };
4856
5767
  img.onerror = reject;
4857
- 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)));
4858
5769
  });
4859
5770
  };
4860
5771
  var FEATURES = {
@@ -4998,7 +5909,7 @@ var Reportly = (function () {
4998
5909
  var breakWords = function (str, styles) {
4999
5910
  var breaker = LineBreaker(str, {
5000
5911
  lineBreak: styles.lineBreak,
5001
- 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
5002
5913
  });
5003
5914
  var words = [];
5004
5915
  var bk;
@@ -5039,11 +5950,11 @@ var Reportly = (function () {
5039
5950
  }());
5040
5951
  var transform = function (text, transform) {
5041
5952
  switch (transform) {
5042
- case 1 /* LOWERCASE */:
5953
+ case 1 /* TEXT_TRANSFORM.LOWERCASE */:
5043
5954
  return text.toLowerCase();
5044
- case 3 /* CAPITALIZE */:
5955
+ case 3 /* TEXT_TRANSFORM.CAPITALIZE */:
5045
5956
  return text.replace(CAPITALIZE, capitalize);
5046
- case 2 /* UPPERCASE */:
5957
+ case 2 /* TEXT_TRANSFORM.UPPERCASE */:
5047
5958
  return text.toUpperCase();
5048
5959
  default:
5049
5960
  return text;
@@ -5088,9 +5999,9 @@ var Reportly = (function () {
5088
5999
  var _this = _super.call(this, context, img) || this;
5089
6000
  var s = new XMLSerializer();
5090
6001
  var bounds = parseBounds(context, img);
5091
- img.setAttribute('width', bounds.width + "px");
5092
- img.setAttribute('height', bounds.height + "px");
5093
- _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)));
5094
6005
  _this.intrinsicWidth = img.width.baseVal.value;
5095
6006
  _this.intrinsicHeight = img.height.baseVal.value;
5096
6007
  _this.context.cache.addImage(_this.svg);
@@ -5122,7 +6033,7 @@ var Reportly = (function () {
5122
6033
 
5123
6034
  var CHECKBOX_BORDER_RADIUS = [
5124
6035
  {
5125
- type: 15 /* DIMENSION_TOKEN */,
6036
+ type: 15 /* TokenType.DIMENSION_TOKEN */,
5126
6037
  flags: 0,
5127
6038
  unit: 'px',
5128
6039
  number: 3
@@ -5130,7 +6041,7 @@ var Reportly = (function () {
5130
6041
  ];
5131
6042
  var RADIO_BORDER_RADIUS = [
5132
6043
  {
5133
- type: 16 /* PERCENTAGE_TOKEN */,
6044
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
5134
6045
  flags: 0,
5135
6046
  number: 50
5136
6047
  }
@@ -5175,9 +6086,9 @@ var Reportly = (function () {
5175
6086
  _this.styles.borderRightStyle =
5176
6087
  _this.styles.borderBottomStyle =
5177
6088
  _this.styles.borderLeftStyle =
5178
- 1 /* SOLID */;
5179
- _this.styles.backgroundClip = [0 /* BORDER_BOX */];
5180
- _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 */];
5181
6092
  _this.bounds = reformatInputBounds(_this.bounds);
5182
6093
  }
5183
6094
  switch (_this.type) {
@@ -5259,7 +6170,8 @@ var Reportly = (function () {
5259
6170
  var parseNodeTree = function (context, node, parent, root) {
5260
6171
  for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
5261
6172
  nextNode = childNode.nextSibling;
5262
- 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) {
5263
6175
  parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
5264
6176
  }
5265
6177
  else if (isElementNode(childNode)) {
@@ -5270,13 +6182,13 @@ var Reportly = (function () {
5270
6182
  var container = createContainer(context, childNode);
5271
6183
  if (container.styles.isVisible()) {
5272
6184
  if (createsRealStackingContext(childNode, container, root)) {
5273
- container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
6185
+ container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
5274
6186
  }
5275
6187
  else if (createsStackingContext(container.styles)) {
5276
- container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
6188
+ container.flags |= 2 /* FLAGS.CREATES_STACKING_CONTEXT */;
5277
6189
  }
5278
6190
  if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
5279
- container.flags |= 8 /* IS_LIST_OWNER */;
6191
+ container.flags |= 8 /* FLAGS.IS_LIST_OWNER */;
5280
6192
  }
5281
6193
  parent.elements.push(container);
5282
6194
  childNode.slot;
@@ -5325,7 +6237,7 @@ var Reportly = (function () {
5325
6237
  };
5326
6238
  var parseTree = function (context, element) {
5327
6239
  var container = createContainer(context, element);
5328
- container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
6240
+ container.flags |= 4 /* FLAGS.CREATES_REAL_STACKING_CONTEXT */;
5329
6241
  parseNodeTree(context, element, container, container);
5330
6242
  return container;
5331
6243
  };
@@ -5593,7 +6505,7 @@ var Reportly = (function () {
5593
6505
  var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
5594
6506
  var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
5595
6507
  if (value < -9999 || value > 9999) {
5596
- return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
6508
+ return createCounterText(value, 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */, suffix.length > 0);
5597
6509
  }
5598
6510
  var tmp = Math.abs(value);
5599
6511
  var string = suffix;
@@ -5629,101 +6541,101 @@ var Reportly = (function () {
5629
6541
  var koreanSuffix = appendSuffix ? ', ' : '';
5630
6542
  var spaceSuffix = appendSuffix ? ' ' : '';
5631
6543
  switch (type) {
5632
- case 0 /* DISC */:
6544
+ case 0 /* LIST_STYLE_TYPE.DISC */:
5633
6545
  return '•' + spaceSuffix;
5634
- case 1 /* CIRCLE */:
6546
+ case 1 /* LIST_STYLE_TYPE.CIRCLE */:
5635
6547
  return '◦' + spaceSuffix;
5636
- case 2 /* SQUARE */:
6548
+ case 2 /* LIST_STYLE_TYPE.SQUARE */:
5637
6549
  return '◾' + spaceSuffix;
5638
- case 5 /* DECIMAL_LEADING_ZERO */:
6550
+ case 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */:
5639
6551
  var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
5640
- return string.length < 4 ? "0" + string : string;
5641
- case 4 /* CJK_DECIMAL */:
6552
+ return string.length < 4 ? "0".concat(string) : string;
6553
+ case 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */:
5642
6554
  return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
5643
- case 6 /* LOWER_ROMAN */:
5644
- return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
5645
- case 7 /* UPPER_ROMAN */:
5646
- return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
5647
- 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 */:
5648
6560
  return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
5649
- case 9 /* LOWER_ALPHA */:
6561
+ case 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */:
5650
6562
  return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
5651
- case 10 /* UPPER_ALPHA */:
6563
+ case 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */:
5652
6564
  return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
5653
- case 11 /* ARABIC_INDIC */:
6565
+ case 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */:
5654
6566
  return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
5655
- case 12 /* ARMENIAN */:
5656
- case 49 /* UPPER_ARMENIAN */:
5657
- return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
5658
- case 35 /* LOWER_ARMENIAN */:
5659
- return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
5660
- 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 */:
5661
6573
  return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
5662
- case 14 /* CAMBODIAN */:
5663
- case 30 /* KHMER */:
6574
+ case 14 /* LIST_STYLE_TYPE.CAMBODIAN */:
6575
+ case 30 /* LIST_STYLE_TYPE.KHMER */:
5664
6576
  return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
5665
- case 15 /* CJK_EARTHLY_BRANCH */:
6577
+ case 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */:
5666
6578
  return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
5667
- case 16 /* CJK_HEAVENLY_STEM */:
6579
+ case 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */:
5668
6580
  return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
5669
- case 17 /* CJK_IDEOGRAPHIC */:
5670
- case 48 /* TRAD_CHINESE_INFORMAL */:
6581
+ case 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */:
6582
+ case 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */:
5671
6583
  return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5672
- case 47 /* TRAD_CHINESE_FORMAL */:
6584
+ case 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */:
5673
6585
  return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5674
- case 42 /* SIMP_CHINESE_INFORMAL */:
6586
+ case 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */:
5675
6587
  return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5676
- case 41 /* SIMP_CHINESE_FORMAL */:
6588
+ case 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */:
5677
6589
  return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
5678
- case 26 /* JAPANESE_INFORMAL */:
6590
+ case 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */:
5679
6591
  return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
5680
- case 25 /* JAPANESE_FORMAL */:
6592
+ case 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */:
5681
6593
  return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
5682
- case 31 /* KOREAN_HANGUL_FORMAL */:
6594
+ case 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */:
5683
6595
  return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
5684
- case 33 /* KOREAN_HANJA_INFORMAL */:
6596
+ case 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */:
5685
6597
  return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
5686
- case 32 /* KOREAN_HANJA_FORMAL */:
6598
+ case 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */:
5687
6599
  return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
5688
- case 18 /* DEVANAGARI */:
6600
+ case 18 /* LIST_STYLE_TYPE.DEVANAGARI */:
5689
6601
  return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
5690
- case 20 /* GEORGIAN */:
5691
- return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
5692
- 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 */:
5693
6605
  return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
5694
- case 22 /* GURMUKHI */:
6606
+ case 22 /* LIST_STYLE_TYPE.GURMUKHI */:
5695
6607
  return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
5696
- case 22 /* HEBREW */:
5697
- return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
5698
- 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 */:
5699
6611
  return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
5700
- case 24 /* HIRAGANA_IROHA */:
6612
+ case 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */:
5701
6613
  return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
5702
- case 27 /* KANNADA */:
6614
+ case 27 /* LIST_STYLE_TYPE.KANNADA */:
5703
6615
  return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
5704
- case 28 /* KATAKANA */:
6616
+ case 28 /* LIST_STYLE_TYPE.KATAKANA */:
5705
6617
  return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
5706
- case 29 /* KATAKANA_IROHA */:
6618
+ case 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */:
5707
6619
  return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
5708
- case 34 /* LAO */:
6620
+ case 34 /* LIST_STYLE_TYPE.LAO */:
5709
6621
  return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
5710
- case 37 /* MONGOLIAN */:
6622
+ case 37 /* LIST_STYLE_TYPE.MONGOLIAN */:
5711
6623
  return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
5712
- case 38 /* MYANMAR */:
6624
+ case 38 /* LIST_STYLE_TYPE.MYANMAR */:
5713
6625
  return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
5714
- case 39 /* ORIYA */:
6626
+ case 39 /* LIST_STYLE_TYPE.ORIYA */:
5715
6627
  return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
5716
- case 40 /* PERSIAN */:
6628
+ case 40 /* LIST_STYLE_TYPE.PERSIAN */:
5717
6629
  return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
5718
- case 43 /* TAMIL */:
6630
+ case 43 /* LIST_STYLE_TYPE.TAMIL */:
5719
6631
  return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
5720
- case 44 /* TELUGU */:
6632
+ case 44 /* LIST_STYLE_TYPE.TELUGU */:
5721
6633
  return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
5722
- case 45 /* THAI */:
6634
+ case 45 /* LIST_STYLE_TYPE.THAI */:
5723
6635
  return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
5724
- case 46 /* TIBETAN */:
6636
+ case 46 /* LIST_STYLE_TYPE.TIBETAN */:
5725
6637
  return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
5726
- case 3 /* DECIMAL */:
6638
+ case 3 /* LIST_STYLE_TYPE.DECIMAL */:
5727
6639
  default:
5728
6640
  return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
5729
6641
  }
@@ -5773,7 +6685,7 @@ var Reportly = (function () {
5773
6685
  onclone = this.options.onclone;
5774
6686
  referenceElement = this.clonedReferenceElement;
5775
6687
  if (typeof referenceElement === 'undefined') {
5776
- 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"))];
5777
6689
  }
5778
6690
  if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
5779
6691
  return [4 /*yield*/, documentClone.fonts.ready];
@@ -5796,16 +6708,33 @@ var Reportly = (function () {
5796
6708
  }
5797
6709
  });
5798
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;
5799
6716
  documentClone.open();
5800
- documentClone.write(serializeDoctype(document.doctype) + "<html></html>");
6717
+ documentClone.write("".concat(serializeDoctype(document.doctype), "<html></html>"));
5801
6718
  // Chrome scrolls the parent document for some reason after the write to the cloned window???
5802
6719
  restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
5803
- 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);
5804
6733
  documentClone.close();
5805
6734
  return iframeLoad;
5806
6735
  };
5807
6736
  DocumentCloner.prototype.createElementClone = function (node) {
5808
- if (isDebugging(node, 2 /* CLONE */)) {
6737
+ if (isDebugging(node, 2 /* DebuggerType.CLONE */)) {
5809
6738
  debugger;
5810
6739
  }
5811
6740
  if (isCanvasElement(node)) {
@@ -5878,7 +6807,7 @@ var Reportly = (function () {
5878
6807
  clonedCanvas.width = canvas.width;
5879
6808
  clonedCanvas.height = canvas.height;
5880
6809
  var ctx = canvas.getContext('2d');
5881
- var clonedCtx = clonedCanvas.getContext('2d');
6810
+ var clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
5882
6811
  if (clonedCtx) {
5883
6812
  if (!this.options.allowTaint && ctx) {
5884
6813
  clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
@@ -6013,16 +6942,16 @@ var Reportly = (function () {
6013
6942
  var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
6014
6943
  copyCSSStyles(style, anonymousReplacedElement);
6015
6944
  declaration.content.forEach(function (token) {
6016
- if (token.type === 0 /* STRING_TOKEN */) {
6945
+ if (token.type === 0 /* TokenType.STRING_TOKEN */) {
6017
6946
  anonymousReplacedElement.appendChild(document.createTextNode(token.value));
6018
6947
  }
6019
- else if (token.type === 22 /* URL_TOKEN */) {
6948
+ else if (token.type === 22 /* TokenType.URL_TOKEN */) {
6020
6949
  var img = document.createElement('img');
6021
6950
  img.src = token.value;
6022
6951
  img.style.opacity = '1';
6023
6952
  anonymousReplacedElement.appendChild(img);
6024
6953
  }
6025
- else if (token.type === 18 /* FUNCTION */) {
6954
+ else if (token.type === 18 /* TokenType.FUNCTION */) {
6026
6955
  if (token.name === 'attr') {
6027
6956
  var attr = token.values.filter(isIdentToken);
6028
6957
  if (attr.length) {
@@ -6035,7 +6964,7 @@ var Reportly = (function () {
6035
6964
  var counterState = _this.counters.getCounterValue(counter.value);
6036
6965
  var counterType = counterStyle && isIdentToken(counterStyle)
6037
6966
  ? listStyleType.parse(_this.context, counterStyle.value)
6038
- : 3 /* DECIMAL */;
6967
+ : 3 /* LIST_STYLE_TYPE.DECIMAL */;
6039
6968
  anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
6040
6969
  }
6041
6970
  }
@@ -6045,8 +6974,8 @@ var Reportly = (function () {
6045
6974
  var counterStates = _this.counters.getCounterValues(counter.value);
6046
6975
  var counterType_1 = counterStyle && isIdentToken(counterStyle)
6047
6976
  ? listStyleType.parse(_this.context, counterStyle.value)
6048
- : 3 /* DECIMAL */;
6049
- 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 : '';
6050
6979
  var text = counterStates
6051
6980
  .map(function (value) { return createCounterText(value, counterType_1, false); })
6052
6981
  .join(separator);
@@ -6055,7 +6984,7 @@ var Reportly = (function () {
6055
6984
  }
6056
6985
  else ;
6057
6986
  }
6058
- else if (token.type === 20 /* IDENT_TOKEN */) {
6987
+ else if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
6059
6988
  switch (token.value) {
6060
6989
  case 'open-quote':
6061
6990
  anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
@@ -6069,10 +6998,10 @@ var Reportly = (function () {
6069
6998
  }
6070
6999
  }
6071
7000
  });
6072
- 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);
6073
7002
  var newClassName = pseudoElt === PseudoElementType.BEFORE
6074
- ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
6075
- : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
7003
+ ? " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_BEFORE)
7004
+ : " ".concat(PSEUDO_HIDE_ELEMENT_CLASS_AFTER);
6076
7005
  if (isSVGElementNode(clone)) {
6077
7006
  clone.className.baseValue += newClassName;
6078
7007
  }
@@ -6146,8 +7075,8 @@ var Reportly = (function () {
6146
7075
  });
6147
7076
  };
6148
7077
  var ignoredStyleProperties = [
6149
- 'all',
6150
- 'd',
7078
+ 'all', // #2476
7079
+ 'd', // #2483
6151
7080
  'content' // Safari shows pseudoelements if content is set
6152
7081
  ];
6153
7082
  var copyCSSStyles = function (style, target) {
@@ -6171,10 +7100,10 @@ var Reportly = (function () {
6171
7100
  str += doctype.internalSubset;
6172
7101
  }
6173
7102
  if (doctype.publicId) {
6174
- str += "\"" + doctype.publicId + "\"";
7103
+ str += "\"".concat(doctype.publicId, "\"");
6175
7104
  }
6176
7105
  if (doctype.systemId) {
6177
- str += "\"" + doctype.systemId + "\"";
7106
+ str += "\"".concat(doctype.systemId, "\"");
6178
7107
  }
6179
7108
  str += '>';
6180
7109
  }
@@ -6198,7 +7127,7 @@ var Reportly = (function () {
6198
7127
  var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
6199
7128
  var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
6200
7129
  var createPseudoHideStyles = function (body) {
6201
- 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));
6202
7131
  };
6203
7132
  var createStyles = function (body, styles) {
6204
7133
  var document = body.ownerDocument;
@@ -6208,6 +7137,13 @@ var Reportly = (function () {
6208
7137
  body.appendChild(style);
6209
7138
  }
6210
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
+ };
6211
7147
 
6212
7148
  var CacheStorage = /** @class */ (function () {
6213
7149
  function CacheStorage() {
@@ -6257,12 +7193,21 @@ var Reportly = (function () {
6257
7193
  };
6258
7194
  Cache.prototype.loadImage = function (key) {
6259
7195
  return __awaiter(this, void 0, void 0, function () {
6260
- var isSameOrigin, useCORS, useProxy, src;
7196
+ var isSameOrigin, _a, useCORS, useProxy, src;
6261
7197
  var _this = this;
6262
- return __generator(this, function (_a) {
6263
- switch (_a.label) {
7198
+ return __generator(this, function (_b) {
7199
+ switch (_b.label) {
6264
7200
  case 0:
6265
- 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;
6266
7211
  useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
6267
7212
  useProxy = !isInlineImage(key) &&
6268
7213
  !isSameOrigin &&
@@ -6279,13 +7224,13 @@ var Reportly = (function () {
6279
7224
  return [2 /*return*/];
6280
7225
  }
6281
7226
  src = key;
6282
- if (!useProxy) return [3 /*break*/, 2];
7227
+ if (!useProxy) return [3 /*break*/, 5];
6283
7228
  return [4 /*yield*/, this.proxy(src)];
6284
- case 1:
6285
- src = _a.sent();
6286
- _a.label = 2;
6287
- case 2:
6288
- 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)));
6289
7234
  return [4 /*yield*/, new Promise(function (resolve, reject) {
6290
7235
  var img = new Image();
6291
7236
  img.onload = function () { return resolve(img); };
@@ -6300,10 +7245,10 @@ var Reportly = (function () {
6300
7245
  setTimeout(function () { return resolve(img); }, 500);
6301
7246
  }
6302
7247
  if (_this._options.imageTimeout > 0) {
6303
- 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);
6304
7249
  }
6305
7250
  })];
6306
- case 3: return [2 /*return*/, _a.sent()];
7251
+ case 6: return [2 /*return*/, _b.sent()];
6307
7252
  }
6308
7253
  });
6309
7254
  });
@@ -6337,19 +7282,19 @@ var Reportly = (function () {
6337
7282
  }
6338
7283
  }
6339
7284
  else {
6340
- 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));
6341
7286
  }
6342
7287
  };
6343
7288
  xhr.onerror = reject;
6344
7289
  var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
6345
- 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));
6346
7291
  if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
6347
7292
  xhr.responseType = responseType;
6348
7293
  }
6349
7294
  if (_this._options.imageTimeout) {
6350
7295
  var timeout_1 = _this._options.imageTimeout;
6351
7296
  xhr.timeout = timeout_1;
6352
- 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)); };
6353
7298
  }
6354
7299
  xhr.send();
6355
7300
  });
@@ -6367,7 +7312,7 @@ var Reportly = (function () {
6367
7312
 
6368
7313
  var Vector = /** @class */ (function () {
6369
7314
  function Vector(x, y) {
6370
- this.type = 0 /* VECTOR */;
7315
+ this.type = 0 /* PathType.VECTOR */;
6371
7316
  this.x = x;
6372
7317
  this.y = y;
6373
7318
  }
@@ -6382,7 +7327,7 @@ var Reportly = (function () {
6382
7327
  };
6383
7328
  var BezierCurve = /** @class */ (function () {
6384
7329
  function BezierCurve(start, startControl, endControl, end) {
6385
- this.type = 1 /* BEZIER_CURVE */;
7330
+ this.type = 1 /* PathType.BEZIER_CURVE */;
6386
7331
  this.start = start;
6387
7332
  this.startControl = startControl;
6388
7333
  this.endControl = endControl;
@@ -6405,7 +7350,7 @@ var Reportly = (function () {
6405
7350
  };
6406
7351
  return BezierCurve;
6407
7352
  }());
6408
- var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
7353
+ var isBezierCurve = function (path) { return path.type === 1 /* PathType.BEZIER_CURVE */; };
6409
7354
 
6410
7355
  var BoundCurves = /** @class */ (function () {
6411
7356
  function BoundCurves(element) {
@@ -6592,8 +7537,8 @@ var Reportly = (function () {
6592
7537
  this.offsetX = offsetX;
6593
7538
  this.offsetY = offsetY;
6594
7539
  this.matrix = matrix;
6595
- this.type = 0 /* TRANSFORM */;
6596
- this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
7540
+ this.type = 0 /* EffectType.TRANSFORM */;
7541
+ this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
6597
7542
  }
6598
7543
  return TransformEffect;
6599
7544
  }());
@@ -6601,23 +7546,23 @@ var Reportly = (function () {
6601
7546
  function ClipEffect(path, target) {
6602
7547
  this.path = path;
6603
7548
  this.target = target;
6604
- this.type = 1 /* CLIP */;
7549
+ this.type = 1 /* EffectType.CLIP */;
6605
7550
  }
6606
7551
  return ClipEffect;
6607
7552
  }());
6608
7553
  var OpacityEffect = /** @class */ (function () {
6609
7554
  function OpacityEffect(opacity) {
6610
7555
  this.opacity = opacity;
6611
- this.type = 2 /* OPACITY */;
6612
- this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
7556
+ this.type = 2 /* EffectType.OPACITY */;
7557
+ this.target = 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */;
6613
7558
  }
6614
7559
  return OpacityEffect;
6615
7560
  }());
6616
7561
  var isTransformEffect = function (effect) {
6617
- return effect.type === 0 /* TRANSFORM */;
7562
+ return effect.type === 0 /* EffectType.TRANSFORM */;
6618
7563
  };
6619
- var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
6620
- 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 */; };
6621
7566
 
6622
7567
  var equalPath = function (a, b) {
6623
7568
  if (a.length === b.length) {
@@ -6663,40 +7608,51 @@ var Reportly = (function () {
6663
7608
  if (this.container.styles.opacity < 1) {
6664
7609
  this.effects.push(new OpacityEffect(this.container.styles.opacity));
6665
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
+ }
6666
7622
  if (this.container.styles.transform !== null) {
6667
7623
  var offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
6668
7624
  var offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
6669
7625
  var matrix = this.container.styles.transform;
6670
7626
  this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
6671
7627
  }
6672
- if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
7628
+ if (this.container.styles.overflowX !== 0 /* OVERFLOW.VISIBLE */) {
6673
7629
  var borderBox = calculateBorderBoxPath(this.curves);
6674
7630
  var paddingBox = calculatePaddingBoxPath(this.curves);
6675
7631
  if (equalPath(borderBox, paddingBox)) {
6676
- 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 */));
6677
7633
  }
6678
7634
  else {
6679
- this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
6680
- 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 */));
6681
7637
  }
6682
7638
  }
6683
7639
  }
6684
7640
  ElementPaint.prototype.getEffects = function (target) {
6685
- 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;
6686
7642
  var parent = this.parent;
6687
7643
  var effects = this.effects.slice(0);
6688
7644
  while (parent) {
6689
7645
  var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
6690
- if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
6691
- effects.unshift.apply(effects, croplessEffects);
6692
- inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(parent.container.styles.position) === -1;
6693
- 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 */) {
6694
7649
  var borderBox = calculateBorderBoxPath(parent.curves);
6695
7650
  var paddingBox = calculatePaddingBoxPath(parent.curves);
6696
7651
  if (!equalPath(borderBox, paddingBox)) {
6697
- effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
7652
+ effects.unshift(new ClipEffect(paddingBox, 2 /* EffectTarget.BACKGROUND_BORDERS */ | 4 /* EffectTarget.CONTENT */));
6698
7653
  }
6699
7654
  }
7655
+ effects.unshift.apply(effects, croplessEffects);
6700
7656
  }
6701
7657
  else {
6702
7658
  effects.unshift.apply(effects, croplessEffects);
@@ -6709,13 +7665,13 @@ var Reportly = (function () {
6709
7665
  }());
6710
7666
  var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
6711
7667
  parent.container.elements.forEach(function (child) {
6712
- var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
6713
- 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 */);
6714
7670
  var paintContainer = new ElementPaint(child, parent);
6715
- if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
7671
+ if (contains(child.styles.display, 2048 /* DISPLAY.LIST_ITEM */)) {
6716
7672
  listItems.push(paintContainer);
6717
7673
  }
6718
- var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
7674
+ var listOwnerItems = contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */) ? [] : listItems;
6719
7675
  if (treatAsRealStackingContext || createsStackingContext) {
6720
7676
  var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
6721
7677
  var stack = new StackingContext(paintContainer);
@@ -6772,7 +7728,7 @@ var Reportly = (function () {
6772
7728
  }
6773
7729
  parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
6774
7730
  }
6775
- if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
7731
+ if (contains(child.flags, 8 /* FLAGS.IS_LIST_OWNER */)) {
6776
7732
  processListItems(child, listOwnerItems);
6777
7733
  }
6778
7734
  });
@@ -6913,19 +7869,19 @@ var Reportly = (function () {
6913
7869
  };
6914
7870
 
6915
7871
  var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
6916
- if (backgroundOrigin === 0 /* BORDER_BOX */) {
7872
+ if (backgroundOrigin === 0 /* BACKGROUND_ORIGIN.BORDER_BOX */) {
6917
7873
  return element.bounds;
6918
7874
  }
6919
- if (backgroundOrigin === 2 /* CONTENT_BOX */) {
7875
+ if (backgroundOrigin === 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */) {
6920
7876
  return contentBox(element);
6921
7877
  }
6922
7878
  return paddingBox(element);
6923
7879
  };
6924
7880
  var calculateBackgroundPaintingArea = function (backgroundClip, element) {
6925
- if (backgroundClip === 0 /* BORDER_BOX */) {
7881
+ if (backgroundClip === 0 /* BACKGROUND_CLIP.BORDER_BOX */) {
6926
7882
  return element.bounds;
6927
7883
  }
6928
- if (backgroundClip === 2 /* CONTENT_BOX */) {
7884
+ if (backgroundClip === 2 /* BACKGROUND_CLIP.CONTENT_BOX */) {
6929
7885
  return contentBox(element);
6930
7886
  }
6931
7887
  return paddingBox(element);
@@ -6939,6 +7895,8 @@ var Reportly = (function () {
6939
7895
  var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
6940
7896
  var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
6941
7897
  var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
7898
+ sizeWidth = Math.max(1, sizeWidth);
7899
+ sizeHeight = Math.max(1, sizeHeight);
6942
7900
  return [path, offsetX, offsetY, sizeWidth, sizeHeight];
6943
7901
  };
6944
7902
  var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
@@ -7053,21 +8011,21 @@ var Reportly = (function () {
7053
8011
  var x = _a[0], y = _a[1];
7054
8012
  var width = _b[0], height = _b[1];
7055
8013
  switch (repeat) {
7056
- case 2 /* REPEAT_X */:
8014
+ case 2 /* BACKGROUND_REPEAT.REPEAT_X */:
7057
8015
  return [
7058
8016
  new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
7059
8017
  new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
7060
8018
  new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
7061
8019
  new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
7062
8020
  ];
7063
- case 3 /* REPEAT_Y */:
8021
+ case 3 /* BACKGROUND_REPEAT.REPEAT_Y */:
7064
8022
  return [
7065
8023
  new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
7066
8024
  new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
7067
8025
  new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
7068
8026
  new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
7069
8027
  ];
7070
- case 1 /* NO_REPEAT */:
8028
+ case 1 /* BACKGROUND_REPEAT.NO_REPEAT */:
7071
8029
  return [
7072
8030
  new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
7073
8031
  new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
@@ -7127,7 +8085,7 @@ var Reportly = (function () {
7127
8085
  return { baseline: baseline, middle: middle };
7128
8086
  };
7129
8087
  FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
7130
- var key = fontFamily + " " + fontSize;
8088
+ var key = "".concat(fontFamily, " ").concat(fontSize);
7131
8089
  if (typeof this._data[key] === 'undefined') {
7132
8090
  this._data[key] = this.parseMetrics(fontFamily, fontSize);
7133
8091
  }
@@ -7155,15 +8113,15 @@ var Reportly = (function () {
7155
8113
  if (!options.canvas) {
7156
8114
  _this.canvas.width = Math.floor(options.width * options.scale);
7157
8115
  _this.canvas.height = Math.floor(options.height * options.scale);
7158
- _this.canvas.style.width = options.width + "px";
7159
- _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");
7160
8118
  }
7161
8119
  _this.fontMetrics = new FontMetrics(document);
7162
8120
  _this.ctx.scale(_this.options.scale, _this.options.scale);
7163
8121
  _this.ctx.translate(-options.x, -options.y);
7164
8122
  _this.ctx.textBaseline = 'bottom';
7165
8123
  _this._activeEffects = [];
7166
- _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));
7167
8125
  return _this;
7168
8126
  }
7169
8127
  CanvasRenderer.prototype.applyEffects = function (effects) {
@@ -7215,7 +8173,7 @@ var Reportly = (function () {
7215
8173
  return __generator(this, function (_a) {
7216
8174
  switch (_a.label) {
7217
8175
  case 0:
7218
- if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
8176
+ if (contains(paint.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
7219
8177
  debugger;
7220
8178
  }
7221
8179
  if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
@@ -7234,7 +8192,15 @@ var Reportly = (function () {
7234
8192
  CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
7235
8193
  var _this = this;
7236
8194
  if (letterSpacing === 0) {
7237
- 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
+ }
7238
8204
  }
7239
8205
  else {
7240
8206
  var letters = segmentGraphemes(text.text);
@@ -7250,8 +8216,8 @@ var Reportly = (function () {
7250
8216
  .join('');
7251
8217
  var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
7252
8218
  var fontSize = isDimensionToken(styles.fontSize)
7253
- ? "" + styles.fontSize.number + styles.fontSize.unit
7254
- : styles.fontSize.number + "px";
8219
+ ? "".concat(styles.fontSize.number).concat(styles.fontSize.unit)
8220
+ : "".concat(styles.fontSize.number, "px");
7255
8221
  return [
7256
8222
  [styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
7257
8223
  fontFamily,
@@ -7260,22 +8226,21 @@ var Reportly = (function () {
7260
8226
  };
7261
8227
  CanvasRenderer.prototype.renderTextNode = function (text, styles) {
7262
8228
  return __awaiter(this, void 0, void 0, function () {
7263
- var _a, font, fontFamily, fontSize, _b, baseline, middle, paintOrder;
8229
+ var font, paintOrder;
7264
8230
  var _this = this;
7265
- return __generator(this, function (_c) {
7266
- _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];
7267
8233
  this.ctx.font = font;
7268
- this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
8234
+ this.ctx.direction = styles.direction === 1 /* DIRECTION.RTL */ ? 'rtl' : 'ltr';
7269
8235
  this.ctx.textAlign = 'left';
7270
8236
  this.ctx.textBaseline = 'alphabetic';
7271
- _b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
7272
8237
  paintOrder = styles.paintOrder;
7273
8238
  text.textBounds.forEach(function (text) {
7274
8239
  paintOrder.forEach(function (paintOrderLayer) {
7275
8240
  switch (paintOrderLayer) {
7276
- case 0 /* FILL */:
8241
+ case 0 /* PAINT_ORDER_LAYER.FILL */:
7277
8242
  _this.ctx.fillStyle = asString(styles.color);
7278
- _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
8243
+ _this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
7279
8244
  var textShadows = styles.textShadow;
7280
8245
  if (textShadows.length && text.text.trim().length) {
7281
8246
  textShadows
@@ -7286,7 +8251,7 @@ var Reportly = (function () {
7286
8251
  _this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
7287
8252
  _this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
7288
8253
  _this.ctx.shadowBlur = textShadow.blur.number;
7289
- _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
8254
+ _this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
7290
8255
  });
7291
8256
  _this.ctx.shadowColor = '';
7292
8257
  _this.ctx.shadowOffsetX = 0;
@@ -7295,32 +8260,30 @@ var Reportly = (function () {
7295
8260
  }
7296
8261
  if (styles.textDecorationLine.length) {
7297
8262
  _this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
8263
+ var decorationLineHeight_1 = 1;
7298
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.
7299
8266
  switch (textDecorationLine) {
7300
- case 1 /* UNDERLINE */:
7301
- // Draws a line at the baseline of the font
7302
- // TODO As some browsers display the line as more than 1px if the font-size is big,
7303
- // need to take that into account both in position and size
7304
- _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);
7305
8269
  break;
7306
- case 2 /* OVERLINE */:
7307
- _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);
7308
8272
  break;
7309
- case 3 /* LINE_THROUGH */:
7310
- // TODO try and find exact position for line-through
7311
- _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);
7312
8275
  break;
7313
8276
  }
7314
8277
  });
7315
8278
  }
7316
8279
  break;
7317
- case 1 /* STROKE */:
8280
+ case 1 /* PAINT_ORDER_LAYER.STROKE */:
7318
8281
  if (styles.webkitTextStrokeWidth && text.text.trim().length) {
7319
8282
  _this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
7320
8283
  _this.ctx.lineWidth = styles.webkitTextStrokeWidth;
7321
8284
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7322
8285
  _this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
7323
- _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);
7324
8287
  }
7325
8288
  _this.ctx.strokeStyle = '';
7326
8289
  _this.ctx.lineWidth = 0;
@@ -7334,23 +8297,99 @@ var Reportly = (function () {
7334
8297
  });
7335
8298
  };
7336
8299
  CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
7337
- 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) {
7338
8303
  var box = contentBox(container);
7339
8304
  var path = calculatePaddingBoxPath(curves);
7340
8305
  this.path(path);
7341
8306
  this.ctx.save();
7342
8307
  this.ctx.clip();
7343
- 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);
7344
8383
  this.ctx.restore();
7345
8384
  }
7346
8385
  };
7347
8386
  CanvasRenderer.prototype.renderNodeContent = function (paint) {
7348
8387
  return __awaiter(this, void 0, void 0, function () {
7349
- 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;
7350
8389
  return __generator(this, function (_c) {
7351
8390
  switch (_c.label) {
7352
8391
  case 0:
7353
- this.applyEffects(paint.getEffects(4 /* CONTENT */));
8392
+ this.applyEffects(paint.getEffects(4 /* EffectTarget.CONTENT */));
7354
8393
  container = paint.container;
7355
8394
  curves = paint.curves;
7356
8395
  styles = container.styles;
@@ -7378,7 +8417,7 @@ var Reportly = (function () {
7378
8417
  return [3 /*break*/, 8];
7379
8418
  case 7:
7380
8419
  _c.sent();
7381
- this.context.logger.error("Error loading image " + container.src);
8420
+ this.context.logger.error("Error loading image ".concat(container.src));
7382
8421
  return [3 /*break*/, 8];
7383
8422
  case 8:
7384
8423
  if (container instanceof CanvasElementContainer) {
@@ -7395,7 +8434,7 @@ var Reportly = (function () {
7395
8434
  return [3 /*break*/, 12];
7396
8435
  case 11:
7397
8436
  _c.sent();
7398
- 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)));
7399
8438
  return [3 /*break*/, 12];
7400
8439
  case 12:
7401
8440
  if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
@@ -7446,19 +8485,19 @@ var Reportly = (function () {
7446
8485
  }
7447
8486
  }
7448
8487
  if (isTextInputElement(container) && container.value.length) {
7449
- _b = this.createFontStyle(styles), fontFamily = _b[0], fontSize = _b[1];
8488
+ _b = this.createFontStyle(styles), font = _b[0], fontFamily = _b[1], fontSize = _b[2];
7450
8489
  baseline = this.fontMetrics.getMetrics(fontFamily, fontSize).baseline;
7451
- this.ctx.font = fontFamily;
8490
+ this.ctx.font = font;
7452
8491
  this.ctx.fillStyle = asString(styles.color);
7453
8492
  this.ctx.textBaseline = 'alphabetic';
7454
8493
  this.ctx.textAlign = canvasTextAlign(container.styles.textAlign);
7455
8494
  bounds = contentBox(container);
7456
8495
  x = 0;
7457
8496
  switch (container.styles.textAlign) {
7458
- case 1 /* CENTER */:
8497
+ case 1 /* TEXT_ALIGN.CENTER */:
7459
8498
  x += bounds.width / 2;
7460
8499
  break;
7461
- case 2 /* RIGHT */:
8500
+ case 2 /* TEXT_ALIGN.RIGHT */:
7462
8501
  x += bounds.width;
7463
8502
  break;
7464
8503
  }
@@ -7476,10 +8515,10 @@ var Reportly = (function () {
7476
8515
  this.ctx.textBaseline = 'alphabetic';
7477
8516
  this.ctx.textAlign = 'left';
7478
8517
  }
7479
- 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];
7480
8519
  if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
7481
8520
  img = container.styles.listStyleImage;
7482
- if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
8521
+ if (!(img.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 18];
7483
8522
  image = void 0;
7484
8523
  url = img.url;
7485
8524
  _c.label = 15;
@@ -7492,13 +8531,13 @@ var Reportly = (function () {
7492
8531
  return [3 /*break*/, 18];
7493
8532
  case 17:
7494
8533
  _c.sent();
7495
- this.context.logger.error("Error loading list-style-image " + url);
8534
+ this.context.logger.error("Error loading list-style-image ".concat(url));
7496
8535
  return [3 /*break*/, 18];
7497
8536
  case 18: return [3 /*break*/, 20];
7498
8537
  case 19:
7499
- if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
7500
- fontFamily = this.createFontStyle(styles)[0];
7501
- 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;
7502
8541
  this.ctx.fillStyle = asString(styles.color);
7503
8542
  this.ctx.textBaseline = 'middle';
7504
8543
  this.ctx.textAlign = 'right';
@@ -7519,7 +8558,7 @@ var Reportly = (function () {
7519
8558
  return __generator(this, function (_p) {
7520
8559
  switch (_p.label) {
7521
8560
  case 0:
7522
- if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
8561
+ if (contains(stack.element.container.flags, 16 /* FLAGS.DEBUG_RENDER */)) {
7523
8562
  debugger;
7524
8563
  }
7525
8564
  // https://www.w3.org/TR/css-position-3/#painting-order
@@ -7667,10 +8706,11 @@ var Reportly = (function () {
7667
8706
  this.ctx.translate(-offsetX, -offsetY);
7668
8707
  };
7669
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
+ // }
7670
8713
  var _a;
7671
- if (image.width === width && image.height === height) {
7672
- return image;
7673
- }
7674
8714
  var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
7675
8715
  var canvas = ownerDocument.createElement('canvas');
7676
8716
  canvas.width = Math.max(1, width);
@@ -7687,11 +8727,11 @@ var Reportly = (function () {
7687
8727
  case 0:
7688
8728
  index = container.styles.backgroundImage.length - 1;
7689
8729
  _loop_1 = function (backgroundImage) {
7690
- 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;
7691
8731
  return __generator(this, function (_h) {
7692
8732
  switch (_h.label) {
7693
8733
  case 0:
7694
- if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
8734
+ if (!(backgroundImage.type === 0 /* CSSImageType.URL */)) return [3 /*break*/, 5];
7695
8735
  image = void 0;
7696
8736
  url = backgroundImage.url;
7697
8737
  _h.label = 1;
@@ -7703,14 +8743,16 @@ var Reportly = (function () {
7703
8743
  return [3 /*break*/, 4];
7704
8744
  case 3:
7705
8745
  _h.sent();
7706
- this_1.context.logger.error("Error loading background-image " + url);
8746
+ this_1.context.logger.error("Error loading background-image ".concat(url));
7707
8747
  return [3 /*break*/, 4];
7708
8748
  case 4:
7709
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;
7710
8752
  _c = calculateBackgroundRendering(container, index, [
7711
- image.width,
7712
- image.height,
7713
- image.width / image.height
8753
+ imageWidth,
8754
+ imageHeight,
8755
+ imageWidth / imageHeight
7714
8756
  ]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
7715
8757
  pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
7716
8758
  this_1.renderRepeat(path, pattern, x, y);
@@ -7725,7 +8767,7 @@ var Reportly = (function () {
7725
8767
  canvas.height = height;
7726
8768
  ctx = canvas.getContext('2d');
7727
8769
  gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1);
7728
- processColorStops(backgroundImage.stops, lineLength).forEach(function (colorStop) {
8770
+ processColorStops(backgroundImage.stops, lineLength || 1).forEach(function (colorStop) {
7729
8771
  return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
7730
8772
  });
7731
8773
  ctx.fillStyle = gradient_1;
@@ -7835,7 +8877,7 @@ var Reportly = (function () {
7835
8877
  return __generator(this, function (_a) {
7836
8878
  switch (_a.label) {
7837
8879
  case 0:
7838
- this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
8880
+ this.applyEffects(paint.getEffects(2 /* EffectTarget.BACKGROUND_BORDERS */));
7839
8881
  styles = paint.container.styles;
7840
8882
  hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
7841
8883
  borders = [
@@ -7891,20 +8933,20 @@ var Reportly = (function () {
7891
8933
  case 3:
7892
8934
  if (!(_i < borders_1.length)) return [3 /*break*/, 13];
7893
8935
  border = borders_1[_i];
7894
- if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
7895
- if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
7896
- 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 */)];
7897
8939
  case 4:
7898
8940
  _a.sent();
7899
8941
  return [3 /*break*/, 11];
7900
8942
  case 5:
7901
- if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
7902
- 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 */)];
7903
8945
  case 6:
7904
8946
  _a.sent();
7905
8947
  return [3 /*break*/, 11];
7906
8948
  case 7:
7907
- if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
8949
+ if (!(border.style === 4 /* BORDER_STYLE.DOUBLE */)) return [3 /*break*/, 9];
7908
8950
  return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
7909
8951
  case 8:
7910
8952
  _a.sent();
@@ -7931,7 +8973,7 @@ var Reportly = (function () {
7931
8973
  this.ctx.save();
7932
8974
  strokePaths = parsePathForBorderStroke(curvePoints, side);
7933
8975
  boxPaths = parsePathForBorder(curvePoints, side);
7934
- if (style === 2 /* DASHED */) {
8976
+ if (style === 2 /* BORDER_STYLE.DASHED */) {
7935
8977
  this.path(boxPaths);
7936
8978
  this.ctx.clip();
7937
8979
  }
@@ -7958,7 +9000,7 @@ var Reportly = (function () {
7958
9000
  length = Math.abs(startY - endY);
7959
9001
  }
7960
9002
  this.ctx.beginPath();
7961
- if (style === 3 /* DOTTED */) {
9003
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
7962
9004
  this.formatPath(strokePaths);
7963
9005
  }
7964
9006
  else {
@@ -7966,7 +9008,7 @@ var Reportly = (function () {
7966
9008
  }
7967
9009
  dashLength = width < 3 ? width * 3 : width * 2;
7968
9010
  spaceLength = width < 3 ? width * 2 : width;
7969
- if (style === 3 /* DOTTED */) {
9011
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
7970
9012
  dashLength = width;
7971
9013
  spaceLength = width;
7972
9014
  }
@@ -7989,14 +9031,14 @@ var Reportly = (function () {
7989
9031
  : maxSpace;
7990
9032
  }
7991
9033
  if (useLineDash) {
7992
- if (style === 3 /* DOTTED */) {
9034
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
7993
9035
  this.ctx.setLineDash([0, dashLength + spaceLength]);
7994
9036
  }
7995
9037
  else {
7996
9038
  this.ctx.setLineDash([dashLength, spaceLength]);
7997
9039
  }
7998
9040
  }
7999
- if (style === 3 /* DOTTED */) {
9041
+ if (style === 3 /* BORDER_STYLE.DOTTED */) {
8000
9042
  this.ctx.lineCap = 'round';
8001
9043
  this.ctx.lineWidth = width;
8002
9044
  }
@@ -8007,7 +9049,7 @@ var Reportly = (function () {
8007
9049
  this.ctx.stroke();
8008
9050
  this.ctx.setLineDash([]);
8009
9051
  // dashed round edge gap
8010
- if (style === 2 /* DASHED */) {
9052
+ if (style === 2 /* BORDER_STYLE.DASHED */) {
8011
9053
  if (isBezierCurve(boxPaths[0])) {
8012
9054
  path1 = boxPaths[3];
8013
9055
  path2 = boxPaths[0];
@@ -8064,22 +9106,22 @@ var Reportly = (function () {
8064
9106
  };
8065
9107
  var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
8066
9108
  switch (clip) {
8067
- case 0 /* BORDER_BOX */:
9109
+ case 0 /* BACKGROUND_CLIP.BORDER_BOX */:
8068
9110
  return calculateBorderBoxPath(curves);
8069
- case 2 /* CONTENT_BOX */:
9111
+ case 2 /* BACKGROUND_CLIP.CONTENT_BOX */:
8070
9112
  return calculateContentBoxPath(curves);
8071
- case 1 /* PADDING_BOX */:
9113
+ case 1 /* BACKGROUND_CLIP.PADDING_BOX */:
8072
9114
  default:
8073
9115
  return calculatePaddingBoxPath(curves);
8074
9116
  }
8075
9117
  };
8076
9118
  var canvasTextAlign = function (textAlign) {
8077
9119
  switch (textAlign) {
8078
- case 1 /* CENTER */:
9120
+ case 1 /* TEXT_ALIGN.CENTER */:
8079
9121
  return 'center';
8080
- case 2 /* RIGHT */:
9122
+ case 2 /* TEXT_ALIGN.RIGHT */:
8081
9123
  return 'right';
8082
- case 0 /* LEFT */:
9124
+ case 0 /* TEXT_ALIGN.LEFT */:
8083
9125
  default:
8084
9126
  return 'left';
8085
9127
  }
@@ -8101,11 +9143,11 @@ var Reportly = (function () {
8101
9143
  _this.options = options;
8102
9144
  _this.canvas.width = Math.floor(options.width * options.scale);
8103
9145
  _this.canvas.height = Math.floor(options.height * options.scale);
8104
- _this.canvas.style.width = options.width + "px";
8105
- _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");
8106
9148
  _this.ctx.scale(_this.options.scale, _this.options.scale);
8107
9149
  _this.ctx.translate(-options.x, -options.y);
8108
- _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));
8109
9151
  return _this;
8110
9152
  }
8111
9153
  ForeignObjectRenderer.prototype.render = function (element) {
@@ -8137,7 +9179,7 @@ var Reportly = (function () {
8137
9179
  resolve(img);
8138
9180
  };
8139
9181
  img.onerror = reject;
8140
- 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)));
8141
9183
  });
8142
9184
  };
8143
9185
 
@@ -8158,7 +9200,7 @@ var Reportly = (function () {
8158
9200
  // eslint-disable-next-line no-console
8159
9201
  if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
8160
9202
  // eslint-disable-next-line no-console
8161
- 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));
8162
9204
  }
8163
9205
  else {
8164
9206
  this.info.apply(this, args);
@@ -8178,7 +9220,7 @@ var Reportly = (function () {
8178
9220
  // eslint-disable-next-line no-console
8179
9221
  if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
8180
9222
  // eslint-disable-next-line no-console
8181
- 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));
8182
9224
  }
8183
9225
  }
8184
9226
  };
@@ -8192,7 +9234,7 @@ var Reportly = (function () {
8192
9234
  // eslint-disable-next-line no-console
8193
9235
  if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
8194
9236
  // eslint-disable-next-line no-console
8195
- 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));
8196
9238
  }
8197
9239
  else {
8198
9240
  this.info.apply(this, args);
@@ -8209,7 +9251,7 @@ var Reportly = (function () {
8209
9251
  // eslint-disable-next-line no-console
8210
9252
  if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
8211
9253
  // eslint-disable-next-line no-console
8212
- 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));
8213
9255
  }
8214
9256
  else {
8215
9257
  this.info.apply(this, args);
@@ -8224,7 +9266,7 @@ var Reportly = (function () {
8224
9266
  function Context(options, windowBounds) {
8225
9267
  var _a;
8226
9268
  this.windowBounds = windowBounds;
8227
- this.instanceName = "#" + Context.instanceCount++;
9269
+ this.instanceName = "#".concat(Context.instanceCount++);
8228
9270
  this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
8229
9271
  this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
8230
9272
  }
@@ -8260,7 +9302,8 @@ var Reportly = (function () {
8260
9302
  allowTaint: (_b = opts.allowTaint) !== null && _b !== void 0 ? _b : false,
8261
9303
  imageTimeout: (_c = opts.imageTimeout) !== null && _c !== void 0 ? _c : 15000,
8262
9304
  proxy: opts.proxy,
8263
- 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
8264
9307
  };
8265
9308
  contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !== void 0 ? _e : true, cache: opts.cache }, resourceOptions);
8266
9309
  windowOptions = {
@@ -8279,7 +9322,7 @@ var Reportly = (function () {
8279
9322
  inlineImages: foreignObjectRendering,
8280
9323
  copyStyles: foreignObjectRendering
8281
9324
  };
8282
- 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));
8283
9326
  documentCloner = new DocumentCloner(context, element, cloneOptions);
8284
9327
  clonedElement = documentCloner.clonedReferenceElement;
8285
9328
  if (!clonedElement) {
@@ -8309,13 +9352,13 @@ var Reportly = (function () {
8309
9352
  canvas = _u.sent();
8310
9353
  return [3 /*break*/, 5];
8311
9354
  case 3:
8312
- 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"));
8313
9356
  context.logger.debug("Starting DOM parsing");
8314
9357
  root = parseTree(context, clonedElement);
8315
9358
  if (backgroundColor === root.styles.backgroundColor) {
8316
9359
  root.styles.backgroundColor = COLORS.TRANSPARENT;
8317
9360
  }
8318
- 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));
8319
9362
  renderer = new CanvasRenderer(context, renderOptions);
8320
9363
  return [4 /*yield*/, renderer.render(root)];
8321
9364
  case 4:
@@ -8376,38 +9419,38 @@ var Reportly = (function () {
8376
9419
  useCORS: true,
8377
9420
  logging: false,
8378
9421
  width: fullPageWidth,
8379
- height: fullPageHeight
9422
+ height: fullPageHeight,
8380
9423
  });
8381
9424
  // Restore scroll position
8382
9425
  window.scrollTo(0, originalScrollY);
8383
9426
  // Show UXbert UI elements again
8384
9427
  this.showUXbertElements();
8385
9428
  // Convert to base64
8386
- this.currentScreenshot = canvas.toDataURL('image/png');
9429
+ this.currentScreenshot = canvas.toDataURL("image/png");
8387
9430
  return this.currentScreenshot;
8388
9431
  }
8389
9432
  catch (error) {
8390
- console.error('Screenshot capture failed:', error);
9433
+ console.error("Screenshot capture failed:", error);
8391
9434
  this.showUXbertElements();
8392
9435
  throw error;
8393
9436
  }
8394
9437
  }
8395
9438
  hideUXbertElements() {
8396
9439
  const elements = document.querySelectorAll('[class*="uxbert-"]');
8397
- elements.forEach(el => {
9440
+ elements.forEach((el) => {
8398
9441
  const element = el;
8399
- element.setAttribute('data-uxbert-display', element.style.display || '');
8400
- element.style.display = 'none';
9442
+ element.setAttribute("data-uxbert-display", element.style.display || "");
9443
+ element.style.display = "none";
8401
9444
  });
8402
9445
  }
8403
9446
  showUXbertElements() {
8404
9447
  const elements = document.querySelectorAll('[class*="uxbert-"]');
8405
- elements.forEach(el => {
9448
+ elements.forEach((el) => {
8406
9449
  const element = el;
8407
- const originalDisplay = element.getAttribute('data-uxbert-display');
9450
+ const originalDisplay = element.getAttribute("data-uxbert-display");
8408
9451
  if (originalDisplay !== null) {
8409
9452
  element.style.display = originalDisplay;
8410
- element.removeAttribute('data-uxbert-display');
9453
+ element.removeAttribute("data-uxbert-display");
8411
9454
  }
8412
9455
  });
8413
9456
  }
@@ -8826,6 +9869,22 @@ var Reportly = (function () {
8826
9869
  this.info = this.collect();
8827
9870
  }
8828
9871
  collect() {
9872
+ // Check if we're in a browser environment
9873
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
9874
+ return {
9875
+ browser: 'SSR',
9876
+ os: 'SSR',
9877
+ screenResolution: '0x0',
9878
+ viewport: '0x0',
9879
+ url: '',
9880
+ timestamp: new Date().toISOString(),
9881
+ userAgent: 'SSR',
9882
+ language: 'en-US',
9883
+ platform: 'SSR',
9884
+ cookiesEnabled: false,
9885
+ onLine: false
9886
+ };
9887
+ }
8829
9888
  return {
8830
9889
  browser: this.getBrowserInfo(),
8831
9890
  os: this.getOSInfo(),
@@ -9009,6 +10068,11 @@ var Reportly = (function () {
9009
10068
  this.isInitialized = false;
9010
10069
  }
9011
10070
  init(userConfig = {}) {
10071
+ // Check if we're in a browser environment
10072
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
10073
+ console.warn("Uxbert Reportly can only be initialized in a browser environment");
10074
+ return;
10075
+ }
9012
10076
  if (this.isInitialized) {
9013
10077
  console.warn("Uxbert Reportly is already initialized");
9014
10078
  return;