dgeoutils 2.5.0 → 2.6.0

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.
@@ -421,14 +421,16 @@ var DPolygon = (function () {
421
421
  enumerable: false,
422
422
  configurable: true
423
423
  });
424
- Object.defineProperty(DPolygon.prototype, "perimeterLatLon", {
424
+ Object.defineProperty(DPolygon.prototype, "pointsDistanceProportions", {
425
425
  get: function () {
426
426
  var e_5, _a;
427
427
  var p = 0;
428
+ var res = [0];
428
429
  try {
429
430
  for (var _b = __values(this.loopPointsGenerator()()), _c = _b.next(); !_c.done; _c = _b.next()) {
430
431
  var _d = __read(_c.value, 2), p1 = _d[0], p2 = _d[1];
431
- p += p1.distanceLatLon(p2);
432
+ p += p1.distance(p2);
433
+ res.push(p);
432
434
  }
433
435
  }
434
436
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -438,6 +440,28 @@ var DPolygon = (function () {
438
440
  }
439
441
  finally { if (e_5) throw e_5.error; }
440
442
  }
443
+ return res.map(function (v) { return v / p; });
444
+ },
445
+ enumerable: false,
446
+ configurable: true
447
+ });
448
+ Object.defineProperty(DPolygon.prototype, "perimeterLatLon", {
449
+ get: function () {
450
+ var e_6, _a;
451
+ var p = 0;
452
+ try {
453
+ for (var _b = __values(this.loopPointsGenerator()()), _c = _b.next(); !_c.done; _c = _b.next()) {
454
+ var _d = __read(_c.value, 2), p1 = _d[0], p2 = _d[1];
455
+ p += p1.distanceLatLon(p2);
456
+ }
457
+ }
458
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
459
+ finally {
460
+ try {
461
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
462
+ }
463
+ finally { if (e_6) throw e_6.error; }
464
+ }
441
465
  return p;
442
466
  },
443
467
  enumerable: false,
@@ -445,7 +469,7 @@ var DPolygon = (function () {
445
469
  });
446
470
  Object.defineProperty(DPolygon.prototype, "area", {
447
471
  get: function () {
448
- var e_6, _a;
472
+ var e_7, _a;
449
473
  var sum = 0;
450
474
  try {
451
475
  for (var _b = __values(this.deintersection.loopPointsGenerator()()), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -453,12 +477,12 @@ var DPolygon = (function () {
453
477
  sum += x * b - y * a;
454
478
  }
455
479
  }
456
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
480
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
457
481
  finally {
458
482
  try {
459
483
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
460
484
  }
461
- finally { if (e_6) throw e_6.error; }
485
+ finally { if (e_7) throw e_7.error; }
462
486
  }
463
487
  return Math.abs(sum / 2) - this.holes.reduce(function (a, hole) { return a + hole.area; }, 0);
464
488
  },
@@ -501,7 +525,7 @@ var DPolygon = (function () {
501
525
  });
502
526
  Object.defineProperty(DPolygon.prototype, "deintersection", {
503
527
  get: function () {
504
- var e_7, _a;
528
+ var e_8, _a;
505
529
  var p = this.clone().close();
506
530
  var store = {};
507
531
  for (var i = 0; i < p.length - 1; i++) {
@@ -547,12 +571,12 @@ var DPolygon = (function () {
547
571
  }
548
572
  }
549
573
  }
550
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
574
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
551
575
  finally {
552
576
  try {
553
577
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
554
578
  }
555
- finally { if (e_7) throw e_7.error; }
579
+ finally { if (e_8) throw e_8.error; }
556
580
  }
557
581
  return p;
558
582
  },
@@ -589,7 +613,7 @@ var DPolygon = (function () {
589
613
  });
590
614
  Object.defineProperty(DPolygon.prototype, "minAreaRectangle", {
591
615
  get: function () {
592
- var e_8, _a, e_9, _b;
616
+ var e_9, _a, e_10, _b;
593
617
  var p = this.convex;
594
618
  var resultPolygon = new DPolygon();
595
619
  var resultArea = Infinity;
@@ -602,7 +626,7 @@ var DPolygon = (function () {
602
626
  var maxHeight = 0;
603
627
  var maxHeightPoint = null;
604
628
  try {
605
- for (var _f = (e_9 = void 0, __values(p.loopPointsGenerator()())), _g = _f.next(); !_g.done; _g = _f.next()) {
629
+ for (var _f = (e_10 = void 0, __values(p.loopPointsGenerator()())), _g = _f.next(); !_g.done; _g = _f.next()) {
606
630
  var _h = __read(_g.value, 4), z = _h[0], i = _h[3];
607
631
  var p1 = l.findPoint(l.findPerpendicular(z));
608
632
  var h = p1.distance(z);
@@ -621,12 +645,12 @@ var DPolygon = (function () {
621
645
  }
622
646
  }
623
647
  }
624
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
648
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
625
649
  finally {
626
650
  try {
627
651
  if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
628
652
  }
629
- finally { if (e_9) throw e_9.error; }
653
+ finally { if (e_10) throw e_10.error; }
630
654
  }
631
655
  if (!maxWidthPoint1 || !maxWidthPoint2 || !maxHeightPoint) {
632
656
  continue;
@@ -646,12 +670,12 @@ var DPolygon = (function () {
646
670
  }
647
671
  }
648
672
  }
649
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
673
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
650
674
  finally {
651
675
  try {
652
676
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
653
677
  }
654
- finally { if (e_8) throw e_8.error; }
678
+ finally { if (e_9) throw e_9.error; }
655
679
  }
656
680
  return resultPolygon;
657
681
  },
@@ -704,7 +728,7 @@ var DPolygon = (function () {
704
728
  });
705
729
  Object.defineProperty(DPolygon.prototype, "isClockwise", {
706
730
  get: function () {
707
- var e_10, _a;
731
+ var e_11, _a;
708
732
  var sum = 0;
709
733
  try {
710
734
  for (var _b = __values(this.clone().close()
@@ -713,12 +737,12 @@ var DPolygon = (function () {
713
737
  sum += (a - x) * (b + y);
714
738
  }
715
739
  }
716
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
740
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
717
741
  finally {
718
742
  try {
719
743
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
720
744
  }
721
- finally { if (e_10) throw e_10.error; }
745
+ finally { if (e_11) throw e_11.error; }
722
746
  }
723
747
  return sum < 0;
724
748
  },
@@ -748,7 +772,7 @@ var DPolygon = (function () {
748
772
  return this.pPoints.reduce(f, v);
749
773
  };
750
774
  DPolygon.prototype.intersection = function (l, includeOnly) {
751
- var e_11, _a;
775
+ var e_12, _a;
752
776
  if (includeOnly === void 0) { includeOnly = false; }
753
777
  var res = [];
754
778
  try {
@@ -760,12 +784,12 @@ var DPolygon = (function () {
760
784
  }
761
785
  }
762
786
  }
763
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
787
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
764
788
  finally {
765
789
  try {
766
790
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
767
791
  }
768
- finally { if (e_11) throw e_11.error; }
792
+ finally { if (e_12) throw e_12.error; }
769
793
  }
770
794
  return res;
771
795
  };
@@ -971,7 +995,7 @@ var DPolygon = (function () {
971
995
  ctx.globalCompositeOperation = old;
972
996
  };
973
997
  DPolygon.prototype.contain = function (p, isBorderInside) {
974
- var e_12, _a;
998
+ var e_13, _a;
975
999
  if (isBorderInside === void 0) { isBorderInside = false; }
976
1000
  var simpleInclude = this.simpleInclude(p);
977
1001
  if (!simpleInclude) {
@@ -997,12 +1021,12 @@ var DPolygon = (function () {
997
1021
  }
998
1022
  }
999
1023
  }
1000
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1024
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1001
1025
  finally {
1002
1026
  try {
1003
1027
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1004
1028
  }
1005
- finally { if (e_12) throw e_12.error; }
1029
+ finally { if (e_13) throw e_13.error; }
1006
1030
  }
1007
1031
  var eps = Math.PI / 10000;
1008
1032
  var absTotalFi = Math.abs(totalFi);
@@ -1015,7 +1039,7 @@ var DPolygon = (function () {
1015
1039
  throw new Error('contains2 faild');
1016
1040
  };
1017
1041
  DPolygon.prototype.onBorder = function (p) {
1018
- var e_13, _a;
1042
+ var e_14, _a;
1019
1043
  var simpleInclude = this.simpleInclude(p);
1020
1044
  if (simpleInclude) {
1021
1045
  var poly = this.deintersection;
@@ -1032,12 +1056,12 @@ var DPolygon = (function () {
1032
1056
  }
1033
1057
  }
1034
1058
  }
1035
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
1059
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
1036
1060
  finally {
1037
1061
  try {
1038
1062
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1039
1063
  }
1040
- finally { if (e_13) throw e_13.error; }
1064
+ finally { if (e_14) throw e_14.error; }
1041
1065
  }
1042
1066
  }
1043
1067
  return false;
@@ -1161,7 +1185,7 @@ var DPolygon = (function () {
1161
1185
  };
1162
1186
  };
1163
1187
  DPolygon.prototype.divideToPieces = function (piecesCount, withAltitude) {
1164
- var e_14, _a;
1188
+ var e_15, _a;
1165
1189
  if (withAltitude === void 0) { withAltitude = false; }
1166
1190
  var fullLength = this.fullLength;
1167
1191
  var pieceLength = fullLength / piecesCount;
@@ -1196,17 +1220,17 @@ var DPolygon = (function () {
1196
1220
  _loop_3(p1, p2, i);
1197
1221
  }
1198
1222
  }
1199
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
1223
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
1200
1224
  finally {
1201
1225
  try {
1202
1226
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1203
1227
  }
1204
- finally { if (e_14) throw e_14.error; }
1228
+ finally { if (e_15) throw e_15.error; }
1205
1229
  }
1206
1230
  return this;
1207
1231
  };
1208
1232
  DPolygon.prototype.prepareToFastSearch = function () {
1209
- var e_15, _a;
1233
+ var e_16, _a;
1210
1234
  this.searchStore = {};
1211
1235
  try {
1212
1236
  for (var _b = __values(this.points), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -1220,12 +1244,12 @@ var DPolygon = (function () {
1220
1244
  this.searchStore[x][y][z || 'undefined'] = true;
1221
1245
  }
1222
1246
  }
1223
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
1247
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
1224
1248
  finally {
1225
1249
  try {
1226
1250
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1227
1251
  }
1228
- finally { if (e_15) throw e_15.error; }
1252
+ finally { if (e_16) throw e_16.error; }
1229
1253
  }
1230
1254
  };
1231
1255
  DPolygon.prototype.fastHas = function (_a) {
@@ -1245,8 +1269,8 @@ var DPolygon = (function () {
1245
1269
  get: function () {
1246
1270
  var polygon = this;
1247
1271
  return function () {
1248
- var r, _a, _b, p, e_16_1;
1249
- var e_16, _c;
1272
+ var r, _a, _b, p, e_17_1;
1273
+ var e_17, _c;
1250
1274
  return __generator(this, function (_d) {
1251
1275
  switch (_d.label) {
1252
1276
  case 0:
@@ -1270,14 +1294,14 @@ var DPolygon = (function () {
1270
1294
  return [3, 2];
1271
1295
  case 5: return [3, 8];
1272
1296
  case 6:
1273
- e_16_1 = _d.sent();
1274
- e_16 = { error: e_16_1 };
1297
+ e_17_1 = _d.sent();
1298
+ e_17 = { error: e_17_1 };
1275
1299
  return [3, 8];
1276
1300
  case 7:
1277
1301
  try {
1278
1302
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1279
1303
  }
1280
- finally { if (e_16) throw e_16.error; }
1304
+ finally { if (e_17) throw e_17.error; }
1281
1305
  return [7];
1282
1306
  case 8: return [2, r.clone()];
1283
1307
  }
@@ -1309,12 +1333,12 @@ var DPolygon = (function () {
1309
1333
  return this.simpleLogicFunction(p, true, false);
1310
1334
  };
1311
1335
  DPolygon.prototype.smartUnion = function (p) {
1312
- var e_17, _a;
1336
+ var e_18, _a;
1313
1337
  var res = this.clone().simpleUnion(p);
1314
1338
  if (res) {
1315
1339
  var allHoles = __spreadArray(__spreadArray(__spreadArray([], __read(this.holes), false), __read(p.holes), false), __read(res.holes), false).map(function (h) { return h.clone(); });
1316
1340
  var _loop_4 = function (a) {
1317
- var e_18, _b;
1341
+ var e_19, _b;
1318
1342
  var _loop_5 = function (b) {
1319
1343
  if (a.equal(b)) {
1320
1344
  return "continue";
@@ -1326,17 +1350,17 @@ var DPolygon = (function () {
1326
1350
  }
1327
1351
  };
1328
1352
  try {
1329
- for (var allHoles_2 = (e_18 = void 0, __values(allHoles)), allHoles_2_1 = allHoles_2.next(); !allHoles_2_1.done; allHoles_2_1 = allHoles_2.next()) {
1353
+ for (var allHoles_2 = (e_19 = void 0, __values(allHoles)), allHoles_2_1 = allHoles_2.next(); !allHoles_2_1.done; allHoles_2_1 = allHoles_2.next()) {
1330
1354
  var b = allHoles_2_1.value;
1331
1355
  _loop_5(b);
1332
1356
  }
1333
1357
  }
1334
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
1358
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
1335
1359
  finally {
1336
1360
  try {
1337
1361
  if (allHoles_2_1 && !allHoles_2_1.done && (_b = allHoles_2.return)) _b.call(allHoles_2);
1338
1362
  }
1339
- finally { if (e_18) throw e_18.error; }
1363
+ finally { if (e_19) throw e_19.error; }
1340
1364
  }
1341
1365
  };
1342
1366
  try {
@@ -1345,12 +1369,12 @@ var DPolygon = (function () {
1345
1369
  _loop_4(a);
1346
1370
  }
1347
1371
  }
1348
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
1372
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
1349
1373
  finally {
1350
1374
  try {
1351
1375
  if (allHoles_1_1 && !allHoles_1_1.done && (_a = allHoles_1.return)) _a.call(allHoles_1);
1352
1376
  }
1353
- finally { if (e_17) throw e_17.error; }
1377
+ finally { if (e_18) throw e_18.error; }
1354
1378
  }
1355
1379
  res.holes = allHoles;
1356
1380
  }
@@ -1565,8 +1589,74 @@ var DPolygon = (function () {
1565
1589
  });
1566
1590
  };
1567
1591
  };
1592
+ DPolygon.prototype.cloneByDistanceProportions = function (proportions) {
1593
+ var e_20, _a;
1594
+ var resultedPolygon = new DPolygon();
1595
+ var resultProportions = Array.from(new Set(__spreadArray(__spreadArray([], __read(this.pointsDistanceProportions), false), __read(proportions), false)))
1596
+ .sort(function (a, b) { return a - b; });
1597
+ var fullLength = this.fullLength;
1598
+ resultedPolygon.push(this.at(0));
1599
+ var index = 1;
1600
+ var path = 0;
1601
+ try {
1602
+ for (var _b = __values(this.loopPointsGenerator()()), _c = _b.next(); !_c.done; _c = _b.next()) {
1603
+ var _d = __read(_c.value, 2), p1_ = _d[0], p2 = _d[1];
1604
+ var p1 = p1_;
1605
+ var _loop_6 = function () {
1606
+ var distance = p1.distance(p2);
1607
+ var currentProportion = (path + distance) / fullLength;
1608
+ if (Math.abs(currentProportion - resultProportions[index]) < 1e-7) {
1609
+ path += distance;
1610
+ resultedPolygon.push(p2.clone());
1611
+ index++;
1612
+ return "break";
1613
+ }
1614
+ else {
1615
+ var radius = (resultProportions[index] - resultProportions[index - 1]) * fullLength;
1616
+ var circle = new DCircle(p1, radius);
1617
+ var line_2 = p1.findLine(p2);
1618
+ var intersectionPoint = line_2.intersectionWithCircle(circle)
1619
+ .filter(function (p) { return line_2.inRange(p, CLOSE_TO_INTERSECTION_DISTANCE); })[0];
1620
+ resultedPolygon.push(intersectionPoint);
1621
+ index++;
1622
+ path += p1.distance(intersectionPoint);
1623
+ p1 = intersectionPoint;
1624
+ }
1625
+ };
1626
+ while (true) {
1627
+ var state_1 = _loop_6();
1628
+ if (state_1 === "break")
1629
+ break;
1630
+ }
1631
+ }
1632
+ }
1633
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
1634
+ finally {
1635
+ try {
1636
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1637
+ }
1638
+ finally { if (e_20) throw e_20.error; }
1639
+ }
1640
+ return resultedPolygon;
1641
+ };
1642
+ DPolygon.prototype.middleLinestring = function (line) {
1643
+ var thisClone = this.cloneByDistanceProportions(line.pointsDistanceProportions);
1644
+ var thatClone = line.cloneByDistanceProportions(this.pointsDistanceProportions);
1645
+ return thisClone
1646
+ .loop()
1647
+ .setX(function (_a, index) {
1648
+ var x = _a.x;
1649
+ return x + thatClone.at(index).x;
1650
+ })
1651
+ .setY(function (_a, index) {
1652
+ var y = _a.y;
1653
+ return y + thatClone.at(index).y;
1654
+ })
1655
+ .divide(2)
1656
+ .run();
1657
+ };
1568
1658
  DPolygon.prototype.getBezierPoint = function (v) {
1569
- var e_19, _a;
1659
+ var e_21, _a;
1570
1660
  if (this.length === 1) {
1571
1661
  return this.first;
1572
1662
  }
@@ -1577,12 +1667,12 @@ var DPolygon = (function () {
1577
1667
  .scale(v));
1578
1668
  }
1579
1669
  }
1580
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
1670
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
1581
1671
  finally {
1582
1672
  try {
1583
1673
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1584
1674
  }
1585
- finally { if (e_19) throw e_19.error; }
1675
+ finally { if (e_21) throw e_21.error; }
1586
1676
  }
1587
1677
  this.pop();
1588
1678
  return this.getBezierPoint(v);
@@ -1641,7 +1731,7 @@ var DPolygon = (function () {
1641
1731
  return undefined;
1642
1732
  };
1643
1733
  DPolygon.prototype.simpleLogicFunction = function (p, unionThis, unionThat) {
1644
- var e_20, _a, e_21, _b, e_22, _c, e_23, _d;
1734
+ var e_22, _a, e_23, _b, e_24, _c, e_25, _d;
1645
1735
  var c = this.getJSTSGeometry(p, unionThis, unionThat);
1646
1736
  if (c) {
1647
1737
  var coordinates_1 = c.getCoordinates();
@@ -1668,7 +1758,7 @@ var DPolygon = (function () {
1668
1758
  try {
1669
1759
  for (var result_1 = __values(result), result_1_1 = result_1.next(); !result_1_1.done; result_1_1 = result_1.next()) {
1670
1760
  var q = result_1_1.value;
1671
- var _loop_6 = function (r) {
1761
+ var _loop_7 = function (r) {
1672
1762
  var _e;
1673
1763
  if (q.has(r.first) && !q.equal(r)) {
1674
1764
  var index = q.findIndex(r.first);
@@ -1681,38 +1771,38 @@ var DPolygon = (function () {
1681
1771
  }
1682
1772
  };
1683
1773
  try {
1684
- for (var result_2 = (e_21 = void 0, __values(result)), result_2_1 = result_2.next(); !result_2_1.done; result_2_1 = result_2.next()) {
1774
+ for (var result_2 = (e_23 = void 0, __values(result)), result_2_1 = result_2.next(); !result_2_1.done; result_2_1 = result_2.next()) {
1685
1775
  var r = result_2_1.value;
1686
- var state_1 = _loop_6(r);
1687
- if (state_1 === "break")
1776
+ var state_2 = _loop_7(r);
1777
+ if (state_2 === "break")
1688
1778
  break;
1689
1779
  }
1690
1780
  }
1691
- catch (e_21_1) { e_21 = { error: e_21_1 }; }
1781
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
1692
1782
  finally {
1693
1783
  try {
1694
1784
  if (result_2_1 && !result_2_1.done && (_b = result_2.return)) _b.call(result_2);
1695
1785
  }
1696
- finally { if (e_21) throw e_21.error; }
1786
+ finally { if (e_23) throw e_23.error; }
1697
1787
  }
1698
1788
  if (result.length < 2) {
1699
1789
  break;
1700
1790
  }
1701
1791
  }
1702
1792
  }
1703
- catch (e_20_1) { e_20 = { error: e_20_1 }; }
1793
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
1704
1794
  finally {
1705
1795
  try {
1706
1796
  if (result_1_1 && !result_1_1.done && (_a = result_1.return)) _a.call(result_1);
1707
1797
  }
1708
- finally { if (e_20) throw e_20.error; }
1798
+ finally { if (e_22) throw e_22.error; }
1709
1799
  }
1710
1800
  }
1711
1801
  result = result.filter(function (h) { return h.length > 2; }).map(function (h) { return h.close(); });
1712
1802
  try {
1713
1803
  for (var result_3 = __values(result), result_3_1 = result_3.next(); !result_3_1.done; result_3_1 = result_3.next()) {
1714
1804
  var q = result_3_1.value;
1715
- var _loop_7 = function (r) {
1805
+ var _loop_8 = function (r) {
1716
1806
  if (result.length < 2) {
1717
1807
  return "break";
1718
1808
  }
@@ -1724,31 +1814,31 @@ var DPolygon = (function () {
1724
1814
  }
1725
1815
  };
1726
1816
  try {
1727
- for (var result_4 = (e_23 = void 0, __values(result)), result_4_1 = result_4.next(); !result_4_1.done; result_4_1 = result_4.next()) {
1817
+ for (var result_4 = (e_25 = void 0, __values(result)), result_4_1 = result_4.next(); !result_4_1.done; result_4_1 = result_4.next()) {
1728
1818
  var r = result_4_1.value;
1729
- var state_2 = _loop_7(r);
1730
- if (state_2 === "break")
1819
+ var state_3 = _loop_8(r);
1820
+ if (state_3 === "break")
1731
1821
  break;
1732
1822
  }
1733
1823
  }
1734
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
1824
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
1735
1825
  finally {
1736
1826
  try {
1737
1827
  if (result_4_1 && !result_4_1.done && (_d = result_4.return)) _d.call(result_4);
1738
1828
  }
1739
- finally { if (e_23) throw e_23.error; }
1829
+ finally { if (e_25) throw e_25.error; }
1740
1830
  }
1741
1831
  if (result.length < 2) {
1742
1832
  break;
1743
1833
  }
1744
1834
  }
1745
1835
  }
1746
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
1836
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
1747
1837
  finally {
1748
1838
  try {
1749
1839
  if (result_3_1 && !result_3_1.done && (_c = result_3.return)) _c.call(result_3);
1750
1840
  }
1751
- finally { if (e_22) throw e_22.error; }
1841
+ finally { if (e_24) throw e_24.error; }
1752
1842
  }
1753
1843
  if (result.length === 0) {
1754
1844
  return null;