locize 4.0.10 → 4.0.12

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/cjs/api/handleEditKey.js +3 -1
  3. package/dist/cjs/api/handleRequestPopupChanges.js +8 -4
  4. package/dist/cjs/api/handleSendMatchedUninstrumented.js +3 -1
  5. package/dist/cjs/implementations/dummyImplementation.js +4 -12
  6. package/dist/cjs/implementations/i18nextImplementation.js +3 -1
  7. package/dist/cjs/locizePlugin.js +3 -3
  8. package/dist/cjs/parser.js +3 -3
  9. package/dist/cjs/process.js +3 -7
  10. package/dist/cjs/startStandalone.js +3 -1
  11. package/dist/cjs/ui/elements/highlightBox.js +1 -1
  12. package/dist/cjs/ui/highlightNode.js +0 -1
  13. package/dist/cjs/ui/popup.js +8 -4
  14. package/dist/cjs/utils.js +9 -3
  15. package/dist/esm/api/handleEditKey.js +3 -1
  16. package/dist/esm/api/handleRequestPopupChanges.js +8 -4
  17. package/dist/esm/api/handleSendMatchedUninstrumented.js +3 -1
  18. package/dist/esm/implementations/dummyImplementation.js +4 -12
  19. package/dist/esm/implementations/i18nextImplementation.js +3 -1
  20. package/dist/esm/locizePlugin.js +3 -3
  21. package/dist/esm/parser.js +3 -3
  22. package/dist/esm/process.js +2 -6
  23. package/dist/esm/startStandalone.js +3 -1
  24. package/dist/esm/ui/elements/highlightBox.js +1 -1
  25. package/dist/esm/ui/highlightNode.js +0 -1
  26. package/dist/esm/ui/popup.js +8 -4
  27. package/dist/esm/utils.js +9 -4
  28. package/dist/umd/locize.js +810 -152
  29. package/dist/umd/locize.min.js +1 -1
  30. package/locize.js +810 -152
  31. package/locize.min.js +1 -1
  32. package/package.json +1 -1
  33. package/src/_startStandalone.js +1 -2
  34. package/src/api/handleEditKey.js +1 -2
  35. package/src/api/handleRequestPopupChanges.js +4 -6
  36. package/src/api/handleSendMatchedUninstrumented.js +1 -2
  37. package/src/clickHandler.js +3 -6
  38. package/src/implementations/dummyImplementation.js +5 -4
  39. package/src/implementations/i18nextImplementation.js +1 -2
  40. package/src/locizePlugin.js +120 -116
  41. package/src/parser.js +11 -11
  42. package/src/process.js +2 -9
  43. package/src/startStandalone.js +1 -2
  44. package/src/ui/elements/highlightBox.js +1 -1
  45. package/src/ui/highlightNode.js +26 -26
  46. package/src/ui/popup.js +4 -6
  47. package/src/utils.js +18 -12
  48. package/src/vars.js +2 -2
package/locize.js CHANGED
@@ -14,24 +14,24 @@
14
14
  }, _typeof(o);
15
15
  }
16
16
 
17
- function _toPrimitive(input, hint) {
18
- if (_typeof(input) !== "object" || input === null) return input;
19
- var prim = input[Symbol.toPrimitive];
20
- if (prim !== undefined) {
21
- var res = prim.call(input, hint || "default");
22
- if (_typeof(res) !== "object") return res;
17
+ function toPrimitive(t, r) {
18
+ if ("object" != _typeof(t) || !t) return t;
19
+ var e = t[Symbol.toPrimitive];
20
+ if (void 0 !== e) {
21
+ var i = e.call(t, r || "default");
22
+ if ("object" != _typeof(i)) return i;
23
23
  throw new TypeError("@@toPrimitive must return a primitive value.");
24
24
  }
25
- return (hint === "string" ? String : Number)(input);
25
+ return ("string" === r ? String : Number)(t);
26
26
  }
27
27
 
28
- function _toPropertyKey(arg) {
29
- var key = _toPrimitive(arg, "string");
30
- return _typeof(key) === "symbol" ? key : String(key);
28
+ function toPropertyKey(t) {
29
+ var i = toPrimitive(t, "string");
30
+ return "symbol" == _typeof(i) ? i : String(i);
31
31
  }
32
32
 
33
33
  function _defineProperty(obj, key, value) {
34
- key = _toPropertyKey(key);
34
+ key = toPropertyKey(key);
35
35
  if (key in obj) {
36
36
  Object.defineProperty(obj, key, {
37
37
  value: value,
@@ -45,37 +45,6 @@
45
45
  return obj;
46
46
  }
47
47
 
48
- function _arrayLikeToArray(arr, len) {
49
- if (len == null || len > arr.length) len = arr.length;
50
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
51
- return arr2;
52
- }
53
-
54
- function _arrayWithoutHoles(arr) {
55
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
56
- }
57
-
58
- function _iterableToArray(iter) {
59
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
60
- }
61
-
62
- function _unsupportedIterableToArray(o, minLen) {
63
- if (!o) return;
64
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
65
- var n = Object.prototype.toString.call(o).slice(8, -1);
66
- if (n === "Object" && o.constructor) n = o.constructor.name;
67
- if (n === "Map" || n === "Set") return Array.from(o);
68
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
69
- }
70
-
71
- function _nonIterableSpread() {
72
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73
- }
74
-
75
- function _toConsumableArray(arr) {
76
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
77
- }
78
-
79
48
  var INVISIBLE_CHARACTERS = ["\u200B", "\u200C"];
80
49
  var INVISIBLE_REGEX = RegExp("([".concat(INVISIBLE_CHARACTERS.join(''), "]{9})+"), 'gu');
81
50
  var TEMPLATE_MINIMUM_LENGTH = '{"k":"a"}'.length;
@@ -331,6 +300,21 @@
331
300
  }
332
301
  }
333
302
 
303
+ function _arrayLikeToArray(arr, len) {
304
+ if (len == null || len > arr.length) len = arr.length;
305
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
306
+ return arr2;
307
+ }
308
+
309
+ function _unsupportedIterableToArray(o, minLen) {
310
+ if (!o) return;
311
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
312
+ var n = Object.prototype.toString.call(o).slice(8, -1);
313
+ if (n === "Object" && o.constructor) n = o.constructor.name;
314
+ if (n === "Map" || n === "Set") return Array.from(o);
315
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
316
+ }
317
+
334
318
  function _nonIterableRest() {
335
319
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
336
320
  }
@@ -367,12 +351,12 @@
367
351
  }
368
352
  function parseAttrFromKey(key) {
369
353
  var attr = 'text';
370
- if (key.indexOf('[') == 0) {
354
+ if (key.indexOf('[') === 0) {
371
355
  var parts = key.split(']');
372
356
  key = parts[1];
373
357
  attr = parts[0].substr(1, parts[0].length - 1);
374
358
  }
375
- var newKey = key.indexOf(';') == key.length - 1 ? key.substr(0, key.length - 2) : key;
359
+ var newKey = key.indexOf(';') === key.length - 1 ? key.substr(0, key.length - 2) : key;
376
360
  return [newKey, attr];
377
361
  }
378
362
  function getI18nMetaFromNode(el) {
@@ -382,7 +366,7 @@
382
366
  var allKeys = {};
383
367
  if (key && key.indexOf(';') >= 0) {
384
368
  var keys = key.split(';');
385
- for (var ix = 0, l_ix = keys.length; ix < l_ix; ix++) {
369
+ for (var ix = 0, lix = keys.length; ix < lix; ix++) {
386
370
  if (keys[ix] != '') {
387
371
  var _parseAttrFromKey = parseAttrFromKey(keys[ix]),
388
372
  _parseAttrFromKey2 = _slicedToArray(_parseAttrFromKey, 2),
@@ -449,6 +433,11 @@
449
433
  if (!results[2]) return '';
450
434
  return decodeURIComponent(results[2].replace(/\+/g, ' '));
451
435
  }
436
+ var _isInIframe = typeof window !== 'undefined';
437
+ try {
438
+ _isInIframe = self !== top;
439
+ } catch (e) {}
440
+ var isInIframe = _isInIframe;
452
441
 
453
442
  function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
454
443
  function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -631,7 +620,9 @@
631
620
  }
632
621
  });
633
622
  children.forEach(function (replaceable) {
634
- if (item.node.contains(replaceable.child)) item.node.removeChild(replaceable.child);
623
+ if (item.node.contains(replaceable.child)) {
624
+ item.node.removeChild(replaceable.child);
625
+ }
635
626
  });
636
627
  }
637
628
  }
@@ -658,6 +649,22 @@
658
649
  }
659
650
  api.addHandler('commitKey', handler$7);
660
651
 
652
+ function _arrayWithoutHoles(arr) {
653
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
654
+ }
655
+
656
+ function _iterableToArray(iter) {
657
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
658
+ }
659
+
660
+ function _nonIterableSpread() {
661
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
662
+ }
663
+
664
+ function _toConsumableArray(arr) {
665
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
666
+ }
667
+
661
668
  function handler$6(payload) {
662
669
  var updated = payload.updated;
663
670
  updated.forEach(function (item) {
@@ -889,9 +896,9 @@
889
896
  if (containerStyle) {
890
897
  var popup = document.getElementById(popupId);
891
898
  if (!popup) return;
892
- var storedPos = localStorage.getItem('locize_popup_pos');
899
+ var storedPos = window.localStorage.getItem('locize_popup_pos');
893
900
  if (storedPos) storedPos = JSON.parse(storedPos);
894
- var storedSize = localStorage.getItem('locize_popup_size');
901
+ var storedSize = window.localStorage.getItem('locize_popup_size');
895
902
  if (storedSize) storedSize = JSON.parse(storedSize);
896
903
  if (storedSize && storedSize.height && storedSize.width) {
897
904
  containerStyle.height = storedSize.height + 'px';
@@ -907,8 +914,12 @@
907
914
  popup.style.setProperty('left', "calc(".concat(popup.style.left, " - ").concat(_diff, ")"));
908
915
  popup.style.setProperty('width', containerStyle.width);
909
916
  }
910
- if (storedPos && storedPos.top && storedPos.top < window.innerHeight - containerStyle.height.replace('px', '')) popup.style.setProperty('top', storedPos.top + 'px');
911
- if (storedPos && storedPos.left && storedPos.left < window.innerWidth - containerStyle.width.replace('px', '')) popup.style.setProperty('left', storedPos.left + 'px');
917
+ if (storedPos && storedPos.top && storedPos.top < window.innerHeight - containerStyle.height.replace('px', '')) {
918
+ popup.style.setProperty('top', storedPos.top + 'px');
919
+ }
920
+ if (storedPos && storedPos.left && storedPos.left < window.innerWidth - containerStyle.width.replace('px', '')) {
921
+ popup.style.setProperty('left', storedPos.left + 'px');
922
+ }
912
923
  }
913
924
  }
914
925
  api.addHandler('requestPopupChanges', handler$4);
@@ -998,7 +1009,9 @@
998
1009
  key: item.key
999
1010
  }), item.value), uni === null || uni === void 0 ? void 0 : uni.node);
1000
1011
  if (uni && uni.keys) delete uni.keys["".concat(item.textType)];
1001
- if (uni && uni.keys && !Object.keys(uni.keys).length) uninstrumentedStore.remove(item.eleUniqueID, uni.node);
1012
+ if (uni && uni.keys && !Object.keys(uni.keys).length) {
1013
+ uninstrumentedStore.remove(item.eleUniqueID, uni.node);
1014
+ }
1002
1015
  });
1003
1016
  api.sendCurrentParsedContent();
1004
1017
  }
@@ -1053,11 +1066,19 @@
1053
1066
  var rect = ele.getBoundingClientRect();
1054
1067
  var box = document.createElement('div');
1055
1068
  box.classList.add('i18next-editor-highlight');
1056
- box.style = "position: absolute; z-index: 99999; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: 1px solid ").concat(borderColor, "; border-radius: 2px; ").concat(shadowColor ? "box-shadow: 0 0 20px 0 ".concat(shadowColor, ";") : '');
1069
+ box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: 1px solid ").concat(borderColor, "; border-radius: 2px; ").concat(shadowColor ? "box-shadow: 0 0 20px 0 ".concat(shadowColor, ";") : '');
1057
1070
  box.setAttribute('data-i18next-editor-element', 'true');
1058
1071
  return box;
1059
1072
  }
1060
1073
 
1074
+ /**
1075
+ * Custom positioning reference element.
1076
+ * @see https://floating-ui.com/docs/virtual-elements
1077
+ */
1078
+
1079
+ const sides = ['top', 'right', 'bottom', 'left'];
1080
+ const alignments = ['start', 'end'];
1081
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
1061
1082
  const min = Math.min;
1062
1083
  const max = Math.max;
1063
1084
  const round = Math.round;
@@ -1168,12 +1189,21 @@
1168
1189
  };
1169
1190
  }
1170
1191
  function rectToClientRect(rect) {
1192
+ const {
1193
+ x,
1194
+ y,
1195
+ width,
1196
+ height
1197
+ } = rect;
1171
1198
  return {
1172
- ...rect,
1173
- top: rect.y,
1174
- left: rect.x,
1175
- right: rect.x + rect.width,
1176
- bottom: rect.y + rect.height
1199
+ width,
1200
+ height,
1201
+ top: y,
1202
+ left: x,
1203
+ right: x + width,
1204
+ bottom: y + height,
1205
+ x,
1206
+ y
1177
1207
  };
1178
1208
  }
1179
1209
 
@@ -1235,7 +1265,7 @@
1235
1265
 
1236
1266
  /**
1237
1267
  * Computes the `x` and `y` coordinates that will place the floating element
1238
- * next to a reference element when it is given a certain positioning strategy.
1268
+ * next to a given reference element.
1239
1269
  *
1240
1270
  * This export does not have any `platform` interface logic. You will need to
1241
1271
  * write one for the platform you are using Floating UI with.
@@ -1313,7 +1343,6 @@
1313
1343
  } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1314
1344
  }
1315
1345
  i = -1;
1316
- continue;
1317
1346
  }
1318
1347
  }
1319
1348
  return {
@@ -1363,9 +1392,10 @@
1363
1392
  strategy
1364
1393
  }));
1365
1394
  const rect = elementContext === 'floating' ? {
1366
- ...rects.floating,
1367
1395
  x,
1368
- y
1396
+ y,
1397
+ width: rects.floating.width,
1398
+ height: rects.floating.height
1369
1399
  } : rects.reference;
1370
1400
  const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1371
1401
  const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
@@ -1376,6 +1406,7 @@
1376
1406
  y: 1
1377
1407
  };
1378
1408
  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1409
+ elements,
1379
1410
  rect,
1380
1411
  offsetParent,
1381
1412
  strategy
@@ -1393,7 +1424,7 @@
1393
1424
  * appears centered to the reference element.
1394
1425
  * @see https://floating-ui.com/docs/arrow
1395
1426
  */
1396
- const arrow = options => ({
1427
+ const arrow$1 = options => ({
1397
1428
  name: 'arrow',
1398
1429
  options,
1399
1430
  async fn(state) {
@@ -1454,7 +1485,7 @@
1454
1485
  // to point to nothing for an aligned placement, adjust the offset of the
1455
1486
  // floating element itself. To ensure `shift()` continues to take action,
1456
1487
  // a single reset is performed when this is true.
1457
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1488
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1458
1489
  const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
1459
1490
  return {
1460
1491
  [axis]: coords[axis] + alignmentOffset,
@@ -1470,13 +1501,116 @@
1470
1501
  }
1471
1502
  });
1472
1503
 
1504
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
1505
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
1506
+ return allowedPlacementsSortedByAlignment.filter(placement => {
1507
+ if (alignment) {
1508
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
1509
+ }
1510
+ return true;
1511
+ });
1512
+ }
1513
+ /**
1514
+ * Optimizes the visibility of the floating element by choosing the placement
1515
+ * that has the most space available automatically, without needing to specify a
1516
+ * preferred placement. Alternative to `flip`.
1517
+ * @see https://floating-ui.com/docs/autoPlacement
1518
+ */
1519
+ const autoPlacement = function (options) {
1520
+ if (options === void 0) {
1521
+ options = {};
1522
+ }
1523
+ return {
1524
+ name: 'autoPlacement',
1525
+ options,
1526
+ async fn(state) {
1527
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
1528
+ const {
1529
+ rects,
1530
+ middlewareData,
1531
+ placement,
1532
+ platform,
1533
+ elements
1534
+ } = state;
1535
+ const {
1536
+ crossAxis = false,
1537
+ alignment,
1538
+ allowedPlacements = placements,
1539
+ autoAlignment = true,
1540
+ ...detectOverflowOptions
1541
+ } = evaluate(options, state);
1542
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
1543
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1544
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
1545
+ const currentPlacement = placements$1[currentIndex];
1546
+ if (currentPlacement == null) {
1547
+ return {};
1548
+ }
1549
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1550
+
1551
+ // Make `computeCoords` start from the right place.
1552
+ if (placement !== currentPlacement) {
1553
+ return {
1554
+ reset: {
1555
+ placement: placements$1[0]
1556
+ }
1557
+ };
1558
+ }
1559
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
1560
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
1561
+ placement: currentPlacement,
1562
+ overflows: currentOverflows
1563
+ }];
1564
+ const nextPlacement = placements$1[currentIndex + 1];
1565
+
1566
+ // There are more placements to check.
1567
+ if (nextPlacement) {
1568
+ return {
1569
+ data: {
1570
+ index: currentIndex + 1,
1571
+ overflows: allOverflows
1572
+ },
1573
+ reset: {
1574
+ placement: nextPlacement
1575
+ }
1576
+ };
1577
+ }
1578
+ const placementsSortedByMostSpace = allOverflows.map(d => {
1579
+ const alignment = getAlignment(d.placement);
1580
+ return [d.placement, alignment && crossAxis ?
1581
+ // Check along the mainAxis and main crossAxis side.
1582
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
1583
+ // Check only the mainAxis.
1584
+ d.overflows[0], d.overflows];
1585
+ }).sort((a, b) => a[1] - b[1]);
1586
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
1587
+ // Aligned placements should not check their opposite crossAxis
1588
+ // side.
1589
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
1590
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
1591
+ if (resetPlacement !== placement) {
1592
+ return {
1593
+ data: {
1594
+ index: currentIndex + 1,
1595
+ overflows: allOverflows
1596
+ },
1597
+ reset: {
1598
+ placement: resetPlacement
1599
+ }
1600
+ };
1601
+ }
1602
+ return {};
1603
+ }
1604
+ };
1605
+ };
1606
+
1473
1607
  /**
1474
1608
  * Optimizes the visibility of the floating element by flipping the `placement`
1475
1609
  * in order to keep it in view when the preferred placement(s) will overflow the
1476
1610
  * clipping boundary. Alternative to `autoPlacement`.
1477
1611
  * @see https://floating-ui.com/docs/flip
1478
1612
  */
1479
- const flip = function (options) {
1613
+ const flip$1 = function (options) {
1480
1614
  if (options === void 0) {
1481
1615
  options = {};
1482
1616
  }
@@ -1511,10 +1645,12 @@
1511
1645
  return {};
1512
1646
  }
1513
1647
  const side = getSide(placement);
1648
+ const initialSideAxis = getSideAxis(initialPlacement);
1514
1649
  const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1515
1650
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1516
1651
  const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1517
- if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
1652
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
1653
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1518
1654
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1519
1655
  }
1520
1656
  const placements = [initialPlacement, ...fallbackPlacements];
@@ -1560,8 +1696,17 @@
1560
1696
  switch (fallbackStrategy) {
1561
1697
  case 'bestFit':
1562
1698
  {
1563
- var _overflowsData$map$so;
1564
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
1699
+ var _overflowsData$filter2;
1700
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
1701
+ if (hasFallbackAxisSideDirection) {
1702
+ const currentSideAxis = getSideAxis(d.placement);
1703
+ return currentSideAxis === initialSideAxis ||
1704
+ // Create a bias to the `y` side axis due to horizontal
1705
+ // reading directions favoring greater width.
1706
+ currentSideAxis === 'y';
1707
+ }
1708
+ return true;
1709
+ }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
1565
1710
  if (placement) {
1566
1711
  resetPlacement = placement;
1567
1712
  }
@@ -1585,8 +1730,209 @@
1585
1730
  };
1586
1731
  };
1587
1732
 
1733
+ function getSideOffsets(overflow, rect) {
1734
+ return {
1735
+ top: overflow.top - rect.height,
1736
+ right: overflow.right - rect.width,
1737
+ bottom: overflow.bottom - rect.height,
1738
+ left: overflow.left - rect.width
1739
+ };
1740
+ }
1741
+ function isAnySideFullyClipped(overflow) {
1742
+ return sides.some(side => overflow[side] >= 0);
1743
+ }
1744
+ /**
1745
+ * Provides data to hide the floating element in applicable situations, such as
1746
+ * when it is not in the same clipping context as the reference element.
1747
+ * @see https://floating-ui.com/docs/hide
1748
+ */
1749
+ const hide = function (options) {
1750
+ if (options === void 0) {
1751
+ options = {};
1752
+ }
1753
+ return {
1754
+ name: 'hide',
1755
+ options,
1756
+ async fn(state) {
1757
+ const {
1758
+ rects
1759
+ } = state;
1760
+ const {
1761
+ strategy = 'referenceHidden',
1762
+ ...detectOverflowOptions
1763
+ } = evaluate(options, state);
1764
+ switch (strategy) {
1765
+ case 'referenceHidden':
1766
+ {
1767
+ const overflow = await detectOverflow(state, {
1768
+ ...detectOverflowOptions,
1769
+ elementContext: 'reference'
1770
+ });
1771
+ const offsets = getSideOffsets(overflow, rects.reference);
1772
+ return {
1773
+ data: {
1774
+ referenceHiddenOffsets: offsets,
1775
+ referenceHidden: isAnySideFullyClipped(offsets)
1776
+ }
1777
+ };
1778
+ }
1779
+ case 'escaped':
1780
+ {
1781
+ const overflow = await detectOverflow(state, {
1782
+ ...detectOverflowOptions,
1783
+ altBoundary: true
1784
+ });
1785
+ const offsets = getSideOffsets(overflow, rects.floating);
1786
+ return {
1787
+ data: {
1788
+ escapedOffsets: offsets,
1789
+ escaped: isAnySideFullyClipped(offsets)
1790
+ }
1791
+ };
1792
+ }
1793
+ default:
1794
+ {
1795
+ return {};
1796
+ }
1797
+ }
1798
+ }
1799
+ };
1800
+ };
1801
+
1802
+ function getBoundingRect(rects) {
1803
+ const minX = min(...rects.map(rect => rect.left));
1804
+ const minY = min(...rects.map(rect => rect.top));
1805
+ const maxX = max(...rects.map(rect => rect.right));
1806
+ const maxY = max(...rects.map(rect => rect.bottom));
1807
+ return {
1808
+ x: minX,
1809
+ y: minY,
1810
+ width: maxX - minX,
1811
+ height: maxY - minY
1812
+ };
1813
+ }
1814
+ function getRectsByLine(rects) {
1815
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
1816
+ const groups = [];
1817
+ let prevRect = null;
1818
+ for (let i = 0; i < sortedRects.length; i++) {
1819
+ const rect = sortedRects[i];
1820
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
1821
+ groups.push([rect]);
1822
+ } else {
1823
+ groups[groups.length - 1].push(rect);
1824
+ }
1825
+ prevRect = rect;
1826
+ }
1827
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
1828
+ }
1829
+ /**
1830
+ * Provides improved positioning for inline reference elements that can span
1831
+ * over multiple lines, such as hyperlinks or range selections.
1832
+ * @see https://floating-ui.com/docs/inline
1833
+ */
1834
+ const inline = function (options) {
1835
+ if (options === void 0) {
1836
+ options = {};
1837
+ }
1838
+ return {
1839
+ name: 'inline',
1840
+ options,
1841
+ async fn(state) {
1842
+ const {
1843
+ placement,
1844
+ elements,
1845
+ rects,
1846
+ platform,
1847
+ strategy
1848
+ } = state;
1849
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
1850
+ // ClientRect's bounds, despite the event listener being triggered. A
1851
+ // padding of 2 seems to handle this issue.
1852
+ const {
1853
+ padding = 2,
1854
+ x,
1855
+ y
1856
+ } = evaluate(options, state);
1857
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
1858
+ const clientRects = getRectsByLine(nativeClientRects);
1859
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
1860
+ const paddingObject = getPaddingObject(padding);
1861
+ function getBoundingClientRect() {
1862
+ // There are two rects and they are disjoined.
1863
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
1864
+ // Find the first rect in which the point is fully inside.
1865
+ return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
1866
+ }
1867
+
1868
+ // There are 2 or more connected rects.
1869
+ if (clientRects.length >= 2) {
1870
+ if (getSideAxis(placement) === 'y') {
1871
+ const firstRect = clientRects[0];
1872
+ const lastRect = clientRects[clientRects.length - 1];
1873
+ const isTop = getSide(placement) === 'top';
1874
+ const top = firstRect.top;
1875
+ const bottom = lastRect.bottom;
1876
+ const left = isTop ? firstRect.left : lastRect.left;
1877
+ const right = isTop ? firstRect.right : lastRect.right;
1878
+ const width = right - left;
1879
+ const height = bottom - top;
1880
+ return {
1881
+ top,
1882
+ bottom,
1883
+ left,
1884
+ right,
1885
+ width,
1886
+ height,
1887
+ x: left,
1888
+ y: top
1889
+ };
1890
+ }
1891
+ const isLeftSide = getSide(placement) === 'left';
1892
+ const maxRight = max(...clientRects.map(rect => rect.right));
1893
+ const minLeft = min(...clientRects.map(rect => rect.left));
1894
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
1895
+ const top = measureRects[0].top;
1896
+ const bottom = measureRects[measureRects.length - 1].bottom;
1897
+ const left = minLeft;
1898
+ const right = maxRight;
1899
+ const width = right - left;
1900
+ const height = bottom - top;
1901
+ return {
1902
+ top,
1903
+ bottom,
1904
+ left,
1905
+ right,
1906
+ width,
1907
+ height,
1908
+ x: left,
1909
+ y: top
1910
+ };
1911
+ }
1912
+ return fallback;
1913
+ }
1914
+ const resetRects = await platform.getElementRects({
1915
+ reference: {
1916
+ getBoundingClientRect
1917
+ },
1918
+ floating: elements.floating,
1919
+ strategy
1920
+ });
1921
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
1922
+ return {
1923
+ reset: {
1924
+ rects: resetRects
1925
+ }
1926
+ };
1927
+ }
1928
+ return {};
1929
+ }
1930
+ };
1931
+ };
1932
+
1588
1933
  // For type backwards-compatibility, the `OffsetOptions` type was also
1589
1934
  // Derivable.
1935
+
1590
1936
  async function convertValueToCoords(state, options) {
1591
1937
  const {
1592
1938
  placement,
@@ -1611,10 +1957,9 @@
1611
1957
  crossAxis: 0,
1612
1958
  alignmentAxis: null
1613
1959
  } : {
1614
- mainAxis: 0,
1615
- crossAxis: 0,
1616
- alignmentAxis: null,
1617
- ...rawValue
1960
+ mainAxis: rawValue.mainAxis || 0,
1961
+ crossAxis: rawValue.crossAxis || 0,
1962
+ alignmentAxis: rawValue.alignmentAxis
1618
1963
  };
1619
1964
  if (alignment && typeof alignmentAxis === 'number') {
1620
1965
  crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
@@ -1635,7 +1980,7 @@
1635
1980
  * object may be passed.
1636
1981
  * @see https://floating-ui.com/docs/offset
1637
1982
  */
1638
- const offset = function (options) {
1983
+ const offset$1 = function (options) {
1639
1984
  if (options === void 0) {
1640
1985
  options = 0;
1641
1986
  }
@@ -1643,15 +1988,27 @@
1643
1988
  name: 'offset',
1644
1989
  options,
1645
1990
  async fn(state) {
1991
+ var _middlewareData$offse, _middlewareData$arrow;
1646
1992
  const {
1647
1993
  x,
1648
- y
1994
+ y,
1995
+ placement,
1996
+ middlewareData
1649
1997
  } = state;
1650
1998
  const diffCoords = await convertValueToCoords(state, options);
1999
+
2000
+ // If the placement is the same and the arrow caused an alignment offset
2001
+ // then we don't need to change the positioning coordinates.
2002
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2003
+ return {};
2004
+ }
1651
2005
  return {
1652
2006
  x: x + diffCoords.x,
1653
2007
  y: y + diffCoords.y,
1654
- data: diffCoords
2008
+ data: {
2009
+ ...diffCoords,
2010
+ placement
2011
+ }
1655
2012
  };
1656
2013
  }
1657
2014
  };
@@ -1662,7 +2019,7 @@
1662
2019
  * keep it in view when it will overflow the clipping boundary.
1663
2020
  * @see https://floating-ui.com/docs/shift
1664
2021
  */
1665
- const shift = function (options) {
2022
+ const shift$1 = function (options) {
1666
2023
  if (options === void 0) {
1667
2024
  options = {};
1668
2025
  }
@@ -1724,13 +2081,172 @@
1724
2081
  ...limitedCoords,
1725
2082
  data: {
1726
2083
  x: limitedCoords.x - x,
1727
- y: limitedCoords.y - y
2084
+ y: limitedCoords.y - y,
2085
+ enabled: {
2086
+ [mainAxis]: checkMainAxis,
2087
+ [crossAxis]: checkCrossAxis
2088
+ }
2089
+ }
2090
+ };
2091
+ }
2092
+ };
2093
+ };
2094
+ /**
2095
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2096
+ */
2097
+ const limitShift = function (options) {
2098
+ if (options === void 0) {
2099
+ options = {};
2100
+ }
2101
+ return {
2102
+ options,
2103
+ fn(state) {
2104
+ const {
2105
+ x,
2106
+ y,
2107
+ placement,
2108
+ rects,
2109
+ middlewareData
2110
+ } = state;
2111
+ const {
2112
+ offset = 0,
2113
+ mainAxis: checkMainAxis = true,
2114
+ crossAxis: checkCrossAxis = true
2115
+ } = evaluate(options, state);
2116
+ const coords = {
2117
+ x,
2118
+ y
2119
+ };
2120
+ const crossAxis = getSideAxis(placement);
2121
+ const mainAxis = getOppositeAxis(crossAxis);
2122
+ let mainAxisCoord = coords[mainAxis];
2123
+ let crossAxisCoord = coords[crossAxis];
2124
+ const rawOffset = evaluate(offset, state);
2125
+ const computedOffset = typeof rawOffset === 'number' ? {
2126
+ mainAxis: rawOffset,
2127
+ crossAxis: 0
2128
+ } : {
2129
+ mainAxis: 0,
2130
+ crossAxis: 0,
2131
+ ...rawOffset
2132
+ };
2133
+ if (checkMainAxis) {
2134
+ const len = mainAxis === 'y' ? 'height' : 'width';
2135
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
2136
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
2137
+ if (mainAxisCoord < limitMin) {
2138
+ mainAxisCoord = limitMin;
2139
+ } else if (mainAxisCoord > limitMax) {
2140
+ mainAxisCoord = limitMax;
2141
+ }
2142
+ }
2143
+ if (checkCrossAxis) {
2144
+ var _middlewareData$offse, _middlewareData$offse2;
2145
+ const len = mainAxis === 'y' ? 'width' : 'height';
2146
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
2147
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
2148
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
2149
+ if (crossAxisCoord < limitMin) {
2150
+ crossAxisCoord = limitMin;
2151
+ } else if (crossAxisCoord > limitMax) {
2152
+ crossAxisCoord = limitMax;
1728
2153
  }
2154
+ }
2155
+ return {
2156
+ [mainAxis]: mainAxisCoord,
2157
+ [crossAxis]: crossAxisCoord
1729
2158
  };
1730
2159
  }
1731
2160
  };
1732
2161
  };
1733
2162
 
2163
+ /**
2164
+ * Provides data that allows you to change the size of the floating element —
2165
+ * for instance, prevent it from overflowing the clipping boundary or match the
2166
+ * width of the reference element.
2167
+ * @see https://floating-ui.com/docs/size
2168
+ */
2169
+ const size = function (options) {
2170
+ if (options === void 0) {
2171
+ options = {};
2172
+ }
2173
+ return {
2174
+ name: 'size',
2175
+ options,
2176
+ async fn(state) {
2177
+ var _state$middlewareData, _state$middlewareData2;
2178
+ const {
2179
+ placement,
2180
+ rects,
2181
+ platform,
2182
+ elements
2183
+ } = state;
2184
+ const {
2185
+ apply = () => {},
2186
+ ...detectOverflowOptions
2187
+ } = evaluate(options, state);
2188
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2189
+ const side = getSide(placement);
2190
+ const alignment = getAlignment(placement);
2191
+ const isYAxis = getSideAxis(placement) === 'y';
2192
+ const {
2193
+ width,
2194
+ height
2195
+ } = rects.floating;
2196
+ let heightSide;
2197
+ let widthSide;
2198
+ if (side === 'top' || side === 'bottom') {
2199
+ heightSide = side;
2200
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
2201
+ } else {
2202
+ widthSide = side;
2203
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
2204
+ }
2205
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
2206
+ const maximumClippingWidth = width - overflow.left - overflow.right;
2207
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
2208
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
2209
+ const noShift = !state.middlewareData.shift;
2210
+ let availableHeight = overflowAvailableHeight;
2211
+ let availableWidth = overflowAvailableWidth;
2212
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
2213
+ availableWidth = maximumClippingWidth;
2214
+ }
2215
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
2216
+ availableHeight = maximumClippingHeight;
2217
+ }
2218
+ if (noShift && !alignment) {
2219
+ const xMin = max(overflow.left, 0);
2220
+ const xMax = max(overflow.right, 0);
2221
+ const yMin = max(overflow.top, 0);
2222
+ const yMax = max(overflow.bottom, 0);
2223
+ if (isYAxis) {
2224
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
2225
+ } else {
2226
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
2227
+ }
2228
+ }
2229
+ await apply({
2230
+ ...state,
2231
+ availableWidth,
2232
+ availableHeight
2233
+ });
2234
+ const nextDimensions = await platform.getDimensions(elements.floating);
2235
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
2236
+ return {
2237
+ reset: {
2238
+ rects: true
2239
+ }
2240
+ };
2241
+ }
2242
+ return {};
2243
+ }
2244
+ };
2245
+ };
2246
+
2247
+ function hasWindow() {
2248
+ return typeof window !== 'undefined';
2249
+ }
1734
2250
  function getNodeName(node) {
1735
2251
  if (isNode(node)) {
1736
2252
  return (node.nodeName || '').toLowerCase();
@@ -1742,24 +2258,32 @@
1742
2258
  }
1743
2259
  function getWindow(node) {
1744
2260
  var _node$ownerDocument;
1745
- return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2261
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1746
2262
  }
1747
2263
  function getDocumentElement(node) {
1748
2264
  var _ref;
1749
2265
  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1750
2266
  }
1751
2267
  function isNode(value) {
2268
+ if (!hasWindow()) {
2269
+ return false;
2270
+ }
1752
2271
  return value instanceof Node || value instanceof getWindow(value).Node;
1753
2272
  }
1754
2273
  function isElement(value) {
2274
+ if (!hasWindow()) {
2275
+ return false;
2276
+ }
1755
2277
  return value instanceof Element || value instanceof getWindow(value).Element;
1756
2278
  }
1757
2279
  function isHTMLElement(value) {
2280
+ if (!hasWindow()) {
2281
+ return false;
2282
+ }
1758
2283
  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1759
2284
  }
1760
2285
  function isShadowRoot(value) {
1761
- // Browsers without `ShadowRoot` support.
1762
- if (typeof ShadowRoot === 'undefined') {
2286
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
1763
2287
  return false;
1764
2288
  }
1765
2289
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
@@ -1776,21 +2300,32 @@
1776
2300
  function isTableElement(element) {
1777
2301
  return ['table', 'td', 'th'].includes(getNodeName(element));
1778
2302
  }
1779
- function isContainingBlock(element) {
2303
+ function isTopLayer(element) {
2304
+ return [':popover-open', ':modal'].some(selector => {
2305
+ try {
2306
+ return element.matches(selector);
2307
+ } catch (e) {
2308
+ return false;
2309
+ }
2310
+ });
2311
+ }
2312
+ function isContainingBlock(elementOrCss) {
1780
2313
  const webkit = isWebKit();
1781
- const css = getComputedStyle(element);
2314
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
1782
2315
 
1783
2316
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1784
- return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
2317
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
2318
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1785
2319
  }
1786
2320
  function getContainingBlock(element) {
1787
2321
  let currentNode = getParentNode(element);
1788
2322
  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1789
2323
  if (isContainingBlock(currentNode)) {
1790
2324
  return currentNode;
1791
- } else {
1792
- currentNode = getParentNode(currentNode);
2325
+ } else if (isTopLayer(currentNode)) {
2326
+ return null;
1793
2327
  }
2328
+ currentNode = getParentNode(currentNode);
1794
2329
  }
1795
2330
  return null;
1796
2331
  }
@@ -1812,8 +2347,8 @@
1812
2347
  };
1813
2348
  }
1814
2349
  return {
1815
- scrollLeft: element.pageXOffset,
1816
- scrollTop: element.pageYOffset
2350
+ scrollLeft: element.scrollX,
2351
+ scrollTop: element.scrollY
1817
2352
  };
1818
2353
  }
1819
2354
  function getParentNode(node) {
@@ -1853,10 +2388,14 @@
1853
2388
  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1854
2389
  const win = getWindow(scrollableAncestor);
1855
2390
  if (isBody) {
1856
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
2391
+ const frameElement = getFrameElement(win);
2392
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1857
2393
  }
1858
2394
  return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1859
2395
  }
2396
+ function getFrameElement(win) {
2397
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
2398
+ }
1860
2399
 
1861
2400
  function getCssDimensions(element) {
1862
2401
  const css = getComputedStyle(element);
@@ -1959,8 +2498,9 @@
1959
2498
  if (domElement) {
1960
2499
  const win = getWindow(domElement);
1961
2500
  const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1962
- let currentIFrame = win.frameElement;
1963
- while (currentIFrame && offsetParent && offsetWin !== win) {
2501
+ let currentWin = win;
2502
+ let currentIFrame = getFrameElement(currentWin);
2503
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1964
2504
  const iframeScale = getScale(currentIFrame);
1965
2505
  const iframeRect = currentIFrame.getBoundingClientRect();
1966
2506
  const css = getComputedStyle(currentIFrame);
@@ -1972,7 +2512,8 @@
1972
2512
  height *= iframeScale.y;
1973
2513
  x += left;
1974
2514
  y += top;
1975
- currentIFrame = getWindow(currentIFrame).frameElement;
2515
+ currentWin = getWindow(currentIFrame);
2516
+ currentIFrame = getFrameElement(currentWin);
1976
2517
  }
1977
2518
  }
1978
2519
  return rectToClientRect({
@@ -1983,15 +2524,42 @@
1983
2524
  });
1984
2525
  }
1985
2526
 
2527
+ // If <html> has a CSS width greater than the viewport, then this will be
2528
+ // incorrect for RTL.
2529
+ function getWindowScrollBarX(element, rect) {
2530
+ const leftScroll = getNodeScroll(element).scrollLeft;
2531
+ if (!rect) {
2532
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
2533
+ }
2534
+ return rect.left + leftScroll;
2535
+ }
2536
+
2537
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
2538
+ if (ignoreScrollbarX === void 0) {
2539
+ ignoreScrollbarX = false;
2540
+ }
2541
+ const htmlRect = documentElement.getBoundingClientRect();
2542
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
2543
+ // RTL <body> scrollbar.
2544
+ getWindowScrollBarX(documentElement, htmlRect));
2545
+ const y = htmlRect.top + scroll.scrollTop;
2546
+ return {
2547
+ x,
2548
+ y
2549
+ };
2550
+ }
2551
+
1986
2552
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1987
2553
  let {
2554
+ elements,
1988
2555
  rect,
1989
2556
  offsetParent,
1990
2557
  strategy
1991
2558
  } = _ref;
1992
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2559
+ const isFixed = strategy === 'fixed';
1993
2560
  const documentElement = getDocumentElement(offsetParent);
1994
- if (offsetParent === documentElement) {
2561
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2562
+ if (offsetParent === documentElement || topLayer && isFixed) {
1995
2563
  return rect;
1996
2564
  }
1997
2565
  let scroll = {
@@ -2000,7 +2568,8 @@
2000
2568
  };
2001
2569
  let scale = createCoords(1);
2002
2570
  const offsets = createCoords(0);
2003
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2571
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2572
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2004
2573
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2005
2574
  scroll = getNodeScroll(offsetParent);
2006
2575
  }
@@ -2011,11 +2580,12 @@
2011
2580
  offsets.y = offsetRect.y + offsetParent.clientTop;
2012
2581
  }
2013
2582
  }
2583
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
2014
2584
  return {
2015
2585
  width: rect.width * scale.x,
2016
2586
  height: rect.height * scale.y,
2017
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2018
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2587
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
2588
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
2019
2589
  };
2020
2590
  }
2021
2591
 
@@ -2023,12 +2593,6 @@
2023
2593
  return Array.from(element.getClientRects());
2024
2594
  }
2025
2595
 
2026
- function getWindowScrollBarX(element) {
2027
- // If <html> has a CSS width greater than the viewport, then this will be
2028
- // incorrect for RTL.
2029
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2030
- }
2031
-
2032
2596
  // Gets the entire size of the scrollable document area, even extending outside
2033
2597
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2034
2598
  function getDocumentRect(element) {
@@ -2103,9 +2667,10 @@
2103
2667
  } else {
2104
2668
  const visualOffsets = getVisualOffsets(element);
2105
2669
  rect = {
2106
- ...clippingAncestor,
2107
2670
  x: clippingAncestor.x - visualOffsets.x,
2108
- y: clippingAncestor.y - visualOffsets.y
2671
+ y: clippingAncestor.y - visualOffsets.y,
2672
+ width: clippingAncestor.width,
2673
+ height: clippingAncestor.height
2109
2674
  };
2110
2675
  }
2111
2676
  return rectToClientRect(rect);
@@ -2161,7 +2726,7 @@
2161
2726
  rootBoundary,
2162
2727
  strategy
2163
2728
  } = _ref;
2164
- const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
2729
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2165
2730
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2166
2731
  const firstClippingAncestor = clippingAncestors[0];
2167
2732
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
@@ -2181,7 +2746,14 @@
2181
2746
  }
2182
2747
 
2183
2748
  function getDimensions(element) {
2184
- return getCssDimensions(element);
2749
+ const {
2750
+ width,
2751
+ height
2752
+ } = getCssDimensions(element);
2753
+ return {
2754
+ width,
2755
+ height
2756
+ };
2185
2757
  }
2186
2758
 
2187
2759
  function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
@@ -2203,17 +2775,26 @@
2203
2775
  offsets.x = offsetRect.x + offsetParent.clientLeft;
2204
2776
  offsets.y = offsetRect.y + offsetParent.clientTop;
2205
2777
  } else if (documentElement) {
2778
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
2779
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
2206
2780
  offsets.x = getWindowScrollBarX(documentElement);
2207
2781
  }
2208
2782
  }
2783
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
2784
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
2785
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
2209
2786
  return {
2210
- x: rect.left + scroll.scrollLeft - offsets.x,
2211
- y: rect.top + scroll.scrollTop - offsets.y,
2787
+ x,
2788
+ y,
2212
2789
  width: rect.width,
2213
2790
  height: rect.height
2214
2791
  };
2215
2792
  }
2216
2793
 
2794
+ function isStaticPositioned(element) {
2795
+ return getComputedStyle(element).position === 'static';
2796
+ }
2797
+
2217
2798
  function getTrueOffsetParent(element, polyfill) {
2218
2799
  if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
2219
2800
  return null;
@@ -2221,40 +2802,56 @@
2221
2802
  if (polyfill) {
2222
2803
  return polyfill(element);
2223
2804
  }
2224
- return element.offsetParent;
2805
+ let rawOffsetParent = element.offsetParent;
2806
+
2807
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
2808
+ // while Chrome and Safari return the <body> element. The <body> element must
2809
+ // be used to perform the correct calculations even if the <html> element is
2810
+ // non-static.
2811
+ if (getDocumentElement(element) === rawOffsetParent) {
2812
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
2813
+ }
2814
+ return rawOffsetParent;
2225
2815
  }
2226
2816
 
2227
2817
  // Gets the closest ancestor positioned element. Handles some edge cases,
2228
2818
  // such as table ancestors and cross browser bugs.
2229
2819
  function getOffsetParent(element, polyfill) {
2230
- const window = getWindow(element);
2820
+ const win = getWindow(element);
2821
+ if (isTopLayer(element)) {
2822
+ return win;
2823
+ }
2231
2824
  if (!isHTMLElement(element)) {
2232
- return window;
2825
+ let svgOffsetParent = getParentNode(element);
2826
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2827
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2828
+ return svgOffsetParent;
2829
+ }
2830
+ svgOffsetParent = getParentNode(svgOffsetParent);
2831
+ }
2832
+ return win;
2233
2833
  }
2234
2834
  let offsetParent = getTrueOffsetParent(element, polyfill);
2235
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
2835
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2236
2836
  offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2237
2837
  }
2238
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
2239
- return window;
2838
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2839
+ return win;
2240
2840
  }
2241
- return offsetParent || getContainingBlock(element) || window;
2841
+ return offsetParent || getContainingBlock(element) || win;
2242
2842
  }
2243
2843
 
2244
- const getElementRects = async function (_ref) {
2245
- let {
2246
- reference,
2247
- floating,
2248
- strategy
2249
- } = _ref;
2844
+ const getElementRects = async function (data) {
2250
2845
  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2251
2846
  const getDimensionsFn = this.getDimensions;
2847
+ const floatingDimensions = await getDimensionsFn(data.floating);
2252
2848
  return {
2253
- reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
2849
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2254
2850
  floating: {
2255
2851
  x: 0,
2256
2852
  y: 0,
2257
- ...(await getDimensionsFn(floating))
2853
+ width: floatingDimensions.width,
2854
+ height: floatingDimensions.height
2258
2855
  }
2259
2856
  };
2260
2857
  };
@@ -2276,10 +2873,75 @@
2276
2873
  isRTL
2277
2874
  };
2278
2875
 
2876
+ /**
2877
+ * Modifies the placement by translating the floating element along the
2878
+ * specified axes.
2879
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2880
+ * object may be passed.
2881
+ * @see https://floating-ui.com/docs/offset
2882
+ */
2883
+ const offset = offset$1;
2884
+
2885
+ /**
2886
+ * Optimizes the visibility of the floating element by choosing the placement
2887
+ * that has the most space available automatically, without needing to specify a
2888
+ * preferred placement. Alternative to `flip`.
2889
+ * @see https://floating-ui.com/docs/autoPlacement
2890
+ */
2891
+ autoPlacement;
2892
+
2893
+ /**
2894
+ * Optimizes the visibility of the floating element by shifting it in order to
2895
+ * keep it in view when it will overflow the clipping boundary.
2896
+ * @see https://floating-ui.com/docs/shift
2897
+ */
2898
+ const shift = shift$1;
2899
+
2900
+ /**
2901
+ * Optimizes the visibility of the floating element by flipping the `placement`
2902
+ * in order to keep it in view when the preferred placement(s) will overflow the
2903
+ * clipping boundary. Alternative to `autoPlacement`.
2904
+ * @see https://floating-ui.com/docs/flip
2905
+ */
2906
+ const flip = flip$1;
2907
+
2908
+ /**
2909
+ * Provides data that allows you to change the size of the floating element —
2910
+ * for instance, prevent it from overflowing the clipping boundary or match the
2911
+ * width of the reference element.
2912
+ * @see https://floating-ui.com/docs/size
2913
+ */
2914
+ size;
2915
+
2916
+ /**
2917
+ * Provides data to hide the floating element in applicable situations, such as
2918
+ * when it is not in the same clipping context as the reference element.
2919
+ * @see https://floating-ui.com/docs/hide
2920
+ */
2921
+ hide;
2922
+
2923
+ /**
2924
+ * Provides data to position an inner element of the floating element so that it
2925
+ * appears centered to the reference element.
2926
+ * @see https://floating-ui.com/docs/arrow
2927
+ */
2928
+ const arrow = arrow$1;
2929
+
2930
+ /**
2931
+ * Provides improved positioning for inline reference elements that can span
2932
+ * over multiple lines, such as hyperlinks or range selections.
2933
+ * @see https://floating-ui.com/docs/inline
2934
+ */
2935
+ inline;
2936
+
2937
+ /**
2938
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2939
+ */
2940
+ limitShift;
2941
+
2279
2942
  /**
2280
2943
  * Computes the `x` and `y` coordinates that will place the floating element
2281
- * next to a reference element when it is given a certain CSS positioning
2282
- * strategy.
2944
+ * next to a given reference element.
2283
2945
  */
2284
2946
  const computePosition = (reference, floating, options) => {
2285
2947
  // This caches the expensive `getClippingElementAncestors` function so that
@@ -2302,7 +2964,6 @@
2302
2964
 
2303
2965
  var selected = {};
2304
2966
  function highlight(item, node, keys) {
2305
- item.id;
2306
2967
  var rectEle = getOptimizedBoundingRectEle(node);
2307
2968
  if (!item.highlightBox) {
2308
2969
  var box = HighlightBox(rectEle, colors.highlight);
@@ -2607,13 +3268,13 @@
2607
3268
  ignoreMergedEleUniqueIds.push(child.uniqueID);
2608
3269
  }
2609
3270
  var txt = child.textContent;
2610
- if (nodeI18nMeta && nodeI18nMeta['html'] && i < node.childNodes.length - 1) {
3271
+ if (nodeI18nMeta && nodeI18nMeta.html && i < node.childNodes.length - 1) {
2611
3272
  merge.push({
2612
3273
  childIndex: i,
2613
3274
  child: child,
2614
3275
  text: txt
2615
3276
  });
2616
- } else if (nodeI18nMeta && nodeI18nMeta['html'] && i === node.childNodes.length - 1) {
3277
+ } else if (nodeI18nMeta && nodeI18nMeta.html && i === node.childNodes.length - 1) {
2617
3278
  merge.push({
2618
3279
  childIndex: i,
2619
3280
  child: child,
@@ -2622,7 +3283,7 @@
2622
3283
  storeIfQualifiedKey(node.uniqueID, null, 'html', nodeI18nMeta, node, merge, node.innerHTML);
2623
3284
  merge = [];
2624
3285
  } else if (txt) {
2625
- if (nodeI18nMeta && nodeI18nMeta['text']) {
3286
+ if (nodeI18nMeta && nodeI18nMeta.text) {
2626
3287
  storeIfQualifiedKey(node.uniqueID, null, 'text', nodeI18nMeta, node, undefined, txt);
2627
3288
  } else if (child.nodeName === '#text' && !containsOnlySpaces(txt)) {
2628
3289
  uninstrumentedStore.save(node.uniqueID, 'text', node, txt);
@@ -2777,7 +3438,9 @@
2777
3438
  }
2778
3439
  }
2779
3440
  function dragMouseDown(e) {
2780
- if (!overlay) overlay = document.getElementById('i18next-editor-popup-overlay');
3441
+ if (!overlay) {
3442
+ overlay = document.getElementById('i18next-editor-popup-overlay');
3443
+ }
2781
3444
  if (overlay) overlay.style.display = 'block';
2782
3445
  stopMouseTracking();
2783
3446
  elmnt = this.parentPopup;
@@ -2804,7 +3467,7 @@
2804
3467
  startMouseTracking();
2805
3468
  if (overlay) overlay.style.display = 'none';
2806
3469
  var ele = document.getElementById('i18next-editor-popup');
2807
- localStorage.setItem('locize_popup_pos', JSON.stringify({
3470
+ window.localStorage.setItem('locize_popup_pos', JSON.stringify({
2808
3471
  top: parseInt(document.defaultView.getComputedStyle(ele).top, 10),
2809
3472
  left: parseInt(document.defaultView.getComputedStyle(ele).left, 10)
2810
3473
  }));
@@ -2844,7 +3507,9 @@
2844
3507
  }
2845
3508
  function initDrag(e) {
2846
3509
  stopMouseTracking();
2847
- if (!overlay) overlay = document.getElementById('i18next-editor-popup-overlay');
3510
+ if (!overlay) {
3511
+ overlay = document.getElementById('i18next-editor-popup-overlay');
3512
+ }
2848
3513
  if (overlay) overlay.style.display = 'block';
2849
3514
  element = this.parentPopup;
2850
3515
  startX = e.clientX;
@@ -2862,7 +3527,7 @@
2862
3527
  startMouseTracking();
2863
3528
  if (overlay) overlay.style.display = 'none';
2864
3529
  var ele = document.getElementById('i18next-editor-popup');
2865
- localStorage.setItem('locize_popup_size', JSON.stringify({
3530
+ window.localStorage.setItem('locize_popup_size', JSON.stringify({
2866
3531
  width: parseInt(document.defaultView.getComputedStyle(ele).width, 10),
2867
3532
  height: parseInt(document.defaultView.getComputedStyle(ele).height, 10)
2868
3533
  }));
@@ -2900,7 +3565,9 @@
2900
3565
  if (Array.isArray(fallback)) return fallback[fallback.length - 1];
2901
3566
  if (fallback && fallback["default"]) {
2902
3567
  if (typeof fallback["default"] === 'string') return fallback;
2903
- if (Array.isArray(fallback["default"])) return fallback["default"][fallback["default"].length - 1];
3568
+ if (Array.isArray(fallback["default"])) {
3569
+ return fallback["default"][fallback["default"].length - 1];
3570
+ }
2904
3571
  }
2905
3572
  if (typeof fallback === 'function') {
2906
3573
  var res = fallback(i18n.resolvedLanguage);
@@ -2957,21 +3624,13 @@
2957
3624
  getResource: function getResource(lng, ns, key) {
2958
3625
  return {};
2959
3626
  },
2960
- setResource: function setResource(lng, ns, key, value) {
2961
- return;
2962
- },
3627
+ setResource: function setResource(lng, ns, key, value) {},
2963
3628
  getResourceBundle: function getResourceBundle(lng, ns, cb) {
2964
3629
  cb({});
2965
3630
  },
2966
- getDefaultNS: function getDefaultNS() {
2967
- return;
2968
- },
2969
- getLng: function getLng() {
2970
- return;
2971
- },
2972
- getSourceLng: function getSourceLng() {
2973
- return;
2974
- },
3631
+ getDefaultNS: function getDefaultNS() {},
3632
+ getLng: function getLng() {},
3633
+ getSourceLng: function getSourceLng() {},
2975
3634
  getLocizeDetails: function getLocizeDetails() {
2976
3635
  return {};
2977
3636
  },
@@ -2985,10 +3644,6 @@
2985
3644
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2986
3645
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2987
3646
  var dummyImplementation = getImplementation();
2988
- var isInIframe = typeof window !== 'undefined';
2989
- try {
2990
- isInIframe = self !== top;
2991
- } catch (e) {}
2992
3647
  function start() {
2993
3648
  var implementation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dummyImplementation;
2994
3649
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
@@ -3050,7 +3705,7 @@
3050
3705
  }
3051
3706
  }
3052
3707
  if (document.body) return continueToStart();
3053
- window.addEventListener('load', function () {
3708
+ if (typeof window !== 'undefined') window.addEventListener('load', function () {
3054
3709
  return continueToStart();
3055
3710
  });
3056
3711
  }
@@ -3076,7 +3731,8 @@
3076
3731
  var options = i18n.options;
3077
3732
  i18next = i18n;
3078
3733
  var impl = getImplementation$1(i18n);
3079
- configurePostProcessor(i18next, options);
3734
+ var showInContext = opt.show || getQsParameterByName(opt.qsProp) === 'true';
3735
+ if (isInIframe || showInContext) configurePostProcessor(i18next, options);
3080
3736
  start(impl, opt);
3081
3737
  }
3082
3738
  };
@@ -3090,7 +3746,9 @@
3090
3746
  rest = _objectWithoutProperties(options, _excluded);
3091
3747
  start(implementation, Object.keys(rest).length > 0 ? rest : undefined);
3092
3748
  }
3093
- if (typeof window !== 'undefined') window.locizeStartStandalone = startStandalone;
3749
+ if (typeof window !== 'undefined') {
3750
+ window.locizeStartStandalone = startStandalone;
3751
+ }
3094
3752
 
3095
3753
  var index = {
3096
3754
  wrap: wrap,