@crystaldesign/planner-core 26.14.0-beta.4 → 26.14.0-beta.41

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.
@@ -234,9 +234,9 @@ function isDockingType(value) {
234
234
 
235
235
  /** Minimum x/y over all non-AV geometry of an SVG — the offset docking-point coordinates are corrected by. */
236
236
 
237
- function _createForOfIteratorHelper$7(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$7(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
238
- function _unsupportedIterableToArray$7(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$7(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$7(r, a) : void 0; } }
239
- function _arrayLikeToArray$7(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
237
+ function _createForOfIteratorHelper$8(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$8(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
238
+ function _unsupportedIterableToArray$8(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$8(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$8(r, a) : void 0; } }
239
+ function _arrayLikeToArray$8(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
240
240
  var COMMAND_PARAM_COUNT = {
241
241
  M: 2,
242
242
  L: 2,
@@ -445,7 +445,7 @@ function pathBoundingBox(d) {
445
445
  var previousQuadraticControl;
446
446
  var previousCommand = '';
447
447
  var hasGeometry = false;
448
- var _iterator = _createForOfIteratorHelper$7(commands),
448
+ var _iterator = _createForOfIteratorHelper$8(commands),
449
449
  _step;
450
450
  try {
451
451
  var _loop = function _loop() {
@@ -543,7 +543,7 @@ function pathBoundingBox(d) {
543
543
  }
544
544
  expand(current.x, current.y);
545
545
  expand(end.x, end.y);
546
- var _iterator2 = _createForOfIteratorHelper$7(cubicAxisExtrema(current.x, control1.x, control2.x, end.x)),
546
+ var _iterator2 = _createForOfIteratorHelper$8(cubicAxisExtrema(current.x, control1.x, control2.x, end.x)),
547
547
  _step2;
548
548
  try {
549
549
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -555,7 +555,7 @@ function pathBoundingBox(d) {
555
555
  } finally {
556
556
  _iterator2.f();
557
557
  }
558
- var _iterator3 = _createForOfIteratorHelper$7(cubicAxisExtrema(current.y, control1.y, control2.y, end.y)),
558
+ var _iterator3 = _createForOfIteratorHelper$8(cubicAxisExtrema(current.y, control1.y, control2.y, end.y)),
559
559
  _step3;
560
560
  try {
561
561
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -651,9 +651,9 @@ function pathBoundingBox(d) {
651
651
  };
652
652
  }
653
653
 
654
- function _createForOfIteratorHelper$6(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$6(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
655
- function _unsupportedIterableToArray$6(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$6(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$6(r, a) : void 0; } }
656
- function _arrayLikeToArray$6(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
654
+ function _createForOfIteratorHelper$7(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$7(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
655
+ function _unsupportedIterableToArray$7(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$7(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$7(r, a) : void 0; } }
656
+ function _arrayLikeToArray$7(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
657
657
  /** XPathResult.ORDERED_NODE_SNAPSHOT_TYPE — used numerically because XML documents do not always expose the constant. */
658
658
  var ORDERED_NODE_SNAPSHOT_TYPE = 7;
659
659
 
@@ -672,7 +672,7 @@ function snapshotByIdPrefix(xmlDocument, idPrefix) {
672
672
  function getDockingPointLines(content) {
673
673
  var dockingPointLines = [];
674
674
  var xmlDocument = parseXml(content);
675
- var _iterator = _createForOfIteratorHelper$6(snapshotByIdPrefix(xmlDocument, 'AV')),
675
+ var _iterator = _createForOfIteratorHelper$7(snapshotByIdPrefix(xmlDocument, 'AV')),
676
676
  _step;
677
677
  try {
678
678
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -716,7 +716,7 @@ function getPolygonPoints(content, idPrefix) {
716
716
  if (element.nodeName === 'polygon') {
717
717
  var pointsAsString = element.getAttribute('points');
718
718
  if (!pointsAsString) return undefined;
719
- var _iterator2 = _createForOfIteratorHelper$6(pointsAsString.split(' ')),
719
+ var _iterator2 = _createForOfIteratorHelper$7(pointsAsString.split(' ')),
720
720
  _step2;
721
721
  try {
722
722
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -761,7 +761,7 @@ function parsePointsAttribute(pointsAttribute) {
761
761
  }
762
762
  function geometryOfFirstShape(content, idPrefix) {
763
763
  var xmlDocument = parseXml(content);
764
- var _iterator3 = _createForOfIteratorHelper$6(snapshotByIdPrefix(xmlDocument, idPrefix)),
764
+ var _iterator3 = _createForOfIteratorHelper$7(snapshotByIdPrefix(xmlDocument, idPrefix)),
765
765
  _step3;
766
766
  try {
767
767
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -840,7 +840,7 @@ function removeMask(content) {
840
840
  if (content.toLowerCase().indexOf('<mask') < 0) return content;
841
841
  var xmlDocument = parseXml(content, 'image/svg+xml');
842
842
  var allElements = _toConsumableArray(xmlDocument.getElementsByTagName('*'));
843
- var _iterator4 = _createForOfIteratorHelper$6(allElements),
843
+ var _iterator4 = _createForOfIteratorHelper$7(allElements),
844
844
  _step4;
845
845
  try {
846
846
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -1071,9 +1071,9 @@ function getRootSize(content) {
1071
1071
  };
1072
1072
  }
1073
1073
 
1074
- function _createForOfIteratorHelper$5(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$5(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1075
- function _unsupportedIterableToArray$5(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$5(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0; } }
1076
- function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1074
+ function _createForOfIteratorHelper$6(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$6(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1075
+ function _unsupportedIterableToArray$6(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$6(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$6(r, a) : void 0; } }
1076
+ function _arrayLikeToArray$6(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1077
1077
  /**
1078
1078
  * Polygon `points` tokenizer: the pair separator is ',' when the string contains one, ' ' otherwise, so both
1079
1079
  * "x,y x,y" and "x y x y" parse. An all-comma list keeps the legacy misparse on purpose.
@@ -1085,7 +1085,7 @@ function parsePolygonPoints(pointsText) {
1085
1085
  var readingX = true;
1086
1086
  var x = '';
1087
1087
  var y = '';
1088
- var _iterator = _createForOfIteratorHelper$5(text),
1088
+ var _iterator = _createForOfIteratorHelper$6(text),
1089
1089
  _step;
1090
1090
  try {
1091
1091
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1123,7 +1123,7 @@ function parsePolygonPoints(pointsText) {
1123
1123
  /** Legacy points format: "x,y " pairs with a trailing space. */
1124
1124
  function serializePolygonPoints(points) {
1125
1125
  var result = '';
1126
- var _iterator2 = _createForOfIteratorHelper$5(points),
1126
+ var _iterator2 = _createForOfIteratorHelper$6(points),
1127
1127
  _step2;
1128
1128
  try {
1129
1129
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -1148,9 +1148,9 @@ function round2(value) {
1148
1148
  return Math.round(value * 100) / 100;
1149
1149
  }
1150
1150
 
1151
- function _createForOfIteratorHelper$4(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1152
- function _unsupportedIterableToArray$4(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$4(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0; } }
1153
- function _arrayLikeToArray$4(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1151
+ function _createForOfIteratorHelper$5(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$5(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1152
+ function _unsupportedIterableToArray$5(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$5(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0; } }
1153
+ function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1154
1154
 
1155
1155
  /** One stretch area projected onto the active axis; end is pre-rounded, as the legacy engine rounded it. */
1156
1156
 
@@ -1197,7 +1197,7 @@ function parsePathSafely(d, warn) {
1197
1197
  function stretchPathData(d, areas, axis, warn) {
1198
1198
  var commands = parsePathSafely(d, warn);
1199
1199
  if (!commands) return d;
1200
- var _iterator = _createForOfIteratorHelper$4(areas),
1200
+ var _iterator = _createForOfIteratorHelper$5(areas),
1201
1201
  _step;
1202
1202
  try {
1203
1203
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1205,7 +1205,7 @@ function stretchPathData(d, areas, axis, warn) {
1205
1205
  var delta = area.end - area.begin;
1206
1206
  // NaN start reproduces the legacy undefined `last` (all comparisons false, arithmetic stays NaN until an absolute command).
1207
1207
  var last = Number.NaN;
1208
- var _iterator2 = _createForOfIteratorHelper$4(commands),
1208
+ var _iterator2 = _createForOfIteratorHelper$5(commands),
1209
1209
  _step2;
1210
1210
  try {
1211
1211
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -1216,7 +1216,7 @@ function stretchPathData(d, areas, axis, warn) {
1216
1216
  if (absolute) {
1217
1217
  var value = params[absolute.track];
1218
1218
  if (value > area.begin) {
1219
- var _iterator3 = _createForOfIteratorHelper$4(absolute.shift),
1219
+ var _iterator3 = _createForOfIteratorHelper$5(absolute.shift),
1220
1220
  _step3;
1221
1221
  try {
1222
1222
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -1236,7 +1236,7 @@ function stretchPathData(d, areas, axis, warn) {
1236
1236
  if (relative) {
1237
1237
  var help = params[relative.help];
1238
1238
  if ((!relative.requireNonNegativeForward || help >= 0) && last < area.begin && last + help > area.begin) {
1239
- var _iterator4 = _createForOfIteratorHelper$4(relative.shift),
1239
+ var _iterator4 = _createForOfIteratorHelper$5(relative.shift),
1240
1240
  _step4;
1241
1241
  try {
1242
1242
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -1249,7 +1249,7 @@ function stretchPathData(d, areas, axis, warn) {
1249
1249
  _iterator4.f();
1250
1250
  }
1251
1251
  } else if (help < 0 && last >= area.begin && last + params[relative.backwardProbe] < area.begin) {
1252
- var _iterator5 = _createForOfIteratorHelper$4(relative.shift),
1252
+ var _iterator5 = _createForOfIteratorHelper$5(relative.shift),
1253
1253
  _step5;
1254
1254
  try {
1255
1255
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
@@ -1284,7 +1284,7 @@ function stretchPathData(d, areas, axis, warn) {
1284
1284
  function scalePathData(d, widthFactor, heightFactor, roundResults, warn) {
1285
1285
  var commands = parsePathSafely(d, warn);
1286
1286
  if (!commands) return d;
1287
- var _iterator6 = _createForOfIteratorHelper$4(commands),
1287
+ var _iterator6 = _createForOfIteratorHelper$5(commands),
1288
1288
  _step6;
1289
1289
  try {
1290
1290
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
@@ -1360,9 +1360,9 @@ function currentSizes(state) {
1360
1360
  };
1361
1361
  }
1362
1362
 
1363
- function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1364
- function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
1365
- function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1363
+ function _createForOfIteratorHelper$4(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1364
+ function _unsupportedIterableToArray$4(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$4(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0; } }
1365
+ function _arrayLikeToArray$4(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1366
1366
 
1367
1367
  /** ViewBox-to-attribute scale of the root element (1:1 for planner-conform articles). */
1368
1368
 
@@ -1435,7 +1435,7 @@ function scaleLineAttributes(line, scale) {
1435
1435
  function scalePolygonAttributes(polygon, scale) {
1436
1436
  var _polygon$getAttribute;
1437
1437
  var points = parsePolygonPoints((_polygon$getAttribute = polygon.getAttribute('points')) !== null && _polygon$getAttribute !== void 0 ? _polygon$getAttribute : '');
1438
- var _iterator = _createForOfIteratorHelper$3(points),
1438
+ var _iterator = _createForOfIteratorHelper$4(points),
1439
1439
  _step;
1440
1440
  try {
1441
1441
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1523,7 +1523,7 @@ function applyViewBoxScale(state, scale) {
1523
1523
  function ensureTeDisplayNone(document) {
1524
1524
  var teElements = snapshotByIdPrefix(document, 'TE');
1525
1525
  if (teElements.length === 0) {
1526
- var _iterator2 = _createForOfIteratorHelper$3(snapshotByIdPrefix(document, 'OLT')),
1526
+ var _iterator2 = _createForOfIteratorHelper$4(snapshotByIdPrefix(document, 'OLT')),
1527
1527
  _step2;
1528
1528
  try {
1529
1529
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -1539,7 +1539,7 @@ function ensureTeDisplayNone(document) {
1539
1539
  }
1540
1540
  teElements = snapshotByIdPrefix(document, 'TE');
1541
1541
  }
1542
- var _iterator3 = _createForOfIteratorHelper$3(teElements),
1542
+ var _iterator3 = _createForOfIteratorHelper$4(teElements),
1543
1543
  _step3;
1544
1544
  try {
1545
1545
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -1761,9 +1761,9 @@ var VERTICAL_AXIS = {
1761
1761
  }
1762
1762
  };
1763
1763
 
1764
- function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1765
- function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
1766
- function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1764
+ function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1765
+ function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
1766
+ function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1767
1767
  /** Elements that carry coordinates but have no transformer — they keep their position, which is worth a warning. */
1768
1768
  var UNTRANSFORMED_COORDINATE_ELEMENTS = ['circle', 'ellipse', 'text', 'tspan', 'use'];
1769
1769
 
@@ -1780,7 +1780,7 @@ function areaRanges(state, axis) {
1780
1780
  });
1781
1781
  }
1782
1782
  function stretchRect(rect, ranges, axis) {
1783
- var _iterator = _createForOfIteratorHelper$2(ranges),
1783
+ var _iterator = _createForOfIteratorHelper$3(ranges),
1784
1784
  _step;
1785
1785
  try {
1786
1786
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1812,7 +1812,7 @@ function scaleRect(rect, state) {
1812
1812
  rect.setAttribute('height', String(round3(height * state.globalScaleFactorHeight)));
1813
1813
  }
1814
1814
  function stretchLine(line, ranges, axis) {
1815
- var _iterator2 = _createForOfIteratorHelper$2(ranges),
1815
+ var _iterator2 = _createForOfIteratorHelper$3(ranges),
1816
1816
  _step2;
1817
1817
  try {
1818
1818
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -1848,7 +1848,7 @@ function transformPoints(element, mode, state) {
1848
1848
  var _element$getAttribute;
1849
1849
  var points = parsePolygonPoints((_element$getAttribute = element.getAttribute('points')) !== null && _element$getAttribute !== void 0 ? _element$getAttribute : '');
1850
1850
  if (mode === 'GLOBAL_SCALE') {
1851
- var _iterator3 = _createForOfIteratorHelper$2(points),
1851
+ var _iterator3 = _createForOfIteratorHelper$3(points),
1852
1852
  _step3;
1853
1853
  try {
1854
1854
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -1863,12 +1863,12 @@ function transformPoints(element, mode, state) {
1863
1863
  }
1864
1864
  } else {
1865
1865
  var axis = mode === 'SAH' ? HORIZONTAL_AXIS : VERTICAL_AXIS;
1866
- var _iterator4 = _createForOfIteratorHelper$2(areaRanges(state, axis)),
1866
+ var _iterator4 = _createForOfIteratorHelper$3(areaRanges(state, axis)),
1867
1867
  _step4;
1868
1868
  try {
1869
1869
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1870
1870
  var range = _step4.value;
1871
- var _iterator5 = _createForOfIteratorHelper$2(points),
1871
+ var _iterator5 = _createForOfIteratorHelper$3(points),
1872
1872
  _step5;
1873
1873
  try {
1874
1874
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
@@ -2037,6 +2037,363 @@ function resizeOutline(state, newWidth, newHeight, outline) {
2037
2037
  if (scale) applyStretchPass(state, 'GLOBAL_SCALE', outline);
2038
2038
  }
2039
2039
 
2040
+ function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
2041
+ function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
2042
+ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2043
+
2044
+ /**
2045
+ * Profile drawings: an article drawn as a stack of plates around one spine curve (e.g. the arches of a pool
2046
+ * enclosure). Stretching moves only the spine; every plate edge is rebuilt as a parallel offset of it, so plates
2047
+ * keep their thickness and gaps at any size, where the SAH/SAV areas would squeeze them.
2048
+ *
2049
+ * Opt-in through a `<g id="PROFILE…">` (usually inside TE, so viewers without this engine never show it), holding
2050
+ * the spine as one `<path>` of absolute M/L commands from foot to foot (feet on the OLT's bottom edge):
2051
+ * - `data-plates`: `in,out;in,out;…` — each plate's inner and outer edge as its distance outward from the spine.
2052
+ * - `data-k` (optional, default 1): heights are multiplied by k for the offsets, so a plate steps `d` sideways but
2053
+ * `d / k` upwards (box profiles whose top plates are thicker than their legs).
2054
+ * - `data-parts` (optional): `in,out,from,to;…` — plates over part of the spine only (e.g. a sliding door), from/to
2055
+ * as fractional spine vertex indices; their ends stay square to the spine.
2056
+ * The drawing in VIT stays as the fallback for other viewers; this engine replaces it with the rebuilt plates.
2057
+ *
2058
+ * Not IDM compatible: a DIVA-only extension of the article SVG, implemented for the Polyfaser pool enclosure roofs
2059
+ * (ART_SIDE_DACH_*). IDM and every other SVG consumer ignore the group and show the VIT drawing.
2060
+ */
2061
+
2062
+ var PROFILE_PREFIX = 'PROFILE';
2063
+ /** A knee sharper than this keeps a bevel instead of a miter point (miter length / offset). */
2064
+ var MITER_LIMIT = 8;
2065
+ function parsePairs(text, size) {
2066
+ if (!text) return [];
2067
+ return text.split(';').map(function (group) {
2068
+ return group.split(',');
2069
+ })
2070
+ // an empty field would read as 0 (`Number('')`)
2071
+ .filter(function (fields) {
2072
+ return fields.length === size && fields.every(function (field) {
2073
+ return field.trim() !== '' && Number.isFinite(Number(field));
2074
+ });
2075
+ }).map(function (fields) {
2076
+ return fields.map(Number);
2077
+ });
2078
+ }
2079
+ var COPIED_ATTRIBUTES = ['class', 'fill', 'stroke', 'stroke-width'];
2080
+
2081
+ /** The path's `class` and presentation attributes (`fill`, `stroke`, `stroke-width`) that it sets. */
2082
+ function presentationAttributes(path) {
2083
+ return COPIED_ATTRIBUTES.flatMap(function (name) {
2084
+ var value = path === null || path === void 0 ? void 0 : path.getAttribute(name);
2085
+ return value != null ? [[name, value]] : [];
2086
+ });
2087
+ }
2088
+
2089
+ /** Absolute M/L points of a path `d`; any other command makes the spine unusable. */
2090
+ function parseSpine(d) {
2091
+ var _d$trim$match;
2092
+ var tokens = (_d$trim$match = d.trim().match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/g)) !== null && _d$trim$match !== void 0 ? _d$trim$match : [];
2093
+ var points = [];
2094
+ var i = 0;
2095
+ while (i < tokens.length) {
2096
+ var token = tokens[i];
2097
+ if (token === 'M' || token === 'L') {
2098
+ var x = Number(tokens[i + 1]);
2099
+ var y = Number(tokens[i + 2]);
2100
+ if (!Number.isFinite(x) || !Number.isFinite(y)) return undefined;
2101
+ points.push({
2102
+ x: x,
2103
+ y: y
2104
+ });
2105
+ i += 3;
2106
+ } else if (/^-?\d/.test(token) || token.startsWith('.') || token.startsWith('-.')) {
2107
+ // implicit L after an M/L pair
2108
+ var _x = Number(token);
2109
+ var _y = Number(tokens[i + 1]);
2110
+ if (!Number.isFinite(_x) || !Number.isFinite(_y)) return undefined;
2111
+ points.push({
2112
+ x: _x,
2113
+ y: _y
2114
+ });
2115
+ i += 2;
2116
+ } else if (token === 'Z' || token === 'z') {
2117
+ i += 1;
2118
+ } else {
2119
+ return undefined;
2120
+ }
2121
+ }
2122
+ return points.length >= 2 ? points : undefined;
2123
+ }
2124
+
2125
+ /**
2126
+ * Takes the profile groups out of the document (before any stretch pass touches them) and returns their specs.
2127
+ * A group without a usable spine or plates is dropped with a warning: the article then shows its VIT drawing.
2128
+ */
2129
+ function takeProfiles(document, warn) {
2130
+ var _snapshotByIdPrefix$;
2131
+ var specs = [];
2132
+ var firstVitPath = (_snapshotByIdPrefix$ = snapshotByIdPrefix(document, 'VIT')[0]) === null || _snapshotByIdPrefix$ === void 0 ? void 0 : _snapshotByIdPrefix$.getElementsByTagName('path')[0];
2133
+ var _iterator = _createForOfIteratorHelper$2(snapshotByIdPrefix(document, PROFILE_PREFIX)),
2134
+ _step;
2135
+ try {
2136
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2137
+ var _spinePath$getAttribu, _group$getAttribute, _group$parentNode, _firstVitPath$getAttr;
2138
+ var group = _step.value;
2139
+ var spinePath = group.getElementsByTagName('path')[0];
2140
+ var spine = spinePath ? parseSpine((_spinePath$getAttribu = spinePath.getAttribute('d')) !== null && _spinePath$getAttribu !== void 0 ? _spinePath$getAttribu : '') : undefined;
2141
+ var plates = parsePairs(group.getAttribute('data-plates'), 2);
2142
+ var parts = parsePairs(group.getAttribute('data-parts'), 4);
2143
+ var k = Number((_group$getAttribute = group.getAttribute('data-k')) !== null && _group$getAttribute !== void 0 ? _group$getAttribute : '1');
2144
+ (_group$parentNode = group.parentNode) === null || _group$parentNode === void 0 || _group$parentNode.removeChild(group);
2145
+ if (!spine || plates.length === 0 || !(Number.isFinite(k) && k > 0)) {
2146
+ var _group$getAttribute2;
2147
+ warn("stretch: profile '".concat((_group$getAttribute2 = group.getAttribute('id')) !== null && _group$getAttribute2 !== void 0 ? _group$getAttribute2 : '', "' has no usable spine or plates and is ignored"));
2148
+ continue;
2149
+ }
2150
+ specs.push({
2151
+ spine: spine,
2152
+ plates: plates,
2153
+ parts: parts,
2154
+ k: k,
2155
+ style: (_firstVitPath$getAttr = firstVitPath === null || firstVitPath === void 0 ? void 0 : firstVitPath.getAttribute('style')) !== null && _firstVitPath$getAttr !== void 0 ? _firstVitPath$getAttr : null,
2156
+ attributes: presentationAttributes(firstVitPath)
2157
+ });
2158
+ }
2159
+ } catch (err) {
2160
+ _iterator.e(err);
2161
+ } finally {
2162
+ _iterator.f();
2163
+ }
2164
+ return specs;
2165
+ }
2166
+
2167
+ /** Outward unit normal of segment a→b; with the spine running from the left foot over the top to the right foot, outward is away from the enclosed space. */
2168
+ function normal(a, b) {
2169
+ var dx = b.x - a.x;
2170
+ var dy = b.y - a.y;
2171
+ var length = Math.hypot(dx, dy) || 1;
2172
+ return {
2173
+ x: dy / length,
2174
+ y: -dx / length
2175
+ };
2176
+ }
2177
+
2178
+ /** The polyline moved `d` along its outward normals, with mitered joins (beveled past MITER_LIMIT). */
2179
+ function offsetPolyline(points, d) {
2180
+ var normals = points.slice(1).map(function (p, i) {
2181
+ return normal(points[i], p);
2182
+ });
2183
+ var out = [];
2184
+ points.forEach(function (p, i) {
2185
+ if (i === 0 || i === points.length - 1) {
2186
+ var n = normals[Math.min(i, normals.length - 1)];
2187
+ out.push({
2188
+ x: p.x + n.x * d,
2189
+ y: p.y + n.y * d
2190
+ });
2191
+ return;
2192
+ }
2193
+ var n1 = normals[i - 1];
2194
+ var n2 = normals[i];
2195
+ var dot = n1.x * n2.x + n1.y * n2.y;
2196
+ var scale = 1 + dot > 2 / (MITER_LIMIT * MITER_LIMIT) ? d / (1 + dot) : undefined;
2197
+ if (scale === undefined) {
2198
+ out.push({
2199
+ x: p.x + n1.x * d,
2200
+ y: p.y + n1.y * d
2201
+ }, {
2202
+ x: p.x + n2.x * d,
2203
+ y: p.y + n2.y * d
2204
+ });
2205
+ } else {
2206
+ out.push({
2207
+ x: p.x + (n1.x + n2.x) * scale,
2208
+ y: p.y + (n1.y + n2.y) * scale
2209
+ });
2210
+ }
2211
+ });
2212
+ return out;
2213
+ }
2214
+
2215
+ /** Moves an end point along its end segment onto the ground line (y = ground), up or down. */
2216
+ function toGround(end, next, ground) {
2217
+ if (Math.abs(end.y - next.y) < 1e-9) return end;
2218
+ var t = (ground - end.y) / (end.y - next.y);
2219
+ return {
2220
+ x: end.x + (end.x - next.x) * t,
2221
+ y: ground
2222
+ };
2223
+ }
2224
+
2225
+ /** The spine between two fractional vertex indices. */
2226
+ function subSpine(points, from, to) {
2227
+ var at = function at(index) {
2228
+ var i = Math.min(Math.max(Math.floor(index), 0), points.length - 2);
2229
+ var t = Math.min(Math.max(index - i, 0), 1);
2230
+ return {
2231
+ x: points[i].x + (points[i + 1].x - points[i].x) * t,
2232
+ y: points[i].y + (points[i + 1].y - points[i].y) * t
2233
+ };
2234
+ };
2235
+ var _ref = from <= to ? [from, to] : [to, from],
2236
+ _ref2 = _slicedToArray(_ref, 2),
2237
+ a = _ref2[0],
2238
+ b = _ref2[1];
2239
+ var inner = points.filter(function (_, i) {
2240
+ return i > a && i < b;
2241
+ });
2242
+ return [at(a)].concat(_toConsumableArray(inner), [at(b)]);
2243
+ }
2244
+
2245
+ /** The outlines' stroke width: the inline style wins over the presentation attribute, as in the CSS cascade. */
2246
+ function strokeWidth(spec) {
2247
+ var _spec$style, _spec$attributes$find;
2248
+ var match = (_spec$style = spec.style) === null || _spec$style === void 0 ? void 0 : _spec$style.match(/stroke-width:\s*([\d.]+)/);
2249
+ var attribute = (_spec$attributes$find = spec.attributes.find(function (_ref3) {
2250
+ var _ref4 = _slicedToArray(_ref3, 1),
2251
+ name = _ref4[0];
2252
+ return name === 'stroke-width';
2253
+ })) === null || _spec$attributes$find === void 0 ? void 0 : _spec$attributes$find[1];
2254
+ var width = match ? Number(match[1]) : Number.parseFloat(attribute !== null && attribute !== void 0 ? attribute : '');
2255
+ return Number.isFinite(width) ? width : 0;
2256
+ }
2257
+
2258
+ /**
2259
+ * Maps x linearly so the outermost plate's feet stand on the OLT's bottom corners, its stroke inside the OLT like the
2260
+ * drawn feet: the offsets land the feet wherever the plate thicknesses put them, not on the rails.
2261
+ */
2262
+ function standOnOlt(outlines, outermost, ground, left, right) {
2263
+ var feet = outermost.filter(function (p) {
2264
+ return Math.abs(p.y - ground) < 1e-6;
2265
+ }).map(function (p) {
2266
+ return p.x;
2267
+ });
2268
+ var from = Math.min.apply(Math, _toConsumableArray(feet));
2269
+ var to = Math.max.apply(Math, _toConsumableArray(feet));
2270
+ if (!(to > from)) return outlines;
2271
+ var scale = (right - left) / (to - from);
2272
+ return outlines.map(function (outline) {
2273
+ return outline.map(function (p) {
2274
+ return {
2275
+ x: left + (p.x - from) * scale,
2276
+ y: p.y
2277
+ };
2278
+ });
2279
+ });
2280
+ }
2281
+ function pathData(points) {
2282
+ return 'M' + points.map(function (p) {
2283
+ return "".concat(round3(p.x), ",").concat(round3(p.y));
2284
+ }).join(' L') + ' Z';
2285
+ }
2286
+
2287
+ /**
2288
+ * Rebuilds the profiles for the stretched size and replaces the VIT drawing with them. The spine's left foot stays,
2289
+ * its right foot moves with the OLT's right edge, everything between is spread evenly; heights follow the OLT height.
2290
+ * The outermost plate's feet then stand on the OLT's bottom corners.
2291
+ */
2292
+ function renderProfiles(state, specs) {
2293
+ if (specs.length === 0) return;
2294
+ var vit = snapshotByIdPrefix(state.document, 'VIT')[0];
2295
+ if (!vit) return;
2296
+ var widthDelta = state.widthOlt - state.origOltWidth;
2297
+ var top = state.startHeightOlt;
2298
+ var heightScale = state.origOltHeight > 0 ? state.heightOlt / state.origOltHeight : 1;
2299
+ var ground = top + state.heightOlt;
2300
+ while (vit.firstChild) vit.removeChild(vit.firstChild);
2301
+ var _iterator2 = _createForOfIteratorHelper$2(specs),
2302
+ _step2;
2303
+ try {
2304
+ var _loop = function _loop() {
2305
+ var spec = _step2.value;
2306
+ var left = spec.spine[0].x;
2307
+ var right = spec.spine[spec.spine.length - 1].x;
2308
+ var spread = right - left !== 0 ? (right + widthDelta - left) / (right - left) : 1;
2309
+ // stretched spine, in the offset space (heights times k)
2310
+ var spine = spec.spine.map(function (p) {
2311
+ return {
2312
+ x: left + (p.x - left) * spread,
2313
+ y: (top + (p.y - top) * heightScale) * spec.k
2314
+ };
2315
+ });
2316
+ var back = function back(points) {
2317
+ return points.map(function (p) {
2318
+ return {
2319
+ x: p.x,
2320
+ y: p.y / spec.k
2321
+ };
2322
+ });
2323
+ };
2324
+ var plate = function plate(inner, outer, points, grounded) {
2325
+ var a = back(offsetPolyline(points, inner));
2326
+ var b = back(offsetPolyline(points, outer));
2327
+ if (grounded) {
2328
+ var ends = function ends(line) {
2329
+ return [toGround(line[0], line[1], ground)].concat(_toConsumableArray(line.slice(1, -1)), [toGround(line[line.length - 1], line[line.length - 2], ground)]);
2330
+ };
2331
+ a = ends(a);
2332
+ b = ends(b);
2333
+ }
2334
+ return [].concat(_toConsumableArray(a), _toConsumableArray(b.reverse()));
2335
+ };
2336
+ var plates = spec.plates.map(function (_ref5) {
2337
+ var _ref6 = _slicedToArray(_ref5, 2),
2338
+ inner = _ref6[0],
2339
+ outer = _ref6[1];
2340
+ return plate(inner, outer, spine, true);
2341
+ });
2342
+ var parts = spec.parts.map(function (_ref7) {
2343
+ var _ref8 = _slicedToArray(_ref7, 4),
2344
+ inner = _ref8[0],
2345
+ outer = _ref8[1],
2346
+ from = _ref8[2],
2347
+ to = _ref8[3];
2348
+ return plate(inner, outer, subSpine(spine, from, to), false);
2349
+ });
2350
+ var outermost = plates[spec.plates.reduce(function (best, _ref9, i) {
2351
+ var _ref10 = _slicedToArray(_ref9, 2),
2352
+ outer = _ref10[1];
2353
+ return outer > spec.plates[best][1] ? i : best;
2354
+ }, 0)];
2355
+ var half = strokeWidth(spec) / 2;
2356
+ var outlines = standOnOlt([].concat(_toConsumableArray(plates), _toConsumableArray(parts)), outermost, ground, state.startWidthOlt + half, state.startWidthOlt + state.widthOlt - half);
2357
+ var _iterator3 = _createForOfIteratorHelper$2(outlines),
2358
+ _step3;
2359
+ try {
2360
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2361
+ var outline = _step3.value;
2362
+ var path = state.document.createElementNS(vit.namespaceURI, 'path');
2363
+ var _iterator4 = _createForOfIteratorHelper$2(spec.attributes),
2364
+ _step4;
2365
+ try {
2366
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2367
+ var _step4$value = _slicedToArray(_step4.value, 2),
2368
+ name = _step4$value[0],
2369
+ value = _step4$value[1];
2370
+ path.setAttribute(name, value);
2371
+ }
2372
+ } catch (err) {
2373
+ _iterator4.e(err);
2374
+ } finally {
2375
+ _iterator4.f();
2376
+ }
2377
+ if (spec.style) path.setAttribute('style', spec.style);
2378
+ path.setAttribute('d', pathData(outline));
2379
+ vit.appendChild(path);
2380
+ }
2381
+ } catch (err) {
2382
+ _iterator3.e(err);
2383
+ } finally {
2384
+ _iterator3.f();
2385
+ }
2386
+ };
2387
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2388
+ _loop();
2389
+ }
2390
+ } catch (err) {
2391
+ _iterator2.e(err);
2392
+ } finally {
2393
+ _iterator2.f();
2394
+ }
2395
+ }
2396
+
2040
2397
  function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
2041
2398
  function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
2042
2399
  function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -2382,6 +2739,11 @@ function stretchArticleSvg(svg, targetWidthCm, targetDepthCm) {
2382
2739
  if (state.targetWidthOlt === 0) origWidthCm = parseFloat((_root$getAttribute3 = root.getAttribute('width')) !== null && _root$getAttribute3 !== void 0 ? _root$getAttribute3 : '');
2383
2740
  if (state.targetHeightOlt === 0) state.targetHeightOlt = parseFloat((_root$getAttribute4 = root.getAttribute('height')) !== null && _root$getAttribute4 !== void 0 ? _root$getAttribute4 : '');
2384
2741
  ensureTeDisplayNone(xmlDocument);
2742
+ // profile drawings rebuild their plates from the spine instead of stretching them (not in global-scale mode);
2743
+ // DIVA-only, not IDM compatible (Polyfaser roofs), see profile.ts
2744
+ var profiles = options.useGlobalScale ? [] : takeProfiles(xmlDocument, function (message) {
2745
+ return addWarning(state, message);
2746
+ });
2385
2747
  prepareStretchGeometry(state);
2386
2748
  // a kept axis targets its measured OLT, so resizeOutline leaves it alone; a global scale gets factor 1 instead of NaN
2387
2749
  if (options.keepWidth) {
@@ -2399,6 +2761,7 @@ function stretchArticleSvg(svg, targetWidthCm, targetDepthCm) {
2399
2761
 
2400
2762
  // the early exit keeps the canvas origin, which only matches a caller that measured no minBorder
2401
2763
  if (!options.keepWidth && !options.keepDepth && targetWidthCm === origWidthCm && targetDepthCm === origDepthCm) {
2764
+ renderProfiles(state, profiles);
2402
2765
  return {
2403
2766
  svg: serializeXml(xmlDocument),
2404
2767
  sizes: currentSizes(state),
@@ -2407,6 +2770,7 @@ function stretchArticleSvg(svg, targetWidthCm, targetDepthCm) {
2407
2770
  }
2408
2771
  resizeOutline(state, state.targetWidthOlt, state.targetHeightOlt, 'OLT');
2409
2772
  if (state.hasOlf) resizeOutline(state, state.targetWidthOlt + state.deltaOlfWidth, state.targetHeightOlt + state.deltaOlfHeight, 'OLF');
2773
+ renderProfiles(state, profiles);
2410
2774
  fixViewBox(state, (_options$minBorderX = options.minBorderX) !== null && _options$minBorderX !== void 0 ? _options$minBorderX : 0, (_options$minBorderY = options.minBorderY) !== null && _options$minBorderY !== void 0 ? _options$minBorderY : 0);
2411
2775
  return {
2412
2776
  svg: serializeXml(xmlDocument),