@svgedit/svgcanvas 7.2.4 → 7.2.7

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/svgcanvas.js CHANGED
@@ -1520,7 +1520,7 @@ function _mergeNamespaces(n, m) {
1520
1520
  class Paint {
1521
1521
  /**
1522
1522
  * @param {module:jGraduate.jGraduatePaintOptions} [opt]
1523
- */
1523
+ */
1524
1524
  constructor(opt) {
1525
1525
  const options = opt || {};
1526
1526
  this.alpha = isNaN(options.alpha) ? 100 : options.alpha;
@@ -1571,8 +1571,9 @@ class Paint {
1571
1571
  this.type = 'linearGradient';
1572
1572
  this.solidColor = null;
1573
1573
  this.radialGradient = null;
1574
- if (options.linearGradient.hasAttribute('xlink:href')) {
1575
- const xhref = document.getElementById(options.linearGradient.getAttribute('xlink:href').substr(1));
1574
+ const hrefAttr = options.linearGradient.getAttribute('href') || options.linearGradient.getAttribute('xlink:href');
1575
+ if (hrefAttr) {
1576
+ const xhref = document.getElementById(hrefAttr.replace(/^#/, ''));
1576
1577
  this.linearGradient = xhref.cloneNode(true);
1577
1578
  } else {
1578
1579
  this.linearGradient = options.linearGradient.cloneNode(true);
@@ -1582,8 +1583,9 @@ class Paint {
1582
1583
  this.type = 'radialGradient';
1583
1584
  this.solidColor = null;
1584
1585
  this.linearGradient = null;
1585
- if (options.radialGradient.hasAttribute('xlink:href')) {
1586
- const xhref = document.getElementById(options.radialGradient.getAttribute('xlink:href').substr(1));
1586
+ const hrefAttr = options.radialGradient.getAttribute('href') || options.radialGradient.getAttribute('xlink:href');
1587
+ if (hrefAttr) {
1588
+ const xhref = document.getElementById(hrefAttr.replace(/^#/, ''));
1587
1589
  this.radialGradient = xhref.cloneNode(true);
1588
1590
  } else {
1589
1591
  this.radialGradient = options.radialGradient.cloneNode(true);
@@ -2584,21 +2586,22 @@ const getUrlFromAttr = function (attrVal) {
2584
2586
  /**
2585
2587
  * @function module:utilities.getHref
2586
2588
  * @param {Element} elem
2587
- * @returns {string} The given element's `xlink:href` value
2589
+ * @returns {string} The given element's `href` value
2588
2590
  */
2589
2591
  let getHref = function (elem) {
2590
- return elem.getAttributeNS(NS.XLINK, 'href');
2592
+ // Prefer 'href', fallback to 'xlink:href'
2593
+ return elem.getAttribute('href') || elem.getAttributeNS(NS.XLINK, 'href');
2591
2594
  };
2592
2595
 
2593
2596
  /**
2594
- * Sets the given element's `xlink:href` value.
2597
+ * Sets the given element's `href` value.
2595
2598
  * @function module:utilities.setHref
2596
2599
  * @param {Element} elem
2597
2600
  * @param {string} val
2598
2601
  * @returns {void}
2599
2602
  */
2600
2603
  let setHref = function (elem, val) {
2601
- elem.setAttributeNS(NS.XLINK, 'xlink:href', val);
2604
+ elem.setAttribute('href', val);
2602
2605
  };
2603
2606
 
2604
2607
  /**
@@ -2773,8 +2776,7 @@ const getPathDFromElement = function (elem) {
2773
2776
  const h = b.height;
2774
2777
  num = 4 - num; // Why? Because!
2775
2778
 
2776
- d = !rx && !ry
2777
- // Regular rect
2779
+ d = !rx && !ry // Regular rect
2778
2780
  ? getPathDFromSegments([['M', [x, y]], ['L', [x + w, y]], ['L', [x + w, y + h]], ['L', [x, y + h]], ['L', [x, y]], ['Z', []]]) : getPathDFromSegments([['M', [x, y + ry]], ['C', [x, y + ry / num, x + rx / num, y, x + rx, y]], ['L', [x + w - rx, y]], ['C', [x + w - rx / num, y, x + w, y + ry / num, x + w, y + ry]], ['L', [x + w, y + h - ry]], ['C', [x + w, y + h - ry / num, x + w - rx / num, y + h, x + w - rx, y + h]], ['L', [x + rx, y + h]], ['C', [x + rx / num, y + h, x, y + h - ry / num, x, y + h - ry]], ['L', [x, y + ry]], ['Z', []]]);
2779
2781
  break;
2780
2782
  }
@@ -3738,7 +3740,7 @@ let BatchCommand$4 = class BatchCommand extends Command {
3738
3740
  */
3739
3741
  unapply(handler) {
3740
3742
  super.unapply(handler, () => {
3741
- this.stack.reverse().forEach(stackItem => {
3743
+ [...this.stack].reverse().forEach(stackItem => {
3742
3744
  console.assert(stackItem, 'stack item should not be null');
3743
3745
  stackItem && stackItem.unapply(handler);
3744
3746
  });
@@ -4975,7 +4977,7 @@ class Path {
4975
4977
  */
4976
4978
 
4977
4979
  let svgCanvas$g = null;
4978
- let path$1 = null;
4980
+ let path$2 = null;
4979
4981
 
4980
4982
  /**
4981
4983
  * @function module:path-actions.init
@@ -5357,7 +5359,7 @@ const pathActionsMethod = function () {
5357
5359
  }));
5358
5360
  // set stretchy line to first point
5359
5361
  stretchy.setAttribute('d', ['M', mouseX, mouseY, mouseX, mouseY].join(' '));
5360
- index = subpath ? path$1.segs.length : 0;
5362
+ index = subpath ? path$2.segs.length : 0;
5361
5363
  svgCanvas$g.addPointGrip(index, mouseX, mouseY);
5362
5364
  } else {
5363
5365
  // determine if we clicked on an existing point
@@ -5414,18 +5416,18 @@ const pathActionsMethod = function () {
5414
5416
  svgCanvas$g.setDrawnPath(null);
5415
5417
  svgCanvas$g.setStarted(false);
5416
5418
  if (subpath) {
5417
- if (path$1.matrix) {
5418
- svgCanvas$g.remapElement(newpath, {}, path$1.matrix.inverse());
5419
+ if (path$2.matrix) {
5420
+ svgCanvas$g.remapElement(newpath, {}, path$2.matrix.inverse());
5419
5421
  }
5420
5422
  const newD = newpath.getAttribute('d');
5421
- const origD = path$1.elem.getAttribute('d');
5422
- path$1.elem.setAttribute('d', origD + newD);
5423
+ const origD = path$2.elem.getAttribute('d');
5424
+ path$2.elem.setAttribute('d', origD + newD);
5423
5425
  newpath.parentNode.removeChild(newpath);
5424
- if (path$1.matrix) {
5426
+ if (path$2.matrix) {
5425
5427
  svgCanvas$g.recalcRotatedPath();
5426
5428
  }
5427
- pathActionsMethod.toEditMode(path$1.elem);
5428
- path$1.selectPt();
5429
+ pathActionsMethod.toEditMode(path$2.elem);
5430
+ path$2.selectPt();
5429
5431
  return false;
5430
5432
  }
5431
5433
  // else, create a new point, update path element
@@ -5458,7 +5460,7 @@ const pathActionsMethod = function () {
5458
5460
  stretchy.setAttribute('d', ['M', x, y, x, y].join(' '));
5459
5461
  index = num;
5460
5462
  if (subpath) {
5461
- index += path$1.segs.length;
5463
+ index += path$2.segs.length;
5462
5464
  }
5463
5465
  svgCanvas$g.addPointGrip(index, x, y);
5464
5466
  }
@@ -5468,42 +5470,42 @@ const pathActionsMethod = function () {
5468
5470
  }
5469
5471
 
5470
5472
  // TODO: Make sure currentPath isn't null at this point
5471
- if (!path$1) {
5473
+ if (!path$2) {
5472
5474
  return undefined;
5473
5475
  }
5474
- path$1.storeD();
5476
+ path$2.storeD();
5475
5477
  ({
5476
5478
  id
5477
5479
  } = evt.target);
5478
5480
  let curPt;
5479
5481
  if (id.substr(0, 14) === 'pathpointgrip_') {
5480
5482
  // Select this point
5481
- curPt = path$1.cur_pt = Number.parseInt(id.substr(14));
5482
- path$1.dragging = [startX, startY];
5483
- const seg = path$1.segs[curPt];
5483
+ curPt = path$2.cur_pt = Number.parseInt(id.substr(14));
5484
+ path$2.dragging = [startX, startY];
5485
+ const seg = path$2.segs[curPt];
5484
5486
 
5485
5487
  // only clear selection if shift is not pressed (otherwise, add
5486
5488
  // node to selection)
5487
5489
  if (!evt.shiftKey) {
5488
- if (path$1.selected_pts.length <= 1 || !seg.selected) {
5489
- path$1.clearSelection();
5490
+ if (path$2.selected_pts.length <= 1 || !seg.selected) {
5491
+ path$2.clearSelection();
5490
5492
  }
5491
- path$1.addPtsToSelection(curPt);
5493
+ path$2.addPtsToSelection(curPt);
5492
5494
  } else if (seg.selected) {
5493
- path$1.removePtFromSelection(curPt);
5495
+ path$2.removePtFromSelection(curPt);
5494
5496
  } else {
5495
- path$1.addPtsToSelection(curPt);
5497
+ path$2.addPtsToSelection(curPt);
5496
5498
  }
5497
5499
  } else if (id.startsWith('ctrlpointgrip_')) {
5498
- path$1.dragging = [startX, startY];
5500
+ path$2.dragging = [startX, startY];
5499
5501
  const parts = id.split('_')[1].split('c');
5500
5502
  curPt = Number(parts[0]);
5501
5503
  const ctrlNum = Number(parts[1]);
5502
- path$1.selectPt(curPt, ctrlNum);
5504
+ path$2.selectPt(curPt, ctrlNum);
5503
5505
  }
5504
5506
 
5505
5507
  // Start selection box
5506
- if (!path$1.dragging) {
5508
+ if (!path$2.dragging) {
5507
5509
  let rubberBox = svgCanvas$g.getRubberBox();
5508
5510
  if (!rubberBox) {
5509
5511
  rubberBox = svgCanvas$g.setRubberBox(svgCanvas$g.selectorManager.getRubberBandBox());
@@ -5599,26 +5601,26 @@ const pathActionsMethod = function () {
5599
5601
  return;
5600
5602
  }
5601
5603
  // if we are dragging a point, let's move it
5602
- if (path$1.dragging) {
5604
+ if (path$2.dragging) {
5603
5605
  const pt = svgCanvas$g.getPointFromGrip({
5604
- x: path$1.dragging[0],
5605
- y: path$1.dragging[1]
5606
- }, path$1);
5606
+ x: path$2.dragging[0],
5607
+ y: path$2.dragging[1]
5608
+ }, path$2);
5607
5609
  const mpt = svgCanvas$g.getPointFromGrip({
5608
5610
  x: mouseX,
5609
5611
  y: mouseY
5610
- }, path$1);
5612
+ }, path$2);
5611
5613
  const diffX = mpt.x - pt.x;
5612
5614
  const diffY = mpt.y - pt.y;
5613
- path$1.dragging = [mouseX, mouseY];
5614
- if (path$1.dragctrl) {
5615
- path$1.moveCtrl(diffX, diffY);
5615
+ path$2.dragging = [mouseX, mouseY];
5616
+ if (path$2.dragctrl) {
5617
+ path$2.moveCtrl(diffX, diffY);
5616
5618
  } else {
5617
- path$1.movePts(diffX, diffY);
5619
+ path$2.movePts(diffX, diffY);
5618
5620
  }
5619
5621
  } else {
5620
- path$1.selected_pts = [];
5621
- path$1.eachSeg(function (_i) {
5622
+ path$2.selected_pts = [];
5623
+ path$2.eachSeg(function (_i) {
5622
5624
  const seg = this;
5623
5625
  if (!seg.next && !seg.prev) {
5624
5626
  return;
@@ -5638,7 +5640,7 @@ const pathActionsMethod = function () {
5638
5640
  this.select(sel);
5639
5641
  // Note that addPtsToSelection is not being run
5640
5642
  if (sel) {
5641
- path$1.selected_pts.push(seg.index);
5643
+ path$2.selected_pts.push(seg.index);
5642
5644
  }
5643
5645
  });
5644
5646
  }
@@ -5674,16 +5676,16 @@ const pathActionsMethod = function () {
5674
5676
 
5675
5677
  // Edit mode
5676
5678
  const rubberBox = svgCanvas$g.getRubberBox();
5677
- if (path$1.dragging) {
5678
- const lastPt = path$1.cur_pt;
5679
- path$1.dragging = false;
5680
- path$1.dragctrl = false;
5681
- path$1.update();
5679
+ if (path$2.dragging) {
5680
+ const lastPt = path$2.cur_pt;
5681
+ path$2.dragging = false;
5682
+ path$2.dragctrl = false;
5683
+ path$2.update();
5682
5684
  if (hasMoved) {
5683
- path$1.endChanges('Move path point(s)');
5685
+ path$2.endChanges('Move path point(s)');
5684
5686
  }
5685
5687
  if (!evt.shiftKey && !hasMoved) {
5686
- path$1.selectPt(lastPt);
5688
+ path$2.selectPt(lastPt);
5687
5689
  }
5688
5690
  } else if (rubberBox?.getAttribute('display') !== 'none') {
5689
5691
  // Done with multi-node-select
@@ -5704,12 +5706,12 @@ const pathActionsMethod = function () {
5704
5706
  * @returns {void}
5705
5707
  */
5706
5708
  toEditMode(element) {
5707
- path$1 = svgCanvas$g.getPath_(element);
5709
+ path$2 = svgCanvas$g.getPath_(element);
5708
5710
  svgCanvas$g.setCurrentMode('pathedit');
5709
5711
  svgCanvas$g.clearSelection();
5710
- path$1.setPathContext();
5711
- path$1.show(true).update();
5712
- path$1.oldbbox = getBBox(path$1.elem);
5712
+ path$2.setPathContext();
5713
+ path$2.show(true).update();
5714
+ path$2.oldbbox = getBBox(path$2.elem);
5713
5715
  subpath = false;
5714
5716
  },
5715
5717
  /**
@@ -5718,13 +5720,13 @@ const pathActionsMethod = function () {
5718
5720
  * @returns {void}
5719
5721
  */
5720
5722
  toSelectMode(elem) {
5721
- const selPath = elem === path$1.elem;
5723
+ const selPath = elem === path$2.elem;
5722
5724
  svgCanvas$g.setCurrentMode('select');
5723
- path$1.setPathContext();
5724
- path$1.show(false);
5725
+ path$2.setPathContext();
5726
+ path$2.show(false);
5725
5727
  currentPath = false;
5726
5728
  svgCanvas$g.clearSelection();
5727
- if (path$1.matrix) {
5729
+ if (path$2.matrix) {
5728
5730
  // Rotated, so may need to re-calculate the center
5729
5731
  svgCanvas$g.recalcRotatedPath();
5730
5732
  }
@@ -5745,7 +5747,7 @@ const pathActionsMethod = function () {
5745
5747
  subpath = true;
5746
5748
  } else {
5747
5749
  pathActionsMethod.clear(true);
5748
- pathActionsMethod.toEditMode(path$1.elem);
5750
+ pathActionsMethod.toEditMode(path$2.elem);
5749
5751
  }
5750
5752
  },
5751
5753
  /**
@@ -5813,8 +5815,8 @@ const pathActionsMethod = function () {
5813
5815
  } else if (svgCanvas$g.getCurrentMode() === 'pathedit') {
5814
5816
  this.toSelectMode();
5815
5817
  }
5816
- if (path$1) {
5817
- path$1.init().show(false);
5818
+ if (path$2) {
5819
+ path$2.init().show(false);
5818
5820
  }
5819
5821
  },
5820
5822
  /**
@@ -5869,7 +5871,7 @@ const pathActionsMethod = function () {
5869
5871
  */
5870
5872
  zoomChange() {
5871
5873
  if (svgCanvas$g.getCurrentMode() === 'pathedit') {
5872
- path$1.update();
5874
+ path$2.update();
5873
5875
  }
5874
5876
  },
5875
5877
  /**
@@ -5882,8 +5884,8 @@ const pathActionsMethod = function () {
5882
5884
  * @returns {module:path.NodePoint}
5883
5885
  */
5884
5886
  getNodePoint() {
5885
- const selPt = path$1.selected_pts.length ? path$1.selected_pts[0] : 1;
5886
- const seg = path$1.segs[selPt];
5887
+ const selPt = path$2.selected_pts.length ? path$2.selected_pts[0] : 1;
5888
+ const seg = path$2.segs[selPt];
5887
5889
  return {
5888
5890
  x: seg.item.x,
5889
5891
  y: seg.item.y,
@@ -5901,33 +5903,33 @@ const pathActionsMethod = function () {
5901
5903
  * @returns {void}
5902
5904
  */
5903
5905
  clonePathNode() {
5904
- path$1.storeD();
5905
- const selPts = path$1.selected_pts;
5906
+ path$2.storeD();
5907
+ const selPts = path$2.selected_pts;
5906
5908
  // const {segs} = path;
5907
5909
 
5908
5910
  let i = selPts.length;
5909
5911
  const nums = [];
5910
5912
  while (i--) {
5911
5913
  const pt = selPts[i];
5912
- path$1.addSeg(pt);
5914
+ path$2.addSeg(pt);
5913
5915
  nums.push(pt + i);
5914
5916
  nums.push(pt + i + 1);
5915
5917
  }
5916
- path$1.init().addPtsToSelection(nums);
5917
- path$1.endChanges('Clone path node(s)');
5918
+ path$2.init().addPtsToSelection(nums);
5919
+ path$2.endChanges('Clone path node(s)');
5918
5920
  },
5919
5921
  /**
5920
5922
  * @returns {void}
5921
5923
  */
5922
5924
  opencloseSubPath() {
5923
- const selPts = path$1.selected_pts;
5925
+ const selPts = path$2.selected_pts;
5924
5926
  // Only allow one selected node for now
5925
5927
  if (selPts.length !== 1) {
5926
5928
  return;
5927
5929
  }
5928
5930
  const {
5929
5931
  elem
5930
- } = path$1;
5932
+ } = path$2;
5931
5933
  const list = elem.pathSegList;
5932
5934
 
5933
5935
  // const len = list.numberOfItems;
@@ -5937,7 +5939,7 @@ const pathActionsMethod = function () {
5937
5939
  let startItem = null;
5938
5940
 
5939
5941
  // Check if subpath is already open
5940
- path$1.eachSeg(function (i) {
5942
+ path$2.eachSeg(function (i) {
5941
5943
  if (this.type === 2 && i <= index) {
5942
5944
  startItem = this.item;
5943
5945
  }
@@ -5958,7 +5960,7 @@ const pathActionsMethod = function () {
5958
5960
  });
5959
5961
  if (!openPt) {
5960
5962
  // Single path, so close last seg
5961
- openPt = path$1.segs.length - 1;
5963
+ openPt = path$2.segs.length - 1;
5962
5964
  }
5963
5965
  if (openPt !== false) {
5964
5966
  // Close this path
@@ -5966,14 +5968,14 @@ const pathActionsMethod = function () {
5966
5968
  // Create a line going to the previous "M"
5967
5969
  const newseg = elem.createSVGPathSegLinetoAbs(startItem.x, startItem.y);
5968
5970
  const closer = elem.createSVGPathSegClosePath();
5969
- if (openPt === path$1.segs.length - 1) {
5971
+ if (openPt === path$2.segs.length - 1) {
5970
5972
  list.appendItem(newseg);
5971
5973
  list.appendItem(closer);
5972
5974
  } else {
5973
5975
  list.insertItemBefore(closer, openPt);
5974
5976
  list.insertItemBefore(newseg, openPt);
5975
5977
  }
5976
- path$1.init().selectPt(openPt + 1);
5978
+ path$2.init().selectPt(openPt + 1);
5977
5979
  return;
5978
5980
  }
5979
5981
 
@@ -5983,11 +5985,11 @@ const pathActionsMethod = function () {
5983
5985
  // M 1,1 L 2,2 L 1,1 z M 4,4 L 5,5 L6,6 L 5,5 z
5984
5986
  // M 1,1 L 2,2 L 1,1 z [M 4,4] L 5,5 L(M)6,6 L 5,5 z
5985
5987
 
5986
- const seg = path$1.segs[index];
5988
+ const seg = path$2.segs[index];
5987
5989
  if (seg.mate) {
5988
5990
  list.removeItem(index); // Removes last "L"
5989
5991
  list.removeItem(index); // Removes the "Z"
5990
- path$1.init().selectPt(index - 1);
5992
+ path$2.init().selectPt(index - 1);
5991
5993
  return;
5992
5994
  }
5993
5995
  let lastM;
@@ -6021,7 +6023,7 @@ const pathActionsMethod = function () {
6021
6023
 
6022
6024
  // i = index; // i is local here, so has no effect; what was the intent for this?
6023
6025
 
6024
- path$1.init().selectPt(0);
6026
+ path$2.init().selectPt(0);
6025
6027
  },
6026
6028
  /**
6027
6029
  * @returns {void}
@@ -6030,17 +6032,17 @@ const pathActionsMethod = function () {
6030
6032
  if (!pathActionsMethod.canDeleteNodes) {
6031
6033
  return;
6032
6034
  }
6033
- path$1.storeD();
6034
- const selPts = path$1.selected_pts;
6035
+ path$2.storeD();
6036
+ const selPts = path$2.selected_pts;
6035
6037
  let i = selPts.length;
6036
6038
  while (i--) {
6037
6039
  const pt = selPts[i];
6038
- path$1.deleteSeg(pt);
6040
+ path$2.deleteSeg(pt);
6039
6041
  }
6040
6042
 
6041
6043
  // Cleanup
6042
6044
  const cleanup = function () {
6043
- const segList = path$1.elem.pathSegList;
6045
+ const segList = path$2.elem.pathSegList;
6044
6046
  let len = segList.numberOfItems;
6045
6047
  const remItems = function (pos, count) {
6046
6048
  while (count--) {
@@ -6084,21 +6086,21 @@ const pathActionsMethod = function () {
6084
6086
  cleanup();
6085
6087
 
6086
6088
  // Completely delete a path with 1 or 0 segments
6087
- if (path$1.elem.pathSegList.numberOfItems <= 1) {
6088
- pathActionsMethod.toSelectMode(path$1.elem);
6089
+ if (path$2.elem.pathSegList.numberOfItems <= 1) {
6090
+ pathActionsMethod.toSelectMode(path$2.elem);
6089
6091
  svgCanvas$g.canvas.deleteSelectedElements();
6090
6092
  return;
6091
6093
  }
6092
- path$1.init();
6093
- path$1.clearSelection();
6094
+ path$2.init();
6095
+ path$2.clearSelection();
6094
6096
 
6095
6097
  // TODO: Find right way to select point now
6096
6098
  // path.selectPt(selPt);
6097
6099
  if (window.opera) {
6098
6100
  // Opera repaints incorrectly
6099
- path$1.elem.setAttribute('d', path$1.elem.getAttribute('d'));
6101
+ path$2.elem.setAttribute('d', path$2.elem.getAttribute('d'));
6100
6102
  }
6101
- path$1.endChanges('Delete path node(s)');
6103
+ path$2.endChanges('Delete path node(s)');
6102
6104
  },
6103
6105
  // Can't seem to use `@borrows` here, so using `@see`
6104
6106
  /**
@@ -6113,7 +6115,7 @@ const pathActionsMethod = function () {
6113
6115
  * @returns {void}
6114
6116
  */
6115
6117
  setSegType(v) {
6116
- path$1?.setSegType(v);
6118
+ path$2?.setSegType(v);
6117
6119
  },
6118
6120
  /**
6119
6121
  * @param {string} attr
@@ -6121,21 +6123,21 @@ const pathActionsMethod = function () {
6121
6123
  * @returns {void}
6122
6124
  */
6123
6125
  moveNode(attr, newValue) {
6124
- const selPts = path$1.selected_pts;
6126
+ const selPts = path$2.selected_pts;
6125
6127
  if (!selPts.length) {
6126
6128
  return;
6127
6129
  }
6128
- path$1.storeD();
6130
+ path$2.storeD();
6129
6131
 
6130
6132
  // Get first selected point
6131
- const seg = path$1.segs[selPts[0]];
6133
+ const seg = path$2.segs[selPts[0]];
6132
6134
  const diff = {
6133
6135
  x: 0,
6134
6136
  y: 0
6135
6137
  };
6136
6138
  diff[attr] = newValue - seg.item[attr];
6137
6139
  seg.move(diff.x, diff.y);
6138
- path$1.endChanges('Move path point');
6140
+ path$2.endChanges('Move path point');
6139
6141
  },
6140
6142
  /**
6141
6143
  * @param {Element} elem
@@ -6243,7 +6245,7 @@ const setLinkControlPoints = lcp => {
6243
6245
  * @type {null|module:path.Path}
6244
6246
  * @memberof module:path
6245
6247
  */
6246
- let path = null;
6248
+ let path$1 = null;
6247
6249
 
6248
6250
  /**
6249
6251
  * @external MouseEvent
@@ -6412,10 +6414,10 @@ const init$g = canvas => {
6412
6414
  return uiStrings;
6413
6415
  };
6414
6416
  svgCanvas$f.getPathObj = () => {
6415
- return path;
6417
+ return path$1;
6416
6418
  };
6417
6419
  svgCanvas$f.setPathObj = obj => {
6418
- path = obj;
6420
+ path$1 = obj;
6419
6421
  };
6420
6422
  svgCanvas$f.getPathFuncs = () => {
6421
6423
  return pathFuncs;
@@ -6646,13 +6648,13 @@ const getRotVals = (x, y) => {
6646
6648
  * @returns {void}
6647
6649
  */
6648
6650
  const recalcRotatedPath = () => {
6649
- const currentPath = path.elem;
6651
+ const currentPath = path$1.elem;
6650
6652
  angle = getRotationAngle(currentPath, true);
6651
6653
  if (!angle) {
6652
6654
  return;
6653
6655
  }
6654
6656
  // selectedBBoxes[0] = path.oldbbox;
6655
- const oldbox = path.oldbbox; // selectedBBoxes[0],
6657
+ const oldbox = path$1.oldbbox; // selectedBBoxes[0],
6656
6658
  oldcx = oldbox.x + oldbox.width / 2;
6657
6659
  oldcy = oldbox.y + oldbox.height / 2;
6658
6660
  const box = getBBox(currentPath);
@@ -6999,7 +7001,7 @@ var pathModule = /*#__PURE__*/Object.freeze({
6999
7001
  getPointGrip: getPointGrip,
7000
7002
  getSegSelector: getSegSelector,
7001
7003
  init: init$g,
7002
- get path () { return path; },
7004
+ get path () { return path$1; },
7003
7005
  pathActions: pathActions,
7004
7006
  ptObjToArr: ptObjToArr,
7005
7007
  recalcRotatedPath: recalcRotatedPath,
@@ -10618,9 +10620,18 @@ const mouseUpEvent = evt => {
10618
10620
  const elem = selectedElements[0];
10619
10621
  if (elem) {
10620
10622
  elem.removeAttribute('style');
10621
- walkTree(elem, el => {
10622
- el.removeAttribute('style');
10623
- });
10623
+
10624
+ // we don't remove the style elements for contents of foreignObjects
10625
+ // because that is a valid way to style them
10626
+ if (elem.localName === 'foreignObject') {
10627
+ walkTree(elem, el => {
10628
+ el.style.removeProperty('pointer-events');
10629
+ });
10630
+ } else {
10631
+ walkTree(elem, el => {
10632
+ el.removeAttribute('style');
10633
+ });
10634
+ }
10624
10635
  }
10625
10636
  }
10626
10637
  return;
@@ -13086,12 +13097,37 @@ const recalculateDimensions = selected => {
13086
13097
  // Handle rotation transformations
13087
13098
  const angle = getRotationAngle(selected);
13088
13099
  if (angle) {
13089
- // Include x and y in the rotation center calculation
13090
- oldcenter = {
13091
- x: box.x + box.width / 2 + x,
13092
- y: box.y + box.height / 2 + y
13093
- };
13094
- newcenter = transformPoint(box.x + box.width / 2 + x, box.y + box.height / 2 + y, transformListToTransform(tlist).matrix);
13100
+ if (selected.localName === 'image') {
13101
+ // Use the center of the image as the rotation center
13102
+ const xAttr = convertToNum('x', selected.getAttribute('x') || '0');
13103
+ const yAttr = convertToNum('y', selected.getAttribute('y') || '0');
13104
+ const width = convertToNum('width', selected.getAttribute('width') || '0');
13105
+ const height = convertToNum('height', selected.getAttribute('height') || '0');
13106
+ const cx = xAttr + width / 2;
13107
+ const cy = yAttr + height / 2;
13108
+ oldcenter = {
13109
+ x: cx,
13110
+ y: cy
13111
+ };
13112
+ const transform = transformListToTransform(tlist).matrix;
13113
+ newcenter = transformPoint(cx, cy, transform);
13114
+ } else if (selected.localName === 'text') {
13115
+ // Use the center of the bounding box as the rotation center for text
13116
+ const cx = box.x + box.width / 2;
13117
+ const cy = box.y + box.height / 2;
13118
+ oldcenter = {
13119
+ x: cx,
13120
+ y: cy
13121
+ };
13122
+ newcenter = transformPoint(cx, cy, transformListToTransform(tlist).matrix);
13123
+ } else {
13124
+ // Include x and y in the rotation center calculation for other elements
13125
+ oldcenter = {
13126
+ x: box.x + box.width / 2 + x,
13127
+ y: box.y + box.height / 2 + y
13128
+ };
13129
+ newcenter = transformPoint(box.x + box.width / 2 + x, box.y + box.height / 2 + y, transformListToTransform(tlist).matrix);
13130
+ }
13095
13131
 
13096
13132
  // Remove the rotation transform from the list
13097
13133
  for (let i = 0; i < tlist.numberOfItems; ++i) {
@@ -14606,7 +14642,7 @@ const REVERSE_NS = getReverseNS();
14606
14642
  const svgGenericWhiteList = ['class', 'id', 'display', 'transform', 'style'];
14607
14643
  const svgWhiteList_ = {
14608
14644
  // SVG Elements
14609
- a: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'xlink:href', 'xlink:title'],
14645
+ a: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'href', 'mask', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'xlink:href', 'xlink:title'],
14610
14646
  circle: ['clip-path', 'clip-rule', 'cx', 'cy', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'r', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage'],
14611
14647
  clipPath: ['clipPathUnits'],
14612
14648
  defs: [],
@@ -14621,20 +14657,20 @@ const svgWhiteList_ = {
14621
14657
  feMergeNode: ['in'],
14622
14658
  feMorphology: ['in', 'operator', 'radius'],
14623
14659
  feOffset: ['dx', 'in', 'dy', 'result'],
14624
- filter: ['color-interpolation-filters', 'filterRes', 'filterUnits', 'height', 'primitiveUnits', 'requiredFeatures', 'width', 'x', 'xlink:href', 'y'],
14660
+ filter: ['color-interpolation-filters', 'filterRes', 'filterUnits', 'height', 'href', 'primitiveUnits', 'requiredFeatures', 'width', 'x', 'xlink:href', 'y'],
14625
14661
  foreignObject: ['font-size', 'height', 'opacity', 'requiredFeatures', 'width', 'x', 'y'],
14626
14662
  g: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'font-family', 'font-size', 'font-style', 'font-weight', 'text-anchor'],
14627
- image: ['clip-path', 'clip-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'systemLanguage', 'width', 'x', 'xlink:href', 'xlink:title', 'y'],
14663
+ image: ['clip-path', 'clip-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'systemLanguage', 'width', 'x', 'href', 'xlink:href', 'xlink:title', 'y'],
14628
14664
  line: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'x1', 'x2', 'y1', 'y2'],
14629
- linearGradient: ['gradientTransform', 'gradientUnits', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'x1', 'x2', 'xlink:href', 'y1', 'y2'],
14665
+ linearGradient: ['gradientTransform', 'gradientUnits', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'x1', 'x2', 'href', 'xlink:href', 'y1', 'y2'],
14630
14666
  marker: ['markerHeight', 'markerUnits', 'markerWidth', 'orient', 'preserveAspectRatio', 'refX', 'refY', 'se_type', 'systemLanguage', 'viewBox'],
14631
14667
  mask: ['height', 'maskContentUnits', 'maskUnits', 'width', 'x', 'y'],
14632
14668
  metadata: [],
14633
14669
  path: ['clip-path', 'clip-rule', 'd', 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage'],
14634
- pattern: ['height', 'patternContentUnits', 'patternTransform', 'patternUnits', 'requiredFeatures', 'systemLanguage', 'viewBox', 'width', 'x', 'xlink:href', 'y'],
14670
+ pattern: ['height', 'patternContentUnits', 'patternTransform', 'patternUnits', 'requiredFeatures', 'systemLanguage', 'viewBox', 'width', 'x', 'href', 'xlink:href', 'y'],
14635
14671
  polygon: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'sides', 'shape', 'edge', 'point', 'starRadiusMultiplier', 'r', 'radialshift', 'r2', 'orient', 'cx', 'cy'],
14636
14672
  polyline: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'opacity', 'points', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'se:connector'],
14637
- radialGradient: ['cx', 'cy', 'fx', 'fy', 'gradientTransform', 'gradientUnits', 'r', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'xlink:href'],
14673
+ radialGradient: ['cx', 'cy', 'fx', 'fy', 'gradientTransform', 'gradientUnits', 'r', 'requiredFeatures', 'spreadMethod', 'systemLanguage', 'href', 'xlink:href'],
14638
14674
  rect: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'mask', 'opacity', 'requiredFeatures', 'rx', 'ry', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'width', 'x', 'y'],
14639
14675
  stop: ['offset', 'requiredFeatures', 'stop-opacity', 'systemLanguage', 'stop-color', 'gradientUnits', 'gradientTransform'],
14640
14676
  style: ['type'],
@@ -14642,10 +14678,22 @@ const svgWhiteList_ = {
14642
14678
  switch: ['requiredFeatures', 'systemLanguage'],
14643
14679
  symbol: ['fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'opacity', 'overflow', 'preserveAspectRatio', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'viewBox', 'width', 'height'],
14644
14680
  text: ['clip-path', 'clip-rule', 'dominant-baseline', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'text-anchor', 'letter-spacing', 'word-spacing', 'text-decoration', 'textLength', 'lengthAdjust', 'x', 'xml:space', 'y'],
14645
- textPath: ['dominant-baseline', 'method', 'requiredFeatures', 'spacing', 'startOffset', 'systemLanguage', 'xlink:href'],
14681
+ textPath: ['dominant-baseline', 'href', 'method', 'requiredFeatures', 'spacing', 'startOffset', 'systemLanguage', 'xlink:href'],
14646
14682
  title: [],
14647
14683
  tspan: ['clip-path', 'clip-rule', 'dx', 'dy', 'dominant-baseline', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'font-family', 'font-size', 'font-style', 'font-weight', 'mask', 'opacity', 'requiredFeatures', 'rotate', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'systemLanguage', 'text-anchor', 'textLength', 'x', 'xml:space', 'y'],
14648
- use: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'mask', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'width', 'x', 'xlink:href', 'y', 'overflow'],
14684
+ use: ['clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'height', 'href', 'mask', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'width', 'x', 'xlink:href', 'y', 'overflow'],
14685
+ // Filter Primitives
14686
+ feComponentTransfer: ['in', 'result'],
14687
+ feFuncR: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
14688
+ feFuncG: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
14689
+ feFuncB: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
14690
+ feFuncA: ['type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'],
14691
+ feConvolveMatrix: ['in', 'order', 'kernelMatrix', 'divisor', 'bias', 'targetX', 'targetY', 'edgeMode', 'kernelUnitLength', 'preserveAlpha'],
14692
+ feDiffuseLighting: ['in', 'surfaceScale', 'diffuseConstant', 'kernelUnitLength', 'lighting-color'],
14693
+ feSpecularLighting: ['in', 'surfaceScale', 'specularConstant', 'specularExponent', 'kernelUnitLength', 'lighting-color'],
14694
+ feDisplacementMap: ['in', 'in2', 'scale', 'xChannelSelector', 'yChannelSelector'],
14695
+ feTurbulence: ['baseFrequency', 'numOctaves', 'result', 'seed', 'stitchTiles', 'type'],
14696
+ feTile: ['in'],
14649
14697
  // MathML Elements
14650
14698
  annotation: ['encoding'],
14651
14699
  'annotation-xml': ['encoding'],
@@ -14663,7 +14711,7 @@ const svgWhiteList_ = {
14663
14711
  mphantom: [],
14664
14712
  mprescripts: [],
14665
14713
  mroot: [],
14666
- mrow: ['xlink:href', 'xlink:type', 'xmlns:xlink'],
14714
+ mrow: ['href', 'xlink:href', 'xlink:type', 'xmlns:xlink'],
14667
14715
  mspace: ['depth', 'height', 'width'],
14668
14716
  msqrt: [],
14669
14717
  mstyle: ['displaystyle', 'mathbackground', 'mathcolor', 'mathvariant', 'scriptlevel'],
@@ -14677,9 +14725,24 @@ const svgWhiteList_ = {
14677
14725
  munder: [],
14678
14726
  munderover: [],
14679
14727
  none: [],
14680
- semantics: []
14728
+ semantics: [],
14729
+ // HTML Elements for use in a foreignObject
14730
+ div: [],
14731
+ p: [],
14732
+ li: [],
14733
+ pre: [],
14734
+ ol: [],
14735
+ ul: [],
14736
+ span: [],
14737
+ hr: [],
14738
+ br: [],
14739
+ h1: [],
14740
+ h2: [],
14741
+ h3: [],
14742
+ h4: [],
14743
+ h5: [],
14744
+ h6: []
14681
14745
  };
14682
- /* eslint-enable max-len */
14683
14746
 
14684
14747
  // add generic attributes to all elements of the whitelist
14685
14748
  Object.keys(svgWhiteList_).forEach(element => {
@@ -14747,16 +14810,20 @@ const sanitizeSvg = node => {
14747
14810
  // Check that an attribute with the correct localName in the correct namespace is on
14748
14811
  // our whitelist or is a namespace declaration for one of our allowed namespaces
14749
14812
  if (attrNsURI !== allowedAttrsNS[attrLocalName] && attrNsURI !== NS.XMLNS && !(attrNsURI === NS.XMLNS && REVERSE_NS[attr.value])) {
14750
- // Bypassing the whitelist to allow se: and oi: prefixes
14751
- // We can add specific namepaces on demand for now.
14752
- // Is there a more appropriate way to do this?
14753
- if (attrName.startsWith('se:') || attrName.startsWith('oi:') || attrName.startsWith('data-')) {
14754
- // We should bypass the namespace aswell
14755
- const seAttrNS = attrName.startsWith('se:') ? NS.SE : attrName.startsWith('oi:') ? NS.OI : null;
14756
- seAttrs.push([attrName, attr.value, seAttrNS]);
14757
- } else {
14758
- console.warn(`sanitizeSvg: attribute ${attrName} in element ${node.nodeName} not in whitelist is removed`);
14759
- node.removeAttributeNS(attrNsURI, attrLocalName);
14813
+ // Special case: allow href attribute even without namespace if it's in the whitelist
14814
+ const isHrefAttribute = attrLocalName === 'href' && allowedAttrs.includes('href');
14815
+ if (!isHrefAttribute) {
14816
+ // Bypassing the whitelist to allow se: and oi: prefixes
14817
+ // We can add specific namepaces on demand for now.
14818
+ // Is there a more appropriate way to do this?
14819
+ if (attrName.startsWith('se:') || attrName.startsWith('oi:') || attrName.startsWith('data-')) {
14820
+ // We should bypass the namespace aswell
14821
+ const seAttrNS = attrName.startsWith('se:') ? NS.SE : attrName.startsWith('oi:') ? NS.OI : null;
14822
+ seAttrs.push([attrName, attr.value, seAttrNS]);
14823
+ } else {
14824
+ console.warn(`sanitizeSvg: attribute ${attrName} in element ${node.nodeName} not in whitelist is removed: ${node.outerHTML}`);
14825
+ node.removeAttributeNS(attrNsURI, attrLocalName);
14826
+ }
14760
14827
  }
14761
14828
  }
14762
14829
 
@@ -14780,22 +14847,37 @@ const sanitizeSvg = node => {
14780
14847
  node.setAttributeNS(ns, att, val);
14781
14848
  });
14782
14849
 
14783
- // for some elements that have a xlink:href, ensure the URI refers to a local element
14784
- // (but not for links)
14850
+ // for some elements that have a xlink:href or href, ensure the URI refers to a local element
14851
+ // (but not for links and other elements where external hrefs are allowed)
14785
14852
  const href = getHref(node);
14786
14853
  if (href && ['filter', 'linearGradient', 'pattern', 'radialGradient', 'textPath', 'use'].includes(node.nodeName) && href[0] !== '#') {
14787
14854
  // remove the attribute (but keep the element)
14788
14855
  setHref(node, '');
14789
- console.warn(`sanitizeSvg: attribute href in element ${node.nodeName} pointing to a non-local reference (${href}) is removed`);
14856
+ console.warn(`sanitizeSvg: attribute href in element ${node.nodeName} pointing to a non-local reference (${href}) is removed: ${node.outerHTML}`);
14790
14857
  node.removeAttributeNS(NS.XLINK, 'href');
14858
+ node.removeAttribute('href');
14791
14859
  }
14792
14860
 
14793
14861
  // Safari crashes on a <use> without a xlink:href, so we just remove the node here
14794
14862
  if (node.nodeName === 'use' && !getHref(node)) {
14795
- console.warn(`sanitizeSvg: element ${node.nodeName} without a xlink:href is removed`);
14863
+ console.warn(`sanitizeSvg: element ${node.nodeName} without a xlink:href or href is removed: ${node.outerHTML}`);
14796
14864
  node.remove();
14797
14865
  return;
14798
14866
  }
14867
+ // if the element has attributes pointing to a non-local reference,
14868
+ // need to remove the attribute
14869
+ ['clip-path', 'fill', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'stroke'].forEach(attr => {
14870
+ let val = node.getAttribute(attr);
14871
+ if (val) {
14872
+ val = getUrlFromAttr(val);
14873
+ // simply check for first character being a '#'
14874
+ if (val && val[0] !== '#') {
14875
+ node.setAttribute(attr, '');
14876
+ console.warn(`sanitizeSvg: attribute ${attr} in element ${node.nodeName} pointing to a non-local reference (${val}) is removed: ${node.outerHTML}`);
14877
+ node.removeAttribute(attr);
14878
+ }
14879
+ }
14880
+ });
14799
14881
 
14800
14882
  // recurse to children
14801
14883
  i = node.childNodes.length;
@@ -14806,7 +14888,7 @@ const sanitizeSvg = node => {
14806
14888
  } else {
14807
14889
  // remove all children from this node and insert them before this node
14808
14890
  // TODO: in the case of animation elements this will hardly ever be correct
14809
- console.warn(`sanitizeSvg: element ${node.nodeName} not supported is removed`);
14891
+ console.warn(`sanitizeSvg: element ${node.nodeName} not supported is removed: ${node.outerHTML}`);
14810
14892
  const children = [];
14811
14893
  while (node.hasChildNodes()) {
14812
14894
  children.push(parent.insertBefore(node.firstChild, node));
@@ -15647,7 +15729,7 @@ try {
15647
15729
  /** @license
15648
15730
  *
15649
15731
  * jsPDF - PDF Document creation from JavaScript
15650
- * Version 3.0.0 Built on 2025-02-19T09:26:58.791Z
15732
+ * Version 3.0.1 Built on 2025-03-17T14:19:36.873Z
15651
15733
  * CommitID 00000000
15652
15734
  *
15653
15735
  * Copyright (c) 2010-2021 James Hall <james@parall.ax>, https://github.com/MrRio/jsPDF
@@ -17411,8 +17493,7 @@ function E$1(e) {
17411
17493
  E = Math.sin(c);
17412
17494
  p = new Vt(M, E, -E, M, 0, 0);
17413
17495
  } else c && c instanceof Vt && (p = c);
17414
- S !== x.ADVANCED || p || (p = Yt), void 0 !== (h = i.charSpace || _r) && (v += O(U(h)) + " Tc\n", this.setCharSpace(this.getCharSpace() || 0)), void 0 !== (d = i.horizontalScale) && (v += O(100 * d) + " Tz\n");
17415
- i.lang;
17496
+ S !== x.ADVANCED || p || (p = Yt), void 0 !== (h = i.charSpace || _r) && (v += O(U(h)) + " Tc\n", this.setCharSpace(this.getCharSpace() || 0)), void 0 !== (d = i.horizontalScale) && (v += O(100 * d) + " Tz\n"), i.lang;
17416
17497
  var D = -1,
17417
17498
  R = void 0 !== i.renderingMode ? i.renderingMode : i.stroke,
17418
17499
  T = g.internal.getCurrentPageInfo().pageContext;
@@ -18064,7 +18145,7 @@ I$1.prototype.lsbFirstWord = function (t) {
18064
18145
  return 0 === i;
18065
18146
  }, E$1.API = {
18066
18147
  events: []
18067
- }, E$1.version = "3.0.0";
18148
+ }, E$1.version = "3.0.1";
18068
18149
  var q$1 = E$1.API,
18069
18150
  D$1 = 1,
18070
18151
  R$1 = function (t) {
@@ -19655,17 +19736,10 @@ function _t(t) {
19655
19736
  return 0 === t.length && (e = false), t.length % 4 != 0 && (e = false), false === /^[A-Za-z0-9+/]+$/.test(t.substr(0, t.length - 2)) && (e = false), false === /^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(t.substr(-2)) && (e = false), e;
19656
19737
  },
19657
19738
  L = e.__addimage__.extractImageFromDataUrl = function (t) {
19658
- var e = (t = t || "").split("base64,"),
19659
- r = null;
19660
- if (2 === e.length) {
19661
- var n = /^data:(\w*\/\w*);*(charset=(?!charset=)[\w=-]*)*;*$/.exec(e[0]);
19662
- Array.isArray(n) && (r = {
19663
- mimeType: n[1],
19664
- charset: n[2],
19665
- data: e[1]
19666
- });
19667
- }
19668
- return r;
19739
+ if (null == t) return null;
19740
+ if (!(t = t.trim()).startsWith("data:")) return null;
19741
+ var e = t.indexOf(",");
19742
+ return e < 0 ? null : t.substring(0, e).trim().endsWith("base64") ? t.substring(e + 1) : null;
19669
19743
  },
19670
19744
  A = e.__addimage__.supportsArrayBuffer = function () {
19671
19745
  return "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array;
@@ -19712,19 +19786,19 @@ function _t(t) {
19712
19786
  return s;
19713
19787
  },
19714
19788
  k = e.__addimage__.convertBase64ToBinaryString = function (t, e) {
19715
- var r;
19716
19789
  e = "boolean" != typeof e || e;
19717
- var n,
19718
- i = "";
19790
+ var r,
19791
+ n = "";
19719
19792
  if ("string" == typeof t) {
19720
- n = null !== (r = L(t)) ? r.data : t;
19793
+ var i;
19794
+ r = null !== (i = L(t)) && void 0 !== i ? i : t;
19721
19795
  try {
19722
- i = u$2(n);
19796
+ n = u$2(r);
19723
19797
  } catch (t) {
19724
- if (e) throw N(n) ? new Error("atob-Error in jsPDF.convertBase64ToBinaryString " + t.message) : new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ");
19798
+ if (e) throw N(r) ? new Error("atob-Error in jsPDF.convertBase64ToBinaryString " + t.message) : new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ");
19725
19799
  }
19726
19800
  }
19727
- return i;
19801
+ return n;
19728
19802
  };
19729
19803
  e.getImageProperties = function (t) {
19730
19804
  var n,
@@ -20733,10 +20807,12 @@ var Ut$1,
20733
20807
  set: function (t) {
20734
20808
  var e;
20735
20809
  if (this.ctx.font = t, null !== (e = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z]+?)\s*$/i.exec(t))) {
20736
- var r = e[1],
20737
- n = (e[2], e[3]),
20738
- i = e[4],
20739
- a = (e[5], e[6]),
20810
+ var r = e[1];
20811
+ e[2];
20812
+ var n = e[3],
20813
+ i = e[4];
20814
+ e[5];
20815
+ var a = e[6],
20740
20816
  o = /^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(i)[2];
20741
20817
  i = "px" === o ? Math.floor(parseFloat(i) * this.pdf.internal.scaleFactor) : "em" === o ? Math.floor(parseFloat(i) * this.pdf.getFontSize()) : Math.floor(parseFloat(i) * this.pdf.internal.scaleFactor), this.pdf.setFontSize(i);
20742
20818
  var s = function (t) {
@@ -22418,8 +22494,7 @@ function Zt(t) {
22418
22494
  i = t[e++],
22419
22495
  a = i >> 7,
22420
22496
  o = 1 << (7 & i) + 1;
22421
- t[e++];
22422
- t[e++];
22497
+ t[e++], t[e++];
22423
22498
  var s = null,
22424
22499
  c = null;
22425
22500
  a && (s = e, c = o, e += 3 * o);
@@ -25101,42 +25176,34 @@ function ee(t) {
25101
25176
  for (var i = 0; i < n; i++) if (t[e + i] != r.charCodeAt(i)) return true;
25102
25177
  return false;
25103
25178
  }(t, e, "RIFF", 4)) {
25104
- var s, c;
25105
- l(t, e += 4);
25106
- for (e += 8; e < t.length;) {
25107
- var f = u(t, e),
25108
- d = l(t, e += 4);
25179
+ for (l(t, e += 4), e += 8; e < t.length;) {
25180
+ var s = u(t, e),
25181
+ c = l(t, e += 4);
25109
25182
  e += 4;
25110
- var p = d + (1 & d);
25111
- switch (f) {
25183
+ var f = c + (1 & c);
25184
+ switch (s) {
25112
25185
  case "VP8 ":
25113
25186
  case "VP8L":
25114
- void 0 === r.frames[n] && (r.frames[n] = {});
25115
- (v = r.frames[n]).src_off = i ? o : e - 8, v.src_size = a + d + 8, n++, i && (i = false, a = 0, o = 0);
25187
+ void 0 === r.frames[n] && (r.frames[n] = {}), (g = r.frames[n]).src_off = i ? o : e - 8, g.src_size = a + c + 8, n++, i && (i = false, a = 0, o = 0);
25116
25188
  break;
25117
25189
  case "VP8X":
25118
- (v = r.header = {}).feature_flags = t[e];
25119
- var g = e + 4;
25120
- v.canvas_width = 1 + h(t, g);
25121
- g += 3;
25122
- v.canvas_height = 1 + h(t, g);
25123
- g += 3;
25190
+ (g = r.header = {}).feature_flags = t[e];
25191
+ var d = e + 4;
25192
+ g.canvas_width = 1 + h(t, d), d += 3, g.canvas_height = 1 + h(t, d), d += 3;
25124
25193
  break;
25125
25194
  case "ALPH":
25126
- i = true, a = p + 8, o = e - 8;
25195
+ i = true, a = f + 8, o = e - 8;
25127
25196
  break;
25128
25197
  case "ANIM":
25129
- (v = r.header).bgcolor = l(t, e);
25130
- g = e + 4;
25131
- v.loop_count = (s = t)[(c = g) + 0] << 0 | s[c + 1] << 8;
25132
- g += 2;
25198
+ (g = r.header).bgcolor = l(t, e), d = e + 4, g.loop_count = (m = t)[(v = d) + 0] << 0 | m[v + 1] << 8, d += 2;
25133
25199
  break;
25134
25200
  case "ANMF":
25135
- var m, v;
25136
- (v = r.frames[n] = {}).offset_x = 2 * h(t, e), e += 3, v.offset_y = 2 * h(t, e), e += 3, v.width = 1 + h(t, e), e += 3, v.height = 1 + h(t, e), e += 3, v.duration = h(t, e), e += 3, m = t[e++], v.dispose = 1 & m, v.blend = m >> 1 & 1;
25201
+ var p, g;
25202
+ (g = r.frames[n] = {}).offset_x = 2 * h(t, e), e += 3, g.offset_y = 2 * h(t, e), e += 3, g.width = 1 + h(t, e), e += 3, g.height = 1 + h(t, e), e += 3, g.duration = h(t, e), e += 3, p = t[e++], g.dispose = 1 & p, g.blend = p >> 1 & 1;
25137
25203
  }
25138
- "ANMF" != f && (e += p);
25204
+ "ANMF" != s && (e += f);
25139
25205
  }
25206
+ var m, v;
25140
25207
  return r;
25141
25208
  }
25142
25209
  }(m, 0);
@@ -26552,9 +26619,11 @@ function (t) {
26552
26619
  isInputVisual: true
26553
26620
  });
26554
26621
  t.API.events.push(["postProcessText", function (t) {
26555
- var e = t.text,
26556
- n = (t.x, t.y, t.options || {}),
26557
- i = (t.mutex, n.lang, []);
26622
+ var e = t.text;
26623
+ t.x, t.y;
26624
+ var n = t.options || {};
26625
+ t.mutex, n.lang;
26626
+ var i = [];
26558
26627
  if (n.isInputVisual = "boolean" != typeof n.isInputVisual || n.isInputVisual, r.setOptions(n), "[object Array]" === Object.prototype.toString.call(e)) {
26559
26628
  var a = 0;
26560
26629
  for (i = [], a = 0; a < e.length; a += 1) "[object Array]" === Object.prototype.toString.call(e[a]) ? i.push([r.doBidiReorder(e[a][0]), e[a][1], e[a][2]]) : i.push([r.doBidiReorder(e[a])]);
@@ -27571,6 +27640,7 @@ function requirePath_parse() {
27571
27640
  for (i = need_params; i > 0; i--) {
27572
27641
  if (is_arc && (i === 3 || i === 4)) scanFlag(state);else scanParam(state);
27573
27642
  if (state.err.length) {
27643
+ finalizeSegment(state);
27574
27644
  return;
27575
27645
  }
27576
27646
  state.data.push(state.param);
@@ -27612,9 +27682,7 @@ function requirePath_parse() {
27612
27682
  while (state.index < max && !state.err.length) {
27613
27683
  scanSegment(state);
27614
27684
  }
27615
- if (state.err.length) {
27616
- state.result = [];
27617
- } else if (state.result.length) {
27685
+ if (state.result.length) {
27618
27686
  if ('mM'.indexOf(state.result[0][0]) < 0) {
27619
27687
  state.err = 'SvgPath: string should start with `M` or `m`';
27620
27688
  state.result = [];
@@ -28262,24 +28330,38 @@ function requireSvgpath$1() {
28262
28330
  // Convert processed SVG Path back to string
28263
28331
  //
28264
28332
  SvgPath.prototype.toString = function () {
28265
- var elements = [],
28266
- skipCmd,
28267
- cmd;
28333
+ var result = '',
28334
+ prevCmd = '',
28335
+ cmdSkipped = false;
28268
28336
  this.__evaluateStack();
28269
- for (var i = 0; i < this.segments.length; i++) {
28270
- // remove repeating commands names
28271
- cmd = this.segments[i][0];
28272
- skipCmd = i > 0 && cmd !== 'm' && cmd !== 'M' && cmd === this.segments[i - 1][0];
28273
- elements = elements.concat(skipCmd ? this.segments[i].slice(1) : this.segments[i]);
28274
- }
28275
- return elements.join(' ')
28276
- // Optimizations: remove spaces around commands & before `-`
28277
- //
28278
- // We could also remove leading zeros for `0.5`-like values,
28279
- // but their count is too small to spend time for.
28280
- .replace(/ ?([achlmqrstvz]) ?/gi, '$1').replace(/ \-/g, '-')
28281
- // workaround for FontForge SVG importing bug
28282
- .replace(/zm/g, 'z m');
28337
+ for (var i = 0, len = this.segments.length; i < len; i++) {
28338
+ var segment = this.segments[i];
28339
+ var cmd = segment[0];
28340
+
28341
+ // Command not repeating => store
28342
+ if (cmd !== prevCmd || cmd === 'm' || cmd === 'M') {
28343
+ // workaround for FontForge SVG importing bug, keep space between "z m".
28344
+ if (cmd === 'm' && prevCmd === 'z') result += ' ';
28345
+ result += cmd;
28346
+ cmdSkipped = false;
28347
+ } else {
28348
+ cmdSkipped = true;
28349
+ }
28350
+
28351
+ // Store segment params
28352
+ for (var pos = 1; pos < segment.length; pos++) {
28353
+ var val = segment[pos];
28354
+ // Space can be skipped
28355
+ // 1. After command (always)
28356
+ // 2. For negative value (with '-' at start)
28357
+ if (pos === 1) {
28358
+ if (cmdSkipped && val >= 0) result += ' ';
28359
+ } else if (val >= 0) result += ' ';
28360
+ result += val;
28361
+ }
28362
+ prevCmd = cmd;
28363
+ }
28364
+ return result;
28283
28365
  };
28284
28366
 
28285
28367
  // Translate path to (x [, y])
@@ -29268,7 +29350,7 @@ var p$1 = function () {
29268
29350
  });
29269
29351
  }, t;
29270
29352
  }(),
29271
- b = function () {
29353
+ y$1 = function () {
29272
29354
  function e(t) {
29273
29355
  this.renderedElements = {}, this.idMap = t, this.idPrefix = String(e.instanceCounter++);
29274
29356
  }
@@ -29296,7 +29378,7 @@ var p$1 = function () {
29296
29378
  }).join("|")), this.idPrefix + "|" + t + "|" + r;
29297
29379
  }, e.instanceCounter = 0, e;
29298
29380
  }();
29299
- function y$1(t, e) {
29381
+ function b(t, e) {
29300
29382
  return Math.atan2(e[1] - t[1], e[0] - t[0]);
29301
29383
  }
29302
29384
  var v$1 = 2 / 3;
@@ -29413,8 +29495,8 @@ var E = function () {
29413
29495
  I = function (t, e, r, i) {
29414
29496
  void 0 === i && (i = false), this.id = t, this.anchor = e, this.angle = r, this.isStartMarker = i;
29415
29497
  },
29416
- H = /url\(["']?#([^"']+)["']?\)/,
29417
- R = {
29498
+ R = /url\(["']?#([^"']+)["']?\)/,
29499
+ H = {
29418
29500
  bottom: "bottom",
29419
29501
  "text-bottom": "bottom",
29420
29502
  top: "top",
@@ -29434,7 +29516,7 @@ function W(t, e) {
29434
29516
  return (r = t && t.toString().match(/^([\-0-9.]+)em$/)) ? parseFloat(r[1]) * e : (r = t && t.toString().match(/^([\-0-9.]+)(px|)$/)) ? parseFloat(r[1]) : 0;
29435
29517
  }
29436
29518
  function V(t) {
29437
- return R[t] || "alphabetic";
29519
+ return H[t] || "alphabetic";
29438
29520
  }
29439
29521
  function j(t) {
29440
29522
  for (var e, r = [], i = /[+-]?(?:(?:\d+\.?\d*)|(?:\d*\.?\d+))(?:[eE][+-]?\d+)?/g; e = i.exec(t);) r.push(parseFloat(e[0]));
@@ -29503,14 +29585,14 @@ function $(t, e, r, i, n, a, s, o) {
29503
29585
  m = a / p,
29504
29586
  g = t.getAttribute("preserveAspectRatio");
29505
29587
  if (g) {
29506
- var b = g.split(" ");
29507
- "defer" === b[0] && (b = b.slice(1)), l = b[0], u = b[1] || "meet";
29588
+ var y = g.split(" ");
29589
+ "defer" === y[0] && (y = y.slice(1)), l = y[0], u = y[1] || "meet";
29508
29590
  } else l = "xMidYMid", u = "meet";
29509
29591
  if ("none" !== l && ("meet" === u ? d = m = Math.min(d, m) : "slice" === u && (d = m = Math.max(d, m))), o) return s.pdf.Matrix(d, 0, 0, m, 0, 0);
29510
- var y = r - h * d,
29592
+ var b = r - h * d,
29511
29593
  v = i - f * m;
29512
- l.indexOf("xMid") >= 0 ? y += (n - c * d) / 2 : l.indexOf("xMax") >= 0 && (y += n - c * d), l.indexOf("YMid") >= 0 ? v += (a - p * m) / 2 : l.indexOf("YMax") >= 0 && (v += a - p * m);
29513
- var x = s.pdf.Matrix(1, 0, 0, 1, y, v),
29594
+ l.indexOf("xMid") >= 0 ? b += (n - c * d) / 2 : l.indexOf("xMax") >= 0 && (b += n - c * d), l.indexOf("YMid") >= 0 ? v += (a - p * m) / 2 : l.indexOf("YMax") >= 0 && (v += a - p * m);
29595
+ var x = s.pdf.Matrix(1, 0, 0, 1, b, v),
29514
29596
  S = s.pdf.Matrix(d, 0, 0, m, 0, 0);
29515
29597
  return s.pdf.matrixMult(S, x);
29516
29598
  }
@@ -29740,7 +29822,7 @@ var K = function () {
29740
29822
  }, t;
29741
29823
  }();
29742
29824
  function at(t, e) {
29743
- var r = H.exec(t);
29825
+ var r = R.exec(t);
29744
29826
  if (r) {
29745
29827
  var i = r[1],
29746
29828
  n = e.refsHandler.get(i);
@@ -29783,10 +29865,10 @@ function st(t, r, i) {
29783
29865
  g.ok && (t.attributeState.stroke = new d(g));
29784
29866
  }
29785
29867
  m && t.attributeState.stroke instanceof d && (t.attributeState.contextStroke = t.attributeState.stroke.color), l && t.attributeState.fill instanceof d && (t.attributeState.contextFill = t.attributeState.fill.color);
29786
- var b = N$1(n, t.styleSheets, "stroke-linecap");
29787
- b && (t.attributeState.strokeLinecap = b);
29788
- var y = N$1(n, t.styleSheets, "stroke-linejoin");
29789
- y && (t.attributeState.strokeLinejoin = y);
29868
+ var y = N$1(n, t.styleSheets, "stroke-linecap");
29869
+ y && (t.attributeState.strokeLinecap = y);
29870
+ var b = N$1(n, t.styleSheets, "stroke-linejoin");
29871
+ b && (t.attributeState.strokeLinejoin = b);
29790
29872
  var v = N$1(n, t.styleSheets, "stroke-dasharray");
29791
29873
  if (v) {
29792
29874
  var x = parseInt(N$1(n, t.styleSheets, "stroke-dashoffset") || "0");
@@ -29847,7 +29929,7 @@ function ot(t, e, r) {
29847
29929
  t.attributeState.fontWeight === e.attributeState.fontWeight && t.attributeState.fontStyle === e.attributeState.fontStyle || (o = X(t.attributeState.fontStyle, t.attributeState.fontWeight)), void 0 === s && void 0 === o || (void 0 === s && (s = U.hasOwnProperty(t.attributeState.fontFamily) ? U[t.attributeState.fontFamily] : t.attributeState.fontFamily), t.pdf.setFont(s, o)), t.attributeState.fontSize !== e.attributeState.fontSize && t.pdf.setFontSize(t.attributeState.fontSize * t.pdf.internal.scaleFactor);
29848
29930
  }
29849
29931
  function lt(t, e, r) {
29850
- var i = H.exec(t);
29932
+ var i = R.exec(t);
29851
29933
  if (i) {
29852
29934
  var n = i[1];
29853
29935
  return r.refsHandler.get(n) || void 0;
@@ -29980,7 +30062,7 @@ var ht = function (t) {
29980
30062
  d = i && t > 0 && !(1 === t && s[t - 1] instanceof T$1),
29981
30063
  m = s[t - 1] || null;
29982
30064
  if (m instanceof T$1 || m instanceof F || m instanceof A) {
29983
- if (e instanceof A) c && a.addMarker(new I(r, [m.x, m.y], y$1(f ? [f.x, f.y] : [m.x, m.y], [e.x1, e.y1]), true)), p && a.addMarker(new I(n, [e.x, e.y], y$1([e.x2, e.y2], [e.x, e.y]))), d && (l = w([m.x, m.y], [e.x1, e.y1]), l = m instanceof T$1 ? l : S(k(o, l)), a.addMarker(new I(i, [m.x, m.y], Math.atan2(l[1], l[0])))), o = w([e.x2, e.y2], [e.x, e.y]);else if (e instanceof T$1 || e instanceof F) {
30065
+ if (e instanceof A) c && a.addMarker(new I(r, [m.x, m.y], b(f ? [f.x, f.y] : [m.x, m.y], [e.x1, e.y1]), true)), p && a.addMarker(new I(n, [e.x, e.y], b([e.x2, e.y2], [e.x, e.y]))), d && (l = w([m.x, m.y], [e.x1, e.y1]), l = m instanceof T$1 ? l : S(k(o, l)), a.addMarker(new I(i, [m.x, m.y], Math.atan2(l[1], l[0])))), o = w([e.x2, e.y2], [e.x, e.y]);else if (e instanceof T$1 || e instanceof F) {
29984
30066
  if (l = w([m.x, m.y], [e.x, e.y]), c) {
29985
30067
  var g = f ? w([f.x, f.y], [e.x, e.y]) : l;
29986
30068
  a.addMarker(new I(r, [m.x, m.y], Math.atan2(g[1], g[0]), true));
@@ -30003,8 +30085,8 @@ var ht = function (t) {
30003
30085
  }
30004
30086
  } else {
30005
30087
  u = e instanceof T$1 && e;
30006
- var b = s[t + 1];
30007
- (b instanceof T$1 || b instanceof F || b instanceof A) && (h = w([u.x, u.y], [b.x, b.y]));
30088
+ var y = s[t + 1];
30089
+ (y instanceof T$1 || y instanceof F || y instanceof A) && (h = w([u.x, u.y], [y.x, y.y]));
30008
30090
  }
30009
30091
  }, p = 0; p < s.length; p++) c(p);
30010
30092
  }
@@ -30018,7 +30100,7 @@ var ht = function (t) {
30018
30100
  }, e;
30019
30101
  }(ft);
30020
30102
  function pt(t) {
30021
- var e = H.exec(t);
30103
+ var e = R.exec(t);
30022
30104
  return e && e[1] || void 0;
30023
30105
  }
30024
30106
  var dt = function (t) {
@@ -30097,17 +30179,17 @@ var dt = function (t) {
30097
30179
  gt = function (t, e) {
30098
30180
  this.width = t, this.height = e;
30099
30181
  },
30100
- bt = function (t) {
30182
+ yt = function (t) {
30101
30183
  function e() {
30102
30184
  return null !== t && t.apply(this, arguments) || this;
30103
30185
  }
30104
30186
  return u$1(e, t), e.prototype.renderCore = function (t) {
30105
30187
  return f$1(this, void 0, void 0, function () {
30106
- var r, i, n, a, s, o, l, u, h, f, p, d, b;
30188
+ var r, i, n, a, s, o, l, u, h, f, p, d, y;
30107
30189
  return c$2(this, function (c) {
30108
30190
  switch (c.label) {
30109
30191
  case 0:
30110
- return r = parseFloat, (i = this.element.getAttribute("href") || this.element.getAttribute("xlink:href")) ? (n = i.substring(1), a = t.refsHandler.get(n), s = B(a.element, "symbol,svg") && a.element.hasAttribute("viewBox"), o = r(N$1(this.element, t.styleSheets, "x") || "0"), l = r(N$1(this.element, t.styleSheets, "y") || "0"), u = void 0, h = void 0, s ? (u = r(N$1(this.element, t.styleSheets, "width") || N$1(a.element, t.styleSheets, "width") || "0"), h = r(N$1(this.element, t.styleSheets, "height") || N$1(a.element, t.styleSheets, "height") || "0"), o += r(N$1(a.element, t.styleSheets, "x") || "0"), l += r(N$1(a.element, t.styleSheets, "y") || "0"), p = j(a.element.getAttribute("viewBox")), f = $(a.element, p, o, l, u, h, t)) : f = t.pdf.Matrix(1, 0, 0, 1, o, l), d = m$2.getContextColors(t, true), b = new g(t.pdf, {
30192
+ return r = parseFloat, (i = this.element.getAttribute("href") || this.element.getAttribute("xlink:href")) ? (n = i.substring(1), a = t.refsHandler.get(n), s = B(a.element, "symbol,svg") && a.element.hasAttribute("viewBox"), o = r(N$1(this.element, t.styleSheets, "x") || "0"), l = r(N$1(this.element, t.styleSheets, "y") || "0"), u = void 0, h = void 0, s ? (u = r(N$1(this.element, t.styleSheets, "width") || N$1(a.element, t.styleSheets, "width") || "0"), h = r(N$1(this.element, t.styleSheets, "height") || N$1(a.element, t.styleSheets, "height") || "0"), o += r(N$1(a.element, t.styleSheets, "x") || "0"), l += r(N$1(a.element, t.styleSheets, "y") || "0"), p = j(a.element.getAttribute("viewBox")), f = $(a.element, p, o, l, u, h, t)) : f = t.pdf.Matrix(1, 0, 0, 1, o, l), d = m$2.getContextColors(t, true), y = new g(t.pdf, {
30111
30193
  refsHandler: t.refsHandler,
30112
30194
  styleSheets: t.styleSheets,
30113
30195
  withinUse: true,
@@ -30116,7 +30198,7 @@ var dt = function (t) {
30116
30198
  textMeasure: t.textMeasure,
30117
30199
  attributeState: Object.assign(m$2.default(), d)
30118
30200
  }), [4, t.refsHandler.getRendered(n, d, function (t) {
30119
- return e.renderReferencedNode(t, n, b);
30201
+ return e.renderReferencedNode(t, n, y);
30120
30202
  })]) : [2];
30121
30203
  case 1:
30122
30204
  return c.sent(), t.pdf.saveGraphicsState(), t.pdf.setCurrentTransformationMatrix(t.transform), s && "visible" !== N$1(a.element, t.styleSheets, "overflow") && (t.pdf.rect(o, l, u, h), t.pdf.clip().discardPath()), t.pdf.doFormObject(t.refsHandler.generateKey(n, d), f), t.pdf.restoreGraphicsState(), [2];
@@ -30149,7 +30231,7 @@ var dt = function (t) {
30149
30231
  return t.pdf.unitMatrix;
30150
30232
  }, e;
30151
30233
  }(ft),
30152
- yt = function (t) {
30234
+ bt = function (t) {
30153
30235
  function e(e, r) {
30154
30236
  return t.call(this, false, e, r) || this;
30155
30237
  }
@@ -30266,27 +30348,27 @@ var Tt = function () {
30266
30348
  o.push(n);
30267
30349
  var g = t.resolveRelativePositionAttribute(n, "dx");
30268
30350
  null !== g && (d += W(g, a.attributeState.fontSize));
30269
- var b = t.resolveRelativePositionAttribute(n, "dy");
30270
- null !== b && (m += W(b, a.attributeState.fontSize));
30351
+ var y = t.resolveRelativePositionAttribute(n, "dy");
30352
+ null !== y && (m += W(y, a.attributeState.fontSize));
30271
30353
  }
30272
30354
  l[i] = d, u[i] = m, h = d + s.width + s.length * r, f = m, c = Math.min(c, d), p = Math.max(p, h);
30273
30355
  }
30274
- var y = 0;
30356
+ var b = 0;
30275
30357
  switch (this.textAnchor) {
30276
30358
  case "start":
30277
- y = 0;
30359
+ b = 0;
30278
30360
  break;
30279
30361
  case "middle":
30280
- y = (p - c) / 2;
30362
+ b = (p - c) / 2;
30281
30363
  break;
30282
30364
  case "end":
30283
- y = p - c;
30365
+ b = p - c;
30284
30366
  }
30285
30367
  for (i = 0; i < this.textNodes.length; i++) if (n = this.textNodes[i], a = this.contexts[i], "#text" === n.nodeName || "hidden" !== a.attributeState.visibility) {
30286
30368
  e.pdf.saveGraphicsState(), ot(a, e, n);
30287
30369
  var v = a.attributeState.alignmentBaseline,
30288
30370
  x = St(a.attributeState);
30289
- e.pdf.text(this.texts[i], l[i] - y, u[i], {
30371
+ e.pdf.text(this.texts[i], l[i] - b, u[i], {
30290
30372
  baseline: V(v),
30291
30373
  angle: e.transform,
30292
30374
  renderingMode: "fill" === x ? void 0 : x,
@@ -30322,15 +30404,15 @@ var Tt = function () {
30322
30404
  var m = f,
30323
30405
  g = m.getAttribute("x");
30324
30406
  if (null !== g) {
30325
- var b = W(g, s);
30326
- n = new Tt(this, N$1(m, r.styleSheets, "text-anchor") || r.attributeState.textAnchor, b, 0), i.push({
30407
+ var y = W(g, s);
30408
+ n = new Tt(this, N$1(m, r.styleSheets, "text-anchor") || r.attributeState.textAnchor, y, 0), i.push({
30327
30409
  type: "y",
30328
30410
  chunk: n
30329
30411
  });
30330
30412
  }
30331
- var y = m.getAttribute("y");
30332
- if (null !== y) {
30333
- var v = W(y, s);
30413
+ var b = m.getAttribute("y");
30414
+ if (null !== b) {
30415
+ var v = W(b, s);
30334
30416
  n = new Tt(this, N$1(m, r.styleSheets, "text-anchor") || r.attributeState.textAnchor, 0, v), i.push({
30335
30417
  type: "x",
30336
30418
  chunk: n
@@ -30344,31 +30426,31 @@ var Tt = function () {
30344
30426
  return u;
30345
30427
  }, e.prototype.renderCore = function (t) {
30346
30428
  return f$1(this, void 0, void 0, function () {
30347
- var e, r, i, n, a, s, o, l, u, h, f, p, d, m, g, b, y, v, x, S, w, k, M;
30429
+ var e, r, i, n, a, s, o, l, u, h, f, p, d, m, g, y, b, v, x, S, w, k, M;
30348
30430
  return c$2(this, function (c) {
30349
30431
  if (t.pdf.saveGraphicsState(), e = 0, r = 0, i = 1, n = t.pdf.getFontSize(), a = W(this.element.getAttribute("x"), n), s = W(this.element.getAttribute("y"), n), o = W(this.element.getAttribute("dx"), n), l = W(this.element.getAttribute("dy"), n), u = parseFloat(this.element.getAttribute("textLength") || "0"), h = t.attributeState.visibility, 0 === this.element.childElementCount) f = this.element.textContent || "", p = function (t, e) {
30350
30432
  return t = kt(t = wt(t)), "default" === e.xmlSpace && (t = Mt(t = t.trim())), t;
30351
- }(f, t.attributeState), d = Ct(this.element, p, t), e = t.textMeasure.getTextOffset(d, t.attributeState), u > 0 && (m = t.textMeasure.measureTextWidth(d, t.attributeState), "default" === t.attributeState.xmlSpace && f.match(/^\s/) && (i = 0), r = (u - m) / (d.length - i) || 0), "visible" === h && (g = t.attributeState.alignmentBaseline, b = St(t.attributeState), t.pdf.text(d, a + o - e, s + l, {
30433
+ }(f, t.attributeState), d = Ct(this.element, p, t), e = t.textMeasure.getTextOffset(d, t.attributeState), u > 0 && (m = t.textMeasure.measureTextWidth(d, t.attributeState), "default" === t.attributeState.xmlSpace && f.match(/^\s/) && (i = 0), r = (u - m) / (d.length - i) || 0), "visible" === h && (g = t.attributeState.alignmentBaseline, y = St(t.attributeState), t.pdf.text(d, a + o - e, s + l, {
30352
30434
  baseline: V(g),
30353
30435
  angle: t.transform,
30354
- renderingMode: "fill" === b ? void 0 : b,
30436
+ renderingMode: "fill" === y ? void 0 : y,
30355
30437
  charSpace: 0 === r ? void 0 : r
30356
30438
  }), this.boundingBox = [a + o - e, s + l + .1 * n, t.textMeasure.measureTextWidth(d, t.attributeState), n]);else {
30357
- for (y = [], v = new Tt(this, t.attributeState.textAnchor, a + o, s + l), y.push({
30439
+ for (b = [], v = new Tt(this, t.attributeState.textAnchor, a + o, s + l), b.push({
30358
30440
  type: "",
30359
30441
  chunk: v
30360
- }), x = this.processTSpans(this, this.element, t, y, v, {
30442
+ }), x = this.processTSpans(this, this.element, t, b, v, {
30361
30443
  prevText: " ",
30362
30444
  prevContext: t
30363
- }), i = x ? 0 : 1, S = true, w = y.length - 1; w >= 0; w--) S && (S = y[w].chunk.rightTrimText());
30364
- u > 0 && (k = 0, M = 0, y.forEach(function (e) {
30445
+ }), i = x ? 0 : 1, S = true, w = b.length - 1; w >= 0; w--) S && (S = b[w].chunk.rightTrimText());
30446
+ u > 0 && (k = 0, M = 0, b.forEach(function (e) {
30365
30447
  var r = e.chunk;
30366
30448
  r.measureText(t), r.textMeasures.forEach(function (t) {
30367
30449
  var e = t.width,
30368
30450
  r = t.length;
30369
30451
  k += e, M += r;
30370
30452
  });
30371
- }), r = (u - k) / (M - i)), y.reduce(function (e, i) {
30453
+ }), r = (u - k) / (M - i)), b.reduce(function (e, i) {
30372
30454
  var n = i.type,
30373
30455
  a = i.chunk;
30374
30456
  return "x" === n ? a.setX(e[0]) : "y" === n && a.setY(e[1]), a.put(t, r);
@@ -30451,14 +30533,14 @@ var Tt = function () {
30451
30533
  }
30452
30534
  return u$1(e, t), e.prototype.renderCore = function (t) {
30453
30535
  return f$1(this, void 0, void 0, function () {
30454
- var r, i, n, a, s, o, l, u, h, f, p, d, m, y, v, x, S, w;
30536
+ var r, i, n, a, s, o, l, u, h, f, p, d, m, b, v, x, S, w;
30455
30537
  return c$2(this, function (c) {
30456
30538
  switch (c.label) {
30457
30539
  case 0:
30458
30540
  return this.imageLoadingPromise ? (t.pdf.setCurrentTransformationMatrix(t.transform), r = parseFloat(N$1(this.element, t.styleSheets, "width") || "0"), i = parseFloat(N$1(this.element, t.styleSheets, "height") || "0"), n = parseFloat(N$1(this.element, t.styleSheets, "x") || "0"), a = parseFloat(N$1(this.element, t.styleSheets, "y") || "0"), !isFinite(r) || r <= 0 || !isFinite(i) || i <= 0 ? [2] : [4, this.imageLoadingPromise]) : [2];
30459
30541
  case 1:
30460
30542
  return s = c.sent(), o = s.data, 0 !== (l = s.format).indexOf("svg") ? [3, 3] : (u = new DOMParser(), h = u.parseFromString(o, "image/svg+xml").firstElementChild, (!(f = this.element.getAttribute("preserveAspectRatio")) || f.indexOf("defer") < 0 || !h.getAttribute("preserveAspectRatio")) && h.setAttribute("preserveAspectRatio", f || ""), h.setAttribute("x", String(n)), h.setAttribute("y", String(a)), h.setAttribute("width", String(r)), h.setAttribute("height", String(i)), [4, Gt(h, p = {}).render(new g(t.pdf, {
30461
- refsHandler: new b(p),
30543
+ refsHandler: new y$1(p),
30462
30544
  styleSheets: t.styleSheets,
30463
30545
  viewport: new gt(r, i),
30464
30546
  svg2pdfParameters: t.svg2pdfParameters,
@@ -30471,7 +30553,7 @@ var Tt = function () {
30471
30553
  case 4:
30472
30554
  return c.trys.push([4, 6,, 7]), [4, e.getImageDimensions(d)];
30473
30555
  case 5:
30474
- return m = c.sent(), y = m[0], v = m[1], x = [0, 0, y, v], S = $(this.element, x, n, a, r, i, t), t.pdf.setCurrentTransformationMatrix(S), t.pdf.addImage(d, "", 0, 0, y, v), [3, 7];
30556
+ return m = c.sent(), b = m[0], v = m[1], x = [0, 0, b, v], S = $(this.element, x, n, a, r, i, t), t.pdf.setCurrentTransformationMatrix(S), t.pdf.addImage(d, "", 0, 0, b, v), [3, 7];
30475
30557
  case 6:
30476
30558
  return w = c.sent(), "object" == typeof console && console.warn && console.warn("Could not load image ".concat(this.imageUrl, ". \n").concat(w)), [3, 7];
30477
30559
  case 7:
@@ -30652,13 +30734,13 @@ var Tt = function () {
30652
30734
  return this.getR(t);
30653
30735
  }, e;
30654
30736
  }(vt),
30655
- Ht = function (t) {
30737
+ Rt = function (t) {
30656
30738
  function e(e, r) {
30657
30739
  return t.call(this, false, e, r) || this;
30658
30740
  }
30659
30741
  return u$1(e, t), e;
30660
30742
  }(Nt),
30661
- Rt = function (t) {
30743
+ Ht = function (t) {
30662
30744
  function e() {
30663
30745
  return null !== t && t.apply(this, arguments) || this;
30664
30746
  }
@@ -30766,7 +30848,7 @@ var Tt = function () {
30766
30848
  }, e.prototype.isOutermostSvg = function (t) {
30767
30849
  return t.svg2pdfParameters.element === this.element;
30768
30850
  }, e;
30769
- }(Rt),
30851
+ }(Ht),
30770
30852
  Wt = function (t) {
30771
30853
  function e() {
30772
30854
  return null !== t && t.apply(this, arguments) || this;
@@ -30776,7 +30858,7 @@ var Tt = function () {
30776
30858
  }, e.prototype.computeNodeTransformCore = function (t) {
30777
30859
  return t.pdf.unitMatrix;
30778
30860
  }, e;
30779
- }(Rt),
30861
+ }(Ht),
30780
30862
  Vt = function (t) {
30781
30863
  function e() {
30782
30864
  return null !== t && t.apply(this, arguments) || this;
@@ -30803,12 +30885,12 @@ var Tt = function () {
30803
30885
  }
30804
30886
  return u$1(e, t), e.prototype.apply = function (t) {
30805
30887
  return f$1(this, void 0, void 0, function () {
30806
- var e, r, i;
30807
- return c$2(this, function (n) {
30808
- switch (n.label) {
30888
+ var e, r, i, n, a;
30889
+ return c$2(this, function (s) {
30890
+ switch (s.label) {
30809
30891
  case 0:
30810
30892
  if (!this.isVisible(true, t)) return [2];
30811
- e = t.pdf.matrixMult(this.computeNodeTransform(t), t.transform), t.pdf.setCurrentTransformationMatrix(e), r = 0, i = this.children, n.label = 1;
30893
+ e = t.pdf.matrixMult(this.computeNodeTransform(t), t.transform), t.pdf.setCurrentTransformationMatrix(e), r = 0, i = this.children, s.label = 1;
30812
30894
  case 1:
30813
30895
  return r < i.length ? [4, i[r].render(new g(t.pdf, {
30814
30896
  refsHandler: t.refsHandler,
@@ -30819,11 +30901,11 @@ var Tt = function () {
30819
30901
  textMeasure: t.textMeasure
30820
30902
  }))] : [3, 4];
30821
30903
  case 2:
30822
- n.sent(), n.label = 3;
30904
+ s.sent(), s.label = 3;
30823
30905
  case 3:
30824
30906
  return r++, [3, 1];
30825
30907
  case 4:
30826
- return t.pdf.clip().discardPath(), t.pdf.setCurrentTransformationMatrix(e.inversed()), [2];
30908
+ return n = this.children.length > 0 && !!N$1(this.children[0].element, t.styleSheets, "clip-rule"), a = n ? this.getClipRuleAttr(this.children[0].element, t.styleSheets) : this.getClipRuleAttr(this.element, t.styleSheets), t.pdf.clip(a).discardPath(), t.pdf.setCurrentTransformationMatrix(e.inversed()), [2];
30827
30909
  }
30828
30910
  });
30829
30911
  });
@@ -30831,6 +30913,8 @@ var Tt = function () {
30831
30913
  return q(t, this);
30832
30914
  }, e.prototype.isVisible = function (t, e) {
30833
30915
  return L(this, t, e);
30916
+ }, e.prototype.getClipRuleAttr = function (t, e) {
30917
+ return "evenodd" === N$1(t, e, "clip-rule") ? "evenodd" : void 0;
30834
30918
  }, e;
30835
30919
  }(J);
30836
30920
  function Gt(e, r) {
@@ -30882,13 +30966,13 @@ function Gt(e, r) {
30882
30966
  i = new Ot(e, n);
30883
30967
  break;
30884
30968
  case "polyline":
30885
- i = new Ht(e, n);
30969
+ i = new Rt(e, n);
30886
30970
  break;
30887
30971
  case "radialgradient":
30888
30972
  i = new et(e, n);
30889
30973
  break;
30890
30974
  case "rect":
30891
- i = new yt(e, n);
30975
+ i = new bt(e, n);
30892
30976
  break;
30893
30977
  case "svg":
30894
30978
  i = new Dt(e, n);
@@ -30900,7 +30984,7 @@ function Gt(e, r) {
30900
30984
  i = new Ft(e, n);
30901
30985
  break;
30902
30986
  case "use":
30903
- i = new bt(e, n);
30987
+ i = new yt(e, n);
30904
30988
  break;
30905
30989
  default:
30906
30990
  i = new Lt(e, n);
@@ -31053,11 +31137,11 @@ var Ut = function () {
31053
31137
  }();
31054
31138
  function Yt(t, e) {
31055
31139
  return f$1(this, arguments, void 0, function (t, e, r) {
31056
- var i, n, a, s, o, l, u, f, p, d, m, y, v, x;
31140
+ var i, n, a, s, o, l, u, f, p, d, m, b, v, x;
31057
31141
  return void 0 === r && (r = {}), c$2(this, function (c) {
31058
31142
  switch (c.label) {
31059
31143
  case 0:
31060
- return i = null !== (y = r.x) && void 0 !== y ? y : 0, n = null !== (v = r.y) && void 0 !== v ? v : 0, a = null !== (x = r.loadExternalStyleSheets) && void 0 !== x && x, o = new b(s = {}), [4, (l = new Ut(t, a)).load()];
31144
+ return i = null !== (b = r.x) && void 0 !== b ? b : 0, n = null !== (v = r.y) && void 0 !== v ? v : 0, a = null !== (x = r.loadExternalStyleSheets) && void 0 !== x && x, o = new y$1(s = {}), [4, (l = new Ut(t, a)).load()];
31061
31145
  case 1:
31062
31146
  return c.sent(), u = new gt(e.internal.pageSize.getWidth(), e.internal.pageSize.getHeight()), f = h$1(h$1({}, r), {
31063
31147
  element: t
@@ -31191,7 +31275,7 @@ const svgToString = (elem, indent) => {
31191
31275
  out.push(' ');
31192
31276
  }
31193
31277
  out.push('<');
31194
- out.push(elem.nodeName);
31278
+ out.push(elem.localName);
31195
31279
  if (elem.id === 'svgcontent') {
31196
31280
  // Process root element separately
31197
31281
  const res = svgCanvas$2.getResolution();
@@ -31364,7 +31448,7 @@ const svgToString = (elem, indent) => {
31364
31448
  }
31365
31449
  }
31366
31450
  out.push('</');
31367
- out.push(elem.nodeName);
31451
+ out.push(elem.localName);
31368
31452
  out.push('>');
31369
31453
  } else {
31370
31454
  out.push('/>');
@@ -31440,7 +31524,8 @@ const setSvgString = (xmlString, preventUndo) => {
31440
31524
  // const url = decodeURIComponent(m.groups.url);
31441
31525
  const iimg = new Image();
31442
31526
  iimg.addEventListener('load', () => {
31443
- image.setAttributeNS(NS.XLINK, 'xlink:href', url);
31527
+ // Set the href attribute to the data URL
31528
+ setHref(image, val);
31444
31529
  });
31445
31530
  iimg.src = url;
31446
31531
  }
@@ -31822,7 +31907,7 @@ const convertImagesToBase64 = async svgElement => {
31822
31907
  const reader = new FileReader();
31823
31908
  return new Promise(resolve => {
31824
31909
  reader.onload = () => {
31825
- img.setAttribute('xlink:href', reader.result);
31910
+ setHref(img, reader.result);
31826
31911
  resolve();
31827
31912
  };
31828
31913
  reader.readAsDataURL(blob);
@@ -43636,10 +43721,10 @@ function requireSharedStore () {
43636
43721
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
43637
43722
 
43638
43723
  (store.versions || (store.versions = [])).push({
43639
- version: '3.41.0',
43724
+ version: '3.43.0',
43640
43725
  mode: IS_PURE ? 'pure' : 'global',
43641
43726
  copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
43642
- license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
43727
+ license: 'https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE',
43643
43728
  source: 'https://github.com/zloirock/core-js'
43644
43729
  });
43645
43730
  return sharedStore.exports;
@@ -43707,7 +43792,7 @@ function requireUid () {
43707
43792
 
43708
43793
  var id = 0;
43709
43794
  var postfix = Math.random();
43710
- var toString = uncurryThis(1.0.toString);
43795
+ var toString = uncurryThis(1.1.toString);
43711
43796
 
43712
43797
  uid = function (key) {
43713
43798
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
@@ -44644,6 +44729,18 @@ function requireEnvironmentIsNode () {
44644
44729
  return environmentIsNode;
44645
44730
  }
44646
44731
 
44732
+ var path;
44733
+ var hasRequiredPath;
44734
+
44735
+ function requirePath () {
44736
+ if (hasRequiredPath) return path;
44737
+ hasRequiredPath = 1;
44738
+ var globalThis = requireGlobalThis();
44739
+
44740
+ path = globalThis;
44741
+ return path;
44742
+ }
44743
+
44647
44744
  var functionUncurryThisAccessor;
44648
44745
  var hasRequiredFunctionUncurryThisAccessor;
44649
44746
 
@@ -45507,6 +45604,7 @@ function requireEs_promise_constructor () {
45507
45604
  var IS_PURE = requireIsPure();
45508
45605
  var IS_NODE = requireEnvironmentIsNode();
45509
45606
  var globalThis = requireGlobalThis();
45607
+ var path = requirePath();
45510
45608
  var call = requireFunctionCall();
45511
45609
  var defineBuiltIn = requireDefineBuiltIn();
45512
45610
  var setPrototypeOf = requireObjectSetPrototypeOf();
@@ -45790,6 +45888,8 @@ function requireEs_promise_constructor () {
45790
45888
  Promise: PromiseConstructor
45791
45889
  });
45792
45890
 
45891
+ PromiseWrapper = path.Promise;
45892
+
45793
45893
  setToStringTag(PromiseConstructor, PROMISE, false, true);
45794
45894
  setSpecies(PROMISE);
45795
45895
  return es_promise_constructor;
@@ -45938,7 +46038,7 @@ function requireIterate () {
45938
46038
  var iterator, iterFn, index, length, result, next, step;
45939
46039
 
45940
46040
  var stop = function (condition) {
45941
- if (iterator) iteratorClose(iterator, 'normal', condition);
46041
+ if (iterator) iteratorClose(iterator, 'normal');
45942
46042
  return new Result(true, condition);
45943
46043
  };
45944
46044
 
@@ -46827,6 +46927,85 @@ function requireAdvanceStringIndex () {
46827
46927
  return advanceStringIndex;
46828
46928
  }
46829
46929
 
46930
+ var regexpFlagsDetection;
46931
+ var hasRequiredRegexpFlagsDetection;
46932
+
46933
+ function requireRegexpFlagsDetection () {
46934
+ if (hasRequiredRegexpFlagsDetection) return regexpFlagsDetection;
46935
+ hasRequiredRegexpFlagsDetection = 1;
46936
+ var globalThis = requireGlobalThis();
46937
+ var fails = requireFails();
46938
+
46939
+ // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError
46940
+ var RegExp = globalThis.RegExp;
46941
+
46942
+ var FLAGS_GETTER_IS_CORRECT = !fails(function () {
46943
+ var INDICES_SUPPORT = true;
46944
+ try {
46945
+ RegExp('.', 'd');
46946
+ } catch (error) {
46947
+ INDICES_SUPPORT = false;
46948
+ }
46949
+
46950
+ var O = {};
46951
+ // modern V8 bug
46952
+ var calls = '';
46953
+ var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy';
46954
+
46955
+ var addGetter = function (key, chr) {
46956
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
46957
+ Object.defineProperty(O, key, { get: function () {
46958
+ calls += chr;
46959
+ return true;
46960
+ } });
46961
+ };
46962
+
46963
+ var pairs = {
46964
+ dotAll: 's',
46965
+ global: 'g',
46966
+ ignoreCase: 'i',
46967
+ multiline: 'm',
46968
+ sticky: 'y'
46969
+ };
46970
+
46971
+ if (INDICES_SUPPORT) pairs.hasIndices = 'd';
46972
+
46973
+ for (var key in pairs) addGetter(key, pairs[key]);
46974
+
46975
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
46976
+ var result = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(O);
46977
+
46978
+ return result !== expected || calls !== expected;
46979
+ });
46980
+
46981
+ regexpFlagsDetection = { correct: FLAGS_GETTER_IS_CORRECT };
46982
+ return regexpFlagsDetection;
46983
+ }
46984
+
46985
+ var regexpGetFlags;
46986
+ var hasRequiredRegexpGetFlags;
46987
+
46988
+ function requireRegexpGetFlags () {
46989
+ if (hasRequiredRegexpGetFlags) return regexpGetFlags;
46990
+ hasRequiredRegexpGetFlags = 1;
46991
+ var call = requireFunctionCall();
46992
+ var hasOwn = requireHasOwnProperty();
46993
+ var isPrototypeOf = requireObjectIsPrototypeOf();
46994
+ var regExpFlagsDetection = requireRegexpFlagsDetection();
46995
+ var regExpFlagsGetterImplementation = requireRegexpFlags();
46996
+
46997
+ var RegExpPrototype = RegExp.prototype;
46998
+
46999
+ regexpGetFlags = regExpFlagsDetection.correct ? function (it) {
47000
+ return it.flags;
47001
+ } : function (it) {
47002
+ return (!regExpFlagsDetection.correct && isPrototypeOf(RegExpPrototype, it) && !hasOwn(it, 'flags'))
47003
+ ? call(regExpFlagsGetterImplementation, it)
47004
+ : it.flags;
47005
+ };
47006
+ return regexpGetFlags;
47007
+ }
47008
+
46830
47009
  var regexpExecAbstract;
46831
47010
  var hasRequiredRegexpExecAbstract;
46832
47011
 
@@ -46862,16 +47041,20 @@ function requireEs_string_match () {
46862
47041
  if (hasRequiredEs_string_match) return es_string_match;
46863
47042
  hasRequiredEs_string_match = 1;
46864
47043
  var call = requireFunctionCall();
47044
+ var uncurryThis = requireFunctionUncurryThis();
46865
47045
  var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic();
46866
47046
  var anObject = requireAnObject();
46867
- var isNullOrUndefined = requireIsNullOrUndefined();
47047
+ var isObject = requireIsObject();
46868
47048
  var toLength = requireToLength();
46869
47049
  var toString = requireToString();
46870
47050
  var requireObjectCoercible = requireRequireObjectCoercible();
46871
47051
  var getMethod = requireGetMethod();
46872
47052
  var advanceStringIndex = requireAdvanceStringIndex();
47053
+ var getRegExpFlags = requireRegexpGetFlags();
46873
47054
  var regExpExec = requireRegexpExecAbstract();
46874
47055
 
47056
+ var stringIndexOf = uncurryThis(''.indexOf);
47057
+
46875
47058
  // @@match logic
46876
47059
  fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
46877
47060
  return [
@@ -46879,7 +47062,7 @@ function requireEs_string_match () {
46879
47062
  // https://tc39.es/ecma262/#sec-string.prototype.match
46880
47063
  function match(regexp) {
46881
47064
  var O = requireObjectCoercible(this);
46882
- var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);
47065
+ var matcher = isObject(regexp) ? getMethod(regexp, MATCH) : undefined;
46883
47066
  return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O));
46884
47067
  },
46885
47068
  // `RegExp.prototype[@@match]` method
@@ -46891,9 +47074,11 @@ function requireEs_string_match () {
46891
47074
 
46892
47075
  if (res.done) return res.value;
46893
47076
 
46894
- if (!rx.global) return regExpExec(rx, S);
47077
+ var flags = toString(getRegExpFlags(rx));
46895
47078
 
46896
- var fullUnicode = rx.unicode;
47079
+ if (stringIndexOf(flags, 'g') === -1) return regExpExec(rx, S);
47080
+
47081
+ var fullUnicode = stringIndexOf(flags, 'u') !== -1;
46897
47082
  rx.lastIndex = 0;
46898
47083
  var A = [];
46899
47084
  var n = 0;
@@ -46981,7 +47166,7 @@ function requireEs_string_replace () {
46981
47166
  var fails = requireFails();
46982
47167
  var anObject = requireAnObject();
46983
47168
  var isCallable = requireIsCallable();
46984
- var isNullOrUndefined = requireIsNullOrUndefined();
47169
+ var isObject = requireIsObject();
46985
47170
  var toIntegerOrInfinity = requireToIntegerOrInfinity();
46986
47171
  var toLength = requireToLength();
46987
47172
  var toString = requireToString();
@@ -46989,6 +47174,7 @@ function requireEs_string_replace () {
46989
47174
  var advanceStringIndex = requireAdvanceStringIndex();
46990
47175
  var getMethod = requireGetMethod();
46991
47176
  var getSubstitution = requireGetSubstitution();
47177
+ var getRegExpFlags = requireRegexpGetFlags();
46992
47178
  var regExpExec = requireRegexpExecAbstract();
46993
47179
  var wellKnownSymbol = requireWellKnownSymbol();
46994
47180
 
@@ -47039,7 +47225,7 @@ function requireEs_string_replace () {
47039
47225
  // https://tc39.es/ecma262/#sec-string.prototype.replace
47040
47226
  function replace(searchValue, replaceValue) {
47041
47227
  var O = requireObjectCoercible(this);
47042
- var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
47228
+ var replacer = isObject(searchValue) ? getMethod(searchValue, REPLACE) : undefined;
47043
47229
  return replacer
47044
47230
  ? call(replacer, searchValue, O, replaceValue)
47045
47231
  : call(nativeReplace, toString(O), searchValue, replaceValue);
@@ -47062,10 +47248,11 @@ function requireEs_string_replace () {
47062
47248
  var functionalReplace = isCallable(replaceValue);
47063
47249
  if (!functionalReplace) replaceValue = toString(replaceValue);
47064
47250
 
47065
- var global = rx.global;
47251
+ var flags = toString(getRegExpFlags(rx));
47252
+ var global = stringIndexOf(flags, 'g') !== -1;
47066
47253
  var fullUnicode;
47067
47254
  if (global) {
47068
- fullUnicode = rx.unicode;
47255
+ fullUnicode = stringIndexOf(flags, 'u') !== -1;
47069
47256
  rx.lastIndex = 0;
47070
47257
  }
47071
47258
 
@@ -47871,7 +48058,7 @@ function requireEs_string_split () {
47871
48058
  var uncurryThis = requireFunctionUncurryThis();
47872
48059
  var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic();
47873
48060
  var anObject = requireAnObject();
47874
- var isNullOrUndefined = requireIsNullOrUndefined();
48061
+ var isObject = requireIsObject();
47875
48062
  var requireObjectCoercible = requireRequireObjectCoercible();
47876
48063
  var speciesConstructor = requireSpeciesConstructor();
47877
48064
  var advanceStringIndex = requireAdvanceStringIndex();
@@ -47919,7 +48106,7 @@ function requireEs_string_split () {
47919
48106
  // https://tc39.es/ecma262/#sec-string.prototype.split
47920
48107
  function split(separator, limit) {
47921
48108
  var O = requireObjectCoercible(this);
47922
- var splitter = isNullOrUndefined(separator) ? undefined : getMethod(separator, SPLIT);
48109
+ var splitter = isObject(separator) ? getMethod(separator, SPLIT) : undefined;
47923
48110
  return splitter
47924
48111
  ? call(splitter, separator, O, limit)
47925
48112
  : call(internalSplit, toString(O), separator, limit);
@@ -48693,7 +48880,7 @@ function p(t, r, e, i) {
48693
48880
  h = 3 * n;
48694
48881
  return Math.abs(s) < a ? [-h / u] : function (t, r, e) {
48695
48882
  var i = t * t / 4 - r;
48696
- if (i < -1e-6) return [];
48883
+ if (i < -e) return [];
48697
48884
  if (i <= e) return [-t / 2];
48698
48885
  var a = Math.sqrt(i);
48699
48886
  return [-t / 2 - a, -t / 2 + a];
@@ -49103,27 +49290,6 @@ var O,
49103
49290
 
49104
49291
  var es_regexp_toString = {};
49105
49292
 
49106
- var regexpGetFlags;
49107
- var hasRequiredRegexpGetFlags;
49108
-
49109
- function requireRegexpGetFlags () {
49110
- if (hasRequiredRegexpGetFlags) return regexpGetFlags;
49111
- hasRequiredRegexpGetFlags = 1;
49112
- var call = requireFunctionCall();
49113
- var hasOwn = requireHasOwnProperty();
49114
- var isPrototypeOf = requireObjectIsPrototypeOf();
49115
- var regExpFlags = requireRegexpFlags();
49116
-
49117
- var RegExpPrototype = RegExp.prototype;
49118
-
49119
- regexpGetFlags = function (R) {
49120
- var flags = R.flags;
49121
- return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R)
49122
- ? call(regExpFlags, R) : flags;
49123
- };
49124
- return regexpGetFlags;
49125
- }
49126
-
49127
49293
  var hasRequiredEs_regexp_toString;
49128
49294
 
49129
49295
  function requireEs_regexp_toString () {
@@ -49347,13 +49513,13 @@ function processImageDataRGBA(imageData, topX, topY, width, height, radius) {
49347
49513
  stackIn = stackStart;
49348
49514
  stackOut = stackEnd;
49349
49515
  for (var x = 0; x < width; x++) {
49350
- var paInitial = aSum * mulSum >> shgSum;
49516
+ var paInitial = aSum * mulSum >>> shgSum;
49351
49517
  pixels[yi + 3] = paInitial;
49352
49518
  if (paInitial !== 0) {
49353
49519
  var _a2 = 255 / paInitial;
49354
- pixels[yi] = (rSum * mulSum >> shgSum) * _a2;
49355
- pixels[yi + 1] = (gSum * mulSum >> shgSum) * _a2;
49356
- pixels[yi + 2] = (bSum * mulSum >> shgSum) * _a2;
49520
+ pixels[yi] = (rSum * mulSum >>> shgSum) * _a2;
49521
+ pixels[yi + 1] = (gSum * mulSum >>> shgSum) * _a2;
49522
+ pixels[yi + 2] = (bSum * mulSum >>> shgSum) * _a2;
49357
49523
  } else {
49358
49524
  pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0;
49359
49525
  }
@@ -49442,12 +49608,12 @@ function processImageDataRGBA(imageData, topX, topY, width, height, radius) {
49442
49608
  stackOut = stackEnd;
49443
49609
  for (var _y = 0; _y < height; _y++) {
49444
49610
  var _p2 = yi << 2;
49445
- pixels[_p2 + 3] = _pa = _aSum * mulSum >> shgSum;
49611
+ pixels[_p2 + 3] = _pa = _aSum * mulSum >>> shgSum;
49446
49612
  if (_pa > 0) {
49447
49613
  _pa = 255 / _pa;
49448
- pixels[_p2] = (_rSum * mulSum >> shgSum) * _pa;
49449
- pixels[_p2 + 1] = (_gSum * mulSum >> shgSum) * _pa;
49450
- pixels[_p2 + 2] = (_bSum * mulSum >> shgSum) * _pa;
49614
+ pixels[_p2] = (_rSum * mulSum >>> shgSum) * _pa;
49615
+ pixels[_p2 + 1] = (_gSum * mulSum >>> shgSum) * _pa;
49616
+ pixels[_p2 + 2] = (_bSum * mulSum >>> shgSum) * _pa;
49451
49617
  } else {
49452
49618
  pixels[_p2] = pixels[_p2 + 1] = pixels[_p2 + 2] = 0;
49453
49619
  }
@@ -50863,9 +51029,9 @@ class Element {
50863
51029
  this.document = document;
50864
51030
  this.node = node;
50865
51031
  this.captureTextNodes = captureTextNodes;
50866
- this.attributes = {};
50867
- this.styles = {};
50868
- this.stylesSpecificity = {};
51032
+ this.attributes = Object.create(null);
51033
+ this.styles = Object.create(null);
51034
+ this.stylesSpecificity = Object.create(null);
50869
51035
  this.animationFrozen = false;
50870
51036
  this.animationFrozenValue = '';
50871
51037
  this.parent = null;
@@ -52288,9 +52454,9 @@ class TextElement extends RenderedElement {
52288
52454
  var isRTL = false; // we treat RTL like LTR
52289
52455
 
52290
52456
  var shift = 0;
52291
- if (textAnchor === 'start' && true || textAnchor === 'end' && isRTL) {
52457
+ if (textAnchor === 'start' && !isRTL || textAnchor === 'end' && isRTL) {
52292
52458
  shift = firstElement.x - this.minX;
52293
- } else if (textAnchor === 'end' && true || textAnchor === 'start' && isRTL) {
52459
+ } else if (textAnchor === 'end' && !isRTL || textAnchor === 'start' && isRTL) {
52294
52460
  shift = firstElement.x - this.maxX;
52295
52461
  } else {
52296
52462
  shift = firstElement.x - (this.minX + this.maxX) / 2;
@@ -53263,7 +53429,7 @@ class FontElement extends Element {
53263
53429
  constructor(document, node, captureTextNodes) {
53264
53430
  super(document, node, captureTextNodes);
53265
53431
  this.type = 'font';
53266
- this.glyphs = {};
53432
+ this.glyphs = Object.create(null);
53267
53433
  this.horizAdvX = this.getAttribute('horiz-adv-x').getNumber();
53268
53434
  var {
53269
53435
  definitions
@@ -53292,7 +53458,7 @@ class FontElement extends Element {
53292
53458
  this.isRTL = true;
53293
53459
  this.isArabic = true;
53294
53460
  if (typeof this.glyphs[glyph.unicode] === 'undefined') {
53295
- this.glyphs[glyph.unicode] = {};
53461
+ this.glyphs[glyph.unicode] = Object.create(null);
53296
53462
  }
53297
53463
  this.glyphs[glyph.unicode][glyph.arabicForm] = glyph;
53298
53464
  } else {
@@ -54777,9 +54943,9 @@ class Document {
54777
54943
  anonymousCrossOrigin
54778
54944
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
54779
54945
  this.canvg = canvg;
54780
- this.definitions = {};
54781
- this.styles = {};
54782
- this.stylesSpecificity = {};
54946
+ this.definitions = Object.create(null);
54947
+ this.styles = Object.create(null);
54948
+ this.stylesSpecificity = Object.create(null);
54783
54949
  this.images = [];
54784
54950
  this.fonts = [];
54785
54951
  this.emSizeStack = [];