@lwrjs/client-modules 0.9.0-alpha.10 → 0.9.0-alpha.11

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.
@@ -66,6 +66,7 @@ function ObjectLookupOwnValue$LWS(object$LWS, key$LWS) {
66
66
 
67
67
  const SymbolCtor$LWS$1 = Symbol;
68
68
  const {
69
+ asyncIterator: SymbolAsyncIterator$LWS,
69
70
  for: SymbolFor$LWS$1,
70
71
  iterator: SymbolIterator$LWS$1,
71
72
  toStringTag: SymbolToStringTag$LWS$1,
@@ -318,8 +319,7 @@ const {
318
319
  const {
319
320
  toFixed: NumberProtoToFixed$LWS,
320
321
  valueOf: NumberProtoValueOf$LWS
321
- } = NumberCtor$LWS$1.prototype; // Used by '@locker/near-membrane-dom'.
322
-
322
+ } = NumberCtor$LWS$1.prototype;
323
323
  const StringCtor$LWS$1 = String;
324
324
  const {
325
325
  prototype: StringProto$LWS$1
@@ -1123,11 +1123,14 @@ function partialStructuredCloneInternal$LWS(value$LWS) {
1123
1123
  function partialStructuredClone$LWS(value$LWS) {
1124
1124
  let result$LWS = value$LWS;
1125
1125
 
1126
- try {
1127
- result$LWS = partialStructuredCloneInternal$LWS(value$LWS); // eslint-disable-next-line no-empty
1128
- } catch (_unused15$LWS) {}
1126
+ if (typeof value$LWS === 'object' && value$LWS !== null) {
1127
+ try {
1128
+ result$LWS = partialStructuredCloneInternal$LWS(value$LWS); // eslint-disable-next-line no-empty
1129
+ } catch (_unused15$LWS) {}
1130
+
1131
+ SEEN_OBJECTS_MAP$LWS.clear();
1132
+ }
1129
1133
 
1130
- SEEN_OBJECTS_MAP$LWS.clear();
1131
1134
  return result$LWS;
1132
1135
  }
1133
1136
 
@@ -1160,8 +1163,7 @@ function consoleWarn$LWS(...args$LWS) {
1160
1163
  ReflectApply$LWS$1(consoleWarnRef$LWS, consoleRef$LWS, args$LWS);
1161
1164
  } // Used by '@locker/near-membrane-base'
1162
1165
 
1163
-
1164
- const ErrorCtor$LWS$1 = Error; // Used by '@locker/near-membrane-' packages.
1166
+ const TypeErrorCtor$LWS$1 = TypeError;
1165
1167
 
1166
1168
  class LockerSecurityError$LWS extends Error {
1167
1169
  constructor(message$LWS) {
@@ -1318,7 +1320,7 @@ function createRevokedProxy$LWS(object$LWS) {
1318
1320
  revocable$LWS.revoke();
1319
1321
  return revocable$LWS.proxy;
1320
1322
  }
1321
- /*! version: 0.17.18 */
1323
+ /*! version: 0.18.2 */
1322
1324
 
1323
1325
  /*!
1324
1326
  * Copyright (C) 2019 salesforce.com, inc.
@@ -1362,6 +1364,7 @@ const {
1362
1364
  getAttributeNodeNS: ElementProtoGetAttributeNodeNS$LWS,
1363
1365
  hasAttribute: ElementProtoHasAttribute$LWS,
1364
1366
  querySelector: ElementProtoQuerySelector$LWS,
1367
+ querySelectorAll: ElementProtoQuerySelectorAll$LWS,
1365
1368
  removeAttributeNode: ElementProtoRemoveAttributeNode$LWS,
1366
1369
  setAttribute: ElementProtoSetAttribute$LWS$1,
1367
1370
  setAttributeNS: ElementProtoSetAttributeNS$LWS
@@ -1389,7 +1392,14 @@ const NodeProtoFirstChildGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$
1389
1392
  ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'lastChild');
1390
1393
  const NodeProtoNodeNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'nodeName');
1391
1394
  const NodeProtoOwnerDocumentGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'ownerDocument');
1392
- const rootWindow$LWS$1 = window; // These properties are part of the WindowOrGlobalScope mixin and not on
1395
+ const {
1396
+ get: NodeProtoTextContentGetter$LWS,
1397
+ set: NodeProtoTextContentSetter$LWS
1398
+ } = ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
1399
+ const rootWindow$LWS$1 = window;
1400
+ const {
1401
+ location: rootWindowLocation$LWS
1402
+ } = rootWindow$LWS$1; // These properties are part of the WindowOrGlobalScope mixin and not on
1393
1403
  // Window.prototype.
1394
1404
  // https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope
1395
1405
 
@@ -1530,10 +1540,9 @@ function getValidator$LWS(globalObject$LWS, document$LWS = globalObject$LWS == n
1530
1540
  return validator$LWS;
1531
1541
  }
1532
1542
 
1533
- const BlobCtor$LWS = Blob;
1534
1543
  const {
1535
1544
  prototype: BlobProto$LWS
1536
- } = BlobCtor$LWS;
1545
+ } = Blob;
1537
1546
  const {
1538
1547
  slice: BlobProtoSlice$LWS
1539
1548
  } = BlobProto$LWS;
@@ -1554,7 +1563,6 @@ const brands$LWS$1 = userAgentData$LWS$1 == null ? void 0 : userAgentData$LWS$1.
1554
1563
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
1555
1564
 
1556
1565
  const chromiumUserAgentRegExp$LWS$1 = / (?:Headless)?Chrome\/\d+/;
1557
- const headlessChromiumUserAgentRegExp$LWS = / HeadlessChrome\/\d+/;
1558
1566
  const webKitUserAgentRegExp$LWS = /WebKit/i;
1559
1567
  let userAgent$LWS$1;
1560
1568
 
@@ -1564,7 +1572,8 @@ function getUserAgent$LWS$1() {
1564
1572
  }
1565
1573
 
1566
1574
  return userAgent$LWS$1;
1567
- }
1575
+ } // Used by '@locker/near-membrane-dom'.
1576
+
1568
1577
 
1569
1578
  const IS_CHROMIUM_BROWSER$LWS$1 = // While experimental, `navigator.userAgentData.brands` may be defined as an
1570
1579
  // empty array in headless Chromium based browsers.
@@ -1572,10 +1581,9 @@ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ? // Use user-agent clie
1572
1581
  // warnings.
1573
1582
  // https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API
1574
1583
  // istanbul ignore next: this code is not reachable in the coverage run.
1575
- ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [// prettier-ignore
1584
+ ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [// istanbul ignore next: this code is not reachable in the coverage run.
1576
1585
  item$LWS => (item$LWS == null ? void 0 : item$LWS.brand) === 'Chromium']) !== undefined : // Fallback to a standard user-agent string sniff.
1577
- ReflectApply$LWS$1(RegExpProtoTest$LWS$1, chromiumUserAgentRegExp$LWS$1, [getUserAgent$LWS$1()]);
1578
- const IS_HEADLESS_CHROMIUM_BROWSER$LWS = ArrayIsArray$LWS$1(brands$LWS$1) && !brands$LWS$1.length || ReflectApply$LWS$1(RegExpProtoTest$LWS$1, headlessChromiumUserAgentRegExp$LWS, [getUserAgent$LWS$1()]);
1586
+ ReflectApply$LWS$1(RegExpProtoTest$LWS$1, chromiumUserAgentRegExp$LWS$1, [getUserAgent$LWS$1()]); // Used by '@locker/near-membrane-dom'.
1579
1587
  const IS_WEBKIT_BROWSER$LWS = !IS_CHROMIUM_BROWSER$LWS$1 && ( // istanbul ignore next: this code is not reachable in the coverage run.
1580
1588
  ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ? ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [// istanbul ignore next
1581
1589
  item$LWS => {
@@ -1584,46 +1592,49 @@ item$LWS => {
1584
1592
  }]) !== undefined : ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [getUserAgent$LWS$1()]));
1585
1593
  const {
1586
1594
  getElementById: DocumentFragmentProtoGetElementById$LWS
1587
- } = DocumentFragment.prototype; // The DOMException constructor was exposed in Edge 12 but wasn't invocable
1595
+ } = DocumentFragment.prototype; // Used by '@locker/near-membrane-shared-dom'.
1596
+ // The DOMException constructor was exposed in Edge 12 but wasn't invocable
1588
1597
  // until Edge 79. As long as this is used for instanceof checks it should be fine.
1589
1598
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMException#browser_compatibility
1590
1599
 
1591
1600
  const DOMExceptionCtor$LWS$1 = DOMException;
1592
- const {
1593
- prototype: DOMExceptionProto$LWS
1594
- } = DOMExceptionCtor$LWS$1;
1595
- ObjectLookupOwnGetter$LWS$1(DOMExceptionProto$LWS, 'code');
1601
+ ObjectLookupOwnGetter$LWS$1(DOMExceptionCtor$LWS$1.prototype, 'code');
1596
1602
  const {
1597
1603
  createDocument: DOMImplementationProtoCreateDocument$LWS
1598
1604
  } = DOMImplementation.prototype;
1599
1605
  const DOMTokenListProtoValueGetter$LWS = ObjectLookupOwnGetter$LWS$1(DOMTokenList.prototype, 'value');
1600
1606
  const EventCtor$LWS = Event;
1601
1607
  const ErrorEventCtor$LWS = ErrorEvent;
1602
- const EventProtoCurrentTargetGetter$LWS = ObjectLookupOwnGetter$LWS$1(EventCtor$LWS.prototype, 'currentTarget');
1608
+ const {
1609
+ prototype: EventProto$LWS
1610
+ } = EventCtor$LWS;
1611
+ const {
1612
+ stopPropagation: EventProtoStopPropagation$LWS
1613
+ } = EventProto$LWS;
1614
+ const EventProtoCurrentTargetGetter$LWS = ObjectLookupOwnGetter$LWS$1(EventProto$LWS, 'currentTarget');
1603
1615
  const {
1604
1616
  addEventListener: EventTargetProtoAddEventListener$LWS,
1605
- dispatchEvent: EventTargetProtoDispatchEvent$LWS
1617
+ dispatchEvent: EventTargetProtoDispatchEvent$LWS,
1618
+ removeEventListener: EventTargetProtoRemoveEventListener$LWS
1606
1619
  } = EventTarget.prototype;
1607
- const HTMLAnchorElementProtoHostnameGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElement.prototype, 'hostname');
1608
1620
  const {
1609
1621
  get: HTMLAnchorElementProtoHrefGetter$LWS,
1610
1622
  set: HTMLAnchorElementProtoHrefSetter$LWS
1611
1623
  } = ReflectGetOwnPropertyDescriptor$LWS(HTMLAnchorElement.prototype, 'href');
1612
1624
  const HTMLAnchorElementProtoPathnameGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElement.prototype, 'pathname');
1613
- const HTMLAnchorElementProtoProtocolGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElement.prototype, 'protocol');
1614
- const {
1615
- prototype: HTMLElementProto$LWS
1616
- } = HTMLElement;
1617
- const HTMLElementProtoDatasetGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLElementProto$LWS, 'dataset'); // Used by '@locker/near-membrane-dom'.
1625
+ const HTMLAnchorElementProtoProtocolGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElement.prototype, 'protocol'); // Used by '@locker/near-membrane-dom'.
1618
1626
 
1619
- ObjectLookupOwnGetter$LWS$1(HTMLElementProto$LWS, 'style');
1627
+ ObjectLookupOwnGetter$LWS$1(HTMLElement.prototype, 'style');
1620
1628
  const {
1621
1629
  prototype: HTMLIFrameElementProto$LWS
1622
1630
  } = HTMLIFrameElement; // Used by '@locker/near-membrane-dom'.
1623
1631
 
1624
1632
  ObjectLookupOwnGetter$LWS$1(HTMLIFrameElementProto$LWS, 'contentWindow');
1625
1633
  const HTMLIFrameElementProtoSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'src');
1626
- ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement.prototype, 'src');
1634
+ const {
1635
+ get: HTMLScriptElementProtoSrcGetter$LWS,
1636
+ set: HTMLScriptElementProtoSrcSetter$LWS
1637
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement.prototype, 'src');
1627
1638
  const NAMESPACE_DEFAULT$LWS = 'default';
1628
1639
  const NAMESPACE_SVG$LWS = 'http://www.w3.org/2000/svg';
1629
1640
  const NAMESPACE_XHTML$LWS = 'http://www.w3.org/1999/xhtml';
@@ -1631,11 +1642,104 @@ const NAMESPACE_XLINK$LWS = 'http://www.w3.org/1999/xlink';
1631
1642
  const RequestProtoURLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Request.prototype, 'url');
1632
1643
  const ResponseCtor$LWS = Response;
1633
1644
  const ResponseProto$LWS = ResponseCtor$LWS.prototype;
1634
- const {
1635
- text: ResponseProtoText$LWS
1636
- } = ResponseProto$LWS;
1637
- const ResponseProtoStatus$LWS = ObjectLookupOwnGetter$LWS$1(ResponseProto$LWS, 'status');
1638
- const ResponseProtoStatusText$LWS = ObjectLookupOwnGetter$LWS$1(ResponseProto$LWS, 'statusText');
1645
+ ObjectLookupOwnGetter$LWS$1(ResponseProto$LWS, 'status');
1646
+ ObjectLookupOwnGetter$LWS$1(ResponseProto$LWS, 'statusText');
1647
+ const SCRIPT_EVALUATOR_PROPERTY_NAME$LWS = '$evaluator$';
1648
+ const SCRIPT_HOOK_SOURCE_TEXT$LWS = `document.currentScript.${SCRIPT_EVALUATOR_PROPERTY_NAME$LWS}`;
1649
+ const evaluatedScriptElements$LWS = toSafeWeakSet$LWS(new WeakSetCtor$LWS());
1650
+ const scriptToOriginalScriptTextContentMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
1651
+ const scriptToResolvedURLRegistryMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
1652
+
1653
+ function defineScriptAccessorProperty$LWS(script$LWS, propKey$LWS, getter$LWS, setter$LWS) {
1654
+ ReflectDefineProperty$LWS$1(script$LWS, propKey$LWS, {
1655
+ __proto__: null,
1656
+ configurable: true,
1657
+ enumerable: true,
1658
+ get: getter$LWS,
1659
+ set: setter$LWS
1660
+ });
1661
+ }
1662
+
1663
+ function defineScriptEvaluatorProperty$LWS(script$LWS, callback$LWS) {
1664
+ if (!ReflectDefineProperty$LWS$1(script$LWS, SCRIPT_EVALUATOR_PROPERTY_NAME$LWS, {
1665
+ __proto__: null,
1666
+ configurable: true,
1667
+ // Create a bound function to obscure the getter source as "[native code]".
1668
+ get: ReflectApply$LWS$1(FunctionProtoBind$LWS, () => {
1669
+ // Track the script element evaluation to ensure the element
1670
+ // is evaluated only once.
1671
+ evaluatedScriptElements$LWS.add(script$LWS);
1672
+ deleteScriptEvaluatorProperty$LWS(script$LWS);
1673
+ const ownerDoc$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, script$LWS, []);
1674
+ const defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, ownerDoc$LWS, []); // We don't need to use something like `WindowLocationGetter()`
1675
+ // because the 'location' and 'top' property are non-configurable.
1676
+
1677
+ const context$LWS = {
1678
+ [UNCOMPILED_LOCATION_NAME$LWS]: defaultView$LWS.location,
1679
+ [UNCOMPILED_TOP_NAME$LWS]: defaultView$LWS.top
1680
+ };
1681
+ callback$LWS(context$LWS, defaultView$LWS, ownerDoc$LWS);
1682
+ }, [])
1683
+ })) {
1684
+ // istanbul ignore next: require a test to get the evaluator in a bad state. Like code that tried to access it in between. This is mostly a "the universe is not as expected error"
1685
+ throw new LockerSecurityError$LWS(`Cannot evaluate ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, script$LWS, [])}`);
1686
+ }
1687
+ }
1688
+
1689
+ function deleteResolvedScriptURL$LWS(script$LWS) {
1690
+ scriptToResolvedURLRegistryMap$LWS.delete(script$LWS);
1691
+ }
1692
+
1693
+ function deleteScriptEvaluatorProperty$LWS(script$LWS) {
1694
+ ReflectDeleteProperty$LWS$1(script$LWS, SCRIPT_EVALUATOR_PROPERTY_NAME$LWS);
1695
+ const originalScriptTextContent$LWS = scriptToOriginalScriptTextContentMap$LWS.get(script$LWS);
1696
+
1697
+ if (typeof originalScriptTextContent$LWS === 'string') {
1698
+ scriptToOriginalScriptTextContentMap$LWS.delete(script$LWS);
1699
+ ReflectDeleteProperty$LWS$1(script$LWS, 'textContent');
1700
+ ReflectApply$LWS$1(NodeProtoTextContentSetter$LWS, script$LWS, [originalScriptTextContent$LWS]);
1701
+ }
1702
+ }
1703
+
1704
+ function getOriginalScriptTextContent$LWS(script$LWS) {
1705
+ return scriptToOriginalScriptTextContentMap$LWS.get(script$LWS);
1706
+ }
1707
+
1708
+ function getResolvedScriptURL$LWS(script$LWS, attributeName$LWS) {
1709
+ var _scriptToResolvedURLR$LWS;
1710
+
1711
+ return (_scriptToResolvedURLR$LWS = scriptToResolvedURLRegistryMap$LWS.get(script$LWS)) == null ? void 0 : _scriptToResolvedURLR$LWS[attributeName$LWS];
1712
+ }
1713
+
1714
+ function isScriptEvaluated$LWS(script$LWS) {
1715
+ return evaluatedScriptElements$LWS.has(script$LWS);
1716
+ }
1717
+
1718
+ function isScriptURLEvaluatorHookDefined$LWS(script$LWS) {
1719
+ return scriptToResolvedURLRegistryMap$LWS.has(script$LWS);
1720
+ }
1721
+
1722
+ function isTextContentEvaluatorHookDefined$LWS(script$LWS) {
1723
+ return scriptToOriginalScriptTextContentMap$LWS.has(script$LWS);
1724
+ }
1725
+
1726
+ function setOriginalScriptTextContent$LWS(script$LWS, textContent$LWS) {
1727
+ return scriptToOriginalScriptTextContentMap$LWS.set(script$LWS, textContent$LWS);
1728
+ }
1729
+
1730
+ function setResolvedScriptURL$LWS(script$LWS, attributeName$LWS, resolvedURL$LWS) {
1731
+ let resolvedURLRegistry$LWS = scriptToResolvedURLRegistryMap$LWS.get(script$LWS);
1732
+
1733
+ if (resolvedURLRegistry$LWS === undefined) {
1734
+ resolvedURLRegistry$LWS = {
1735
+ __proto__: null
1736
+ };
1737
+ scriptToResolvedURLRegistryMap$LWS.set(script$LWS, resolvedURLRegistry$LWS);
1738
+ }
1739
+
1740
+ resolvedURLRegistry$LWS[attributeName$LWS] = resolvedURL$LWS;
1741
+ }
1742
+
1639
1743
  const documentPattern$LWS = 'document';
1640
1744
  const windowPattern$LWS = 'document\\.defaultView|frames|globalThis|self|window';
1641
1745
  const webpackGlobalPattern$LWS = `${windowPattern$LWS}|global`;
@@ -1756,9 +1860,11 @@ const {
1756
1860
  removeItem: StorageProtoRemoveItem$LWS,
1757
1861
  setItem: StorageProtoSetItem$LWS
1758
1862
  } = Storage.prototype;
1759
- const SVGElementProtoDatasetGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGElement.prototype, 'dataset');
1760
1863
  const {
1761
- createObjectURL: URLCreateObjectURL$LWS,
1864
+ get: SVGScriptElementProtoHrefGetter$LWS,
1865
+ set: SVGScriptElementProtoHrefSetter$LWS
1866
+ } = ReflectGetOwnPropertyDescriptor$LWS(SVGScriptElement.prototype, 'href');
1867
+ const {
1762
1868
  revokeObjectURL: URLRevokeObjectURL$LWS
1763
1869
  } = URL; // This has to be done 1-by-1 because putting a full file ignore in this file
1764
1870
  // will result in dist/index.mjs.js containing the directive and subsequently being
@@ -1776,18 +1882,17 @@ const {
1776
1882
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
1777
1883
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
1778
1884
  const XhrProtoWithCredentialsSetter$LWS = ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
1779
- /*! version: 0.17.18 */
1885
+ /*! version: 0.18.2 */
1780
1886
 
1781
1887
  /*!
1782
1888
  * Copyright (C) 2019 salesforce.com, inc.
1783
1889
  */
1784
- const ALLOWED_MIME_TYPES$LWS = ['application/octet-stream', 'application/json', 'application/pdf', 'video/', 'audio/', 'image/', 'font/', 'text/plain', 'text/markdown', 'application/zip', 'application/x-bzip', 'application/x-rar-compressed', 'application/x-tar']; // Allow only alphanumeric, '-', '+', and '.' characters.
1785
-
1890
+ const ALLOWED_MIME_TYPES$LWS = ['application/octet-stream', 'application/json', 'application/pdf', 'video/', 'audio/', 'image/', 'font/', 'text/plain', 'text/markdown', 'application/zip', 'application/x-bzip', 'application/x-rar-compressed', 'application/x-tar'];
1786
1891
  const validMimeTypeRegExp$LWS = /^[a-z]+\/[a-z0-9.+-]+$/;
1787
1892
 
1788
1893
  function isMIMETypeAllowed$LWS(mimeType$LWS) {
1789
- // avoid MIME types which try to escape using special characters
1790
- // Reason: W-4896359
1894
+ // W-4896359 Avoid MIME types which try to escape using special characters:
1895
+ // Allow only alphanumeric, '-', '+', and '.' characters.
1791
1896
  if (ReflectApply$LWS$1(RegExpProtoTest$LWS$1, validMimeTypeRegExp$LWS, [mimeType$LWS])) {
1792
1897
  for (let i$LWS = 0, {
1793
1898
  length: length$LWS
@@ -1802,16 +1907,9 @@ function isMIMETypeAllowed$LWS(mimeType$LWS) {
1802
1907
  }
1803
1908
 
1804
1909
  const DISALLOWED_ENDPOINTS_LIST$LWS = ['/aura', '/webruntime'];
1805
- const newlinesAndTabsRegExp$LWS = /[\u2028\u2029\n\r\t]/g;
1806
- const TRUSTED_DOMAINS_REG_EXP$LWS = /\.(force|salesforce|visualforce|documentforce|my\.site|salesforce-sites)\.com$/;
1807
1910
  const URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['http:', 'https:']);
1808
- const normalizerAnchor$LWS$1 = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['a']);
1809
-
1810
- function normalizeUrl$LWS(url$LWS) {
1811
- ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS$1, [url$LWS]);
1812
- return ReflectApply$LWS$1(HTMLAnchorElementProtoHrefGetter$LWS, normalizerAnchor$LWS$1, []);
1813
- } // @TODO W-7302311 Make paths and domains configurable
1814
-
1911
+ const newlinesAndTabsRegExp$LWS = /[\u2028\u2029\n\r\t]/g;
1912
+ const normalizerAnchor$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['a']); // @TODO: W-7302311 Make paths and domains configurable.
1815
1913
 
1816
1914
  function isValidURL$LWS(parsedURL$LWS) {
1817
1915
  const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
@@ -1828,27 +1926,31 @@ function isValidURL$LWS(parsedURL$LWS) {
1828
1926
  }
1829
1927
 
1830
1928
  function isValidURLScheme$LWS(url$LWS) {
1831
- ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS$1, [url$LWS]);
1832
- return URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS$1, []));
1929
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
1930
+ return URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
1833
1931
  }
1834
1932
 
1835
1933
  function parseURL$LWS(url$LWS) {
1836
- ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS$1, [sanitizeURLString$LWS(url$LWS)]);
1934
+ const normalizedURL$LWS = sanitizeURLForElement$LWS(url$LWS);
1837
1935
  return {
1838
- normalizedURL: ReflectApply$LWS$1(HTMLAnchorElementProtoHrefGetter$LWS, normalizerAnchor$LWS$1, []),
1839
- hostname: ReflectApply$LWS$1(HTMLAnchorElementProtoHostnameGetter$LWS, normalizerAnchor$LWS$1, []),
1840
- pathname: WindowDecodeURIComponent$LWS(ReflectApply$LWS$1(HTMLAnchorElementProtoPathnameGetter$LWS, normalizerAnchor$LWS$1, []))
1936
+ normalizedURL: normalizedURL$LWS,
1937
+ pathname: WindowDecodeURIComponent$LWS(ReflectApply$LWS$1(HTMLAnchorElementProtoPathnameGetter$LWS, normalizerAnchor$LWS, []))
1841
1938
  };
1842
1939
  }
1843
1940
 
1941
+ function resolveURL$LWS(url$LWS) {
1942
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
1943
+ return ReflectApply$LWS$1(HTMLAnchorElementProtoHrefGetter$LWS, normalizerAnchor$LWS, []);
1944
+ }
1945
+
1844
1946
  function sanitizeURLForElement$LWS(url$LWS) {
1845
- return sanitizeURLString$LWS(normalizeUrl$LWS(url$LWS));
1947
+ return resolveURL$LWS(sanitizeURLString$LWS(url$LWS));
1846
1948
  }
1847
1949
 
1848
1950
  function sanitizeURLString$LWS(urlString$LWS) {
1849
1951
  return urlString$LWS === '' ? urlString$LWS : ReflectApply$LWS$1(StringProtoReplace$LWS, urlString$LWS, [newlinesAndTabsRegExp$LWS, '']);
1850
1952
  }
1851
- /*! version: 0.17.18 */
1953
+ /*! version: 0.18.2 */
1852
1954
 
1853
1955
  /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */
1854
1956
 
@@ -3588,19 +3690,22 @@ const SANITIZER_HOOKS_REGISTRY$LWS = {
3588
3690
  __proto__: null,
3589
3691
  uponSanitizeAttribute: sanitizeHrefAttributeHook$LWS
3590
3692
  };
3591
- const htmlTemplate$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
3592
- const normalizerAnchor$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['a']); // Queue for managing pending xhr requests.
3693
+ const htmlTemplate$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']); // Queue for managing pending xhr requests.
3593
3694
 
3594
3695
  const queue$LWS = toSafeSet$LWS(new SetCtor$LWS$1()); // A regexp to find all non lowercase alphanumeric.
3595
3696
 
3596
3697
  const urlReplacerRegExp$LWS = /[^a-z0-9]+/gi;
3597
3698
 
3598
3699
  function checkExistingAndDequeue$LWS(container$LWS, normalizedHref$LWS) {
3599
- if (queue$LWS.has(normalizedHref$LWS.normalizedUrl)) {
3700
+ const {
3701
+ normalizedURL: normalizedURL$LWS
3702
+ } = normalizedHref$LWS;
3703
+
3704
+ if (queue$LWS.has(normalizedURL$LWS)) {
3600
3705
  // Wait for request to finish, then update content.
3601
3706
  const interval$LWS = WindowSetInterval$LWS(() => {
3602
3707
  // istanbul ignore else
3603
- if (!queue$LWS.has(normalizedHref$LWS.normalizedUrl)) {
3708
+ if (!queue$LWS.has(normalizedURL$LWS)) {
3604
3709
  updater$LWS(container$LWS, normalizedHref$LWS);
3605
3710
  WindowClearInterval$LWS(interval$LWS);
3606
3711
  }
@@ -3620,10 +3725,13 @@ function createUrlContainer$LWS(url$LWS) {
3620
3725
  }
3621
3726
 
3622
3727
  function fetchAndSanitize$LWS(normalizedHref$LWS) {
3623
- // This is the first time we see this href.
3624
- const container$LWS = createUrlContainer$LWS(normalizedHref$LWS.normalizedUrl); // Put the URL we're fetching in a queue.
3728
+ const {
3729
+ normalizedURL: normalizedURL$LWS
3730
+ } = normalizedHref$LWS; // This is the first time we see this href.
3625
3731
 
3626
- queue$LWS.add(normalizedHref$LWS.normalizedUrl); // Initiate an XHR to fetch the resource.
3732
+ const container$LWS = createUrlContainer$LWS(normalizedURL$LWS); // Put the URL we're fetching in a queue.
3733
+
3734
+ queue$LWS.add(normalizedURL$LWS); // Initiate an XHR to fetch the resource.
3627
3735
 
3628
3736
  const xhr$LWS = new XhrCtor$LWS();
3629
3737
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, xhr$LWS, ['load', () => {
@@ -3635,8 +3743,12 @@ function fetchAndSanitize$LWS(normalizedHref$LWS) {
3635
3743
  const fragment$LWS = sanitizeSvgTextReturnDOM$LWS(responseText$LWS); // Look for the container again in case other requests have finished
3636
3744
  // earlier for the same URL.
3637
3745
 
3638
- if (normalizedHref$LWS.requestedFragment) {
3639
- const el$LWS = ReflectApply$LWS$1(DocumentFragmentProtoGetElementById$LWS, fragment$LWS, [normalizedHref$LWS.requestedFragment]);
3746
+ const {
3747
+ requestedFragment: requestedFragment$LWS
3748
+ } = normalizedHref$LWS;
3749
+
3750
+ if (requestedFragment$LWS) {
3751
+ const el$LWS = ReflectApply$LWS$1(DocumentFragmentProtoGetElementById$LWS, fragment$LWS, [requestedFragment$LWS]);
3640
3752
 
3641
3753
  if (el$LWS) {
3642
3754
  ReflectApply$LWS$1(ElementProtoSetAttribute$LWS$1, el$LWS, ['id', normalizedHref$LWS.normalizedFragment]);
@@ -3644,48 +3756,43 @@ function fetchAndSanitize$LWS(normalizedHref$LWS) {
3644
3756
  }
3645
3757
 
3646
3758
  ReflectApply$LWS$1(NodeProtoAppendChild$LWS$1, container$LWS, [fragment$LWS]);
3647
- queue$LWS.delete(normalizedHref$LWS.normalizedUrl);
3759
+ queue$LWS.delete(normalizedURL$LWS);
3648
3760
  }
3649
3761
  }]);
3650
- ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', normalizedHref$LWS.requestedUrl]);
3762
+ ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', normalizedHref$LWS.requestedURL]);
3651
3763
  ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
3652
3764
  }
3653
3765
 
3654
3766
  function parseHref$LWS(url$LWS) {
3655
- ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
3656
- const href$LWS = ReflectApply$LWS$1(HTMLAnchorElementProtoHrefGetter$LWS, normalizerAnchor$LWS, []);
3657
- const protocol$LWS = ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []);
3658
3767
  const {
3659
- 0: requestedUrl$LWS,
3768
+ 0: requestedURL$LWS,
3660
3769
  1: requestedFragment$LWS
3661
- } = ReflectApply$LWS$1(StringProtoSplit$LWS, href$LWS, ['#']); // RegExp.prototype[Symbol.replace] resets the lastIndex of global regexp to 0.
3770
+ } = ReflectApply$LWS$1(StringProtoSplit$LWS, url$LWS, ['#']); // RegExp.prototype[Symbol.replace] resets the lastIndex of global regexp to 0.
3662
3771
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
3663
3772
 
3664
- const loweredUrl$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, requestedUrl$LWS, []);
3665
- const normalizedUrl$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, loweredUrl$LWS, [urlReplacerRegExp$LWS, '']);
3666
- const normalizedFragment$LWS = requestedFragment$LWS ? `${normalizedUrl$LWS}_${ReflectApply$LWS$1(StringProtoReplace$LWS, requestedFragment$LWS, [urlReplacerRegExp$LWS, ''])}` : '';
3773
+ const loweredURL$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, requestedURL$LWS, []);
3774
+ const normalizedURL$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, loweredURL$LWS, [urlReplacerRegExp$LWS, '']);
3775
+ const normalizedFragment$LWS = requestedFragment$LWS ? `${normalizedURL$LWS}_${ReflectApply$LWS$1(StringProtoReplace$LWS, requestedFragment$LWS, [urlReplacerRegExp$LWS, ''])}` : '';
3667
3776
  return {
3668
3777
  normalizedFragment: normalizedFragment$LWS,
3669
- normalizedUrl: normalizedUrl$LWS,
3670
- protocol: protocol$LWS,
3778
+ normalizedURL: normalizedURL$LWS,
3671
3779
  requestedFragment: requestedFragment$LWS,
3672
- requestedUrl: requestedUrl$LWS
3780
+ requestedURL: requestedURL$LWS
3673
3781
  };
3674
3782
  }
3675
3783
 
3676
3784
  function updater$LWS(container$LWS, normalizedHref$LWS) {
3677
3785
  const {
3678
- normalizedFragment: normalizedFragment$LWS,
3679
- requestedFragment: requestedFragment$LWS
3786
+ normalizedFragment: normalizedFragment$LWS
3680
3787
  } = normalizedHref$LWS;
3681
3788
  let el$LWS = ReflectApply$LWS$1(ElementProtoQuerySelector$LWS, container$LWS, [`#${normalizedFragment$LWS}`]); // istanbul ignore else
3682
3789
 
3683
3790
  if (el$LWS === null) {
3684
3791
  try {
3685
- el$LWS = ReflectApply$LWS$1(ElementProtoQuerySelector$LWS, container$LWS, [`#${requestedFragment$LWS}`]);
3792
+ el$LWS = ReflectApply$LWS$1(ElementProtoQuerySelector$LWS, container$LWS, [`#${normalizedHref$LWS.requestedFragment}`]);
3686
3793
  ReflectApply$LWS$1(ElementProtoSetAttribute$LWS$1, el$LWS, ['id', normalizedFragment$LWS]);
3687
3794
  } catch (_unused$LWS) {// Catch all malformed CSS3 selectors.
3688
- // getElementById not available on Node.
3795
+ // getElementById not available in Node.
3689
3796
  // Cannot use document.getElementById because multiple containers
3690
3797
  // may have the same ids for SVG elements.
3691
3798
  }
@@ -3739,20 +3846,28 @@ function sanitizeSvgHref$LWS(url$LWS) {
3739
3846
  return url$LWS;
3740
3847
  }
3741
3848
 
3742
- const normalizedHref$LWS = parseHref$LWS(urlAsString$LWS); // Sanitize only for supported URL_SCHEMES_LIST.
3849
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [urlAsString$LWS]);
3850
+ const protocol$LWS = ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []); // Sanitize only for supported URL_SCHEMES_LIST.
3743
3851
 
3744
- if (URL_SCHEMES_LIST$LWS.includes(normalizedHref$LWS.protocol)) {
3745
- const container$LWS = ReflectApply$LWS$1(DocumentProtoGetElementById$LWS, document, [normalizedHref$LWS.normalizedUrl]); // Have we sanitized this URL already?
3852
+ if (URL_SCHEMES_LIST$LWS.includes(protocol$LWS)) {
3853
+ const parsedHref$LWS = parseHref$LWS(ReflectApply$LWS$1(HTMLAnchorElementProtoHrefGetter$LWS, normalizerAnchor$LWS, []));
3854
+ const {
3855
+ normalizedFragment: normalizedFragment$LWS,
3856
+ normalizedURL: normalizedURL$LWS
3857
+ } = parsedHref$LWS;
3858
+ const container$LWS = ReflectApply$LWS$1(DocumentProtoGetElementById$LWS, document, [normalizedURL$LWS]); // Have we sanitized this URL already?
3746
3859
 
3747
- if (container$LWS && normalizedHref$LWS.normalizedFragment) {
3748
- checkExistingAndDequeue$LWS(container$LWS, normalizedHref$LWS);
3749
- } else if (!container$LWS) {
3750
- fetchAndSanitize$LWS(normalizedHref$LWS);
3860
+ if (container$LWS) {
3861
+ if (normalizedFragment$LWS) {
3862
+ checkExistingAndDequeue$LWS(container$LWS, parsedHref$LWS);
3863
+ }
3864
+ } else {
3865
+ fetchAndSanitize$LWS(parsedHref$LWS);
3751
3866
  } // If this has been in the form of http://my-url/file.svg#fragment we
3752
3867
  // return the normalized fragment otherwise we return the normalized URL.
3753
3868
 
3754
3869
 
3755
- return normalizedHref$LWS.requestedFragment ? `#${normalizedHref$LWS.normalizedFragment}` : `#${normalizedHref$LWS.normalizedUrl}`;
3870
+ return parsedHref$LWS.requestedFragment ? `#${normalizedFragment$LWS}` : `#${normalizedURL$LWS}`;
3756
3871
  }
3757
3872
 
3758
3873
  return url$LWS;
@@ -3787,22 +3902,22 @@ function sanitizeSvgTextReturnDOM$LWS(dirty$LWS) {
3787
3902
  const sanitizer$LWS = svgSanitizer$LWS();
3788
3903
  return sanitizer$LWS.sanitize(dirty$LWS);
3789
3904
  }
3790
- /*! version: 0.17.18 */
3905
+ /*! version: 0.18.2 */
3791
3906
 
3792
3907
  /*!
3793
3908
  * Copyright (C) 2019 salesforce.com, inc.
3794
3909
  */
3795
3910
 
3796
3911
  const CustomElementRegistryBlockedProperties$LWS = ['define'];
3797
- const documentToSandboxAttributeDistortionRegistry$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
3798
- const recordToAttributeDistortionFactories$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
3912
+ const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
3913
+ const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
3799
3914
 
3800
3915
  function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS = NAMESPACE_DEFAULT$LWS) {
3801
3916
  const {
3802
3917
  document: document$LWS,
3803
3918
  key: key$LWS
3804
3919
  } = record$LWS;
3805
- const sandboxAttributeDistortionRegistry$LWS = documentToSandboxAttributeDistortionRegistry$LWS.get(document$LWS); // istanbul ignore if: currently unreachable via tests
3920
+ const sandboxAttributeDistortionRegistry$LWS = sandboxAttributeDistortionRegistryCache$LWS.get(document$LWS); // istanbul ignore if: currently unreachable via tests
3806
3921
 
3807
3922
  if (sandboxAttributeDistortionRegistry$LWS === undefined) {
3808
3923
  return undefined;
@@ -3843,24 +3958,24 @@ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attri
3843
3958
  }
3844
3959
 
3845
3960
  function createAttributeDistortionFactories$LWS(record$LWS) {
3846
- const attributeFactories$LWS = recordToAttributeDistortionFactories$LWS.get(record$LWS); // istanbul ignore if: currently unreachable via tests
3961
+ const attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS); // istanbul ignore if: currently unreachable via tests
3847
3962
 
3848
3963
  if (attributeFactories$LWS === undefined) {
3849
3964
  return [];
3850
3965
  }
3851
3966
 
3852
- recordToAttributeDistortionFactories$LWS.delete(record$LWS);
3967
+ attributeDistortionFactoriesCache$LWS.delete(record$LWS);
3853
3968
  const {
3854
3969
  document: document$LWS,
3855
3970
  key: key$LWS
3856
3971
  } = record$LWS;
3857
- let sandboxAttributeDistortionRegistry$LWS = documentToSandboxAttributeDistortionRegistry$LWS.get(document$LWS);
3972
+ let sandboxAttributeDistortionRegistry$LWS = sandboxAttributeDistortionRegistryCache$LWS.get(document$LWS);
3858
3973
 
3859
3974
  if (sandboxAttributeDistortionRegistry$LWS === undefined) {
3860
3975
  sandboxAttributeDistortionRegistry$LWS = {
3861
3976
  __proto__: null
3862
3977
  };
3863
- documentToSandboxAttributeDistortionRegistry$LWS.set(document$LWS, sandboxAttributeDistortionRegistry$LWS);
3978
+ sandboxAttributeDistortionRegistryCache$LWS.set(document$LWS, sandboxAttributeDistortionRegistry$LWS);
3864
3979
  }
3865
3980
 
3866
3981
  const attributeDistortionRegistry$LWS = {
@@ -3892,11 +4007,11 @@ function normalizeNamespace$LWS(ns$LWS) {
3892
4007
  }
3893
4008
 
3894
4009
  function registerElementSetDistortion$LWS(record$LWS, ElementCtor$LWS, attributeName$LWS, attributeNamespace$LWS, distortion$LWS) {
3895
- let attributeFactories$LWS = recordToAttributeDistortionFactories$LWS.get(record$LWS);
4010
+ let attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS);
3896
4011
 
3897
4012
  if (attributeFactories$LWS === undefined) {
3898
4013
  attributeFactories$LWS = [];
3899
- recordToAttributeDistortionFactories$LWS.set(record$LWS, attributeFactories$LWS);
4014
+ attributeDistortionFactoriesCache$LWS.set(record$LWS, attributeFactories$LWS);
3900
4015
  }
3901
4016
 
3902
4017
  const loweredAttributeName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attributeName$LWS, []);
@@ -4874,14 +4989,14 @@ function initDistortionElementAttachShadow$LWS({
4874
4989
  };
4875
4990
  }
4876
4991
 
4877
- const namedNodeMapToElementRegistry$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4992
+ const namedNodeMapToElementCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4878
4993
 
4879
4994
  function pairElement$LWS(attrInstance$LWS, element$LWS) {
4880
- namedNodeMapToElementRegistry$LWS.set(attrInstance$LWS, element$LWS);
4995
+ namedNodeMapToElementCache$LWS.set(attrInstance$LWS, element$LWS);
4881
4996
  }
4882
4997
 
4883
4998
  function setNamedItemWithAttr$LWS(record$LWS, originalMethod$LWS, nodeNameMap$LWS, attr$LWS) {
4884
- const element$LWS = namedNodeMapToElementRegistry$LWS.get(nodeNameMap$LWS); // istanbul ignore else: nothing to do if there's no element
4999
+ const element$LWS = namedNodeMapToElementCache$LWS.get(nodeNameMap$LWS); // istanbul ignore else: nothing to do if there's no element
4885
5000
 
4886
5001
  if (element$LWS) {
4887
5002
  const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, attr$LWS, []);
@@ -5477,19 +5592,6 @@ function initDistortionElementToggleAttribute$LWS({
5477
5592
  return ReflectApply$LWS$1(originalToggleAttribute$LWS, this, args$LWS);
5478
5593
  }];
5479
5594
  };
5480
- }
5481
-
5482
- function initDistortionEval$LWS({
5483
- UNCOMPILED_CONTEXT: UNCOMPILED_CONTEXT$LWS,
5484
- globalObject: {
5485
- eval: originalEval$LWS
5486
- }
5487
- }) {
5488
- return function distortionEval$LWS({
5489
- sandboxEvaluator: sandboxEvaluator$LWS
5490
- }) {
5491
- return [originalEval$LWS, sourceText$LWS => sandboxEvaluator$LWS(transformSourceText$LWS(toString$LWS(sourceText$LWS)), UNCOMPILED_CONTEXT$LWS)];
5492
- };
5493
5595
  } // istanbul ignore next: LWS/Locker currently blocks CustomElementRegistry#define() and disables the composedPath tests
5494
5596
 
5495
5597
 
@@ -5639,6 +5741,7 @@ function initDistortionFunction$LWS({
5639
5741
 
5640
5742
  function initDistortionHistoryPushState$LWS({
5641
5743
  globalObject: {
5744
+ DOMException: DOMException$LWS,
5642
5745
  History: {
5643
5746
  prototype: {
5644
5747
  pushState: originalPushState$LWS
@@ -5647,11 +5750,20 @@ function initDistortionHistoryPushState$LWS({
5647
5750
  }
5648
5751
  }) {
5649
5752
  const distortionEntry$LWS = [originalPushState$LWS, function pushState$LWS(...args$LWS) {
5650
- if (args$LWS.length) {
5651
- args$LWS[0] = partialStructuredClone$LWS(args$LWS[0]);
5652
- }
5753
+ try {
5754
+ return ReflectApply$LWS$1(originalPushState$LWS, this, args$LWS);
5755
+ } catch (error) {
5756
+ if (args$LWS.length && error instanceof DOMException$LWS) {
5757
+ const state$LWS = args$LWS[0];
5758
+
5759
+ if (isObject$LWS$1(state$LWS)) {
5760
+ args$LWS[0] = partialStructuredClone$LWS(state$LWS);
5761
+ return ReflectApply$LWS$1(originalPushState$LWS, this, args$LWS);
5762
+ }
5763
+ }
5653
5764
 
5654
- return ReflectApply$LWS$1(originalPushState$LWS, this, args$LWS);
5765
+ throw error;
5766
+ }
5655
5767
  }];
5656
5768
  return function distortionHistoryPushState$LWS() {
5657
5769
  return distortionEntry$LWS;
@@ -5660,6 +5772,7 @@ function initDistortionHistoryPushState$LWS({
5660
5772
 
5661
5773
  function initDistortionHistoryReplaceState$LWS({
5662
5774
  globalObject: {
5775
+ DOMException: DOMException$LWS,
5663
5776
  History: {
5664
5777
  prototype: {
5665
5778
  replaceState: originalReplaceState$LWS
@@ -5668,11 +5781,20 @@ function initDistortionHistoryReplaceState$LWS({
5668
5781
  }
5669
5782
  }) {
5670
5783
  const distortionEntry$LWS = [originalReplaceState$LWS, function replaceState$LWS(...args$LWS) {
5671
- if (args$LWS.length) {
5672
- args$LWS[0] = partialStructuredClone$LWS(args$LWS[0]);
5673
- }
5784
+ try {
5785
+ return ReflectApply$LWS$1(originalReplaceState$LWS, this, args$LWS);
5786
+ } catch (error) {
5787
+ if (args$LWS.length && error instanceof DOMException$LWS) {
5788
+ const state$LWS = args$LWS[0];
5674
5789
 
5675
- return ReflectApply$LWS$1(originalReplaceState$LWS, this, args$LWS);
5790
+ if (isObject$LWS$1(state$LWS)) {
5791
+ args$LWS[0] = partialStructuredClone$LWS(state$LWS);
5792
+ return ReflectApply$LWS$1(originalReplaceState$LWS, this, args$LWS);
5793
+ }
5794
+ }
5795
+
5796
+ throw error;
5797
+ }
5676
5798
  }];
5677
5799
  return function distortionHistoryReplaceState$LWS() {
5678
5800
  return distortionEntry$LWS;
@@ -5874,12 +5996,6 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
5874
5996
  };
5875
5997
  }
5876
5998
 
5877
- function getDatasetSrcValue$LWS(el$LWS) {
5878
- const dataset$LWS = ReflectApply$LWS$1(HTMLElementProtoDatasetGetter$LWS, el$LWS, []);
5879
- const distortedSrc$LWS = ObjectLookupOwnValue$LWS(dataset$LWS, 'distortedSrc');
5880
- return distortedSrc$LWS === undefined ? '' : distortedSrc$LWS;
5881
- }
5882
-
5883
5999
  function initDistortionHTMLScriptElementSrcGetter$LWS({
5884
6000
  globalObject: {
5885
6001
  HTMLScriptElement: HTMLScriptElement$LWS
@@ -5887,81 +6003,22 @@ function initDistortionHTMLScriptElementSrcGetter$LWS({
5887
6003
  }) {
5888
6004
  const originalSrcGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLScriptElement$LWS.prototype, 'src');
5889
6005
  const distortionEntry$LWS = [originalSrcGetter$LWS, function src$LWS() {
5890
- return getDatasetSrcValue$LWS(this) || ReflectApply$LWS$1(originalSrcGetter$LWS, this, []);
6006
+ var _getResolvedScriptURL$LWS;
6007
+
6008
+ return (_getResolvedScriptURL$LWS = getResolvedScriptURL$LWS(this, 'src')) != null ? _getResolvedScriptURL$LWS : ReflectApply$LWS$1(originalSrcGetter$LWS, this, []);
5891
6009
  }];
5892
6010
  return function distortionHTMLScriptElementSrcGetter$LWS() {
5893
6011
  return distortionEntry$LWS;
5894
6012
  };
5895
6013
  }
5896
6014
 
5897
- const BLOB_SCRIPT_OPTIONS$LWS = {
6015
+ const attributeNameToPropertyNameRegistry$LWS = {
5898
6016
  __proto__: null,
5899
- type: 'text/javascript'
6017
+ href: 'href',
6018
+ src: 'src',
6019
+ 'xlink:href': 'href'
5900
6020
  };
5901
- const SCRIPT_EVALUATOR_PROPERTY_NAME$LWS = '$evaluator$';
5902
- const SCRIPT_PAYLOAD_TOKEN$LWS = '$payload$';
5903
- const SCRIPT_HOOK_SRC_SOURCE_TEXT$LWS = `document.currentScript.${SCRIPT_EVALUATOR_PROPERTY_NAME$LWS}("${SCRIPT_PAYLOAD_TOKEN$LWS}")`;
5904
- const SCRIPT_HOOK_TEXT_CONTENT_SOURCE_TEXT$LWS = `document.currentScript.${SCRIPT_EVALUATOR_PROPERTY_NAME$LWS}()`;
5905
- const seenNodesThatSetTextContent$LWS = toSafeWeakSet$LWS(new WeakSetCtor$LWS());
5906
-
5907
- function defineEvaluatorProperty$LWS(host$LWS, callback$LWS) {
5908
- if (!ReflectDefineProperty$LWS$1(host$LWS, SCRIPT_EVALUATOR_PROPERTY_NAME$LWS, {
5909
- __proto__: null,
5910
- configurable: true,
5911
- // Create a bound function to obscure the getter source as "[native code]".
5912
- get: ReflectApply$LWS$1(FunctionProtoBind$LWS, () => {
5913
- ReflectDeleteProperty$LWS$1(host$LWS, SCRIPT_EVALUATOR_PROPERTY_NAME$LWS);
5914
- const ownerDoc$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, host$LWS, []);
5915
- const defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, ownerDoc$LWS, []); // We don't need to use something like `WindowLocationGetter()`
5916
- // because the 'location' and 'top' property are non-configurable.
5917
-
5918
- const context$LWS = {
5919
- [UNCOMPILED_LOCATION_NAME$LWS]: defaultView$LWS.location,
5920
- [UNCOMPILED_TOP_NAME$LWS]: defaultView$LWS.top
5921
- };
5922
- return (...args$LWS) => {
5923
- callback$LWS(context$LWS, defaultView$LWS, ownerDoc$LWS, args$LWS);
5924
- };
5925
- }, [])
5926
- })) {
5927
- // istanbul ignore next: require a test to get the evaluator in a bad state. Like code that tried to access it in between. This is mostly a "the universe is not as expected error"
5928
- throw new LockerSecurityError$LWS(`Cannot evaluate ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, host$LWS, [])}`);
5929
- }
5930
- }
5931
-
5932
- function defineSrcEvaluatorProperty$LWS(host$LWS, sandboxEvaluator$LWS) {
5933
- // prettier-ignore
5934
- defineEvaluatorProperty$LWS(host$LWS, (context$LWS, defaultView$LWS, ownerDoc$LWS, {
5935
- 0: encodedPayload$LWS
5936
- }) => {
5937
- sandboxEvaluator$LWS(transformSourceText$LWS(WindowDecodeURIComponent$LWS(toString$LWS(encodedPayload$LWS))), context$LWS, defaultView$LWS, ownerDoc$LWS);
5938
- });
5939
- return true;
5940
- }
5941
-
5942
- function defineTextContentEvaluatorProperty$LWS(host$LWS, textContent$LWS, sandboxEvaluator$LWS) {
5943
- // The textContent of a script element is only evaluated on the first set.
5944
- // Subsequent sets change the textContent value but are not evaluated.
5945
- if (seenNodesThatSetTextContent$LWS.has(host$LWS)) {
5946
- return false;
5947
- }
5948
-
5949
- seenNodesThatSetTextContent$LWS.add(host$LWS); // prettier-ignore
5950
-
5951
- defineEvaluatorProperty$LWS(host$LWS, (context$LWS, defaultView$LWS, ownerDoc$LWS) => {
5952
- sandboxEvaluator$LWS(transformSourceText$LWS(textContent$LWS), context$LWS, defaultView$LWS, ownerDoc$LWS);
5953
- });
5954
- return true;
5955
- }
5956
-
5957
- function getSrcEvaluatorHookSourceText$LWS(sourceText$LWS) {
5958
- // Creates a blob URL to invoke the evaluator hook with encoded source text.
5959
- return URLCreateObjectURL$LWS(new BlobCtor$LWS([ReflectApply$LWS$1(StringProtoReplace$LWS, SCRIPT_HOOK_SRC_SOURCE_TEXT$LWS, [SCRIPT_PAYLOAD_TOKEN$LWS, WindowEncodeURIComponent$LWS(sourceText$LWS)])], BLOB_SCRIPT_OPTIONS$LWS));
5960
- }
5961
-
5962
- const getTextContentEvaluatorHookSourceText$LWS = () => SCRIPT_HOOK_TEXT_CONTENT_SOURCE_TEXT$LWS;
5963
-
5964
- const documentToPropertyDescriptorRegistryMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
6021
+ const descriptorRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
5965
6022
 
5966
6023
  function createBlockedAttributeDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS) {
5967
6024
  return function initDistortionBlockedAttribute$LWS() {
@@ -6056,11 +6113,11 @@ function createBlockedPropertyDistortionFactoryInitializers$LWS({
6056
6113
  let {
6057
6114
  length: factoryInitializersOffset$LWS
6058
6115
  } = factoryInitializers$LWS;
6059
- let descRegistryMap$LWS = documentToPropertyDescriptorRegistryMap$LWS.get(document$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
6116
+ let descRegistryMap$LWS = descriptorRegistryCache$LWS.get(document$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
6060
6117
 
6061
6118
  if (descRegistryMap$LWS === undefined) {
6062
6119
  descRegistryMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
6063
- documentToPropertyDescriptorRegistryMap$LWS.set(document$LWS, descRegistryMap$LWS);
6120
+ descriptorRegistryCache$LWS.set(document$LWS, descRegistryMap$LWS);
6064
6121
  }
6065
6122
 
6066
6123
  let descRegistry$LWS = descRegistryMap$LWS.get(proto$LWS); // istanbul ignore else: need a test for this on the same document but different namespace
@@ -6125,60 +6182,107 @@ function createBlockedPropertyDistortionFactoryInitializers$LWS({
6125
6182
  }
6126
6183
 
6127
6184
  function createScriptDistortion$LWS({
6128
- sandboxEvaluator: sandboxEvaluator$LWS
6129
- }, attributeName$LWS, datasetGetter$LWS) {
6130
- const distortionName$LWS = `script${capitalizeFirstChar$LWS(attributeName$LWS)}`; // Use a computed property to dynamically set the distortion function name
6185
+ sandboxEvaluator: sandboxEvaluator$LWS,
6186
+ root: {
6187
+ distortions: distortions$LWS
6188
+ }
6189
+ }, attributeName$LWS, originalPropertyGetter$LWS, originalPropertySetter$LWS, originalTextContentGetter$LWS, originalTextContentSetter$LWS) {
6190
+ var _attributeNameToPrope$LWS;
6191
+
6192
+ const distortionName$LWS = `script${capitalizeFirstChar$LWS(attributeName$LWS)}`;
6193
+ const propName$LWS = (_attributeNameToPrope$LWS = attributeNameToPropertyNameRegistry$LWS[attributeName$LWS]) != null ? _attributeNameToPrope$LWS : attributeName$LWS;
6194
+ let distortedPropertyGetter$LWS;
6195
+ let distortedTextContentGetter$LWS; // Use a computed property to dynamically set the distortion function name
6131
6196
  // without using `Reflect.defineProperty()`.
6132
6197
 
6133
6198
  const {
6134
6199
  [distortionName$LWS]: distortion$LWS
6135
6200
  } = {
6136
- [distortionName$LWS](value$LWS) {
6137
- const originalValue$LWS = value$LWS;
6201
+ [distortionName$LWS](url$LWS) {
6202
+ const isEmptyURL$LWS = url$LWS === '';
6203
+ const isEvaluated$LWS = isScriptEvaluated$LWS(this);
6138
6204
  const elementNamespaceURI$LWS = ReflectApply$LWS$1(ElementProtoNamespaceURIGetter$LWS, this, []);
6139
- const attributeNamespaceURI$LWS = elementNamespaceURI$LWS === NAMESPACE_XHTML$LWS ? '' : NAMESPACE_XLINK$LWS;
6205
+ const attributeNamespaceURI$LWS = elementNamespaceURI$LWS === NAMESPACE_XHTML$LWS ? '' : NAMESPACE_XLINK$LWS; // Exit early, setting the attribute without evaluation, when `url`
6206
+ // is an empty string or the script as already been evaluated.
6207
+
6208
+ if (isEmptyURL$LWS || isEvaluated$LWS) {
6209
+ if (isEmptyURL$LWS && !isEvaluated$LWS) {
6210
+ // The evaluator hook textContent may be set on the script
6211
+ // if the script hasn't been injected into the DOM yet.
6212
+ deleteScriptEvaluatorProperty$LWS(this);
6213
+ deleteResolvedScriptURL$LWS(this);
6214
+ ReflectDeleteProperty$LWS$1(this, propName$LWS);
6215
+ }
6140
6216
 
6141
- if (value$LWS === '') {
6142
- ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, this, [attributeNamespaceURI$LWS, attributeName$LWS, value$LWS]);
6217
+ ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, this, [attributeNamespaceURI$LWS, attributeName$LWS, url$LWS]);
6143
6218
  return;
6144
- } // Normalize the URL.
6219
+ }
6145
6220
 
6221
+ if (!isScriptURLEvaluatorHookDefined$LWS(this)) {
6222
+ if (distortedPropertyGetter$LWS === undefined) {
6223
+ distortedPropertyGetter$LWS = distortions$LWS.get(originalPropertyGetter$LWS);
6224
+ }
6146
6225
 
6147
- ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS$1, [value$LWS]);
6148
- value$LWS = ReflectApply$LWS$1(HTMLAnchorElementProtoHrefGetter$LWS, normalizerAnchor$LWS$1, []); // Create a dataset attribute to expose the undistorted attribute value.
6226
+ defineScriptAccessorProperty$LWS(this, propName$LWS, distortedPropertyGetter$LWS, originalPropertySetter$LWS);
6227
+ }
6149
6228
 
6150
- const dataset$LWS = ReflectApply$LWS$1(datasetGetter$LWS, this, []);
6151
- dataset$LWS[`distorted${capitalizeFirstChar$LWS(attributeName$LWS)}`] = originalValue$LWS; // Create XHR.
6229
+ const resolvedURL$LWS = resolveURL$LWS(url$LWS);
6230
+ setResolvedScriptURL$LWS(this, attributeName$LWS, resolvedURL$LWS);
6231
+ defineScriptEvaluatorProperty$LWS(this, (context$LWS, defaultView$LWS, ownerDoc$LWS) => {
6232
+ deleteResolvedScriptURL$LWS(this);
6233
+ ReflectDeleteProperty$LWS$1(this, propName$LWS);
6234
+ ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, this, [attributeNamespaceURI$LWS, attributeName$LWS, url$LWS]);
6235
+ const xhr$LWS = new XhrCtor$LWS();
6236
+ ReflectApply$LWS$1(XhrProtoWithCredentialsSetter$LWS, xhr$LWS, [true]);
6237
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, xhr$LWS, ['load', () => {
6238
+ let event$LWS;
6239
+ const status$LWS = ReflectApply$LWS$1(XhrProtoStatusGetter$LWS, xhr$LWS, []);
6240
+
6241
+ if (status$LWS === 200) {
6242
+ const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
6243
+ event$LWS = new EventCtor$LWS('load');
6244
+
6245
+ try {
6246
+ sandboxEvaluator$LWS(transformSourceText$LWS(responseText$LWS), context$LWS, defaultView$LWS, ownerDoc$LWS);
6247
+ } catch (error) {
6248
+ if (error instanceof Error) {
6249
+ const {
6250
+ message: message$LWS
6251
+ } = error;
6252
+ event$LWS = new ErrorEventCtor$LWS('error', {
6253
+ __proto__: null,
6254
+ error,
6255
+ message: message$LWS
6256
+ });
6257
+ } else {
6258
+ event$LWS = new EventCtor$LWS('error');
6259
+ }
6260
+ }
6261
+ } else {
6262
+ event$LWS = new EventCtor$LWS('error');
6263
+ }
6152
6264
 
6153
- const hostname$LWS = ReflectApply$LWS$1(HTMLAnchorElementProtoHostnameGetter$LWS, normalizerAnchor$LWS$1, []);
6154
- const xhr$LWS = new XhrCtor$LWS(); // istanbul ignore if: currently unreachable via tests
6265
+ ReflectApply$LWS$1(EventTargetProtoDispatchEvent$LWS, this, [event$LWS]);
6266
+ }]);
6267
+ ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', resolvedURL$LWS]);
6268
+ ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
6269
+ });
6155
6270
 
6156
- if (ReflectApply$LWS$1(RegExpProtoTest$LWS$1, TRUSTED_DOMAINS_REG_EXP$LWS, [hostname$LWS])) {
6157
- ReflectApply$LWS$1(XhrProtoWithCredentialsSetter$LWS, xhr$LWS, [true]);
6158
- }
6271
+ if (!isTextContentEvaluatorHookDefined$LWS(this)) {
6272
+ if (distortedTextContentGetter$LWS === undefined) {
6273
+ distortedTextContentGetter$LWS = distortions$LWS.get(originalTextContentGetter$LWS);
6274
+ }
6159
6275
 
6160
- ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, xhr$LWS, ['load', () => {
6161
- const status$LWS = ReflectApply$LWS$1(XhrProtoStatusGetter$LWS, xhr$LWS, []);
6276
+ defineScriptAccessorProperty$LWS(this, 'textContent', distortedTextContentGetter$LWS, originalTextContentSetter$LWS); // If not already cached then cache the original textContent
6277
+ // value to mask the evaluator hook source text.
6162
6278
 
6163
- if (status$LWS === 200) {
6164
- if (defineSrcEvaluatorProperty$LWS(this, sandboxEvaluator$LWS)) {
6165
- const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []); // Set and run the src evaluator hook.
6279
+ setOriginalScriptTextContent$LWS(this, ReflectApply$LWS$1(NodeProtoTextContentGetter$LWS, this, []));
6280
+ } // Set the script's textContent to the evaluator hook which will run
6281
+ // once the node is inserted into a document. Subsequent changes to
6282
+ // textContent are not evaluated.
6166
6283
 
6167
- ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, this, [attributeNamespaceURI$LWS, attributeName$LWS, getSrcEvaluatorHookSourceText$LWS(responseText$LWS)]);
6168
- }
6169
- } else {
6170
- // The following if statement is enclosed in a dedicated
6171
- // else {} because prettier won't allow a multi-line
6172
- // comment between "else" and "if", which is where the
6173
- // istanbul ignore directive must go to be effective.
6174
- // istanbul ignore else: cannot produce codes beyond 200, 404 in tests
6175
- if (status$LWS === 404) {
6176
- ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, this, [attributeNamespaceURI$LWS, attributeName$LWS, 'blob:http://localhost/not-found']);
6177
- }
6178
- }
6179
- }]);
6180
- ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', value$LWS]);
6181
- ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
6284
+
6285
+ ReflectApply$LWS$1(NodeProtoTextContentSetter$LWS, this, [SCRIPT_HOOK_SOURCE_TEXT$LWS]);
6182
6286
  }
6183
6287
 
6184
6288
  };
@@ -6190,9 +6294,16 @@ function initDistortionHTMLScriptElementSrcSetter$LWS({
6190
6294
  HTMLScriptElement: HTMLScriptElement$LWS
6191
6295
  }
6192
6296
  }) {
6193
- const originalSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLScriptElement$LWS.prototype, 'src');
6297
+ const {
6298
+ get: originalSrcGetter$LWS,
6299
+ set: originalSrcSetter$LWS
6300
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'src');
6301
+ const {
6302
+ get: originalTextContentGetter$LWS,
6303
+ set: originalTextContentSetter$LWS
6304
+ } = ReflectGetOwnPropertyDescriptor$LWS(Node.prototype, 'textContent');
6194
6305
  return function distortionHTMLScriptElementSrcSetter$LWS(record$LWS) {
6195
- const src$LWS = createScriptDistortion$LWS(record$LWS, 'src', HTMLElementProtoDatasetGetter$LWS);
6306
+ const src$LWS = createScriptDistortion$LWS(record$LWS, 'src', originalSrcGetter$LWS, originalSrcSetter$LWS, originalTextContentGetter$LWS, originalTextContentSetter$LWS);
6196
6307
  registerElementSetDistortion$LWS(record$LWS, HTMLScriptElement$LWS, 'src', NAMESPACE_DEFAULT$LWS, src$LWS);
6197
6308
  return [originalSrcSetter$LWS, src$LWS];
6198
6309
  };
@@ -6200,6 +6311,7 @@ function initDistortionHTMLScriptElementSrcSetter$LWS({
6200
6311
 
6201
6312
  function initDistortionIDBObjectStoreAdd$LWS({
6202
6313
  globalObject: {
6314
+ DOMException: DOMException$LWS,
6203
6315
  IDBObjectStore: {
6204
6316
  prototype: {
6205
6317
  add: originalAdd$LWS
@@ -6208,12 +6320,20 @@ function initDistortionIDBObjectStoreAdd$LWS({
6208
6320
  }
6209
6321
  }) {
6210
6322
  const distortionEntry$LWS = [originalAdd$LWS, function add$LWS(...args$LWS) {
6211
- // istanbul ignore else: needs default platform behavior test
6212
- if (args$LWS.length) {
6213
- args$LWS[0] = partialStructuredClone$LWS(args$LWS[0]);
6214
- }
6323
+ try {
6324
+ return ReflectApply$LWS$1(originalAdd$LWS, this, args$LWS);
6325
+ } catch (error) {
6326
+ if (args$LWS.length && error instanceof DOMException$LWS) {
6327
+ const value$LWS = args$LWS[0];
6328
+
6329
+ if (isObject$LWS$1(value$LWS)) {
6330
+ args$LWS[0] = partialStructuredClone$LWS(value$LWS);
6331
+ return ReflectApply$LWS$1(originalAdd$LWS, this, args$LWS);
6332
+ }
6333
+ }
6215
6334
 
6216
- return ReflectApply$LWS$1(originalAdd$LWS, this, args$LWS);
6335
+ throw error;
6336
+ }
6217
6337
  }];
6218
6338
  return function distortionIDBObjectStoreAdd$LWS() {
6219
6339
  return distortionEntry$LWS;
@@ -6222,6 +6342,7 @@ function initDistortionIDBObjectStoreAdd$LWS({
6222
6342
 
6223
6343
  function initDistortionIDBObjectStorePut$LWS({
6224
6344
  globalObject: {
6345
+ DOMException: DOMException$LWS,
6225
6346
  IDBObjectStore: {
6226
6347
  prototype: {
6227
6348
  put: originalPut$LWS
@@ -6230,12 +6351,20 @@ function initDistortionIDBObjectStorePut$LWS({
6230
6351
  }
6231
6352
  }) {
6232
6353
  const distortionEntry$LWS = [originalPut$LWS, function put$LWS(...args$LWS) {
6233
- // istanbul ignore else: needs default platform behavior test
6234
- if (args$LWS.length) {
6235
- args$LWS[0] = partialStructuredClone$LWS(args$LWS[0]);
6236
- }
6354
+ try {
6355
+ return ReflectApply$LWS$1(originalPut$LWS, this, args$LWS);
6356
+ } catch (error) {
6357
+ if (args$LWS.length && error instanceof DOMException$LWS) {
6358
+ const value$LWS = args$LWS[0];
6237
6359
 
6238
- return ReflectApply$LWS$1(originalPut$LWS, this, args$LWS);
6360
+ if (isObject$LWS$1(value$LWS)) {
6361
+ args$LWS[0] = partialStructuredClone$LWS(value$LWS);
6362
+ return ReflectApply$LWS$1(originalPut$LWS, this, args$LWS);
6363
+ }
6364
+ }
6365
+
6366
+ throw error;
6367
+ }
6239
6368
  }];
6240
6369
  return function distortionIDBObjectStorePut$LWS() {
6241
6370
  return distortionEntry$LWS;
@@ -6264,6 +6393,51 @@ function initDistortionJSONParse$LWS({
6264
6393
  };
6265
6394
  }
6266
6395
 
6396
+ function initDistortionMessagePortPostMessage$LWS({
6397
+ globalObject: {
6398
+ DOMException: DOMException$LWS,
6399
+ MessagePort: MessagePort$LWS
6400
+ }
6401
+ }) {
6402
+ const {
6403
+ postMessage: originalPostMessage$LWS
6404
+ } = MessagePort$LWS.prototype;
6405
+ const distortionEntry$LWS = [originalPostMessage$LWS, function postMessage$LWS(...args$LWS) {
6406
+ try {
6407
+ return ReflectApply$LWS$1(originalPostMessage$LWS, this, args$LWS);
6408
+ } catch (error) {
6409
+ const {
6410
+ length: length$LWS
6411
+ } = args$LWS;
6412
+
6413
+ if (length$LWS && error instanceof DOMException$LWS) {
6414
+ const message$LWS = args$LWS[0];
6415
+
6416
+ if (isObject$LWS$1(message$LWS)) {
6417
+ if (length$LWS > 1) {
6418
+ // MDN document providing a transfer list array
6419
+ // while the WHATWG documents providing an options
6420
+ // object with a 'transfer' property. To cover both
6421
+ // cases we structurally clone the entire `args` array.
6422
+ // https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/postMessage#parameters
6423
+ // https://html.spec.whatwg.org/multipage/web-messaging.html#dom-structuredserializeoptions-transfer
6424
+ args$LWS = partialStructuredClone$LWS(args$LWS);
6425
+ } else {
6426
+ args$LWS[0] = partialStructuredClone$LWS(message$LWS);
6427
+ }
6428
+
6429
+ return ReflectApply$LWS$1(originalPostMessage$LWS, this, args$LWS);
6430
+ }
6431
+ }
6432
+
6433
+ throw error;
6434
+ }
6435
+ }];
6436
+ return function distortionMessagePortPostMessage$LWS() {
6437
+ return distortionEntry$LWS;
6438
+ };
6439
+ }
6440
+
6267
6441
  function initDistortionNamedNodeMapSetNamedItem$LWS({
6268
6442
  globalObject: {
6269
6443
  Attr: Attr$LWS,
@@ -6502,6 +6676,28 @@ function initDistortionNodeReplaceChild$LWS({
6502
6676
  return function distortionNodeReplaceChild$LWS() {
6503
6677
  return distortionEntry$LWS;
6504
6678
  };
6679
+ }
6680
+
6681
+ function initDistortionNodeTextContentGetter$LWS({
6682
+ globalObject: {
6683
+ HTMLScriptElement: HTMLScriptElement$LWS,
6684
+ Node: Node$LWS,
6685
+ SVGScriptElement: SVGScriptElement$LWS
6686
+ }
6687
+ }) {
6688
+ const originalTextContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(Node$LWS.prototype, 'textContent');
6689
+ const distortionEntry$LWS = [originalTextContentGetter$LWS, function textContent$LWS() {
6690
+ if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement$LWS) {
6691
+ var _getOriginalScriptTex$LWS;
6692
+
6693
+ return (_getOriginalScriptTex$LWS = getOriginalScriptTextContent$LWS(this)) != null ? _getOriginalScriptTex$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
6694
+ }
6695
+
6696
+ return ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
6697
+ }];
6698
+ return function distortionHTMLScriptElementSrcGetter$LWS() {
6699
+ return distortionEntry$LWS;
6700
+ };
6505
6701
  } // IMPORTANT! This validator MUST use the top "window" global object, and not
6506
6702
  // the provided "globalObject" because magenta objects (arbitrary user-code
6507
6703
  // created global objects) must be allowed to interact with their OWN <html>,
@@ -6521,9 +6717,16 @@ function initDistortionNodeTextContentSetter$LWS({
6521
6717
  Node: Node$LWS,
6522
6718
  HTMLScriptElement: HTMLScriptElement$LWS,
6523
6719
  SVGScriptElement: SVGScriptElement$LWS
6720
+ },
6721
+ root: {
6722
+ distortions: distortions$LWS
6524
6723
  }
6525
6724
  }) {
6526
- const originalTextContentSetter$LWS = ObjectLookupOwnSetter$LWS(Node$LWS.prototype, 'textContent');
6725
+ const {
6726
+ get: originalTextContentGetter$LWS,
6727
+ set: originalTextContentSetter$LWS
6728
+ } = ReflectGetOwnPropertyDescriptor$LWS(Node$LWS.prototype, 'textContent');
6729
+ let distortedTextContentGetter$LWS;
6527
6730
  return function distortionNodeTextContentSetter$LWS(record$LWS) {
6528
6731
  const {
6529
6732
  sandboxEvaluator: sandboxEvaluator$LWS
@@ -6557,19 +6760,37 @@ function initDistortionNodeTextContentSetter$LWS({
6557
6760
  ReflectApply$LWS$1(distortion$LWS, ownerEl$LWS, [valueAsString$LWS]);
6558
6761
  return;
6559
6762
  }
6560
- }
6763
+ } else if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement$LWS) {
6764
+ if (!isTextContentEvaluatorHookDefined$LWS(this)) {
6765
+ if (distortedTextContentGetter$LWS === undefined) {
6766
+ distortedTextContentGetter$LWS = distortions$LWS.get(originalTextContentGetter$LWS);
6767
+ }
6768
+
6769
+ defineScriptAccessorProperty$LWS(this, 'textContent', distortedTextContentGetter$LWS, originalTextContentSetter$LWS);
6770
+ } // Cache the original textContent value to mask the evaluator
6771
+ // hook source text.
6772
+
6773
+
6774
+ setOriginalScriptTextContent$LWS(this, valueAsString$LWS);
6775
+
6776
+ if (!isScriptEvaluated$LWS(this)) {
6777
+ // Skip textContent evaluation if script URL is already
6778
+ // specified.
6779
+ if (!isScriptURLEvaluatorHookDefined$LWS(this)) {
6780
+ defineScriptEvaluatorProperty$LWS(this, (context$LWS, defaultView$LWS, ownerDoc$LWS) => {
6781
+ // Set the script's textContent immediately
6782
+ // after the evaluator hook fires to overwrite
6783
+ // the evaluator hook source text.
6784
+ ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
6785
+ sandboxEvaluator$LWS(transformSourceText$LWS(valueAsString$LWS), context$LWS, defaultView$LWS, ownerDoc$LWS);
6786
+ }); // Set the script's textContent to the evaluator
6787
+ // hook which will run once the node is inserted
6788
+ // into a document. Subsequent changes to textContent
6789
+ // are not evaluated.
6790
+
6791
+ ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [SCRIPT_HOOK_SOURCE_TEXT$LWS]);
6792
+ }
6561
6793
 
6562
- if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement$LWS) {
6563
- if (defineTextContentEvaluatorProperty$LWS(this, valueAsString$LWS, (sourceText$LWS, context$LWS, globalObject$LWS, document$LWS) => {
6564
- // Set the textContent immediately after the
6565
- // evaluator hook fires to overwrite the evaluator
6566
- // hook source text. Subsequent sets change the
6567
- // textContent value but are not evaluated.
6568
- ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
6569
- sandboxEvaluator$LWS(sourceText$LWS, context$LWS, globalObject$LWS, document$LWS);
6570
- })) {
6571
- // Set and run the textContent evaluator hook.
6572
- ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [getTextContentEvaluatorHookSourceText$LWS()]);
6573
6794
  return;
6574
6795
  }
6575
6796
  } // istanbul ignore else: needs default platform behavior test
@@ -6584,6 +6805,7 @@ function initDistortionNodeTextContentSetter$LWS({
6584
6805
 
6585
6806
  function initDistortionNotificationCtor$LWS({
6586
6807
  globalObject: {
6808
+ DOMException: DOMException$LWS,
6587
6809
  Notification: originalNotificationCtor$LWS
6588
6810
  }
6589
6811
  }) {
@@ -6593,11 +6815,32 @@ function initDistortionNotificationCtor$LWS({
6593
6815
  }
6594
6816
 
6595
6817
  const distortionEntry$LWS = [originalNotificationCtor$LWS, function Notification$LWS(...args$LWS) {
6596
- if (args$LWS.length > 1) {
6597
- args$LWS[1] = partialStructuredClone$LWS(args$LWS[1]);
6598
- }
6818
+ try {
6819
+ return ReflectApply$LWS$1(originalNotificationCtor$LWS, this, args$LWS);
6820
+ } catch (error) {
6821
+ if (args$LWS.length > 1 && error instanceof DOMException$LWS) {
6822
+ const providedOptions$LWS = args$LWS[1];
6599
6823
 
6600
- return ReflectApply$LWS$1(originalNotificationCtor$LWS, this, args$LWS);
6824
+ if (isObjectLike$LWS(providedOptions$LWS)) {
6825
+ const {
6826
+ data: data$LWS
6827
+ } = providedOptions$LWS;
6828
+
6829
+ if (isObject$LWS$1(data$LWS)) {
6830
+ args$LWS[1] = {
6831
+ // The Notification constructor accepts
6832
+ // inherited options property values.
6833
+ __proto__: providedOptions$LWS,
6834
+ // Shadow any inherited value.
6835
+ data: partialStructuredClone$LWS(data$LWS)
6836
+ };
6837
+ return ReflectApply$LWS$1(originalNotificationCtor$LWS, this, args$LWS);
6838
+ }
6839
+ }
6840
+ }
6841
+
6842
+ throw error;
6843
+ }
6601
6844
  }];
6602
6845
  return function distortionNotificationCtor$LWS() {
6603
6846
  return distortionEntry$LWS;
@@ -7457,14 +7700,38 @@ function initDistortionSVGElementDatasetGetter$LWS({
7457
7700
  };
7458
7701
  }
7459
7702
 
7460
- function initDistortionSVGScriptElementHrefAttribute$LWS({
7703
+ function initDistortionSVGScriptElementHrefGetter$LWS({
7704
+ globalObject: {
7705
+ SVGScriptElement: SVGScriptElement$LWS
7706
+ }
7707
+ }) {
7708
+ const originalHrefGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGScriptElement$LWS.prototype, 'href');
7709
+ const distortionEntry$LWS = [originalHrefGetter$LWS, function href$LWS() {
7710
+ var _getResolvedScriptURL2$LWS;
7711
+
7712
+ return (_getResolvedScriptURL2$LWS = getResolvedScriptURL$LWS(this, 'href')) != null ? _getResolvedScriptURL2$LWS : ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
7713
+ }];
7714
+ return function distortionSVGScriptElementHrefGetter$LWS() {
7715
+ return distortionEntry$LWS;
7716
+ };
7717
+ }
7718
+
7719
+ function initDistortionSVGScriptElementHrefSetter$LWS({
7461
7720
  globalObject: {
7462
7721
  SVGScriptElement: SVGScriptElement$LWS
7463
7722
  }
7464
7723
  }) {
7465
- return function distortionSVGScriptElementHrefAttribute$LWS(record$LWS) {
7466
- registerElementSetDistortion$LWS(record$LWS, SVGScriptElement$LWS, 'href', NAMESPACE_XLINK$LWS, createScriptDistortion$LWS(record$LWS, 'href', SVGElementProtoDatasetGetter$LWS));
7467
- registerElementSetDistortion$LWS(record$LWS, SVGScriptElement$LWS, 'xlink:href', NAMESPACE_XLINK$LWS, createScriptDistortion$LWS(record$LWS, 'xlink:href', SVGElementProtoDatasetGetter$LWS));
7724
+ const {
7725
+ get: originalHrefGetter$LWS,
7726
+ set: originalHrefSetter$LWS
7727
+ } = ReflectGetOwnPropertyDescriptor$LWS(SVGScriptElement$LWS.prototype, 'href');
7728
+ const {
7729
+ get: originalTextContentGetter$LWS,
7730
+ set: originalTextContentSetter$LWS
7731
+ } = ReflectGetOwnPropertyDescriptor$LWS(Node.prototype, 'textContent');
7732
+ return function distortionSVGScriptElementHrefSetter$LWS(record$LWS) {
7733
+ registerElementSetDistortion$LWS(record$LWS, SVGScriptElement$LWS, 'href', NAMESPACE_XLINK$LWS, createScriptDistortion$LWS(record$LWS, 'href', originalHrefGetter$LWS, originalHrefSetter$LWS, originalTextContentGetter$LWS, originalTextContentSetter$LWS));
7734
+ registerElementSetDistortion$LWS(record$LWS, SVGScriptElement$LWS, 'xlink:href', NAMESPACE_XLINK$LWS, createScriptDistortion$LWS(record$LWS, 'xlink:href', originalHrefGetter$LWS, originalHrefSetter$LWS, originalTextContentGetter$LWS, originalTextContentSetter$LWS));
7468
7735
  return null;
7469
7736
  };
7470
7737
  }
@@ -7773,12 +8040,9 @@ class BaseFrameHandler$LWS {
7773
8040
  }
7774
8041
 
7775
8042
  ReflectSetPrototypeOf$LWS$1(BaseFrameHandler$LWS.prototype, null);
7776
- ObjectFreeze$LWS$1(BaseFrameHandler$LWS.prototype);
7777
8043
 
7778
8044
  class ShadowFramesPrototypeHandler$LWS extends BaseFrameHandler$LWS {}
7779
8045
 
7780
- ObjectFreeze$LWS$1(ShadowFramesPrototypeHandler$LWS.prototype);
7781
-
7782
8046
  function initDistortionWindowFramesGetter$LWS({
7783
8047
  globalObject: globalObject$LWS
7784
8048
  }) {
@@ -7885,8 +8149,6 @@ function initDistortionWindowFramesGetter$LWS({
7885
8149
 
7886
8150
  }
7887
8151
 
7888
- ObjectFreeze$LWS$1(ShadowFrameHandler$LWS.prototype);
7889
-
7890
8152
  class ShadowWindowPropertiesHandler$LWS extends ShadowFramesPrototypeHandler$LWS {
7891
8153
  get(target$LWS, key$LWS, receiver$LWS) {
7892
8154
  const value$LWS = getFrameByNameKey$LWS(key$LWS);
@@ -7937,18 +8199,17 @@ function initDistortionWindowFramesGetter$LWS({
7937
8199
  return keys$LWS;
7938
8200
  }
7939
8201
 
7940
- }
7941
-
7942
- ObjectFreeze$LWS$1(ShadowWindowPropertiesHandler$LWS.prototype); // In order to preserve window.frames === window.frames, create a
8202
+ } // In order to preserve window.frames === window.frames, create a
7943
8203
  // shadow target object, to be used with the proxy object that is
7944
8204
  // returned by accesses to window.frames.
7945
8205
 
8206
+
7946
8207
  const shadowFrames$LWS = {};
7947
8208
  const shadowFramesPrototype$LWS = {};
7948
8209
  const shadowWindowProperties$LWS = {};
7949
- const shadowFramesHandler$LWS = ObjectFreeze$LWS$1(new ShadowFrameHandler$LWS());
7950
- const shadowFramesPrototypeHandler$LWS = ObjectFreeze$LWS$1(new ShadowFramesPrototypeHandler$LWS());
7951
- const shadowWindowPropertiesHandler$LWS = ObjectFreeze$LWS$1(new ShadowWindowPropertiesHandler$LWS());
8210
+ const shadowFramesHandler$LWS = new ShadowFrameHandler$LWS();
8211
+ const shadowFramesPrototypeHandler$LWS = new ShadowFramesPrototypeHandler$LWS();
8212
+ const shadowWindowPropertiesHandler$LWS = new ShadowWindowPropertiesHandler$LWS();
7952
8213
  const framesPrototypeProxy$LWS = new ProxyCtor$LWS(shadowFramesPrototype$LWS, shadowFramesPrototypeHandler$LWS);
7953
8214
  const windowPropertiesProxy$LWS = new ProxyCtor$LWS(shadowWindowProperties$LWS, shadowWindowPropertiesHandler$LWS);
7954
8215
  ReflectSetPrototypeOf$LWS$1(shadowFrames$LWS, framesPrototypeProxy$LWS);
@@ -8045,14 +8306,45 @@ function initDistortionWindowPostMessage$LWS({
8045
8306
  }
8046
8307
  }) {
8047
8308
  const distortionEntry$LWS = [originalPostMessage$LWS, function postMessage$LWS(...args$LWS) {
8048
- // istanbul ignore else: needs default platform behavior test
8049
- if (args$LWS.length) {
8050
- // Structured clone all arguments so that `transfer` is referenced
8051
- // correctly within `message`.
8052
- args$LWS = partialStructuredClone$LWS(args$LWS);
8053
- }
8309
+ try {
8310
+ return ReflectApply$LWS$1(originalPostMessage$LWS, this, args$LWS);
8311
+ } catch (error) {
8312
+ // We don't check if `error instance of DOMException` because
8313
+ // accessing `DOMException` of the `globalObject` will throw
8314
+ // an error for opaque windows.
8315
+ const {
8316
+ length: length$LWS
8317
+ } = args$LWS;
8054
8318
 
8055
- return ReflectApply$LWS$1(originalPostMessage$LWS, this, args$LWS);
8319
+ if (length$LWS) {
8320
+ const message$LWS = args$LWS[0];
8321
+
8322
+ if (isObject$LWS$1(message$LWS)) {
8323
+ // Calling `window.postMessage(message, target, transfer)`
8324
+ // is equivalent to `window.postMessage(message, { targetOrigin, transfer })`.
8325
+ const providedOptions$LWS = length$LWS > 1 ? args$LWS[1] : undefined;
8326
+
8327
+ if (isObjectLike$LWS(providedOptions$LWS)) {
8328
+ args$LWS[1] = {
8329
+ // The postMessage function accepts inherited
8330
+ // options property values.
8331
+ __proto__: providedOptions$LWS,
8332
+ // Shadow any inherited value.
8333
+ transfer: providedOptions$LWS == null ? void 0 : providedOptions$LWS.transfer
8334
+ }; // Structured clone all arguments so that `transfer`
8335
+ // is referenced correctly within `message`.
8336
+
8337
+ args$LWS = partialStructuredClone$LWS(args$LWS);
8338
+ } else {
8339
+ args$LWS[0] = partialStructuredClone$LWS(message$LWS);
8340
+ }
8341
+
8342
+ return ReflectApply$LWS$1(originalPostMessage$LWS, this, args$LWS);
8343
+ }
8344
+ }
8345
+
8346
+ throw error;
8347
+ }
8056
8348
  }];
8057
8349
  return function distortionWindowPostMessage$LWS() {
8058
8350
  return distortionEntry$LWS;
@@ -8129,6 +8421,7 @@ function initDistortionWindowSetTimeout$LWS({
8129
8421
  function initDistortionWindowStructuredClone$LWS({
8130
8422
  // @ts-ignore: Prevent property existence error.
8131
8423
  globalObject: {
8424
+ DOMException: DOMException$LWS,
8132
8425
  structuredClone: originalStructuredClone$LWS
8133
8426
  }
8134
8427
  }) {
@@ -8138,14 +8431,40 @@ function initDistortionWindowStructuredClone$LWS({
8138
8431
  }
8139
8432
 
8140
8433
  const distortionEntry$LWS = [originalStructuredClone$LWS, function structuredClone$LWS(...args$LWS) {
8141
- // istanbul ignore else: needs default platform behavior test
8142
- if (args$LWS.length) {
8143
- // Structured clone all arguments so that `options.transfer` is
8144
- // referenced correctly within `value`.
8145
- args$LWS = partialStructuredClone$LWS(args$LWS);
8146
- }
8434
+ try {
8435
+ return ReflectApply$LWS$1(originalStructuredClone$LWS, this, args$LWS);
8436
+ } catch (error) {
8437
+ const {
8438
+ length: length$LWS
8439
+ } = args$LWS;
8440
+
8441
+ if (length$LWS && error instanceof DOMException$LWS) {
8442
+ const message$LWS = args$LWS[0];
8443
+
8444
+ if (isObject$LWS$1(message$LWS)) {
8445
+ const providedOptions$LWS = length$LWS > 1 ? args$LWS[1] : undefined;
8446
+
8447
+ if (isObjectLike$LWS(providedOptions$LWS)) {
8448
+ args$LWS[1] = {
8449
+ // The structuredClone function accepts inherited
8450
+ // options property values.
8451
+ __proto__: providedOptions$LWS,
8452
+ // Shadow any inherited value.
8453
+ transfer: providedOptions$LWS == null ? void 0 : providedOptions$LWS.transfer
8454
+ }; // Structured clone all arguments so that `options.transfer`
8455
+ // is referenced correctly within `value`.
8456
+
8457
+ args$LWS = partialStructuredClone$LWS(args$LWS);
8458
+ } else {
8459
+ args$LWS[0] = partialStructuredClone$LWS(message$LWS);
8460
+ }
8461
+
8462
+ return ReflectApply$LWS$1(originalStructuredClone$LWS, this, args$LWS);
8463
+ }
8464
+ }
8147
8465
 
8148
- return ReflectApply$LWS$1(originalStructuredClone$LWS, this, args$LWS);
8466
+ throw error;
8467
+ }
8149
8468
  }];
8150
8469
  return function distortionWindowStructuredClone$LWS() {
8151
8470
  return distortionEntry$LWS;
@@ -8265,7 +8584,8 @@ initDistortionHTMLIFrameElementSrcSetter$LWS, // HTMLLinkElement
8265
8584
  initDistortionHTMLLinkElementRelSetter$LWS, initDistortionHTMLLinkElementRelListSetter$LWS, // HTMLObjectElement
8266
8585
  initDistortionHTMLObjectElementDataSetter$LWS, // HTMLScriptElement
8267
8586
  initDistortionHTMLScriptElementSrcGetter$LWS, // IDBObjectStore
8268
- initDistortionIDBObjectStoreAdd$LWS, initDistortionIDBObjectStorePut$LWS, // Navigator
8587
+ initDistortionIDBObjectStoreAdd$LWS, initDistortionIDBObjectStorePut$LWS, // MessagePort
8588
+ initDistortionMessagePortPostMessage$LWS, // Navigator
8269
8589
  initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS, // Node
8270
8590
  initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS, // Notification
8271
8591
  initDistortionNotificationCtor$LWS, // Range
@@ -8295,10 +8615,10 @@ initDistortionEventTargetAddEventListener$LWS, // HTMLScriptElement,
8295
8615
  initDistortionHTMLScriptElementSrcSetter$LWS, // JSON
8296
8616
  initDistortionJSONParse$LWS, // NamedNodeMap
8297
8617
  initDistortionNamedNodeMapSetNamedItem$LWS, initDistortionNamedNodeMapSetNamedItemNS$LWS, // Node
8298
- initDistortionNodeValueSetter$LWS, initDistortionNodeTextContentSetter$LWS, // Storage
8618
+ initDistortionNodeValueSetter$LWS, initDistortionNodeTextContentGetter$LWS, initDistortionNodeTextContentSetter$LWS, // Storage
8299
8619
  initDistortionLocalStorage$LWS, initDistortionSessionStorage$LWS, // SVGAnimationElement
8300
8620
  initDistortionSVGAnimateElementAttributeNameAttribute$LWS, // SVGScriptElement
8301
- initDistortionSVGScriptElementHrefAttribute$LWS, // SVGSetElement
8621
+ initDistortionSVGScriptElementHrefGetter$LWS, initDistortionSVGScriptElementHrefSetter$LWS, // SVGSetElement
8302
8622
  initDistortionSVGSetElementAttributeNameAttribute$LWS, // Window
8303
8623
  initDistortionWindowOnstorage$LWS, initDistortionWindowSetInterval$LWS, initDistortionWindowSetTimeout$LWS];
8304
8624
  const externalDistortionFactoryInitializers$LWS = ArrayConcat$LWS(internalDistortionFactoryInitializers$LWS, [// Element
@@ -8308,12 +8628,22 @@ initDistortionElementAfter$LWS, initDistortionElementAppend$LWS, initDistortionE
8308
8628
  // initDistortionNodeAppendChild,
8309
8629
  initDistortionNodeInsertBefore$LWS]);
8310
8630
  const externalKeyedDistortionFactoryInitializers$LWS = internalKeyedDistortionFactoryInitializers$LWS;
8311
- const evaluationDistortionFactoryInitializers$LWS = [// eval
8312
- initDistortionEval$LWS];
8313
- const opaqueDistortionFactoryInitializers$LWS = [// Window
8314
- initDistortionWindowPostMessage$LWS];
8315
8631
  const DocumentBlockedProperties$LWS = ['createProcessingInstruction', 'exitFullscreen', 'fullscreen', 'fullscreenElement', 'fullscreenEnabled', 'mozCancelFullScreen', 'mozFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'onfullscreenchange', 'onfullscreenerror', 'onmozfullscreenchange', 'onmozfullscreenerror', 'onrejectionhandled', 'onsecuritypolicyviolation', 'onunhandledrejection', 'releaseCapture', 'releaseEvents', 'webkitFullScreenKeyboardInputAllowed', 'write', 'writeln'];
8316
8632
  const ElementBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
8633
+
8634
+ function initDistortionEval$LWS({
8635
+ UNCOMPILED_CONTEXT: UNCOMPILED_CONTEXT$LWS,
8636
+ globalObject: {
8637
+ eval: originalEval$LWS
8638
+ }
8639
+ }) {
8640
+ return function distortionEval$LWS({
8641
+ sandboxEvaluator: sandboxEvaluator$LWS
8642
+ }) {
8643
+ return [originalEval$LWS, sourceText$LWS => sandboxEvaluator$LWS(transformSourceText$LWS(toString$LWS(sourceText$LWS)), UNCOMPILED_CONTEXT$LWS)];
8644
+ };
8645
+ }
8646
+
8317
8647
  const HTMLElementBlockedAttributes$LWS = ['nonce'];
8318
8648
  const HTMLElementBlockedProperties$LWS = ['nonce', 'onrejectionhandled', 'onunhandledrejection'];
8319
8649
  const HTMLEmbedElementBlockedProperties$LWS = ['getSVGDocument']; // https://www.w3schools.com/tags/tag_iframe.asp
@@ -8327,168 +8657,434 @@ const SVGElementBlockedAttributes$LWS = ['nonce'];
8327
8657
  const SVGElementBlockedProperties$LWS = ['nonce'];
8328
8658
  const XSLTProcessorBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
8329
8659
 
8330
- const {
8331
- apply: ReflectApply$LWS,
8332
- defineProperty: ReflectDefineProperty$LWS,
8333
- deleteProperty: ReflectDeleteProperty$LWS,
8334
- getPrototypeOf: ReflectGetPrototypeOf$LWS,
8335
- ownKeys: ReflectOwnKeys$LWS,
8336
- setPrototypeOf: ReflectSetPrototypeOf$LWS
8337
- } = Reflect;
8338
- const ObjectCtor$LWS = Object;
8339
- const {
8340
- assign: ObjectAssign$LWS,
8341
- freeze: ObjectFreeze$LWS,
8342
- keys: ObjectKeys$LWS,
8343
- prototype: ObjectProto$LWS
8344
- } = ObjectCtor$LWS;
8345
- const {
8346
- hasOwn: OriginalObjectHasOwn$LWS
8347
- } = ObjectCtor$LWS;
8348
- const {
8349
- __lookupGetter__: ObjectProtoLookupGetter$LWS,
8350
- __lookupSetter__: ObjectProtoLookupSetter$LWS,
8351
- hasOwnProperty: ObjectProtoHasOwnProperty$LWS
8352
- } = ObjectProto$LWS;
8353
- const ObjectHasOwn$LWS = typeof OriginalObjectHasOwn$LWS === 'function' ? OriginalObjectHasOwn$LWS :
8354
- /* istanbul ignore next: currently unreachable via tests */
8355
- function ObjectHasOwn$LWS(object$LWS, __key$LWS) {
8356
- return ReflectApply$LWS(ObjectProtoHasOwnProperty$LWS, object$LWS, [__key$LWS]);
8357
- };
8358
- const {
8359
- toString: ObjectProtoToString$LWS
8360
- } = ObjectProto$LWS;
8660
+ const distortionFactoriesCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8661
+ const evalDistortionFactoryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8662
+ const opaqueWindowPostMessageDistortionFactoryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1()); // WebKit based browsers have a bug that prematurely removes distortion entries
8663
+ // from the distortions weak map.
8361
8664
 
8362
- function isObject$LWS(__value$LWS) {
8363
- return typeof __value$LWS === 'object' && __value$LWS !== null;
8364
- }
8665
+ const SUPPORTS_DISTORTIONS_WEAK_MAP$LWS = !IS_WEBKIT_BROWSER$LWS;
8365
8666
 
8366
- function ObjectLookupOwnGetter$LWS(object$LWS, __key$LWS) {
8367
- return object$LWS === null || object$LWS === undefined || !ObjectHasOwn$LWS(object$LWS, __key$LWS) ? undefined : ReflectApply$LWS(ObjectProtoLookupGetter$LWS, object$LWS, [__key$LWS]);
8368
- }
8667
+ function createDistortionEntries$LWS(_record$LWS, _factories$LWS, entries$LWS = []) {
8668
+ let {
8669
+ length: entriesOffset$LWS
8670
+ } = entries$LWS;
8369
8671
 
8370
- const SymbolCtor$LWS = Symbol;
8371
- const {
8372
- for: SymbolFor$LWS,
8373
- iterator: SymbolIterator$LWS,
8374
- toStringTag: SymbolToStringTag$LWS,
8375
- unscopables: SymbolUnscopables$LWS
8376
- } = SymbolCtor$LWS;
8377
- const ArrayCtor$LWS = Array;
8378
- const {
8379
- prototype: ArrayProto$LWS
8380
- } = ArrayCtor$LWS;
8381
- const {
8382
- at: ArrayProtoAt$LWS,
8383
- concat: ArrayProtoConcat$LWS,
8384
- copyWithin: ArrayProtoCopyWithin$LWS,
8385
- entries: ArrayProtoEntries$LWS,
8386
- every: ArrayProtoEvery$LWS,
8387
- fill: ArrayProtoFill$LWS,
8388
- findIndex: ArrayProtoFindIndex$LWS,
8389
- flat: ArrayProtoFlat$LWS,
8390
- flatMap: ArrayProtoFlatMap$LWS,
8391
- forEach: ArrayProtoForEach$LWS,
8392
- indexOf: ArrayProtoIndexOf$LWS,
8393
- join: ArrayProtoJoin$LWS,
8394
- keys: ArrayProtoKeys$LWS,
8395
- lastIndexOf: ArrayProtoLastIndexOf$LWS,
8396
- map: ArrayProtoMap$LWS,
8397
- pop: ArrayProtoPop$LWS,
8398
- reduce: ArrayProtoReduce$LWS,
8399
- reduceRight: ArrayProtoReduceRight$LWS,
8400
- reverse: ArrayProtoReverse$LWS,
8401
- slice: ArrayProtoSlice$LWS,
8402
- some: ArrayProtoSome$LWS,
8403
- splice: ArrayProtoSplice$LWS,
8404
- toLocaleString: ArrayProtoToLocaleString$LWS,
8405
- toString: ArrayProtoToString$LWS,
8406
- values: ArrayProtoValues$LWS,
8407
- [SymbolIterator$LWS]: ArrayProtoSymbolIterator$LWS
8408
- } = ArrayProto$LWS;
8409
- const ArrayUnscopables$LWS = ObjectFreeze$LWS(ObjectAssign$LWS({
8410
- __proto__: null
8411
- }, ArrayProto$LWS[SymbolUnscopables$LWS]));
8412
- const {
8413
- filter: ArrayProtoFilter$LWS,
8414
- find: ArrayProtoFind$LWS,
8415
- includes: ArrayProtoIncludes$LWS,
8416
- shift: ArrayProtoShift$LWS,
8417
- sort: ArrayProtoSort$LWS,
8418
- unshift: ArrayProtoUnshift$LWS
8419
- } = ArrayProto$LWS;
8420
- const {
8421
- push: ArrayProtoPush$LWS
8422
- } = ArrayProto$LWS;
8423
- const {
8424
- isArray: ArrayIsArray$LWS
8425
- } = ArrayCtor$LWS;
8672
+ for (let _i$LWS = 0, {
8673
+ length: _length$LWS
8674
+ } = _factories$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
8675
+ const factory$LWS = _factories$LWS[_i$LWS];
8676
+ const entry$LWS = factory$LWS(_record$LWS);
8426
8677
 
8427
- function toSafeArray$LWS(array$LWS) {
8428
- ReflectSetPrototypeOf$LWS(array$LWS, null);
8429
- array$LWS.at = ArrayProtoAt$LWS;
8430
- array$LWS.concat = ArrayProtoConcat$LWS; // *** DO NOT SET THE ARRAY CONSTRUCTOR PROPERTY ***
8431
- // https://bugs.chromium.org/p/v8/issues/detail?id=13202
8432
- // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/lookup.cc;l=196-215?q=IsArraySpeciesLookupChainIntact
8433
- //
8434
- // In V8 setting the constructor property of an array, promise, regexp, or
8435
- // typed array triggers a de-opt because it could change an instance's
8436
- // @@species. This de-opt affects at least `Array#splice` and occurs even
8437
- // if the prototype of the array is change or nulled beforehand. Further,
8438
- // the de-opt persists after a page refresh. It is not until navigating to
8439
- // a different page that the performance of `Array#splice` is restored.
8678
+ if (entry$LWS) {
8679
+ const {
8680
+ 0: _originalValue$LWS,
8681
+ 1: distortedValue$LWS
8682
+ } = entry$LWS;
8440
8683
 
8441
- array$LWS.copyWithin = ArrayProtoCopyWithin$LWS;
8442
- array$LWS.entries = ArrayProtoEntries$LWS;
8443
- array$LWS.every = ArrayProtoEvery$LWS;
8444
- array$LWS.fill = ArrayProtoFill$LWS;
8445
- array$LWS.filter = ArrayProtoFilter$LWS;
8446
- array$LWS.find = ArrayProtoFind$LWS;
8447
- array$LWS.findIndex = ArrayProtoFindIndex$LWS;
8448
- array$LWS.flat = ArrayProtoFlat$LWS;
8449
- array$LWS.flatMap = ArrayProtoFlatMap$LWS;
8450
- array$LWS.forEach = ArrayProtoForEach$LWS;
8451
- array$LWS.includes = ArrayProtoIncludes$LWS;
8452
- array$LWS.indexOf = ArrayProtoIndexOf$LWS;
8453
- array$LWS.join = ArrayProtoJoin$LWS;
8454
- array$LWS.keys = ArrayProtoKeys$LWS;
8455
- array$LWS.lastIndexOf = ArrayProtoLastIndexOf$LWS;
8456
- array$LWS.map = ArrayProtoMap$LWS;
8457
- array$LWS.pop = ArrayProtoPop$LWS;
8458
- array$LWS.push = ArrayProtoPush$LWS;
8459
- array$LWS.reduce = ArrayProtoReduce$LWS;
8460
- array$LWS.reduceRight = ArrayProtoReduceRight$LWS;
8461
- array$LWS.reverse = ArrayProtoReverse$LWS;
8462
- array$LWS.shift = ArrayProtoShift$LWS;
8463
- array$LWS.slice = ArrayProtoSlice$LWS;
8464
- array$LWS.some = ArrayProtoSome$LWS;
8465
- array$LWS.sort = ArrayProtoSort$LWS;
8466
- array$LWS.splice = ArrayProtoSplice$LWS;
8467
- array$LWS.toLocaleString = ArrayProtoToLocaleString$LWS;
8468
- array$LWS.toString = ArrayProtoToString$LWS;
8469
- array$LWS.unshift = ArrayProtoUnshift$LWS;
8470
- array$LWS.values = ArrayProtoValues$LWS;
8471
- array$LWS[SymbolIterator$LWS] = ArrayProtoSymbolIterator$LWS;
8472
- array$LWS[SymbolUnscopables$LWS] = ArrayUnscopables$LWS;
8473
- ReflectSetPrototypeOf$LWS(array$LWS, ArrayProto$LWS);
8474
- return array$LWS;
8475
- }
8684
+ if (typeof _originalValue$LWS === 'function') {
8685
+ entries$LWS[entriesOffset$LWS++] = [_originalValue$LWS, // eslint-disable-next-line @typescript-eslint/no-use-before-define
8686
+ proxyMaskFunctionDistortion$LWS(_record$LWS, factory$LWS, distortedValue$LWS, _originalValue$LWS)];
8687
+ } else {
8688
+ // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
8689
+ if (typeof _originalValue$LWS === 'object' && _originalValue$LWS !== null) {
8690
+ entries$LWS[entriesOffset$LWS++] = entry$LWS;
8691
+ }
8692
+ }
8693
+ }
8694
+ }
8476
8695
 
8477
- ObjectLookupOwnGetter$LWS(ArrayBuffer.prototype, 'byteLength'); // https://caniuse.com/bigint
8696
+ return entries$LWS;
8697
+ }
8478
8698
 
8479
- const LOCKER_IDENTIFIER_MARKER$LWS = '$LWS'; // This package is bundled by third-parties that have their own build time
8480
- // replacement logic. Instead of customizing each build system to be aware
8481
- // of this package we implement a two phase debug mode by performing small
8482
- // runtime checks to determine phase one, our code is unminified, and
8483
- // phase two, the user opted-in to custom devtools formatters. Phase one
8484
- // is used for light weight initialization time debug while phase two is
8485
- // reserved for post initialization runtime.
8486
- // istanbul ignore next
8699
+ function createDistortionMap$LWS(entries$LWS) {
8700
+ return SUPPORTS_DISTORTIONS_WEAK_MAP$LWS ? toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1(entries$LWS)) : // istanbul ignore next: this code is not reachable in the coverage run.
8701
+ toSafeMap$LWS$1(new MapCtor$LWS$1(entries$LWS));
8702
+ }
8487
8703
 
8488
- const LOCKER_UNMINIFIED_FLAG$LWS = `${() =>
8489
- /* $LWS */
8490
- 1}`.includes(LOCKER_IDENTIFIER_MARKER$LWS);
8491
- const CHAR_ELLIPSIS$LWS = '\u2026';
8704
+ function getDistortionFactories$LWS(_record$LWS) {
8705
+ const {
8706
+ document: _document$LWS,
8707
+ globalObject: _globalObject$LWS,
8708
+ type: _type$LWS
8709
+ } = _record$LWS;
8710
+ let _factories$LWS = distortionFactoriesCache$LWS.get(_document$LWS);
8711
+
8712
+ if (_factories$LWS) {
8713
+ return _factories$LWS;
8714
+ }
8715
+
8716
+ const {
8717
+ Document: _Document$LWS,
8718
+ Element: _Element$LWS,
8719
+ HTMLElement: _HTMLElement$LWS,
8720
+ HTMLIFrameElement: _HTMLIFrameElement$LWS,
8721
+ HTMLScriptElement: _HTMLScriptElement$LWS,
8722
+ SVGElement: _SVGElement$LWS,
8723
+ XSLTProcessor: XSLTProcessor$LWS
8724
+ } = _globalObject$LWS;
8725
+ const initializers$LWS = _type$LWS === 1
8726
+ /* SandboxType.Internal */
8727
+ ? ArrayConcat$LWS(internalDistortionFactoryInitializers$LWS, internalKeyedDistortionFactoryInitializers$LWS) : ArrayConcat$LWS(externalDistortionFactoryInitializers$LWS, externalKeyedDistortionFactoryInitializers$LWS);
8728
+ createBlockedAttributeDistortionFactoryInitializers$LWS(_HTMLElement$LWS, 'HTMLElement', HTMLElementBlockedAttributes$LWS, initializers$LWS);
8729
+ createBlockedAttributeDistortionFactoryInitializers$LWS(_HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS);
8730
+ createBlockedAttributeDistortionFactoryInitializers$LWS(_HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS);
8731
+ createBlockedAttributeDistortionFactoryInitializers$LWS(_SVGElement$LWS, 'SVGElement', SVGElementBlockedAttributes$LWS, initializers$LWS);
8732
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, CustomElementRegistry.prototype, CustomElementRegistryBlockedProperties$LWS, initializers$LWS);
8733
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _Document$LWS.prototype, DocumentBlockedProperties$LWS, initializers$LWS);
8734
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _Element$LWS.prototype, ElementBlockedProperties$LWS, initializers$LWS);
8735
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _HTMLElement$LWS.prototype, HTMLElementBlockedProperties$LWS, initializers$LWS);
8736
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _HTMLIFrameElement$LWS.prototype, HTMLIFrameElementBlockedProperties$LWS, initializers$LWS);
8737
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, HTMLEmbedElement.prototype, HTMLEmbedElementBlockedProperties$LWS, initializers$LWS);
8738
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, HTMLObjectElement.prototype, HTMLObjectElementBlockedProperties$LWS, initializers$LWS);
8739
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _HTMLScriptElement$LWS.prototype, HTMLScriptElementBlockedProperties$LWS, initializers$LWS);
8740
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _SVGElement$LWS.prototype, SVGElementBlockedProperties$LWS, initializers$LWS); // istanbul ignore else: this is a safety precaution that is unreachable via tests
8741
+
8742
+ if (typeof XSLTProcessor$LWS === 'function') {
8743
+ createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, XSLTProcessor$LWS.prototype, XSLTProcessorBlockedProperties$LWS, initializers$LWS);
8744
+ } // Reuse the `initializers` array as the `factories` array.
8745
+
8746
+
8747
+ _factories$LWS = initializers$LWS;
8748
+
8749
+ for (let _i$LWS = 0, {
8750
+ length: _length$LWS
8751
+ } = _factories$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
8752
+ _factories$LWS[_i$LWS] = initializers$LWS[_i$LWS](_record$LWS);
8753
+ }
8754
+
8755
+ distortionFactoriesCache$LWS.set(_document$LWS, _factories$LWS);
8756
+ return _factories$LWS;
8757
+ }
8758
+
8759
+ function getEvalDistortionFactory$LWS(_record$LWS) {
8760
+ const {
8761
+ document: _document$LWS
8762
+ } = _record$LWS;
8763
+ let evalDistortionFactory$LWS = evalDistortionFactoryCache$LWS.get(_document$LWS);
8764
+
8765
+ if (evalDistortionFactory$LWS) {
8766
+ return evalDistortionFactory$LWS;
8767
+ }
8768
+
8769
+ evalDistortionFactory$LWS = initDistortionEval$LWS(_record$LWS);
8770
+ evalDistortionFactoryCache$LWS.set(_document$LWS, evalDistortionFactory$LWS);
8771
+ return evalDistortionFactory$LWS;
8772
+ }
8773
+
8774
+ function getOpaqueWindowPostMessageDistortionFactory$LWS(_record$LWS) {
8775
+ const {
8776
+ globalObject: _globalObject$LWS
8777
+ } = _record$LWS;
8778
+ let opaqueWindowPostMessageDistortionFactory$LWS = opaqueWindowPostMessageDistortionFactoryCache$LWS.get(_globalObject$LWS);
8779
+
8780
+ if (opaqueWindowPostMessageDistortionFactory$LWS) {
8781
+ return opaqueWindowPostMessageDistortionFactory$LWS;
8782
+ }
8783
+
8784
+ opaqueWindowPostMessageDistortionFactory$LWS = initDistortionWindowPostMessage$LWS(_record$LWS);
8785
+ opaqueWindowPostMessageDistortionFactoryCache$LWS.set(_globalObject$LWS, opaqueWindowPostMessageDistortionFactory$LWS);
8786
+ return opaqueWindowPostMessageDistortionFactory$LWS;
8787
+ }
8788
+
8789
+ function proxyMaskFunctionDistortion$LWS({
8790
+ BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
8791
+ LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
8792
+ LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
8793
+ instrumentation: instrumentation$LWS,
8794
+ key: __key$LWS
8795
+ }, distortionFactory$LWS, distortionFunc$LWS, maskFunc$LWS) {
8796
+ let activityName$LWS;
8797
+ let startActivity$LWS; // istanbul ignore if: this is a safety precaution that is unreachable via tests
8798
+
8799
+ if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8800
+ ({
8801
+ startActivity: startActivity$LWS
8802
+ } = instrumentation$LWS);
8803
+ const {
8804
+ name: factoryName$LWS
8805
+ } = distortionFactory$LWS;
8806
+ activityName$LWS = factoryName$LWS ? ReflectApply$LWS$1(StringProtoReplace$LWS, factoryName$LWS, [LOCKER_IDENTIFIER_MARKER$LWS$1, '']) : '<unknown>';
8807
+ }
8808
+
8809
+ const _proxy$LWS = new ProxyCtor$LWS(maskFunc$LWS, {
8810
+ apply(__target$LWS, thisArg$LWS, _args$LWS) {
8811
+ // istanbul ignore if: this is a safety precaution that is unreachable via tests
8812
+ if (thisArg$LWS === _proxy$LWS) {
8813
+ thisArg$LWS = distortionFunc$LWS;
8814
+ }
8815
+
8816
+ let activity$LWS; // istanbul ignore if: this is a safety precaution that is unreachable via tests
8817
+
8818
+ if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8819
+ activity$LWS = startActivity$LWS(activityName$LWS, BASIC_INSTRUMENTATION_DATA$LWS);
8820
+ }
8821
+
8822
+ try {
8823
+ return ReflectApply$LWS$1(distortionFunc$LWS, thisArg$LWS, _args$LWS);
8824
+ } catch (error) {
8825
+ // istanbul ignore if: this is a safety precaution that is unreachable via tests
8826
+ if (LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8827
+ activity$LWS.error({
8828
+ sandboxKey: __key$LWS,
8829
+ error
8830
+ });
8831
+ }
8832
+
8833
+ throw error;
8834
+ } finally {
8835
+ // istanbul ignore if: this is a safety precaution that is unreachable via tests
8836
+ if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8837
+ activity$LWS.stop();
8838
+ }
8839
+ }
8840
+ },
8841
+
8842
+ construct(__target$LWS, _args$LWS, newTarget$LWS) {
8843
+ // istanbul ignore else: no non-matching path found via tests
8844
+ if (newTarget$LWS === _proxy$LWS) {
8845
+ newTarget$LWS = distortionFunc$LWS;
8846
+ }
8847
+
8848
+ let activity$LWS; // istanbul ignore if: this is a safety precaution that is unreachable via tests
8849
+
8850
+ if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8851
+ activity$LWS = startActivity$LWS(activityName$LWS, BASIC_INSTRUMENTATION_DATA$LWS);
8852
+ }
8853
+
8854
+ try {
8855
+ return ReflectConstruct$LWS(distortionFunc$LWS, _args$LWS, newTarget$LWS);
8856
+ } catch (error) {
8857
+ // istanbul ignore if: this is a safety precaution that is unreachable via tests
8858
+ if (LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8859
+ activity$LWS.error({
8860
+ sandboxKey: __key$LWS,
8861
+ error
8862
+ });
8863
+ }
8864
+
8865
+ throw error;
8866
+ } finally {
8867
+ // istanbul ignore if: this is a safety precaution that is unreachable via tests
8868
+ if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
8869
+ activity$LWS.stop();
8870
+ }
8871
+ }
8872
+ }
8873
+
8874
+ });
8875
+ return _proxy$LWS;
8876
+ }
8877
+
8878
+ let lockerEvalContextValue$LWS;
8879
+ let lockerEvalHelpersValue$LWS;
8880
+
8881
+ function clearEvalContext$LWS() {
8882
+ const evalContext$LWS = lockerEvalContextValue$LWS;
8883
+ lockerEvalContextValue$LWS = undefined;
8884
+ return evalContext$LWS;
8885
+ }
8886
+
8887
+ function clearEvalHelpers$LWS() {
8888
+ const evalHelpers$LWS = lockerEvalHelpersValue$LWS;
8889
+ lockerEvalHelpersValue$LWS = undefined;
8890
+ return evalHelpers$LWS;
8891
+ }
8892
+
8893
+ function setEvalContext$LWS(evalContext$LWS) {
8894
+ lockerEvalContextValue$LWS = evalContext$LWS;
8895
+ }
8896
+
8897
+ function setEvalHelpers$LWS(evalHelpers$LWS) {
8898
+ lockerEvalHelpersValue$LWS = evalHelpers$LWS;
8899
+ }
8900
+
8901
+ const CORE_SANDBOX_KEY$LWS = 'lws-core-sandbox';
8902
+ const DEFAULT_ENDOWMENTS_DESCRIPTOR_MAP$LWS = {
8903
+ [SANDBOX_EVAL_CONTEXT_NAME$LWS]: {
8904
+ __proto__: null,
8905
+
8906
+ get() {
8907
+ return clearEvalContext$LWS();
8908
+ }
8909
+
8910
+ },
8911
+ [SANDBOX_EVAL_HELPERS_NAME$LWS]: {
8912
+ __proto__: null,
8913
+
8914
+ get() {
8915
+ return clearEvalHelpers$LWS();
8916
+ }
8917
+
8918
+ }
8919
+ };
8920
+ const EMPTY_DISTORTIONS_MAP$LWS = createDistortionMap$LWS();
8921
+ const EMPTY_OBJECT$LWS = {};
8922
+ const ROOT_UNCOMPILED_CONTEXT$LWS = {
8923
+ [UNCOMPILED_LOCATION_NAME$LWS]: rootWindowLocation$LWS,
8924
+ [UNCOMPILED_TOP_NAME$LWS]: topWindow$LWS
8925
+ };
8926
+ const {
8927
+ apply: ReflectApply$LWS,
8928
+ defineProperty: ReflectDefineProperty$LWS,
8929
+ deleteProperty: ReflectDeleteProperty$LWS,
8930
+ getPrototypeOf: ReflectGetPrototypeOf$LWS,
8931
+ ownKeys: ReflectOwnKeys$LWS,
8932
+ setPrototypeOf: ReflectSetPrototypeOf$LWS
8933
+ } = Reflect;
8934
+ const ObjectCtor$LWS = Object;
8935
+ const {
8936
+ assign: ObjectAssign$LWS,
8937
+ freeze: ObjectFreeze$LWS,
8938
+ keys: ObjectKeys$LWS,
8939
+ prototype: ObjectProto$LWS
8940
+ } = ObjectCtor$LWS;
8941
+ const {
8942
+ hasOwn: OriginalObjectHasOwn$LWS
8943
+ } = ObjectCtor$LWS;
8944
+ const {
8945
+ __lookupGetter__: ObjectProtoLookupGetter$LWS,
8946
+ __lookupSetter__: ObjectProtoLookupSetter$LWS,
8947
+ hasOwnProperty: ObjectProtoHasOwnProperty$LWS
8948
+ } = ObjectProto$LWS;
8949
+ const ObjectHasOwn$LWS = typeof OriginalObjectHasOwn$LWS === 'function' ? OriginalObjectHasOwn$LWS :
8950
+ /* istanbul ignore next: currently unreachable via tests */
8951
+ function ObjectHasOwn$LWS(object$LWS, __key$LWS) {
8952
+ return ReflectApply$LWS(ObjectProtoHasOwnProperty$LWS, object$LWS, [__key$LWS]);
8953
+ };
8954
+ const {
8955
+ toString: ObjectProtoToString$LWS
8956
+ } = ObjectProto$LWS;
8957
+
8958
+ function isObject$LWS(__value$LWS) {
8959
+ return typeof __value$LWS === 'object' && __value$LWS !== null;
8960
+ }
8961
+
8962
+ function ObjectLookupOwnGetter$LWS(object$LWS, __key$LWS) {
8963
+ return object$LWS === null || object$LWS === undefined || !ObjectHasOwn$LWS(object$LWS, __key$LWS) ? undefined : ReflectApply$LWS(ObjectProtoLookupGetter$LWS, object$LWS, [__key$LWS]);
8964
+ }
8965
+
8966
+ const SymbolCtor$LWS = Symbol;
8967
+ const {
8968
+ for: SymbolFor$LWS,
8969
+ iterator: SymbolIterator$LWS,
8970
+ toStringTag: SymbolToStringTag$LWS,
8971
+ unscopables: SymbolUnscopables$LWS
8972
+ } = SymbolCtor$LWS;
8973
+ const ArrayCtor$LWS = Array;
8974
+ const {
8975
+ prototype: ArrayProto$LWS
8976
+ } = ArrayCtor$LWS;
8977
+ const {
8978
+ at: ArrayProtoAt$LWS,
8979
+ concat: ArrayProtoConcat$LWS,
8980
+ copyWithin: ArrayProtoCopyWithin$LWS,
8981
+ entries: ArrayProtoEntries$LWS,
8982
+ every: ArrayProtoEvery$LWS,
8983
+ fill: ArrayProtoFill$LWS,
8984
+ findIndex: ArrayProtoFindIndex$LWS,
8985
+ flat: ArrayProtoFlat$LWS,
8986
+ flatMap: ArrayProtoFlatMap$LWS,
8987
+ forEach: ArrayProtoForEach$LWS,
8988
+ indexOf: ArrayProtoIndexOf$LWS,
8989
+ join: ArrayProtoJoin$LWS,
8990
+ keys: ArrayProtoKeys$LWS,
8991
+ lastIndexOf: ArrayProtoLastIndexOf$LWS,
8992
+ map: ArrayProtoMap$LWS,
8993
+ pop: ArrayProtoPop$LWS,
8994
+ reduce: ArrayProtoReduce$LWS,
8995
+ reduceRight: ArrayProtoReduceRight$LWS,
8996
+ reverse: ArrayProtoReverse$LWS,
8997
+ slice: ArrayProtoSlice$LWS,
8998
+ some: ArrayProtoSome$LWS,
8999
+ splice: ArrayProtoSplice$LWS,
9000
+ toLocaleString: ArrayProtoToLocaleString$LWS,
9001
+ toString: ArrayProtoToString$LWS,
9002
+ values: ArrayProtoValues$LWS,
9003
+ [SymbolIterator$LWS]: ArrayProtoSymbolIterator$LWS
9004
+ } = ArrayProto$LWS;
9005
+ const ArrayUnscopables$LWS = ObjectFreeze$LWS(ObjectAssign$LWS({
9006
+ __proto__: null
9007
+ }, ArrayProto$LWS[SymbolUnscopables$LWS]));
9008
+ const {
9009
+ filter: ArrayProtoFilter$LWS,
9010
+ find: ArrayProtoFind$LWS,
9011
+ includes: ArrayProtoIncludes$LWS,
9012
+ shift: ArrayProtoShift$LWS,
9013
+ sort: ArrayProtoSort$LWS,
9014
+ unshift: ArrayProtoUnshift$LWS
9015
+ } = ArrayProto$LWS;
9016
+ const {
9017
+ push: ArrayProtoPush$LWS
9018
+ } = ArrayProto$LWS;
9019
+ const {
9020
+ isArray: ArrayIsArray$LWS
9021
+ } = ArrayCtor$LWS;
9022
+
9023
+ function toSafeArray$LWS(array$LWS) {
9024
+ ReflectSetPrototypeOf$LWS(array$LWS, null);
9025
+ array$LWS.at = ArrayProtoAt$LWS;
9026
+ array$LWS.concat = ArrayProtoConcat$LWS; // *** DO NOT SET THE ARRAY CONSTRUCTOR PROPERTY ***
9027
+ // https://bugs.chromium.org/p/v8/issues/detail?id=13202
9028
+ // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/lookup.cc;l=196-215?q=IsArraySpeciesLookupChainIntact
9029
+ //
9030
+ // In V8 setting the constructor property of an array, promise, regexp, or
9031
+ // typed array triggers a de-opt because it could change an instance's
9032
+ // @@species. This de-opt affects at least `Array#splice` and occurs even
9033
+ // if the prototype of the array is change or nulled beforehand. Further,
9034
+ // the de-opt persists after a page refresh. It is not until navigating to
9035
+ // a different page that the performance of `Array#splice` is restored.
9036
+
9037
+ array$LWS.copyWithin = ArrayProtoCopyWithin$LWS;
9038
+ array$LWS.entries = ArrayProtoEntries$LWS;
9039
+ array$LWS.every = ArrayProtoEvery$LWS;
9040
+ array$LWS.fill = ArrayProtoFill$LWS;
9041
+ array$LWS.filter = ArrayProtoFilter$LWS;
9042
+ array$LWS.find = ArrayProtoFind$LWS;
9043
+ array$LWS.findIndex = ArrayProtoFindIndex$LWS;
9044
+ array$LWS.flat = ArrayProtoFlat$LWS;
9045
+ array$LWS.flatMap = ArrayProtoFlatMap$LWS;
9046
+ array$LWS.forEach = ArrayProtoForEach$LWS;
9047
+ array$LWS.includes = ArrayProtoIncludes$LWS;
9048
+ array$LWS.indexOf = ArrayProtoIndexOf$LWS;
9049
+ array$LWS.join = ArrayProtoJoin$LWS;
9050
+ array$LWS.keys = ArrayProtoKeys$LWS;
9051
+ array$LWS.lastIndexOf = ArrayProtoLastIndexOf$LWS;
9052
+ array$LWS.map = ArrayProtoMap$LWS;
9053
+ array$LWS.pop = ArrayProtoPop$LWS;
9054
+ array$LWS.push = ArrayProtoPush$LWS;
9055
+ array$LWS.reduce = ArrayProtoReduce$LWS;
9056
+ array$LWS.reduceRight = ArrayProtoReduceRight$LWS;
9057
+ array$LWS.reverse = ArrayProtoReverse$LWS;
9058
+ array$LWS.shift = ArrayProtoShift$LWS;
9059
+ array$LWS.slice = ArrayProtoSlice$LWS;
9060
+ array$LWS.some = ArrayProtoSome$LWS;
9061
+ array$LWS.sort = ArrayProtoSort$LWS;
9062
+ array$LWS.splice = ArrayProtoSplice$LWS;
9063
+ array$LWS.toLocaleString = ArrayProtoToLocaleString$LWS;
9064
+ array$LWS.toString = ArrayProtoToString$LWS;
9065
+ array$LWS.unshift = ArrayProtoUnshift$LWS;
9066
+ array$LWS.values = ArrayProtoValues$LWS;
9067
+ array$LWS[SymbolIterator$LWS] = ArrayProtoSymbolIterator$LWS;
9068
+ array$LWS[SymbolUnscopables$LWS] = ArrayUnscopables$LWS;
9069
+ ReflectSetPrototypeOf$LWS(array$LWS, ArrayProto$LWS);
9070
+ return array$LWS;
9071
+ }
9072
+
9073
+ ObjectLookupOwnGetter$LWS(ArrayBuffer.prototype, 'byteLength'); // https://caniuse.com/bigint
9074
+
9075
+ const LOCKER_IDENTIFIER_MARKER$LWS = '$LWS'; // This package is bundled by third-parties that have their own build time
9076
+ // replacement logic. Instead of customizing each build system to be aware
9077
+ // of this package we implement a two phase debug mode by performing small
9078
+ // runtime checks to determine phase one, our code is unminified, and
9079
+ // phase two, the user opted-in to custom devtools formatters. Phase one
9080
+ // is used for light weight initialization time debug while phase two is
9081
+ // reserved for post initialization runtime.
9082
+ // istanbul ignore next
9083
+
9084
+ const LOCKER_UNMINIFIED_FLAG$LWS = `${() =>
9085
+ /* $LWS */
9086
+ 1}`.includes(LOCKER_IDENTIFIER_MARKER$LWS);
9087
+ const CHAR_ELLIPSIS$LWS = '\u2026';
8492
9088
  const TO_STRING_BRAND_BIG_INT$LWS = '[object BigInt]';
8493
9089
  const TO_STRING_BRAND_BOOLEAN$LWS = '[object Boolean]';
8494
9090
  const TO_STRING_BRAND_NUMBER$LWS = '[object Number]';
@@ -8654,6 +9250,9 @@ ArrayIsArray$LWS(brands$LWS) && brands$LWS.length ? // Use user-agent client hin
8654
9250
  ReflectApply$LWS(ArrayProtoFind$LWS, brands$LWS, [// prettier-ignore
8655
9251
  item$LWS => (item$LWS == null ? void 0 : item$LWS.brand) === 'Chromium']) !== undefined : // Fallback to a standard user-agent string sniff.
8656
9252
  ReflectApply$LWS(RegExpProtoTest$LWS, chromiumUserAgentRegExp$LWS, [getUserAgent$LWS()]);
9253
+ const IS_OLD_CHROMIUM_BROWSER$LWS = IS_CHROMIUM_BROWSER$LWS && // Chromium added support for `navigator.userAgentData` in v90.
9254
+ // https://caniuse.com/mdn-api_navigator_useragentdata
9255
+ userAgentData$LWS === undefined;
8657
9256
  const {
8658
9257
  prototype: DocumentProto$LWS
8659
9258
  } = Document;
@@ -9597,8 +10196,8 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
9597
10196
  let useFastForeignTargetPathForTypedArrays$LWS = IS_IN_SHADOW_REALM$LWS;
9598
10197
  let nearMembraneSymbolFlag$LWS = false;
9599
10198
  let lastProxyTrapCalled$LWS = 0;
9600
- const activateLazyOwnPropertyDefinition$LWS = IS_IN_SHADOW_REALM$LWS ? (__target$LWS, __key$LWS, state$LWS) => {
9601
- state$LWS[__key$LWS] = false;
10199
+ const activateLazyOwnPropertyDefinition$LWS = IS_IN_SHADOW_REALM$LWS ? (__target$LWS, __key$LWS, _state$LWS) => {
10200
+ _state$LWS[__key$LWS] = false;
9602
10201
  const foreignTargetPointer$LWS = getTransferablePointer$LWS(__target$LWS);
9603
10202
  let _safeDesc$LWS;
9604
10203
 
@@ -10343,23 +10942,23 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10343
10942
  clearFastForeignTargetPointers$LWS();
10344
10943
  } : noop$LWS;
10345
10944
  const getLazyPropertyDescriptorStateByTarget$LWS = IS_IN_SHADOW_REALM$LWS ? __target$LWS => {
10346
- let state$LWS = localProxyTargetToLazyPropertyDescriptorStateMap$LWS.get(__target$LWS);
10945
+ let _state$LWS = localProxyTargetToLazyPropertyDescriptorStateMap$LWS.get(__target$LWS);
10347
10946
 
10348
- if (state$LWS === undefined) {
10947
+ if (_state$LWS === undefined) {
10349
10948
  const statePointerOrUndefined$LWS = foreignCallableGetLazyPropertyDescriptorStateByTarget$LWS(getTransferablePointer$LWS(__target$LWS));
10350
10949
 
10351
10950
  if (typeof statePointerOrUndefined$LWS === 'function') {
10352
10951
  statePointerOrUndefined$LWS();
10353
- state$LWS = selectedTarget$LWS;
10952
+ _state$LWS = selectedTarget$LWS;
10354
10953
  selectedTarget$LWS = undefined;
10355
10954
 
10356
- if (state$LWS) {
10357
- localProxyTargetToLazyPropertyDescriptorStateMap$LWS.set(__target$LWS, state$LWS);
10955
+ if (_state$LWS) {
10956
+ localProxyTargetToLazyPropertyDescriptorStateMap$LWS.set(__target$LWS, _state$LWS);
10358
10957
  }
10359
10958
  }
10360
10959
  }
10361
10960
 
10362
- return state$LWS;
10961
+ return _state$LWS;
10363
10962
  } : noop$LWS;
10364
10963
  const isForeignPointerOfObjectProto$LWS = IS_IN_SHADOW_REALM$LWS ? // eslint-disable-next-line no-return-assign
10365
10964
  foreignTargetPointer$LWS => foreignTargetPointer$LWS === (foreignPointerObjectProto$LWS === undefined ? foreignPointerObjectProto$LWS = getTransferablePointer$LWS(ObjectProto$LWS) : foreignPointerObjectProto$LWS) : alwaysFalse$LWS;
@@ -10553,9 +11152,9 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10553
11152
 
10554
11153
  if (typeof __target$LWS === 'object' && __target$LWS !== null || typeof __target$LWS === 'function') {
10555
11154
  const __key$LWS = useThisArgAsTarget$LWS ? _args$LWS[0] : _args$LWS[1];
10556
- const state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
11155
+ const _state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
10557
11156
 
10558
- if (state$LWS != null && state$LWS[__key$LWS]) {
11157
+ if (_state$LWS != null && _state$LWS[__key$LWS]) {
10559
11158
  // Activate the descriptor by triggering
10560
11159
  // its getter.
10561
11160
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
@@ -10576,9 +11175,9 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10576
11175
  const {
10577
11176
  0: __key$LWS
10578
11177
  } = _args$LWS;
10579
- const state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(thisArg$LWS);
11178
+ const _state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(thisArg$LWS);
10580
11179
 
10581
- if (state$LWS != null && state$LWS[__key$LWS]) {
11180
+ if (_state$LWS != null && _state$LWS[__key$LWS]) {
10582
11181
  // Activate the descriptor by triggering
10583
11182
  // its getter.
10584
11183
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
@@ -10604,9 +11203,9 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10604
11203
  } = _args$LWS;
10605
11204
 
10606
11205
  if (typeof __target$LWS === 'object' && __target$LWS !== null || typeof __target$LWS === 'function') {
10607
- const state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
11206
+ const _state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
10608
11207
 
10609
- if (state$LWS != null && state$LWS[__key$LWS]) {
11208
+ if (_state$LWS != null && _state$LWS[__key$LWS]) {
10610
11209
  // Activate the descriptor by triggering
10611
11210
  // its getter.
10612
11211
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
@@ -10633,7 +11232,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10633
11232
  return ReflectApply$LWS(originalFunc$LWS, thisArg$LWS, _args$LWS);
10634
11233
  }
10635
11234
 
10636
- const state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
11235
+ const _state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
10637
11236
  const isFixingChromeBug$LWS = __target$LWS === globalThisRef$LWS && shouldFixChromeBug$LWS;
10638
11237
  const unsafeDescMap$LWS = isFixingChromeBug$LWS ? // Create an empty property descriptor map
10639
11238
  // to populate with curated descriptors.
@@ -10641,7 +11240,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10641
11240
  // safe to use the native method.
10642
11241
  ReflectApply$LWS(originalFunc$LWS, thisArg$LWS, _args$LWS);
10643
11242
 
10644
- if (!isFixingChromeBug$LWS && state$LWS === undefined) {
11243
+ if (!isFixingChromeBug$LWS && _state$LWS === undefined) {
10645
11244
  // Exit early if the target is not a global
10646
11245
  // object and there are no lazy descriptors.
10647
11246
  return unsafeDescMap$LWS;
@@ -10653,7 +11252,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10653
11252
  length: _length$LWS
10654
11253
  } = ownKeys$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
10655
11254
  const ownKey$LWS = ownKeys$LWS[_i$LWS];
10656
- const isLazyProp$LWS = !!(state$LWS != null && state$LWS[ownKey$LWS]);
11255
+ const isLazyProp$LWS = !!(_state$LWS != null && _state$LWS[ownKey$LWS]);
10657
11256
 
10658
11257
  if (isLazyProp$LWS) {
10659
11258
  // Activate the descriptor by triggering
@@ -10939,9 +11538,9 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
10939
11538
  return createPointer$LWS(_proxy$LWS);
10940
11539
  }
10941
11540
 
10942
- const setLazyPropertyDescriptorStateByTarget$LWS = IS_IN_SHADOW_REALM$LWS ? (__target$LWS, state$LWS) => {
10943
- localProxyTargetToLazyPropertyDescriptorStateMap$LWS.set(__target$LWS, state$LWS);
10944
- foreignCallableSetLazyPropertyDescriptorStateByTarget$LWS(getTransferablePointer$LWS(__target$LWS), getTransferablePointer$LWS(state$LWS));
11541
+ const setLazyPropertyDescriptorStateByTarget$LWS = IS_IN_SHADOW_REALM$LWS ? (__target$LWS, _state$LWS) => {
11542
+ localProxyTargetToLazyPropertyDescriptorStateMap$LWS.set(__target$LWS, _state$LWS);
11543
+ foreignCallableSetLazyPropertyDescriptorStateByTarget$LWS(getTransferablePointer$LWS(__target$LWS), getTransferablePointer$LWS(_state$LWS));
10945
11544
  } : noop$LWS;
10946
11545
 
10947
11546
  class BoundaryProxyHandler$LWS {
@@ -11014,9 +11613,6 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11014
11613
  if (foreignTargetTraits$LWS & 64
11015
11614
  /* TargetTraits.Revoked */
11016
11615
  ) {
11017
- // Future optimization: Hoping proxies with frozen handlers
11018
- // can be faster.
11019
- ObjectFreeze$LWS(this);
11020
11616
  this.revoke();
11021
11617
  } else if (IS_IN_SHADOW_REALM$LWS) {
11022
11618
  if (isForeignTargetArray$LWS || foreignTargetTraits$LWS & 2
@@ -11051,13 +11647,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11051
11647
 
11052
11648
  return cachedSerializedValue$LWS;
11053
11649
  }]);
11054
- } // Future optimization: Hoping proxies with frozen handlers
11055
- // can be faster. If local mutations are not trapped, then
11056
- // freezing the handler is ok because it is not expecting to
11057
- // change in the future.
11058
-
11059
-
11060
- ObjectFreeze$LWS(this);
11650
+ }
11061
11651
  }
11062
11652
  } // Internal shadow realm side utilities:
11063
11653
 
@@ -11069,10 +11659,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11069
11659
  this.defineProperty = BoundaryProxyHandler$LWS.passthruDefinePropertyTrap;
11070
11660
  this.preventExtensions = BoundaryProxyHandler$LWS.passthruPreventExtensionsTrap;
11071
11661
  this.set = BoundaryProxyHandler$LWS.passthruSetTrap;
11072
- this.setPrototypeOf = BoundaryProxyHandler$LWS.passthruSetPrototypeOfTrap; // Future optimization: Hoping proxies with frozen handlers can
11073
- // be faster.
11074
-
11075
- ObjectFreeze$LWS(this);
11662
+ this.setPrototypeOf = BoundaryProxyHandler$LWS.passthruSetPrototypeOfTrap;
11076
11663
  }
11077
11664
 
11078
11665
  makeProxyStatic() {
@@ -11107,11 +11694,8 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11107
11694
  if (targetIntegrityTraits$LWS & 8
11108
11695
  /* TargetIntegrityTraits.Revoked */
11109
11696
  ) {
11110
- // Future optimization: Hoping proxies with frozen
11111
- // handlers can be faster.
11112
- ObjectFreeze$LWS(this); // the target is a revoked proxy, in which case we revoke
11697
+ // the target is a revoked proxy, in which case we revoke
11113
11698
  // this proxy as well.
11114
-
11115
11699
  this.revoke();
11116
11700
  return;
11117
11701
  } // A proxy can revoke itself when traps are triggered and break
@@ -11124,9 +11708,6 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11124
11708
  // We don't wrap `foreignCallableIsTargetRevoked()` in a
11125
11709
  // try-catch because it cannot throw.
11126
11710
  if (foreignCallableIsTargetRevoked$LWS(foreignTargetPointer$LWS)) {
11127
- // Future optimization: Hoping proxies with frozen
11128
- // handlers can be faster.
11129
- ObjectFreeze$LWS(this);
11130
11711
  this.revoke();
11131
11712
  return;
11132
11713
  }
@@ -11165,11 +11746,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11165
11746
  // because it cannot throw.
11166
11747
  foreignCallableDebugInfo$LWS('Mutations on the membrane of an object originating ' + 'outside of the sandbox will not be reflected on ' + 'the object itself:', foreignTargetPointer$LWS);
11167
11748
  }
11168
- } // Future optimization: Hoping proxies with frozen handlers can
11169
- // be faster.
11170
-
11171
-
11172
- ObjectFreeze$LWS(this);
11749
+ }
11173
11750
  } // Passthru traps:
11174
11751
 
11175
11752
 
@@ -11774,8 +12351,10 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11774
12351
  let _result$LWS;
11775
12352
 
11776
12353
  if (useFastPath$LWS) {
12354
+ let pointerOrPrimitive$LWS;
12355
+
11777
12356
  try {
11778
- _result$LWS = foreignCallableGetPropertyValue$LWS(foreignTargetPointer$LWS, __key$LWS);
12357
+ pointerOrPrimitive$LWS = foreignCallableGetPropertyValue$LWS(foreignTargetPointer$LWS, __key$LWS);
11779
12358
  } catch (error) {
11780
12359
  var _selectedTarget24$LWS;
11781
12360
 
@@ -11788,6 +12367,14 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
11788
12367
 
11789
12368
  throw errorToThrow$LWS;
11790
12369
  }
12370
+
12371
+ if (typeof pointerOrPrimitive$LWS === 'function') {
12372
+ pointerOrPrimitive$LWS();
12373
+ _result$LWS = selectedTarget$LWS;
12374
+ selectedTarget$LWS = undefined;
12375
+ } else {
12376
+ _result$LWS = pointerOrPrimitive$LWS;
12377
+ }
11791
12378
  } else {
11792
12379
  const _safeDesc$LWS = lookupForeignDescriptor$LWS(foreignTargetPointer$LWS, shadowTarget$LWS, __key$LWS);
11793
12380
 
@@ -12613,19 +13200,22 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
12613
13200
  selectedTarget$LWS = undefined; // We don't wrap the weak map `get()` call in a try-catch
12614
13201
  // because we know `target` is an object.
12615
13202
 
12616
- const state$LWS = proxyTargetToLazyPropertyDescriptorStateMap$LWS.get(__target$LWS);
12617
- return state$LWS ? getTransferablePointer$LWS(state$LWS) : state$LWS;
13203
+ const _state$LWS = proxyTargetToLazyPropertyDescriptorStateMap$LWS.get(__target$LWS);
13204
+ return _state$LWS ? getTransferablePointer$LWS(_state$LWS) : _state$LWS;
12618
13205
  } : noop$LWS, // callableGetPropertyValue
12619
- !IS_IN_SHADOW_REALM$LWS ? (targetPointer$LWS, _index$LWS) => {
13206
+ !IS_IN_SHADOW_REALM$LWS ? (targetPointer$LWS, __key$LWS) => {
12620
13207
  targetPointer$LWS();
12621
13208
  const __target$LWS = selectedTarget$LWS;
12622
13209
  selectedTarget$LWS = undefined;
13210
+ let __value$LWS;
12623
13211
 
12624
13212
  try {
12625
- return __target$LWS[_index$LWS];
13213
+ __value$LWS = __target$LWS[__key$LWS];
12626
13214
  } catch (error) {
12627
13215
  throw pushErrorAcrossBoundary$LWS(error);
12628
13216
  }
13217
+
13218
+ return typeof __value$LWS === 'object' && __value$LWS !== null || typeof __value$LWS === 'function' ? getTransferablePointer$LWS(__value$LWS) : __value$LWS;
12629
13219
  } : noop$LWS, // callableGetTargetIntegrityTraits
12630
13220
  !IS_IN_SHADOW_REALM$LWS ? targetPointer$LWS => {
12631
13221
  targetPointer$LWS();
@@ -12703,20 +13293,20 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
12703
13293
  targetPointer$LWS();
12704
13294
  const __target$LWS = selectedTarget$LWS;
12705
13295
  selectedTarget$LWS = undefined;
12706
- let state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
13296
+ let _state$LWS = getLazyPropertyDescriptorStateByTarget$LWS(__target$LWS);
12707
13297
 
12708
- if (state$LWS === undefined) {
12709
- state$LWS = {
13298
+ if (_state$LWS === undefined) {
13299
+ _state$LWS = {
12710
13300
  __proto__: null
12711
13301
  };
12712
- setLazyPropertyDescriptorStateByTarget$LWS(__target$LWS, state$LWS);
13302
+ setLazyPropertyDescriptorStateByTarget$LWS(__target$LWS, _state$LWS);
12713
13303
  }
12714
13304
 
12715
13305
  for (let _i$LWS = 0, {
12716
13306
  length: _length$LWS
12717
13307
  } = ownKeys$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
12718
13308
  const ownKey$LWS = ownKeys$LWS[_i$LWS];
12719
- state$LWS[ownKey$LWS] = true;
13309
+ _state$LWS[ownKey$LWS] = true;
12720
13310
  ReflectDefineProperty$LWS(__target$LWS, ownKey$LWS, // The role of this descriptor is to serve as a
12721
13311
  // bouncer. When either a getter or a setter is
12722
13312
  // invoked the descriptor will be replaced with
@@ -12734,12 +13324,12 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
12734
13324
  // doesn't exist the property will be defined
12735
13325
  // as non-enumerable.
12736
13326
  get() {
12737
- activateLazyOwnPropertyDefinition$LWS(__target$LWS, ownKey$LWS, state$LWS);
13327
+ activateLazyOwnPropertyDefinition$LWS(__target$LWS, ownKey$LWS, _state$LWS);
12738
13328
  return __target$LWS[ownKey$LWS];
12739
13329
  },
12740
13330
 
12741
13331
  set(__value$LWS) {
12742
- activateLazyOwnPropertyDefinition$LWS(__target$LWS, ownKey$LWS, state$LWS);
13332
+ activateLazyOwnPropertyDefinition$LWS(__target$LWS, ownKey$LWS, _state$LWS);
12743
13333
  ReflectSet$LWS(__target$LWS, ownKey$LWS, __value$LWS);
12744
13334
  }
12745
13335
 
@@ -12790,11 +13380,11 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
12790
13380
  const __target$LWS = selectedTarget$LWS;
12791
13381
  selectedTarget$LWS = undefined;
12792
13382
  statePointer$LWS();
12793
- const state$LWS = selectedTarget$LWS;
13383
+ const _state$LWS = selectedTarget$LWS;
12794
13384
  selectedTarget$LWS = undefined; // We don't wrap the weak map `set()` call in a try-catch
12795
13385
  // because we know `target` is an object.
12796
13386
 
12797
- proxyTargetToLazyPropertyDescriptorStateMap$LWS.set(__target$LWS, state$LWS);
13387
+ proxyTargetToLazyPropertyDescriptorStateMap$LWS.set(__target$LWS, _state$LWS);
12798
13388
  } : noop$LWS, // callableTrackAsFastTarget
12799
13389
  !IS_IN_SHADOW_REALM$LWS ? targetPointer$LWS => {
12800
13390
  targetPointer$LWS();
@@ -13074,9 +13664,7 @@ function createMembraneMarshall$LWS(_globalObject$LWS) {
13074
13664
  BoundaryProxyHandlerProto$LWS[arityToConstructTrapNameRegistry$LWS[4]] = constructTrapForFourOrMoreArgs$LWS;
13075
13665
  BoundaryProxyHandlerProto$LWS[arityToConstructTrapNameRegistry$LWS[5]] = constructTrapForFiveOrMoreArgs$LWS;
13076
13666
  BoundaryProxyHandlerProto$LWS[arityToConstructTrapNameRegistry$LWS.n] = constructTrapForAnyNumberOfArgs$LWS;
13077
- ReflectSetPrototypeOf$LWS(BoundaryProxyHandlerProto$LWS, null); // Future optimization: Hoping proxies with frozen handlers can be faster.
13078
-
13079
- ObjectFreeze$LWS(BoundaryProxyHandlerProto$LWS);
13667
+ ReflectSetPrototypeOf$LWS(BoundaryProxyHandlerProto$LWS, null);
13080
13668
  };
13081
13669
  };
13082
13670
  /* eslint-enable prefer-object-spread */
@@ -13647,12 +14235,15 @@ function createIframeVirtualEnvironment$LWS(_globalObject$LWS, options$LWS) {
13647
14235
  blueDocumentToBlueCreateHooksCallbackMap$LWS.set(blueRefs$LWS.document, blueConnector$LWS);
13648
14236
  }
13649
14237
 
14238
+ const {
14239
+ eval: redIndirectEval$LWS
14240
+ } = redWindow$LWS;
13650
14241
  const env$LWS = new VirtualEnvironment$LWS({
13651
14242
  blueConnector: blueConnector$LWS,
13652
14243
  distortionCallback: distortionCallback$LWS,
13653
14244
  instrumentation: instrumentation$LWS,
13654
14245
  liveTargetCallback: liveTargetCallback$LWS,
13655
- redConnector: createRedConnector$LWS(redWindow$LWS.eval)
14246
+ redConnector: createRedConnector$LWS(redIndirectEval$LWS)
13656
14247
  });
13657
14248
  linkIntrinsics$LWS(env$LWS, _globalObject$LWS); // window
13658
14249
  // window.document
@@ -13702,271 +14293,83 @@ function createIframeVirtualEnvironment$LWS(_globalObject$LWS, options$LWS) {
13702
14293
  ReflectApply$LWS(DocumentProtoOpen$LWS, redDocument$LWS, []);
13703
14294
  ReflectApply$LWS(DocumentProtoClose$LWS, redDocument$LWS, []);
13704
14295
  } else {
13705
- ReflectApply$LWS(ElementProtoRemove$LWS, iframe$LWS, []);
13706
- }
13707
-
13708
- return env$LWS;
13709
- } // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
13710
- // istanbul ignore next
13711
-
13712
-
13713
- const HELPERS_SOURCE_TEXT$LWS = `'use strict';
13714
- ${SANDBOX_EVAL_CONTEXT_NAME$LWS}(${function redHelpersFactory$LWS(_context$LWS) {
13715
- const {
13716
- elementToLoadingPromiseMap: elementToLoadingPromiseMap$LWS
13717
- } = _context$LWS;
13718
- const ArrayCtor$LWS = Array;
13719
- const PromiseCtor$LWS = Promise;
13720
- const TypeErrorCtor$LWS = TypeError;
13721
- const {
13722
- asyncIterator: SymbolAsyncIterator$LWS,
13723
- iterator: SymbolIterator$LWS
13724
- } = Symbol;
13725
- const {
13726
- [SymbolIterator$LWS]: ArrayIterator$LWS
13727
- } = ArrayCtor$LWS.prototype; // The Generator prototype object is %GeneratorFunction.prototype.prototype%.
13728
- // https://tc39.es/ecma262/#sec-generatorfunction.prototype.prototype
13729
- // eslint-disable-next-line @typescript-eslint/no-empty-function, func-names
13730
-
13731
- const GeneratorProto$LWS = function* () {}.constructor.prototype.prototype;
13732
-
13733
- const {
13734
- next: GeneratorProtoNext$LWS,
13735
- throw: GeneratorProtoThrow$LWS
13736
- } = GeneratorProto$LWS;
13737
- const {
13738
- delete: MapProtoDelete$LWS,
13739
- get: MapProtoGet$LWS,
13740
- set: MapProtoSet$LWS
13741
- } = Map.prototype;
13742
- const {
13743
- appendChild: NodeProtoAppendChild$LWS
13744
- } = Node.prototype;
13745
- const {
13746
- defineProperties: ObjectDefineProperties$LWS,
13747
- freeze: ObjectFreeze$LWS
13748
- } = Object;
13749
- const {
13750
- then: PromiseProtoThen$LWS
13751
- } = PromiseCtor$LWS.prototype;
13752
- const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
13753
- const {
13754
- apply: ReflectApply$LWS,
13755
- get: ReflectGet$LWS,
13756
- getPrototypeOf: ReflectGetPrototypeOf$LWS,
13757
- setPrototypeOf: ReflectSetPrototypeOf$LWS
13758
- } = Reflect;
13759
- const {
13760
- replace: StringProtoReplace$LWS
13761
- } = String.prototype;
13762
- const {
13763
- get: WeakMapProtoGet$LWS,
13764
- set: WeakMapProtoSet$LWS
13765
- } = WeakMap.prototype;
13766
- const {
13767
- createElement: DocumentProtoCreateElement$LWS
13768
- } = Document.prototype;
13769
- const {
13770
- querySelector: ElementProtoQuerySelector$LWS,
13771
- setAttribute: ElementProtoSetAttribute$LWS
13772
- } = Element.prototype;
13773
- const {
13774
- stopPropagation: EventProtoStopPropagation$LWS
13775
- } = Event.prototype;
13776
- const {
13777
- addEventListener: EventTargetProtoAddEventListener$LWS,
13778
- removeEventListener: EventTargetProtoRemoveEventListener$LWS
13779
- } = EventTarget.prototype;
13780
- const {
13781
- head: headRef$LWS
13782
- } = document; // We don't use `toSafeMap()` here because `Map` is remapped from the
13783
- // primary realm and dot notation is actually more complex internally for
13784
- // cross-realm objects.
13785
-
13786
- const forOfStateMap$LWS = new Map();
13787
- const singleQuotesRegExp$LWS = /\\?'/g;
13788
- const LOCKER_ID_DATA_NAME$LWS = 'data-locker-id'; // Generate a UID for this sandbox run for <script> elements.
13789
-
13790
- const LOCKER_ID_DATA_VALUE$LWS = `${crypto.getRandomValues(new Uint32Array(1))[0]}`;
13791
-
13792
- class LockerSecurityError$LWS extends Error {
13793
- constructor(message$LWS) {
13794
- super(`Lightning Web Security: ${message$LWS}`);
13795
- }
13796
-
13797
- }
13798
-
13799
- function escapeSingleQuotes$LWS(_string$LWS) {
13800
- // RegExp.prototype[Symbol.replace] resets the lastIndex of global
13801
- // regexp to 0.
13802
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
13803
- return ReflectApply$LWS(StringProtoReplace$LWS, _string$LWS, [singleQuotesRegExp$LWS, "\\'"]);
13804
- }
13805
-
13806
- function forAwaitOf$LWS(_index$LWS, stage$LWS, object$LWS) {
13807
- if (stage$LWS === 0
13808
- /* init */
13809
- ) {
13810
- let sync$LWS = false;
13811
- let {
13812
- [SymbolAsyncIterator$LWS]: iterator$LWS
13813
- } = object$LWS;
13814
-
13815
- if (iterator$LWS === null || iterator$LWS === undefined) {
13816
- sync$LWS = true;
13817
- ({
13818
- [SymbolIterator$LWS]: iterator$LWS
13819
- } = object$LWS);
13820
- }
13821
-
13822
- if (typeof iterator$LWS !== 'function') {
13823
- throw new TypeErrorCtor$LWS('Object is not iterable.');
13824
- }
13825
-
13826
- ReflectApply$LWS(MapProtoSet$LWS, forOfStateMap$LWS, [_index$LWS, {
13827
- iterable: ReflectApply$LWS(iterator$LWS, object$LWS, []),
13828
- step: undefined,
13829
- sync: sync$LWS
13830
- }]);
13831
- return undefined;
13832
- }
13833
-
13834
- const state$LWS = ReflectApply$LWS(MapProtoGet$LWS, forOfStateMap$LWS, [_index$LWS]);
13835
-
13836
- if (stage$LWS === 1
13837
- /* step */
13838
- ) {
13839
- const _result$LWS = state$LWS.iterable.next();
13840
- return state$LWS.sync ? new PromiseCtor$LWS(resolve$LWS => {
13841
- state$LWS.step = _result$LWS;
13842
- resolve$LWS();
13843
- }) : ReflectApply$LWS(PromiseProtoThen$LWS, _result$LWS, [step$LWS => {
13844
- state$LWS.step = step$LWS;
13845
- }]);
13846
- }
13847
-
13848
- if (stage$LWS === 2
13849
- /* value */
13850
- ) {
13851
- return state$LWS.step.value;
13852
- }
13853
-
13854
- if (stage$LWS === 3
13855
- /* done */
13856
- ) {
13857
- const done$LWS = !!state$LWS.step.done;
13858
-
13859
- if (done$LWS) {
13860
- ReflectApply$LWS(MapProtoDelete$LWS, forOfStateMap$LWS, [_index$LWS]);
13861
- }
13862
-
13863
- return done$LWS;
14296
+ if (IS_OLD_CHROMIUM_BROWSER$LWS) {
14297
+ // For Chromium < v86 browsers we evaluate the `window` object to
14298
+ // kickstart the realm so that `window` persists when the iframe is
14299
+ // removed from the document.
14300
+ redIndirectEval$LWS('window');
13864
14301
  }
13865
14302
 
13866
- return undefined;
14303
+ ReflectApply$LWS(ElementProtoRemove$LWS, iframe$LWS, []);
13867
14304
  }
13868
14305
 
13869
- function genStep$LWS(gen$LWS, resolve$LWS, reject$LWS, next$LWS, thrower$LWS, GeneratorMethod$LWS, arg$LWS) {
13870
- let info$LWS;
13871
- let __value$LWS;
13872
-
13873
- try {
13874
- info$LWS = ReflectApply$LWS(GeneratorMethod$LWS, gen$LWS, [arg$LWS]);
13875
- __value$LWS = info$LWS.value;
13876
- } catch (error) {
13877
- reject$LWS(error);
13878
- return;
13879
- }
13880
-
13881
- if (info$LWS.done) {
13882
- resolve$LWS(__value$LWS);
13883
- } else {
13884
- PromiseResolve$LWS(__value$LWS).then(next$LWS, thrower$LWS);
13885
- }
13886
- } // This helper is used to wrap the bodies of async functions that are
13887
- // transformed into generator functions. It's based on @babel/helpers
13888
- // `helpers.asyncToGenerator()`:
13889
- // https://github.com/babel/babel/blob/a967910/packages/babel-helpers/src/helpers.js#L255-L288
13890
-
13891
-
13892
- function genToAsync$LWS(func$LWS, thisArg$LWS) {
13893
- return new PromiseCtor$LWS((resolve$LWS, reject$LWS) => {
13894
- const gen$LWS = ReflectApply$LWS(func$LWS, thisArg$LWS, []);
13895
-
13896
- function next$LWS(__value$LWS) {
13897
- genStep$LWS(gen$LWS, resolve$LWS, reject$LWS, next$LWS, thrower$LWS, GeneratorProtoNext$LWS, __value$LWS);
13898
- }
13899
-
13900
- function thrower$LWS(error) {
13901
- genStep$LWS(gen$LWS, resolve$LWS, reject$LWS, next$LWS, thrower$LWS, GeneratorProtoThrow$LWS, error);
13902
- }
13903
-
13904
- next$LWS(undefined);
13905
- });
13906
- } // loadPromise returns a promise to load the given element.
13907
-
13908
-
13909
- function loadPromise$LWS(_element$LWS, urlAsString$LWS) {
13910
- const promise$LWS = new PromiseCtor$LWS((resolve$LWS, reject$LWS) => {
13911
- function onerror$LWS(_event$LWS) {
13912
- ReflectApply$LWS(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['error', onerror$LWS]);
13913
- ReflectApply$LWS(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['load', onload$LWS]);
13914
- ReflectApply$LWS(EventProtoStopPropagation$LWS, _event$LWS, []);
13915
- reject$LWS(new LockerSecurityError$LWS(`Resource loader error loading '${escapeSingleQuotes$LWS(urlAsString$LWS)}'.`));
13916
- }
13917
-
13918
- function onload$LWS() {
13919
- ReflectApply$LWS(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['error', onerror$LWS]);
13920
- ReflectApply$LWS(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['load', onload$LWS]);
13921
- resolve$LWS(undefined);
13922
- }
13923
-
13924
- ReflectApply$LWS(EventTargetProtoAddEventListener$LWS, _element$LWS, ['error', onerror$LWS]);
13925
- ReflectApply$LWS(EventTargetProtoAddEventListener$LWS, _element$LWS, ['load', onload$LWS]);
13926
- });
13927
- ReflectApply$LWS(WeakMapProtoSet$LWS, elementToLoadingPromiseMap$LWS, [_element$LWS, promise$LWS]);
13928
- ReflectApply$LWS(NodeProtoAppendChild$LWS, headRef$LWS, [_element$LWS]);
13929
- return promise$LWS;
13930
- } // Functionality based on https://sfdc.co/7FuDU but adjusted for multiple
13931
- // sandboxes. loadScript will create one <script> element in the DOM per url
13932
- // per sandbox.
14306
+ return env$LWS;
14307
+ }
13933
14308
 
14309
+ function createResourceLoadError$LWS(_url$LWS) {
14310
+ return new LockerSecurityError$LWS(`platformResourceLoader error loading ${enquote$LWS(_url$LWS)}.`);
14311
+ }
13934
14312
 
13935
- function loadScript$LWS(_thisArg$LWS, _url$LWS) {
13936
- const urlAsString$LWS = toString$LWS(_url$LWS);
13937
- let script$LWS = ReflectApply$LWS(ElementProtoQuerySelector$LWS, headRef$LWS, [`script[data-distorted-src='${escapeSingleQuotes$LWS(urlAsString$LWS)}'][${LOCKER_ID_DATA_NAME$LWS}='${LOCKER_ID_DATA_VALUE$LWS}']`]);
14313
+ const EMPTY_EVAL_HELPERS$LWS = {
14314
+ // @TODO: Remove the 'asyncToGen' and 'makeRedResyncImports' aliases after
14315
+ // the LWS compiler update makes its way through the LWC deployment pipeline.
14316
+ asyncToGen: noop$LWS$1,
14317
+ makeRedResyncImports: noop$LWS$1,
14318
+ forAwaitOf: noop$LWS$1,
14319
+ genToAsync: noop$LWS$1,
14320
+ loadScript: noop$LWS$1,
14321
+ loadStyle: noop$LWS$1,
14322
+ makeRedGet: noop$LWS$1,
14323
+ makeRedSyncImports: noop$LWS$1,
14324
+ namespace: noop$LWS$1,
14325
+ spreadable: noop$LWS$1,
14326
+ super: noop$LWS$1
14327
+ }; // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
14328
+ // istanbul ignore next
13938
14329
 
13939
- if (script$LWS) {
13940
- var _ReflectApply2$LWS;
14330
+ const EVAL_HELPERS_SOURCE_TEXT$LWS = `'use strict';
14331
+ ${SANDBOX_EVAL_CONTEXT_NAME$LWS}(${function redHelpersFactory$LWS(baseGenToAsync$LWS, forAwaitOf$LWS, loadScript$LWS, loadStyle$LWS) {
14332
+ const ArrayCtor$LWS = Array; // eslint-disable-next-line @typescript-eslint/no-shadow, no-shadow
13941
14333
 
13942
- return (_ReflectApply2$LWS = ReflectApply$LWS(WeakMapProtoGet$LWS, elementToLoadingPromiseMap$LWS, [script$LWS])) != null ? _ReflectApply2$LWS : PromiseResolve$LWS();
13943
- }
14334
+ const {
14335
+ iterator: SymbolIterator$LWS
14336
+ } = Symbol;
14337
+ const {
14338
+ [SymbolIterator$LWS]: ArrayProtoIterator$LWS
14339
+ } = ArrayCtor$LWS.prototype; // The Generator prototype object is %GeneratorFunction.prototype.prototype%.
14340
+ // https://tc39.es/ecma262/#sec-generatorfunction.prototype.prototype
14341
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
13944
14342
 
13945
- script$LWS = ReflectApply$LWS(DocumentProtoCreateElement$LWS, document, ['script']);
13946
- ReflectApply$LWS(ElementProtoSetAttribute$LWS, script$LWS, [LOCKER_ID_DATA_NAME$LWS, LOCKER_ID_DATA_VALUE$LWS]);
13947
- script$LWS.type = 'text/javascript';
13948
- script$LWS.src = urlAsString$LWS;
13949
- return loadPromise$LWS(script$LWS, urlAsString$LWS);
13950
- } // Functionality based on http://sfdc.co/bIpMYB but adjusted for multiple
13951
- // sandboxes. loadStyle will create one <link> element in the DOM per url
13952
- // for all the sandboxes.
14343
+ const GeneratorProto$LWS = function* () {}.constructor.prototype.prototype;
13953
14344
 
14345
+ const {
14346
+ next: GeneratorProtoNext$LWS,
14347
+ throw: GeneratorProtoThrow$LWS
14348
+ } = GeneratorProto$LWS;
14349
+ const {
14350
+ defineProperties: ObjectDefineProperties$LWS,
14351
+ freeze: ObjectFreeze$LWS
14352
+ } = Object;
14353
+ const {
14354
+ // eslint-disable-next-line @typescript-eslint/no-shadow, no-shadow
14355
+ apply: ReflectApply$LWS,
14356
+ get: ReflectGet$LWS,
14357
+ getPrototypeOf: ReflectGetPrototypeOf$LWS,
14358
+ setPrototypeOf: ReflectSetPrototypeOf$LWS
14359
+ } = Reflect;
13954
14360
 
13955
- function loadStyle$LWS(_thisArg$LWS, _url$LWS) {
13956
- const urlAsString$LWS = toString$LWS(_url$LWS);
13957
- let link$LWS = ReflectApply$LWS(ElementProtoQuerySelector$LWS, headRef$LWS, [`link[href='${escapeSingleQuotes$LWS(urlAsString$LWS)}']`]);
14361
+ function genToAsync$LWS(func$LWS, thisArg$LWS) {
14362
+ let gen$LWS;
13958
14363
 
13959
- if (link$LWS) {
13960
- var _ReflectApply3$LWS;
14364
+ const wrapGenMethod$LWS = genMethod$LWS => __value$LWS => {
14365
+ if (gen$LWS === undefined) {
14366
+ gen$LWS = ReflectApply$LWS(func$LWS, thisArg$LWS, []);
14367
+ }
13961
14368
 
13962
- return (_ReflectApply3$LWS = ReflectApply$LWS(WeakMapProtoGet$LWS, elementToLoadingPromiseMap$LWS, [link$LWS])) != null ? _ReflectApply3$LWS : PromiseResolve$LWS();
13963
- }
14369
+ return ReflectApply$LWS(genMethod$LWS, gen$LWS, [__value$LWS]);
14370
+ };
13964
14371
 
13965
- link$LWS = ReflectApply$LWS(DocumentProtoCreateElement$LWS, document, ['link']);
13966
- link$LWS.type = 'text/css';
13967
- link$LWS.rel = 'stylesheet';
13968
- link$LWS.href = urlAsString$LWS;
13969
- return loadPromise$LWS(link$LWS, urlAsString$LWS);
14372
+ return baseGenToAsync$LWS(wrapGenMethod$LWS(GeneratorProtoNext$LWS), wrapGenMethod$LWS(GeneratorProtoThrow$LWS));
13970
14373
  }
13971
14374
 
13972
14375
  function makeRedGet$LWS(...bindings$LWS) {
@@ -13987,7 +14390,7 @@ const HELPERS_SOURCE_TEXT$LWS = `'use strict';
13987
14390
  return redGet$LWS;
13988
14391
  }
13989
14392
 
13990
- function makeRedResyncImports$LWS(bindings$LWS) {
14393
+ function makeRedSyncImports$LWS(bindings$LWS) {
13991
14394
  return function (..._args$LWS) {
13992
14395
  for (let _i$LWS = 0, {
13993
14396
  length: _length$LWS
@@ -14008,7 +14411,7 @@ const HELPERS_SOURCE_TEXT$LWS = `'use strict';
14008
14411
 
14009
14412
  function spreadable$LWS(array$LWS) {
14010
14413
  ReflectSetPrototypeOf$LWS(array$LWS, null);
14011
- array$LWS[SymbolIterator$LWS] = ArrayIterator$LWS;
14414
+ array$LWS[SymbolIterator$LWS] = ArrayProtoIterator$LWS;
14012
14415
  return array$LWS;
14013
14416
  }
14014
14417
 
@@ -14022,421 +14425,320 @@ const HELPERS_SOURCE_TEXT$LWS = `'use strict';
14022
14425
  return _args$LWS ? ReflectApply$LWS(superProto$LWS[__key$LWS], thisArgOrReceiver$LWS, _args$LWS) : ReflectGet$LWS(superProto$LWS, __key$LWS, thisArgOrReceiver$LWS);
14023
14426
  }
14024
14427
 
14025
- function toString$LWS(__value$LWS) {
14026
- return typeof __value$LWS === 'string' ? __value$LWS : `${__value$LWS}`;
14027
- }
14028
-
14029
14428
  return {
14030
- // @TODO: Remove this 'asyncToGen' alias after the LWS compiler update
14031
- // makes its way through the LWC deployment pipeline.
14429
+ // @TODO: Remove the 'asyncToGen' and 'makeRedResyncImports' aliases after
14430
+ // the LWS compiler update makes its way through the LWC deployment pipeline.
14032
14431
  asyncToGen: genToAsync$LWS,
14432
+ makeRedResyncImports: makeRedSyncImports$LWS,
14033
14433
  forAwaitOf: forAwaitOf$LWS,
14034
14434
  genToAsync: genToAsync$LWS,
14035
14435
  loadScript: loadScript$LWS,
14036
14436
  loadStyle: loadStyle$LWS,
14037
14437
  makeRedGet: makeRedGet$LWS,
14038
- makeRedResyncImports: makeRedResyncImports$LWS,
14438
+ makeRedSyncImports: makeRedSyncImports$LWS,
14039
14439
  namespace: _namespace$LWS,
14040
14440
  spreadable: spreadable$LWS,
14041
14441
  super: superApplyOrGet$LWS
14042
14442
  };
14043
- }})`; // Options must be an object.
14044
- // And must define at a minimum an `evaluator` property.
14045
-
14046
- function parseOptions$LWS(options$LWS) {
14047
- if (options$LWS === null || typeof options$LWS !== 'object') {
14048
- return undefined;
14049
- }
14443
+ }})`;
14050
14444
 
14445
+ function createEvalHelpersFactoryArgs$LWS(_record$LWS) {
14051
14446
  const {
14052
- evaluator: evaluator$LWS,
14053
- targetElement: targetElement$LWS
14054
- } = options$LWS;
14055
-
14056
- if (typeof evaluator$LWS === 'function') {
14057
- return {
14058
- evaluator: evaluator$LWS,
14059
- targetElement: targetElement$LWS
14060
- };
14061
- }
14062
-
14063
- return undefined;
14064
- }
14065
-
14066
- const policyOptions$LWS = {
14067
- __proto__: null,
14068
- // Reject anything for createHTML until further requirements.
14069
- createHTML: (unsafe$LWS, options$LWS) => undefined,
14070
- // Defines the createScriptURL hook.
14071
- createScriptURL: (unsafe$LWS, options$LWS) => {
14072
- const lwsTTOpts$LWS = parseOptions$LWS(options$LWS);
14073
-
14074
- if (lwsTTOpts$LWS) {
14075
- const {
14076
- evaluator: evaluator$LWS,
14077
- targetElement: targetElement$LWS
14078
- } = lwsTTOpts$LWS;
14079
-
14080
- if (!targetElement$LWS) {
14081
- // Calling this policy without the source element is not supported.
14082
- // Cannot issue a TT.
14083
- return undefined;
14447
+ document: _document$LWS,
14448
+ document: {
14449
+ head: head$LWS
14450
+ },
14451
+ distortions: _distortions$LWS,
14452
+ globalObject: {
14453
+ HTMLScriptElement: {
14454
+ prototype: HTMLScriptElementProto$LWS
14084
14455
  }
14456
+ },
14457
+ root: root$LWS
14458
+ } = _record$LWS;
14459
+ const isRootRecord$LWS = _record$LWS === root$LWS;
14460
+ const forOfStateCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
14461
+ const resourcePromiseCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14462
+ const resourceStatusCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14463
+ const scriptSrcGetterDistortion$LWS = _distortions$LWS.get(isRootRecord$LWS ? HTMLScriptElementProtoSrcGetter$LWS : ObjectLookupOwnGetter$LWS$1(HTMLScriptElementProto$LWS, 'src'));
14464
+ const scriptSrcSetterDistortion$LWS = _distortions$LWS.get(isRootRecord$LWS ? HTMLScriptElementProtoSrcSetter$LWS : ObjectLookupOwnSetter$LWS(HTMLScriptElementProto$LWS, 'src'));
14085
14465
 
14086
- const _url$LWS = normalizeUrl$LWS(unsafe$LWS);
14087
- ReflectDefineProperty$LWS$1(targetElement$LWS, 'runScript', {
14088
- // @ts-ignore
14089
- __proto__: null,
14090
- configurable: true,
14091
- get: async () => {
14092
- ReflectDeleteProperty$LWS$1(targetElement$LWS, 'runScript');
14093
- let _event$LWS;
14466
+ function genStep$LWS(resolve$LWS, reject$LWS, next$LWS, thrower$LWS, genMethodWrapper$LWS, arg$LWS) {
14467
+ let info$LWS;
14468
+ let __value$LWS;
14094
14469
 
14095
- try {
14096
- // Includes crendentials to 1st and 3rd party domains.
14097
- // Cookies are domain bound.
14098
- // Browsers choose which cookies to send based on which domain is accessed.
14099
- const _response$LWS = await WindowFetch$LWS(_url$LWS, {
14100
- __proto__: null,
14101
- credentials: 'include'
14102
- });
14103
- const _status$LWS = ReflectApply$LWS$1(ResponseProtoStatus$LWS, _response$LWS, []);
14470
+ try {
14471
+ info$LWS = genMethodWrapper$LWS(arg$LWS);
14472
+ __value$LWS = info$LWS.value;
14473
+ } catch (error) {
14474
+ reject$LWS(error);
14475
+ return;
14476
+ }
14104
14477
 
14105
- if (_status$LWS !== 200) {
14106
- const text$LWS = ReflectApply$LWS$1(ResponseProtoStatusText$LWS, _response$LWS, []);
14107
- throw new ErrorCtor$LWS$1(text$LWS);
14108
- }
14478
+ if (info$LWS.done) {
14479
+ resolve$LWS(__value$LWS);
14480
+ } else {
14481
+ ReflectApply$LWS$1(PromiseProtoThen$LWS, PromiseResolve$LWS(__value$LWS), [next$LWS, thrower$LWS]);
14482
+ }
14483
+ }
14109
14484
 
14110
- const text$LWS = await ReflectApply$LWS$1(ResponseProtoText$LWS, _response$LWS, []);
14111
- evaluator$LWS(text$LWS);
14112
- _event$LWS = new EventCtor$LWS('load');
14113
- } catch (error) {
14114
- _event$LWS = new ErrorEventCtor$LWS('error', {
14115
- error
14116
- });
14117
- } finally {
14118
- // cleanup
14119
- ReflectSet$LWS(targetElement$LWS, 'textContent', '');
14120
- ReflectDeleteProperty$LWS$1(targetElement$LWS, 'src');
14121
- ReflectSet$LWS(targetElement$LWS, 'src', _url$LWS);
14122
- ReflectApply$LWS$1(EventTargetProtoDispatchEvent$LWS, targetElement$LWS, [_event$LWS]);
14123
- }
14124
- }
14125
- });
14126
- targetElement$LWS.textContent = `document.currentScript.runScript;`; // We shadow the native HTMLScript.src property by defining a "frozen" property 'src' on the element itself.
14485
+ function loadPromise$LWS(_element$LWS, urlAsString$LWS) {
14486
+ const promise$LWS = new PromiseCtor$LWS((resolve$LWS, reject$LWS) => {
14487
+ function onerror$LWS(_event$LWS) {
14488
+ ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['error', onerror$LWS]);
14489
+ ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['load', onload$LWS]);
14490
+ ReflectApply$LWS$1(EventProtoStopPropagation$LWS, _event$LWS, []);
14491
+ resourceStatusCache$LWS.set(_element$LWS, 1
14492
+ /* ResourceLoaderStatus.Errored */
14493
+ );
14494
+ reject$LWS(createResourceLoadError$LWS(urlAsString$LWS));
14495
+ }
14127
14496
 
14128
- ReflectDefineProperty$LWS$1(targetElement$LWS, 'src', {
14129
- // @ts-ignore
14130
- __proto__: null,
14131
- configurable: true,
14132
- enumerable: true,
14133
- set: () => noop$LWS$1,
14134
- get: () => _url$LWS
14135
- });
14136
- } // By the time we return from this function `script.src` already points to our defined property.
14137
- // The assignment `script.src = p.createScriptURL(...)` will invoke our patched setter.
14138
- // `undefined` will never be set and it will not trigger a TT validation on the browser.
14497
+ function onload$LWS() {
14498
+ ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['error', onerror$LWS]);
14499
+ ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, _element$LWS, ['load', onload$LWS]);
14500
+ resourceStatusCache$LWS.set(_element$LWS, 3
14501
+ /* ResourceLoaderStatus.Loaded */
14502
+ );
14503
+ resolve$LWS(undefined);
14504
+ }
14139
14505
 
14506
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _element$LWS, ['error', onerror$LWS]);
14507
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _element$LWS, ['load', onload$LWS]);
14508
+ });
14509
+ resourceStatusCache$LWS.set(_element$LWS, 2
14510
+ /* ResourceLoaderStatus.Loading */
14511
+ );
14512
+ resourcePromiseCache$LWS.set(_element$LWS, promise$LWS);
14513
+ ReflectApply$LWS$1(NodeProtoAppendChild$LWS$1, head$LWS, [_element$LWS]);
14514
+ return promise$LWS;
14515
+ }
14140
14516
 
14141
- return undefined;
14142
- },
14143
- // Reject anything for createScript until further requirements.
14144
- createScript: (unsafe$LWS, options$LWS) => // Disabled for now until we require it
14145
- undefined
14146
- }; // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
14517
+ return [// This helper is used to wrap the bodies of async functions that are
14518
+ // transformed into generator functions. It's based on @babel/helpers
14519
+ // `helpers.asyncToGenerator()`:
14520
+ // https://github.com/babel/babel/blob/a967910/packages/babel-helpers/src/helpers.js#L255-L288
14521
+ function baseGenToAsync$LWS(genNextWrapper$LWS, genThrowWrapper$LWS) {
14522
+ return new PromiseCtor$LWS((resolve$LWS, reject$LWS) => {
14523
+ function next$LWS(__value$LWS) {
14524
+ genStep$LWS(resolve$LWS, reject$LWS, next$LWS, thrower$LWS, genNextWrapper$LWS, __value$LWS);
14525
+ }
14147
14526
 
14148
- // @ts-ignore typeof check above, ignore `undefined` ts check
14149
- typeof trustedTypes !== 'undefined' ? // @ts-ignore
14150
- trustedTypes.createPolicy('locker', policyOptions$LWS) : policyOptions$LWS; // Flag whether the iframe should remain connected to the DOM.
14527
+ function thrower$LWS(error) {
14528
+ genStep$LWS(resolve$LWS, reject$LWS, next$LWS, thrower$LWS, genThrowWrapper$LWS, error);
14529
+ }
14151
14530
 
14152
- const IFRAME_KEEP_ALIVE_FLAG$LWS = LOCKER_UNMINIFIED_FLAG$LWS$1 && IS_CHROMIUM_BROWSER$LWS$1 && !IS_HEADLESS_CHROMIUM_BROWSER$LWS; // WebKit based browsers have a bug that prematurely removes distortion entries
14153
- // from the distortions weak map.
14531
+ next$LWS(undefined);
14532
+ });
14533
+ }, function forAwaitOf$LWS(_index$LWS, stage$LWS, object$LWS) {
14534
+ if (stage$LWS === 0
14535
+ /* init */
14536
+ ) {
14537
+ let sync$LWS = false;
14538
+ let {
14539
+ [SymbolAsyncIterator$LWS]: iterator$LWS
14540
+ } = object$LWS;
14154
14541
 
14155
- const SUPPORTS_DISTORTIONS_WEAK_MAP$LWS = !IS_WEBKIT_BROWSER$LWS;
14156
- const {
14157
- location: rootLocation$LWS
14158
- } = rootWindow$LWS$1; // Fast path non-configurable document, location, and window objects in the
14159
- // virtual environment distortion callback by seeding them in the root window's
14160
- // created distortion map.
14542
+ if (iterator$LWS === null || iterator$LWS === undefined) {
14543
+ sync$LWS = true;
14544
+ ({
14545
+ [SymbolIterator$LWS$1]: iterator$LWS
14546
+ } = object$LWS);
14547
+ }
14161
14548
 
14162
- const rootDistortionMapSeedEntries$LWS = [[rootDocument$LWS, rootDocument$LWS], [rootLocation$LWS, rootLocation$LWS], [rootWindow$LWS$1, rootWindow$LWS$1]];
14163
- const rootSandboxRegistry$LWS = {
14164
- __proto__: null
14165
- };
14166
- const documentToSandboxRegistry$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1([[rootDocument$LWS, rootSandboxRegistry$LWS]]));
14167
- const documentToEvaluationDistortionFactoriesMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14168
- const elementToLoadingPromiseMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14169
- const opaqueToDistortionFactoriesMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14170
- const opaqueToSandboxRegistry$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14171
- const rendererFactoryToRendererMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14172
- const seenGlobalObjects$LWS = toSafeWeakSet$LWS(new WeakSetCtor$LWS());
14173
- const DEFAULT_ENDOWMENTS_DESCRIPTOR_MAP$LWS = {
14174
- [SANDBOX_EVAL_CONTEXT_NAME$LWS]: {
14175
- __proto__: null,
14549
+ if (typeof iterator$LWS !== 'function') {
14550
+ throw new TypeErrorCtor$LWS$1('Object is not iterable.');
14551
+ }
14176
14552
 
14177
- get() {
14178
- return clearEvalContext$LWS();
14553
+ forOfStateCache$LWS.set(_index$LWS, {
14554
+ iterable: ReflectApply$LWS$1(iterator$LWS, object$LWS, []),
14555
+ step: undefined,
14556
+ sync: sync$LWS
14557
+ });
14558
+ return undefined;
14179
14559
  }
14180
14560
 
14181
- },
14182
- [SANDBOX_EVAL_HELPERS_NAME$LWS]: {
14183
- __proto__: null,
14561
+ const _state$LWS = forOfStateCache$LWS.get(_index$LWS);
14184
14562
 
14185
- get() {
14186
- return clearEvalHelpers$LWS();
14563
+ if (stage$LWS === 1
14564
+ /* step */
14565
+ ) {
14566
+ const _result$LWS = _state$LWS.iterable.next();
14567
+ return _state$LWS.sync ? new PromiseCtor$LWS(resolve$LWS => {
14568
+ _state$LWS.step = _result$LWS;
14569
+ resolve$LWS();
14570
+ }) : ReflectApply$LWS$1(PromiseProtoThen$LWS, _result$LWS, [step$LWS => {
14571
+ _state$LWS.step = step$LWS;
14572
+ }]);
14187
14573
  }
14188
14574
 
14189
- }
14190
- };
14191
- const EMPTY_DISTORTIONS_MAP$LWS = createDistortionMap$LWS();
14192
- const EMPTY_HELPERS$LWS = {
14193
- // @TODO: Remove this 'asyncToGen' alias after the LWS compiler update
14194
- // makes its way through the LWC deployment pipeline.
14195
- asyncToGen: noop$LWS$1,
14196
- forAwaitOf: noop$LWS$1,
14197
- genToAsync: noop$LWS$1,
14198
- loadScript: noop$LWS$1,
14199
- loadStyle: noop$LWS$1,
14200
- makeRedGet: noop$LWS$1,
14201
- makeRedResyncImports: noop$LWS$1,
14202
- namespace: noop$LWS$1,
14203
- spreadable: noop$LWS$1,
14204
- super: noop$LWS$1
14205
- };
14206
- const EMPTY_OBJECT$LWS = {};
14207
- const ROOT_UNCOMPILED_CONTEXT$LWS = {
14208
- [UNCOMPILED_LOCATION_NAME$LWS]: rootLocation$LWS,
14209
- [UNCOMPILED_TOP_NAME$LWS]: topWindow$LWS
14210
- };
14211
- let lockerEvalContextValue$LWS;
14212
- let lockerEvalHelpersValue$LWS;
14213
-
14214
- function clearEvalContext$LWS() {
14215
- const evalContext$LWS = lockerEvalContextValue$LWS;
14216
- lockerEvalContextValue$LWS = undefined;
14217
- return evalContext$LWS;
14218
- }
14219
-
14220
- function clearEvalHelpers$LWS() {
14221
- const evalHelpers$LWS = lockerEvalHelpersValue$LWS;
14222
- lockerEvalHelpersValue$LWS = undefined;
14223
- return evalHelpers$LWS;
14224
- }
14225
-
14226
- function createSecondaryWindowSandboxRecord$LWS({
14227
- globalObject: _globalObject$LWS,
14228
- document: _document$LWS,
14229
- context: _context$LWS,
14230
- key: __key$LWS,
14231
- type: _type$LWS
14232
- }, root$LWS) {
14233
- const sandboxRegistry$LWS = getSandboxRegistry$LWS(_document$LWS);
14234
- let _record$LWS = sandboxRegistry$LWS[__key$LWS];
14235
-
14236
- if (_record$LWS) {
14237
- return _record$LWS;
14238
- }
14575
+ if (stage$LWS === 2
14576
+ /* value */
14577
+ ) {
14578
+ return _state$LWS.step.value;
14579
+ }
14239
14580
 
14240
- const {
14241
- BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
14242
- LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14243
- LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14244
- distortions: distortions$LWS,
14245
- instrumentation: instrumentation$LWS
14246
- } = root$LWS;
14247
- const {
14248
- location: location$LWS
14249
- } = _globalObject$LWS;
14250
- const overrideDistortions$LWS = createDistortionMap$LWS();
14251
- _record$LWS = {
14252
- BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
14253
- LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14254
- LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14255
- UNCOMPILED_CONTEXT: {
14256
- [UNCOMPILED_LOCATION_NAME$LWS]: location$LWS,
14257
- [UNCOMPILED_TOP_NAME$LWS]: _globalObject$LWS.top
14258
- },
14259
- context: _context$LWS,
14260
- document: _document$LWS,
14261
- distortions: overrideDistortions$LWS,
14262
- endowments: EMPTY_OBJECT$LWS,
14263
- globalObject: _globalObject$LWS,
14264
- helpers: EMPTY_HELPERS$LWS,
14265
- instrumentation: instrumentation$LWS,
14266
- key: __key$LWS,
14267
- root: root$LWS,
14268
- sandboxEvaluator: noop$LWS$1,
14269
- trackAsFastTarget: noop$LWS$1,
14270
- type: _type$LWS,
14271
- virtualEnvironmentEvaluator: noop$LWS$1
14272
- };
14273
- const getVirtualEnvironment$LWS = createGetVirtualEnvironment$LWS(_record$LWS);
14274
- _record$LWS.sandboxEvaluator = createSandboxEvaluator$LWS(_record$LWS);
14275
- _record$LWS.trackAsFastTarget = createTrackAsFastTarget$LWS(getVirtualEnvironment$LWS);
14276
- _record$LWS.virtualEnvironmentEvaluator = createVirtualEnvironmentEvaluator$LWS(_record$LWS, getVirtualEnvironment$LWS); // Fast path non-configurable document, location, and window objects in the
14277
- // virtual environment distortion callback by adding them to the root window's
14278
- // distortion map.
14581
+ if (stage$LWS === 3
14582
+ /* done */
14583
+ ) {
14584
+ const done$LWS = !!_state$LWS.step.done;
14279
14585
 
14280
- distortions$LWS.set(_document$LWS, _document$LWS);
14281
- distortions$LWS.set(location$LWS, location$LWS);
14282
- const seenGlobalObject$LWS = seenGlobalObjects$LWS.has(_globalObject$LWS);
14586
+ if (done$LWS) {
14587
+ forOfStateCache$LWS.delete(_index$LWS);
14588
+ }
14283
14589
 
14284
- if (!seenGlobalObject$LWS) {
14285
- // WindowProxy object references don't change when the window location
14286
- // changes.
14287
- // https://developer.mozilla.org/en-US/docs/Glossary/WindowProxy
14288
- distortions$LWS.set(_globalObject$LWS, _globalObject$LWS);
14289
- }
14590
+ return done$LWS;
14591
+ }
14290
14592
 
14291
- const entries$LWS = createDistortionEntries$LWS(_record$LWS, getDistortionFactories$LWS(_record$LWS));
14292
- const evaluationEntries$LWS = createDistortionEntries$LWS(_record$LWS, getEvaluationDistortionFactories$LWS(_record$LWS)); // Call `createAttributeDistortionFactories()` last because its factories
14293
- // are populated by the other distortion factories.
14593
+ return undefined;
14594
+ }, // Functionality based on https://sfdc.co/7FuDU but adjusted for multiple
14595
+ // sandboxes. loadScript will create one <script> element in the DOM per
14596
+ // url per sandbox.
14597
+ function loadScript$LWS(_thisArg$LWS, _url$LWS) {
14598
+ const urlAsString$LWS = toString$LWS(_url$LWS);
14599
+ const _resolvedURL$LWS = resolveURL$LWS(urlAsString$LWS);
14600
+ const scripts$LWS = ReflectApply$LWS$1(ElementProtoQuerySelectorAll$LWS, head$LWS, ['script']);
14294
14601
 
14295
- createDistortionEntries$LWS(_record$LWS, createAttributeDistortionFactories$LWS(_record$LWS), entries$LWS);
14602
+ for (let _i$LWS = 0, {
14603
+ length: _length$LWS
14604
+ } = scripts$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14605
+ const script$LWS = scripts$LWS[_i$LWS];
14296
14606
 
14297
- for (let _i$LWS = 0, {
14298
- length: _length$LWS
14299
- } = entries$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14300
- const {
14301
- 0: entryKey$LWS,
14302
- 1: entryValue$LWS
14303
- } = entries$LWS[_i$LWS]; // Add distortion to the root window's distortion map.
14607
+ if (ReflectApply$LWS$1(scriptSrcGetterDistortion$LWS, script$LWS, []) === _resolvedURL$LWS) {
14608
+ var _resourceStatusCache$$LWS;
14304
14609
 
14305
- distortions$LWS.set(entryKey$LWS, entryValue$LWS);
14306
- }
14610
+ const _status$LWS = (_resourceStatusCache$$LWS = resourceStatusCache$LWS.get(script$LWS)) != null ? _resourceStatusCache$$LWS : 0
14611
+ /* ResourceLoaderStatus.None */
14612
+ ;
14307
14613
 
14308
- for (let _i$LWS = 0, {
14309
- length: _length$LWS
14310
- } = evaluationEntries$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14311
- const {
14312
- 0: entryKey$LWS,
14313
- 1: entryValue$LWS
14314
- } = evaluationEntries$LWS[_i$LWS]; // Add evaluation distortion for the child window to the root window's
14315
- // distortion map.
14614
+ if (_status$LWS === 3
14615
+ /* ResourceLoaderStatus.Loaded */
14616
+ ) {
14617
+ return PromiseResolve$LWS(undefined);
14618
+ }
14316
14619
 
14317
- distortions$LWS.set(entryKey$LWS, entryValue$LWS); // Add the undistorted entry to the child window's distortion map
14318
- // so the undistorted entry is used in the child window's sandbox
14319
- // instead of the distorted entry.
14620
+ if (_status$LWS === 1
14621
+ /* ResourceLoaderStatus.Errored */
14622
+ ) {
14623
+ return PromiseReject$LWS(createResourceLoadError$LWS(urlAsString$LWS));
14624
+ }
14320
14625
 
14321
- overrideDistortions$LWS.set(entryKey$LWS, entryKey$LWS);
14322
- }
14626
+ if (_status$LWS === 2
14627
+ /* ResourceLoaderStatus.Loading */
14628
+ ) {
14629
+ return resourcePromiseCache$LWS.get(script$LWS);
14630
+ }
14631
+ }
14632
+ }
14323
14633
 
14324
- sandboxRegistry$LWS[__key$LWS] = _record$LWS;
14634
+ const script$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, _document$LWS, ['script']);
14635
+ script$LWS.type = 'text/javascript';
14636
+ ReflectApply$LWS$1(scriptSrcSetterDistortion$LWS, script$LWS, [urlAsString$LWS]);
14637
+ return loadPromise$LWS(script$LWS, urlAsString$LWS);
14638
+ }, // Functionality based on http://sfdc.co/bIpMYB but adjusted for multiple
14639
+ // sandboxes. loadStyle will create one <link> element in the DOM per url
14640
+ // for all the sandboxes.
14641
+ function loadStyle$LWS(_thisArg$LWS, _url$LWS) {
14642
+ const urlAsString$LWS = toString$LWS(_url$LWS);
14643
+ let link$LWS = ReflectApply$LWS$1(ElementProtoQuerySelector$LWS, head$LWS, [`link[href=${enquote$LWS(urlAsString$LWS)}]`]);
14325
14644
 
14326
- if (seenGlobalObject$LWS) {
14327
- return _record$LWS;
14328
- }
14645
+ if (link$LWS) {
14646
+ var _resourceStatusCache$2$LWS;
14329
14647
 
14330
- seenGlobalObjects$LWS.add(_globalObject$LWS);
14648
+ const _status$LWS = (_resourceStatusCache$2$LWS = resourceStatusCache$LWS.get(link$LWS)) != null ? _resourceStatusCache$2$LWS : 0
14649
+ /* ResourceLoaderStatus.None */
14650
+ ;
14331
14651
 
14332
- const onDOMContentLoadedOrWindowLoad$LWS = () => {
14333
- try {
14334
- // We don't need to use `WindowDocumentGetter()` because we know
14335
- // this is a window object and the 'document' property is
14336
- // non-configurable.
14337
- const {
14338
- document: newDocument$LWS
14339
- } = _globalObject$LWS; // Ensure the document has changed before attempting to create a
14340
- // sandbox record.
14652
+ if (_status$LWS === 0
14653
+ /* ResourceLoaderStatus.None */
14654
+ || _status$LWS === 3
14655
+ /* ResourceLoaderStatus.Loaded */
14656
+ ) {
14657
+ return PromiseResolve$LWS(undefined);
14658
+ }
14341
14659
 
14342
- if (_document$LWS !== newDocument$LWS) {
14343
- createSecondaryWindowSandboxRecord$LWS({
14344
- context: EMPTY_OBJECT$LWS,
14345
- document: newDocument$LWS,
14346
- globalObject: _globalObject$LWS,
14347
- key: __key$LWS,
14348
- type: _type$LWS
14349
- }, root$LWS);
14660
+ if (_status$LWS === 1
14661
+ /* ResourceLoaderStatus.Errored */
14662
+ ) {
14663
+ return PromiseReject$LWS(createResourceLoadError$LWS(urlAsString$LWS));
14350
14664
  }
14351
- } catch (_unused36$LWS) {
14352
- // istanbul ignore next: this is a safety precaution that is unreachable via tests
14353
- createOpaqueSecondaryWindowSandboxRecord$LWS({
14354
- globalObject: _globalObject$LWS,
14355
- key: __key$LWS,
14356
- type: _type$LWS
14357
- }, root$LWS);
14665
+
14666
+ const promise$LWS = _status$LWS === 2
14667
+ /* ResourceLoaderStatus.Loading */
14668
+ ? resourcePromiseCache$LWS.get(link$LWS) : undefined;
14669
+ return promise$LWS != null ? promise$LWS : PromiseResolve$LWS(undefined);
14358
14670
  }
14359
- };
14360
14671
 
14361
- const frameElement$LWS = ReflectApply$LWS$1(WindowFrameElementGetter$LWS, _globalObject$LWS, []);
14672
+ link$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, _document$LWS, ['link']);
14673
+ link$LWS.type = 'text/css';
14674
+ link$LWS.rel = 'stylesheet';
14675
+ link$LWS.href = urlAsString$LWS;
14676
+ return loadPromise$LWS(link$LWS, urlAsString$LWS);
14677
+ }];
14678
+ }
14362
14679
 
14363
- if (frameElement$LWS) {
14364
- // Create a new sandbox record when the iframe window location changes.
14365
- ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, frameElement$LWS, ['load', onDOMContentLoadedOrWindowLoad$LWS, // useCapture
14366
- true]);
14367
- } else {
14368
- // Create a new sandbox record when the opened window location changes.
14369
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event#usage_notes
14370
- //
14371
- // The 'unload' event handler is okay to use here under the assumption
14372
- // that most `window.open()` calls are not done with the 'noopener'
14373
- // option, so the back/forward cache (i.e. bfcache) is likely being
14374
- // skipped anyways.
14375
- // https://web.dev/bfcache/#avoid-window.opener-references
14376
- ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _globalObject$LWS, ['unload', function onWindowUnload$LWS() {
14377
- WindowQueueMicrotask$LWS(() => {
14378
- try {
14379
- // Ensure the document has changed before adding event
14380
- // listeners.
14381
- const {
14382
- document: newDocument$LWS
14383
- } = _globalObject$LWS;
14680
+ function toSourceText$LWS(__value$LWS, sourceType$LWS) {
14681
+ let _sourceText$LWS = typeof __value$LWS === 'function' ? extractFunctionBodySource$LWS(__value$LWS) : toString$LWS(__value$LWS); // We workaround bundlers, like Rollup, aggressively stripping inline source
14682
+ // maps by compiling them with the name "sandboxMappingURL". At runtime the
14683
+ // name is changed so the inline source map is registered.
14384
14684
 
14385
- if (_document$LWS !== newDocument$LWS) {
14386
- ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
14387
- ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
14388
- }
14389
- } catch (_unused37$LWS) {
14390
- // istanbul ignore next: this is a safety precaution that is unreachable via tests
14391
- createOpaqueSecondaryWindowSandboxRecord$LWS({
14392
- globalObject: _globalObject$LWS,
14393
- key: __key$LWS,
14394
- type: _type$LWS
14395
- }, root$LWS);
14396
- }
14397
- });
14398
- }, // useCapture
14399
- true]);
14685
+ _sourceText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, _sourceText$LWS, [// This regexp looks involved, but it prevents browsers and developer
14686
+ // tools from mistaking the regexp or the replacement string for an
14687
+ // actual source mapping URL.
14688
+ /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
14689
+ return sourceType$LWS === 1
14690
+ /* SourceType.Module */
14691
+ && indexOfPragma$LWS(_sourceText$LWS, 'use strict') === -1 ? // Append "'use strict'" to the extracted function body so it is
14692
+ // evaluated in strict mode.
14693
+ `'use strict';${_sourceText$LWS}` : _sourceText$LWS;
14694
+ }
14695
+
14696
+ const rootSandboxRegistry$LWS = {
14697
+ __proto__: null
14698
+ };
14699
+ const documentSandboxRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1([[rootDocument$LWS, rootSandboxRegistry$LWS]]));
14700
+ const opaqueWindowSandboxRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14701
+
14702
+ function getOpaqueSandboxRegistry$LWS(_globalObject$LWS) {
14703
+ // Use the `document` as the key because a window object maintains its
14704
+ // identity continuity when its location changes and while the
14705
+ // non-configurable document property does not.
14706
+ let sandboxRegistry$LWS = opaqueWindowSandboxRegistryCache$LWS.get(_globalObject$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
14707
+
14708
+ if (sandboxRegistry$LWS === undefined) {
14709
+ sandboxRegistry$LWS = {
14710
+ __proto__: null
14711
+ };
14712
+ opaqueWindowSandboxRegistryCache$LWS.set(_globalObject$LWS, sandboxRegistry$LWS);
14400
14713
  }
14401
14714
 
14402
- return _record$LWS;
14715
+ return sandboxRegistry$LWS;
14403
14716
  }
14404
14717
 
14405
- function createDistortionEntries$LWS(_record$LWS, _factories$LWS, entries$LWS = []) {
14406
- let {
14407
- length: entriesOffset$LWS
14408
- } = entries$LWS;
14718
+ function getSandboxRegistry$LWS(_document$LWS) {
14719
+ // Use the `document` as the key because a window object maintains its
14720
+ // identity continuity when its location changes and while the
14721
+ // non-configurable document property does not.
14722
+ let sandboxRegistry$LWS = documentSandboxRegistryCache$LWS.get(_document$LWS);
14409
14723
 
14410
- for (let _i$LWS = 0, {
14411
- length: _length$LWS
14412
- } = _factories$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14413
- const factory$LWS = _factories$LWS[_i$LWS];
14414
- const entry$LWS = factory$LWS(_record$LWS);
14724
+ if (sandboxRegistry$LWS === undefined) {
14725
+ sandboxRegistry$LWS = {
14726
+ __proto__: null
14727
+ };
14728
+ documentSandboxRegistryCache$LWS.set(_document$LWS, sandboxRegistry$LWS);
14729
+ }
14415
14730
 
14416
- if (entry$LWS) {
14417
- const {
14418
- 0: proxyTarget$LWS,
14419
- 1: distortedValue$LWS
14420
- } = entry$LWS;
14731
+ return sandboxRegistry$LWS;
14732
+ } // Flag whether the iframe should remain connected to the DOM.
14421
14733
 
14422
- if (typeof proxyTarget$LWS === 'function') {
14423
- entries$LWS[entriesOffset$LWS++] = [proxyTarget$LWS, proxyWrapFunctionDistortion$LWS(_record$LWS, factory$LWS.name, proxyTarget$LWS, distortedValue$LWS)];
14424
- } else {
14425
- // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
14426
- if (typeof proxyTarget$LWS === 'object' && proxyTarget$LWS !== null) {
14427
- entries$LWS[entriesOffset$LWS++] = entry$LWS;
14428
- }
14429
- }
14430
- }
14431
- }
14432
14734
 
14433
- return entries$LWS;
14434
- }
14735
+ const IFRAME_KEEP_ALIVE_FLAG$LWS = LOCKER_UNMINIFIED_FLAG$LWS$1 && !false; // Fast path non-configurable document, location, and window objects in the
14736
+ // virtual environment distortion callback by seeding them in the root window's
14737
+ // created distortion map.
14435
14738
 
14436
- function createDistortionMap$LWS(entries$LWS) {
14437
- return SUPPORTS_DISTORTIONS_WEAK_MAP$LWS ? toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1(entries$LWS)) : // istanbul ignore next: this code is not reachable in the coverage run.
14438
- toSafeMap$LWS$1(new MapCtor$LWS$1(entries$LWS));
14439
- }
14739
+ const rootDistortionMapSeedEntries$LWS = [[rootDocument$LWS, rootDocument$LWS], [rootWindowLocation$LWS, rootWindowLocation$LWS], [rootWindow$LWS$1, rootWindow$LWS$1]];
14740
+ const rendererFactoryToRendererCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
14741
+ const seenGlobalObjects$LWS = toSafeWeakSet$LWS(new WeakSetCtor$LWS());
14440
14742
 
14441
14743
  function createGetVirtualEnvironment$LWS(_record$LWS) {
14442
14744
  let virtualEnvironment$LWS;
@@ -14468,14 +14770,12 @@ function createVirtualEnvironmentEvaluator$LWS(_record$LWS, getVirtualEnvironmen
14468
14770
 
14469
14771
  const _context$LWS = clearEvalContext$LWS(); // Populate `record.helpers`.
14470
14772
 
14471
- setEvalContext$LWS(redHelpersFactory$LWS => {
14472
- const helpers$LWS = redHelpersFactory$LWS({
14473
- elementToLoadingPromiseMap: elementToLoadingPromiseMap$LWS
14474
- });
14773
+ setEvalContext$LWS(redEvalHelpersFactory$LWS => {
14774
+ const helpers$LWS = ReflectApply$LWS$1(redEvalHelpersFactory$LWS, undefined, createEvalHelpersFactoryArgs$LWS(_record$LWS));
14475
14775
  _record$LWS.helpers = helpers$LWS;
14476
14776
  setEvalHelpers$LWS(helpers$LWS);
14477
14777
  });
14478
- virtualEnvironment$LWS.evaluate(HELPERS_SOURCE_TEXT$LWS);
14778
+ virtualEnvironment$LWS.evaluate(EVAL_HELPERS_SOURCE_TEXT$LWS);
14479
14779
 
14480
14780
  if (typeof _context$LWS === 'object' && _context$LWS !== null) {
14481
14781
  // Track the `context` object and its properties as a fast
@@ -14484,91 +14784,23 @@ function createVirtualEnvironmentEvaluator$LWS(_record$LWS, getVirtualEnvironmen
14484
14784
  virtualEnvironment$LWS.trackAsFastTarget(_context$LWS);
14485
14785
  const ownKeys$LWS = ReflectOwnKeys$LWS$1(_context$LWS);
14486
14786
 
14487
- for (let _i$LWS = 0, {
14488
- length: _length$LWS
14489
- } = ownKeys$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14490
- const __value$LWS = _context$LWS[ownKeys$LWS[_i$LWS]];
14491
-
14492
- if (typeof __value$LWS === 'object' && __value$LWS !== null) {
14493
- virtualEnvironment$LWS.trackAsFastTarget(__value$LWS);
14494
- }
14495
- }
14496
- } // Restore the old eval context.
14497
-
14498
-
14499
- setEvalContext$LWS(_context$LWS);
14500
- }
14501
-
14502
- return virtualEnvironment$LWS.evaluate(_sourceText$LWS);
14503
- };
14504
- }
14505
-
14506
- function createOpaqueSecondaryWindowSandboxRecord$LWS({
14507
- globalObject: _globalObject$LWS,
14508
- key: __key$LWS,
14509
- type: _type$LWS
14510
- }, root$LWS) {
14511
- const sandboxRegistry$LWS = getOpaqueSandboxRegistry$LWS(_globalObject$LWS);
14512
- let _record$LWS = sandboxRegistry$LWS[__key$LWS]; // istanbul ignore if: calls that would evaluate to true here ARE tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
14513
-
14514
- if (_record$LWS) {
14515
- return _record$LWS;
14516
- }
14517
-
14518
- const {
14519
- BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
14520
- LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14521
- LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14522
- distortions: distortions$LWS,
14523
- instrumentation: instrumentation$LWS
14524
- } = root$LWS;
14525
- _record$LWS = {
14526
- BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
14527
- LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14528
- LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14529
- UNCOMPILED_CONTEXT: EMPTY_OBJECT$LWS,
14530
- context: EMPTY_OBJECT$LWS,
14531
- document,
14532
- distortions: EMPTY_DISTORTIONS_MAP$LWS,
14533
- endowments: EMPTY_OBJECT$LWS,
14534
- globalObject: _globalObject$LWS,
14535
- helpers: EMPTY_HELPERS$LWS,
14536
- instrumentation: instrumentation$LWS,
14537
- key: __key$LWS,
14538
- root: root$LWS,
14539
- sandboxEvaluator: noop$LWS$1,
14540
- trackAsFastTarget: noop$LWS$1,
14541
- type: _type$LWS,
14542
- virtualEnvironmentEvaluator: noop$LWS$1
14543
- }; // Fast path non-configurable location and window objects in the virtual
14544
- // environment distortion callback by adding them to the root window's
14545
- // distortion map.
14546
-
14547
- const {
14548
- location: location$LWS
14549
- } = _globalObject$LWS;
14550
- distortions$LWS.set(location$LWS, location$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
14551
-
14552
- if (!seenGlobalObjects$LWS.has(_globalObject$LWS)) {
14553
- distortions$LWS.set(_globalObject$LWS, _globalObject$LWS);
14554
- }
14787
+ for (let _i$LWS = 0, {
14788
+ length: _length$LWS
14789
+ } = ownKeys$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14790
+ const __value$LWS = _context$LWS[ownKeys$LWS[_i$LWS]];
14555
14791
 
14556
- const opaqueEntries$LWS = createDistortionEntries$LWS(_record$LWS, getOpaqueDistortionFactories$LWS(_record$LWS));
14792
+ if (typeof __value$LWS === 'object' && __value$LWS !== null) {
14793
+ virtualEnvironment$LWS.trackAsFastTarget(__value$LWS);
14794
+ }
14795
+ }
14796
+ } // Restore the old eval context.
14557
14797
 
14558
- for (let _i$LWS = 0, {
14559
- length: _length$LWS
14560
- } = opaqueEntries$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14561
- const {
14562
- 0: entryKey$LWS,
14563
- 1: entryValue$LWS
14564
- } = opaqueEntries$LWS[_i$LWS]; // Add opaque distortion for the child window to the root window's
14565
- // distortion map.
14566
14798
 
14567
- distortions$LWS.set(entryKey$LWS, entryValue$LWS);
14568
- }
14799
+ setEvalContext$LWS(_context$LWS);
14800
+ }
14569
14801
 
14570
- sandboxRegistry$LWS[__key$LWS] = _record$LWS;
14571
- return _record$LWS;
14802
+ return virtualEnvironment$LWS.evaluate(_sourceText$LWS);
14803
+ };
14572
14804
  }
14573
14805
 
14574
14806
  function createSandboxEvaluator$LWS({
@@ -14595,73 +14827,6 @@ function createSandboxEvaluator$LWS({
14595
14827
  });
14596
14828
  }
14597
14829
 
14598
- function createRootWindowSandboxRecord$LWS({
14599
- context: _context$LWS,
14600
- endowments: endowments$LWS,
14601
- instrumentation: instrumentation$LWS,
14602
- key: __key$LWS,
14603
- type: _type$LWS,
14604
- verboseInstrumentation: verboseInstrumentation$LWS
14605
- }) {
14606
- let _record$LWS = rootSandboxRegistry$LWS[__key$LWS];
14607
-
14608
- if (_record$LWS) {
14609
- return _record$LWS;
14610
- }
14611
-
14612
- const LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS = // In the future we can preface the LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG
14613
- // definition with a LOCKER_UNMINIFIED_FLAG check to have instrumentation
14614
- // removed in minified production builds.
14615
- instrumentation$LWS !== EMPTY_OBJECT$LWS && typeof instrumentation$LWS === 'object' && instrumentation$LWS !== null;
14616
- const distortions$LWS = createDistortionMap$LWS(rootDistortionMapSeedEntries$LWS);
14617
- _record$LWS = {
14618
- BASIC_INSTRUMENTATION_DATA: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS ? {
14619
- sandboxKey: __key$LWS
14620
- } : EMPTY_OBJECT$LWS,
14621
- LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14622
- LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: // In the future we can preface the LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG
14623
- // definition with a LOCKER_UNMINIFIED_FLAG check to have instrumentation
14624
- // removed in minified production builds.
14625
- verboseInstrumentation$LWS && LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14626
- UNCOMPILED_CONTEXT: ROOT_UNCOMPILED_CONTEXT$LWS,
14627
- context: _context$LWS,
14628
- document: rootDocument$LWS,
14629
- distortions: distortions$LWS,
14630
- endowments: endowments$LWS,
14631
- globalObject: rootWindow$LWS$1,
14632
- helpers: EMPTY_HELPERS$LWS,
14633
- instrumentation: instrumentation$LWS,
14634
- key: __key$LWS,
14635
- root: EMPTY_OBJECT$LWS,
14636
- sandboxEvaluator: noop$LWS$1,
14637
- trackAsFastTarget: noop$LWS$1,
14638
- type: _type$LWS,
14639
- virtualEnvironmentEvaluator: noop$LWS$1
14640
- };
14641
- const getVirtualEnvironment$LWS = createGetVirtualEnvironment$LWS(_record$LWS);
14642
- _record$LWS.root = _record$LWS;
14643
- _record$LWS.sandboxEvaluator = createSandboxEvaluator$LWS(_record$LWS);
14644
- _record$LWS.trackAsFastTarget = createTrackAsFastTarget$LWS(getVirtualEnvironment$LWS);
14645
- _record$LWS.virtualEnvironmentEvaluator = createVirtualEnvironmentEvaluator$LWS(_record$LWS, getVirtualEnvironment$LWS);
14646
- const entries$LWS = createDistortionEntries$LWS(_record$LWS, getDistortionFactories$LWS(_record$LWS)); // Call `createAttributeDistortionFactories()` last because its factories
14647
- // are populated by the other distortion factories.
14648
-
14649
- createDistortionEntries$LWS(_record$LWS, createAttributeDistortionFactories$LWS(_record$LWS), entries$LWS); // Add distortions to the root window's distortion map.
14650
-
14651
- for (let _i$LWS = 0, {
14652
- length: _length$LWS
14653
- } = entries$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14654
- const {
14655
- 0: entryKey$LWS,
14656
- 1: entryValue$LWS
14657
- } = entries$LWS[_i$LWS];
14658
- distortions$LWS.set(entryKey$LWS, entryValue$LWS);
14659
- }
14660
-
14661
- rootSandboxRegistry$LWS[__key$LWS] = _record$LWS;
14662
- return _record$LWS;
14663
- }
14664
-
14665
14830
  function createVirtualEnvironment$LWS(_record$LWS) {
14666
14831
  const {
14667
14832
  LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: verboseInstrumentation$LWS,
@@ -14672,14 +14837,14 @@ function createVirtualEnvironment$LWS(_record$LWS) {
14672
14837
  key: __key$LWS,
14673
14838
  root: root$LWS,
14674
14839
  root: {
14675
- distortions: distortions$LWS
14840
+ distortions: _distortions$LWS
14676
14841
  },
14677
14842
  type: _type$LWS
14678
14843
  } = _record$LWS;
14679
14844
  const isRootRecord$LWS = _record$LWS === root$LWS;
14680
14845
  return createIframeVirtualEnvironment$LWS(_globalObject$LWS, {
14681
14846
  distortionCallback(originalTarget$LWS) {
14682
- const distortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
14847
+ const distortedTarget$LWS = _distortions$LWS.get(originalTarget$LWS);
14683
14848
 
14684
14849
  if (distortedTarget$LWS) {
14685
14850
  return isRootRecord$LWS ? distortedTarget$LWS : overrideDistortions$LWS.get(originalTarget$LWS) || distortedTarget$LWS;
@@ -14699,7 +14864,7 @@ function createVirtualEnvironment$LWS(_record$LWS) {
14699
14864
  if (!ObjectHasOwn$LWS$1(originalTarget$LWS, 'location')) {
14700
14865
  return originalTarget$LWS;
14701
14866
  }
14702
- } catch (_unused38$LWS) {
14867
+ } catch (_unused36$LWS) {
14703
14868
  // Likely an opaque object of a cross-origin window.
14704
14869
  // istanbul ignore next: an access of property iframe.contentWindow.location.href on an opaque window, that should reach this catch clause IS tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
14705
14870
  return originalTarget$LWS;
@@ -14716,7 +14881,7 @@ function createVirtualEnvironment$LWS(_record$LWS) {
14716
14881
  // object, or if it is an opaque cross-origin window.
14717
14882
  originalTargetDocument$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
14718
14883
  originalTargetWindow$LWS = originalTarget$LWS;
14719
- } catch (_unused39$LWS) {
14884
+ } catch (_unused37$LWS) {
14720
14885
  try {
14721
14886
  // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
14722
14887
  if (ReflectApply$LWS$1(WindowLocationGetter$LWS, originalTarget$LWS, [])) {
@@ -14728,7 +14893,7 @@ function createVirtualEnvironment$LWS(_record$LWS) {
14728
14893
  return originalTarget$LWS;
14729
14894
  } // eslint-disable-next-line no-empty
14730
14895
 
14731
- } catch (_unused40$LWS) {}
14896
+ } catch (_unused38$LWS) {}
14732
14897
  } // Check if originalTarget is a document and get its defaultView.
14733
14898
 
14734
14899
  } else if ('defaultView' in originalTarget$LWS) {
@@ -14742,7 +14907,7 @@ function createVirtualEnvironment$LWS(_record$LWS) {
14742
14907
  try {
14743
14908
  // This will throw if `originalTarget` is not a document object.
14744
14909
  _defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, originalTarget$LWS, []); // eslint-disable-next-line no-empty
14745
- } catch (_unused41$LWS) {}
14910
+ } catch (_unused39$LWS) {}
14746
14911
 
14747
14912
  if (_defaultView$LWS) {
14748
14913
  originalTargetDocument$LWS = originalTarget$LWS;
@@ -14773,129 +14938,310 @@ function createVirtualEnvironment$LWS(_record$LWS) {
14773
14938
  });
14774
14939
  }
14775
14940
 
14776
- function getDistortionFactories$LWS(_record$LWS) {
14777
- // @TODO: Revert @W-11759694 removal of `documentToDistortionFactoriesMap`
14778
- // cache once system mode initialization order is resolved with LWC.
14941
+ function getDefaultType$LWS(__key$LWS) {
14942
+ return __key$LWS === CORE_SANDBOX_KEY$LWS ? 1
14943
+ /* SandboxType.Internal */
14944
+ : 0
14945
+ /* SandboxType.External */
14946
+ ;
14947
+ }
14948
+
14949
+ function createRootWindowSandboxRecord$LWS({
14950
+ context: _context$LWS = EMPTY_OBJECT$LWS,
14951
+ endowments: endowments$LWS = EMPTY_OBJECT$LWS,
14952
+ instrumentation: instrumentation$LWS = EMPTY_OBJECT$LWS,
14953
+ key: __key$LWS,
14954
+ type: _type$LWS = getDefaultType$LWS(__key$LWS),
14955
+ verboseInstrumentation: verboseInstrumentation$LWS = false
14956
+ }) {
14957
+ let _record$LWS = rootSandboxRegistry$LWS[__key$LWS];
14958
+
14959
+ if (_record$LWS) {
14960
+ return _record$LWS;
14961
+ }
14962
+
14963
+ const LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS = // In the future we can preface the LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG
14964
+ // definition with a LOCKER_UNMINIFIED_FLAG check to have instrumentation
14965
+ // removed in minified production builds.
14966
+ instrumentation$LWS !== EMPTY_OBJECT$LWS && typeof instrumentation$LWS === 'object' && instrumentation$LWS !== null;
14967
+ const _distortions$LWS = createDistortionMap$LWS(rootDistortionMapSeedEntries$LWS);
14968
+ _record$LWS = {
14969
+ BASIC_INSTRUMENTATION_DATA: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS ? {
14970
+ sandboxKey: __key$LWS
14971
+ } : EMPTY_OBJECT$LWS,
14972
+ LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14973
+ LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: // In the future we can preface the LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG
14974
+ // definition with a LOCKER_UNMINIFIED_FLAG check to have instrumentation
14975
+ // removed in minified production builds.
14976
+ verboseInstrumentation$LWS && LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
14977
+ UNCOMPILED_CONTEXT: ROOT_UNCOMPILED_CONTEXT$LWS,
14978
+ context: _context$LWS,
14979
+ document: rootDocument$LWS,
14980
+ distortions: _distortions$LWS,
14981
+ endowments: endowments$LWS,
14982
+ globalObject: rootWindow$LWS$1,
14983
+ helpers: EMPTY_EVAL_HELPERS$LWS,
14984
+ instrumentation: instrumentation$LWS,
14985
+ key: __key$LWS,
14986
+ root: EMPTY_OBJECT$LWS,
14987
+ sandboxEvaluator: noop$LWS$1,
14988
+ trackAsFastTarget: noop$LWS$1,
14989
+ type: _type$LWS,
14990
+ virtualEnvironmentEvaluator: noop$LWS$1
14991
+ };
14992
+ const getVirtualEnvironment$LWS = createGetVirtualEnvironment$LWS(_record$LWS);
14993
+ _record$LWS.root = _record$LWS;
14994
+ _record$LWS.sandboxEvaluator = createSandboxEvaluator$LWS(_record$LWS);
14995
+ _record$LWS.trackAsFastTarget = createTrackAsFastTarget$LWS(getVirtualEnvironment$LWS);
14996
+ _record$LWS.virtualEnvironmentEvaluator = createVirtualEnvironmentEvaluator$LWS(_record$LWS, getVirtualEnvironment$LWS);
14997
+ const entries$LWS = createDistortionEntries$LWS(_record$LWS, getDistortionFactories$LWS(_record$LWS)); // Call `createAttributeDistortionFactories()` last because its factories
14998
+ // are populated by the other distortion factories.
14999
+
15000
+ createDistortionEntries$LWS(_record$LWS, createAttributeDistortionFactories$LWS(_record$LWS), entries$LWS); // Add distortions to the root window's distortion map.
15001
+
15002
+ for (let _i$LWS = 0, {
15003
+ length: _length$LWS
15004
+ } = entries$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
15005
+ const {
15006
+ 0: entryKey$LWS,
15007
+ 1: entryValue$LWS
15008
+ } = entries$LWS[_i$LWS];
15009
+ _distortions$LWS.set(entryKey$LWS, entryValue$LWS);
15010
+ }
15011
+
15012
+ rootSandboxRegistry$LWS[__key$LWS] = _record$LWS;
15013
+ return _record$LWS;
15014
+ }
15015
+
15016
+ function createOpaqueSecondaryWindowSandboxRecord$LWS({
15017
+ globalObject: _globalObject$LWS,
15018
+ key: __key$LWS,
15019
+ type: _type$LWS = getDefaultType$LWS(__key$LWS)
15020
+ }, root$LWS) {
15021
+ const sandboxRegistry$LWS = getOpaqueSandboxRegistry$LWS(_globalObject$LWS);
15022
+ let _record$LWS = sandboxRegistry$LWS[__key$LWS]; // istanbul ignore if: calls that would evaluate to true here ARE tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
15023
+
15024
+ if (_record$LWS) {
15025
+ return _record$LWS;
15026
+ }
15027
+
14779
15028
  const {
15029
+ BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
15030
+ LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15031
+ LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15032
+ distortions: _distortions$LWS,
15033
+ instrumentation: instrumentation$LWS
15034
+ } = root$LWS;
15035
+ _record$LWS = {
15036
+ BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
15037
+ LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15038
+ LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15039
+ UNCOMPILED_CONTEXT: EMPTY_OBJECT$LWS,
15040
+ context: EMPTY_OBJECT$LWS,
15041
+ document,
15042
+ distortions: EMPTY_DISTORTIONS_MAP$LWS,
15043
+ endowments: EMPTY_OBJECT$LWS,
14780
15044
  globalObject: _globalObject$LWS,
14781
- type: _type$LWS
14782
- } = _record$LWS;
15045
+ helpers: EMPTY_EVAL_HELPERS$LWS,
15046
+ instrumentation: instrumentation$LWS,
15047
+ key: __key$LWS,
15048
+ root: root$LWS,
15049
+ sandboxEvaluator: noop$LWS$1,
15050
+ trackAsFastTarget: noop$LWS$1,
15051
+ type: _type$LWS,
15052
+ virtualEnvironmentEvaluator: noop$LWS$1
15053
+ }; // Fast path non-configurable location and window objects in the virtual
15054
+ // environment distortion callback by adding them to the root window's
15055
+ // distortion map.
15056
+
14783
15057
  const {
14784
- Document: _Document$LWS,
14785
- Element: _Element$LWS,
14786
- HTMLElement: _HTMLElement$LWS,
14787
- HTMLIFrameElement: _HTMLIFrameElement$LWS,
14788
- HTMLScriptElement: _HTMLScriptElement$LWS,
14789
- SVGElement: _SVGElement$LWS,
14790
- XSLTProcessor: XSLTProcessor$LWS
15058
+ location: location$LWS
14791
15059
  } = _globalObject$LWS;
14792
- const initializers$LWS = _type$LWS === 1
14793
- /* SandboxType.Internal */
14794
- ? ArrayConcat$LWS(internalDistortionFactoryInitializers$LWS, internalKeyedDistortionFactoryInitializers$LWS) : ArrayConcat$LWS(externalDistortionFactoryInitializers$LWS, externalKeyedDistortionFactoryInitializers$LWS);
14795
- createBlockedAttributeDistortionFactoryInitializers$LWS(_HTMLElement$LWS, 'HTMLElement', HTMLElementBlockedAttributes$LWS, initializers$LWS);
14796
- createBlockedAttributeDistortionFactoryInitializers$LWS(_HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS);
14797
- createBlockedAttributeDistortionFactoryInitializers$LWS(_HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS);
14798
- createBlockedAttributeDistortionFactoryInitializers$LWS(_SVGElement$LWS, 'SVGElement', SVGElementBlockedAttributes$LWS, initializers$LWS);
14799
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, CustomElementRegistry.prototype, CustomElementRegistryBlockedProperties$LWS, initializers$LWS);
14800
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _Document$LWS.prototype, DocumentBlockedProperties$LWS, initializers$LWS);
14801
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _Element$LWS.prototype, ElementBlockedProperties$LWS, initializers$LWS);
14802
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _HTMLElement$LWS.prototype, HTMLElementBlockedProperties$LWS, initializers$LWS);
14803
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _HTMLIFrameElement$LWS.prototype, HTMLIFrameElementBlockedProperties$LWS, initializers$LWS);
14804
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, HTMLEmbedElement.prototype, HTMLEmbedElementBlockedProperties$LWS, initializers$LWS);
14805
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, HTMLObjectElement.prototype, HTMLObjectElementBlockedProperties$LWS, initializers$LWS);
14806
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _HTMLScriptElement$LWS.prototype, HTMLScriptElementBlockedProperties$LWS, initializers$LWS);
14807
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, _SVGElement$LWS.prototype, SVGElementBlockedProperties$LWS, initializers$LWS); // istanbul ignore else: this is a safety precaution that is unreachable via tests
15060
+ _distortions$LWS.set(location$LWS, location$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
14808
15061
 
14809
- if (typeof XSLTProcessor$LWS === 'function') {
14810
- createBlockedPropertyDistortionFactoryInitializers$LWS(_record$LWS, XSLTProcessor$LWS.prototype, XSLTProcessorBlockedProperties$LWS, initializers$LWS);
14811
- } // Reuse the `initializers` array as the `factories` array.
15062
+ if (!seenGlobalObjects$LWS.has(_globalObject$LWS)) {
15063
+ _distortions$LWS.set(_globalObject$LWS, _globalObject$LWS);
15064
+ } // Add opaque window postMessage distortion for the child window to the root
15065
+ // window's distortion map.
15066
+
15067
+
15068
+ const opaqueWindowPostMessageDistortionFactory$LWS = getOpaqueWindowPostMessageDistortionFactory$LWS(_record$LWS);
15069
+ const opaqueWindowPostMessageDistortionEntry$LWS = opaqueWindowPostMessageDistortionFactory$LWS(_record$LWS);
15070
+ const originalOpaqueWindowPostMessage$LWS = opaqueWindowPostMessageDistortionEntry$LWS[0];
15071
+ _distortions$LWS.set(originalOpaqueWindowPostMessage$LWS, proxyMaskFunctionDistortion$LWS(_record$LWS, opaqueWindowPostMessageDistortionFactory$LWS, opaqueWindowPostMessageDistortionEntry$LWS[1], originalOpaqueWindowPostMessage$LWS));
15072
+ sandboxRegistry$LWS[__key$LWS] = _record$LWS;
15073
+ return _record$LWS;
15074
+ }
15075
+
15076
+ function createSecondaryWindowSandboxRecord$LWS({
15077
+ globalObject: _globalObject$LWS,
15078
+ document: _document$LWS,
15079
+ context: _context$LWS = EMPTY_OBJECT$LWS,
15080
+ key: __key$LWS,
15081
+ type: _type$LWS = getDefaultType$LWS(__key$LWS)
15082
+ }, root$LWS) {
15083
+ const sandboxRegistry$LWS = getSandboxRegistry$LWS(_document$LWS);
15084
+ let _record$LWS = sandboxRegistry$LWS[__key$LWS];
15085
+
15086
+ if (_record$LWS) {
15087
+ return _record$LWS;
15088
+ }
14812
15089
 
15090
+ const {
15091
+ BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
15092
+ LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15093
+ LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15094
+ distortions: _distortions$LWS,
15095
+ instrumentation: instrumentation$LWS
15096
+ } = root$LWS;
15097
+ const {
15098
+ location: location$LWS
15099
+ } = _globalObject$LWS;
15100
+ const overrideDistortions$LWS = createDistortionMap$LWS();
15101
+ _record$LWS = {
15102
+ BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
15103
+ LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15104
+ LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15105
+ UNCOMPILED_CONTEXT: {
15106
+ [UNCOMPILED_LOCATION_NAME$LWS]: location$LWS,
15107
+ [UNCOMPILED_TOP_NAME$LWS]: _globalObject$LWS.top
15108
+ },
15109
+ context: _context$LWS,
15110
+ document: _document$LWS,
15111
+ distortions: overrideDistortions$LWS,
15112
+ endowments: EMPTY_OBJECT$LWS,
15113
+ globalObject: _globalObject$LWS,
15114
+ helpers: EMPTY_EVAL_HELPERS$LWS,
15115
+ instrumentation: instrumentation$LWS,
15116
+ key: __key$LWS,
15117
+ root: root$LWS,
15118
+ sandboxEvaluator: noop$LWS$1,
15119
+ trackAsFastTarget: noop$LWS$1,
15120
+ type: _type$LWS,
15121
+ virtualEnvironmentEvaluator: noop$LWS$1
15122
+ };
15123
+ const getVirtualEnvironment$LWS = createGetVirtualEnvironment$LWS(_record$LWS);
15124
+ _record$LWS.sandboxEvaluator = createSandboxEvaluator$LWS(_record$LWS);
15125
+ _record$LWS.trackAsFastTarget = createTrackAsFastTarget$LWS(getVirtualEnvironment$LWS);
15126
+ _record$LWS.virtualEnvironmentEvaluator = createVirtualEnvironmentEvaluator$LWS(_record$LWS, getVirtualEnvironment$LWS); // Fast path non-configurable document, location, and window objects in the
15127
+ // virtual environment distortion callback by adding them to the root window's
15128
+ // distortion map.
14813
15129
 
14814
- const _factories$LWS = initializers$LWS;
15130
+ _distortions$LWS.set(_document$LWS, _document$LWS);
15131
+ _distortions$LWS.set(location$LWS, location$LWS);
15132
+ const seenGlobalObject$LWS = seenGlobalObjects$LWS.has(_globalObject$LWS);
14815
15133
 
14816
- for (let _i$LWS = 0, {
14817
- length: _length$LWS
14818
- } = _factories$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14819
- _factories$LWS[_i$LWS] = initializers$LWS[_i$LWS](_record$LWS);
15134
+ if (!seenGlobalObject$LWS) {
15135
+ // WindowProxy object references don't change when the window location
15136
+ // changes.
15137
+ // https://developer.mozilla.org/en-US/docs/Glossary/WindowProxy
15138
+ _distortions$LWS.set(_globalObject$LWS, _globalObject$LWS);
14820
15139
  }
14821
15140
 
14822
- return _factories$LWS;
14823
- }
15141
+ const entries$LWS = createDistortionEntries$LWS(_record$LWS, getDistortionFactories$LWS(_record$LWS)); // Call `createAttributeDistortionFactories()` last because its factories
15142
+ // are populated by the other distortion factories.
14824
15143
 
14825
- function getEvaluationDistortionFactories$LWS(_record$LWS) {
14826
- const {
14827
- document: _document$LWS
14828
- } = _record$LWS;
14829
- let _factories$LWS = documentToEvaluationDistortionFactoriesMap$LWS.get(_document$LWS);
15144
+ createDistortionEntries$LWS(_record$LWS, createAttributeDistortionFactories$LWS(_record$LWS), entries$LWS);
14830
15145
 
14831
- if (_factories$LWS === undefined) {
15146
+ for (let _i$LWS = 0, {
15147
+ length: _length$LWS
15148
+ } = entries$LWS; _i$LWS < _length$LWS; _i$LWS += 1) {
14832
15149
  const {
14833
- length: _length$LWS
14834
- } = evaluationDistortionFactoryInitializers$LWS;
14835
- _factories$LWS = Array(_length$LWS);
14836
-
14837
- for (let _i$LWS = 0; _i$LWS < _length$LWS; _i$LWS += 1) {
14838
- _factories$LWS[_i$LWS] = evaluationDistortionFactoryInitializers$LWS[_i$LWS](_record$LWS);
14839
- }
14840
-
14841
- documentToEvaluationDistortionFactoriesMap$LWS.set(_document$LWS, _factories$LWS);
14842
- }
15150
+ 0: entryKey$LWS,
15151
+ 1: entryValue$LWS
15152
+ } = entries$LWS[_i$LWS]; // Add distortion to the root window's distortion map.
14843
15153
 
14844
- return _factories$LWS;
14845
- }
15154
+ _distortions$LWS.set(entryKey$LWS, entryValue$LWS);
15155
+ } // Add child window eval distortion to the root window's distortion map.
14846
15156
 
14847
- function getOpaqueDistortionFactories$LWS(_record$LWS) {
14848
- const {
14849
- globalObject: _globalObject$LWS
14850
- } = _record$LWS;
14851
- let _factories$LWS = opaqueToDistortionFactoriesMap$LWS.get(_globalObject$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
14852
15157
 
14853
- if (_factories$LWS === undefined) {
14854
- const {
14855
- length: _length$LWS
14856
- } = opaqueDistortionFactoryInitializers$LWS;
14857
- _factories$LWS = Array(_length$LWS);
15158
+ const evalDistortionFactory$LWS = getEvalDistortionFactory$LWS(_record$LWS);
15159
+ const evalDistortionEntry$LWS = evalDistortionFactory$LWS(_record$LWS);
15160
+ const _originalEval$LWS = evalDistortionEntry$LWS[0];
15161
+ _distortions$LWS.set(_originalEval$LWS, proxyMaskFunctionDistortion$LWS(_record$LWS, evalDistortionFactory$LWS, evalDistortionEntry$LWS[1], _originalEval$LWS)); // Add `originalEval` to the child window's distortion map so that the
15162
+ // undistorted `eval` is used in the child window's sandbox instead of the
15163
+ // distorted `eval`.
14858
15164
 
14859
- for (let _i$LWS = 0; _i$LWS < _length$LWS; _i$LWS += 1) {
14860
- _factories$LWS[_i$LWS] = opaqueDistortionFactoryInitializers$LWS[_i$LWS](_record$LWS);
14861
- }
15165
+ overrideDistortions$LWS.set(_originalEval$LWS, _originalEval$LWS);
15166
+ sandboxRegistry$LWS[__key$LWS] = _record$LWS;
14862
15167
 
14863
- opaqueToDistortionFactoriesMap$LWS.set(_globalObject$LWS, _factories$LWS);
15168
+ if (seenGlobalObject$LWS) {
15169
+ return _record$LWS;
14864
15170
  }
14865
15171
 
14866
- return _factories$LWS;
14867
- }
15172
+ seenGlobalObjects$LWS.add(_globalObject$LWS);
14868
15173
 
14869
- function getOpaqueSandboxRegistry$LWS(_globalObject$LWS) {
14870
- // Use the `document` as the key because a window object maintains its
14871
- // identity continuity when its location changes and while the
14872
- // non-configurable document property does not.
14873
- let sandboxRegistry$LWS = opaqueToSandboxRegistry$LWS.get(_globalObject$LWS); // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
15174
+ const onDOMContentLoadedOrWindowLoad$LWS = () => {
15175
+ try {
15176
+ // We don't need to use `WindowDocumentGetter()` because we know
15177
+ // this is a window object and the 'document' property is
15178
+ // non-configurable.
15179
+ const {
15180
+ document: newDocument$LWS
15181
+ } = _globalObject$LWS; // Ensure the document has changed before attempting to create a
15182
+ // sandbox record.
14874
15183
 
14875
- if (sandboxRegistry$LWS === undefined) {
14876
- sandboxRegistry$LWS = {
14877
- __proto__: null
14878
- };
14879
- opaqueToSandboxRegistry$LWS.set(_globalObject$LWS, sandboxRegistry$LWS);
14880
- }
15184
+ if (_document$LWS !== newDocument$LWS) {
15185
+ createSecondaryWindowSandboxRecord$LWS({
15186
+ context: EMPTY_OBJECT$LWS,
15187
+ document: newDocument$LWS,
15188
+ globalObject: _globalObject$LWS,
15189
+ key: __key$LWS,
15190
+ type: _type$LWS
15191
+ }, root$LWS);
15192
+ }
15193
+ } catch (_unused40$LWS) {
15194
+ // istanbul ignore next: this is a safety precaution that is unreachable via tests
15195
+ createOpaqueSecondaryWindowSandboxRecord$LWS({
15196
+ globalObject: _globalObject$LWS,
15197
+ key: __key$LWS,
15198
+ type: _type$LWS
15199
+ }, root$LWS);
15200
+ }
15201
+ };
14881
15202
 
14882
- return sandboxRegistry$LWS;
14883
- }
15203
+ const frameElement$LWS = ReflectApply$LWS$1(WindowFrameElementGetter$LWS, _globalObject$LWS, []);
14884
15204
 
14885
- function getSandboxRegistry$LWS(_document$LWS) {
14886
- // Use the `document` as the key because a window object maintains its
14887
- // identity continuity when its location changes and while the
14888
- // non-configurable document property does not.
14889
- let sandboxRegistry$LWS = documentToSandboxRegistry$LWS.get(_document$LWS);
15205
+ if (frameElement$LWS) {
15206
+ // Create a new sandbox record when the iframe window location changes.
15207
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, frameElement$LWS, ['load', onDOMContentLoadedOrWindowLoad$LWS, // useCapture
15208
+ true]);
15209
+ } else {
15210
+ // Create a new sandbox record when the opened window location changes.
15211
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event#usage_notes
15212
+ //
15213
+ // The 'unload' event handler is okay to use here under the assumption
15214
+ // that most `window.open()` calls are not done with the 'noopener'
15215
+ // option, so the back/forward cache (i.e. bfcache) is likely being
15216
+ // skipped anyways.
15217
+ // https://web.dev/bfcache/#avoid-window.opener-references
15218
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _globalObject$LWS, ['unload', function onWindowUnload$LWS() {
15219
+ WindowQueueMicrotask$LWS(() => {
15220
+ try {
15221
+ // Ensure the document has changed before adding event
15222
+ // listeners.
15223
+ const {
15224
+ document: newDocument$LWS
15225
+ } = _globalObject$LWS;
14890
15226
 
14891
- if (sandboxRegistry$LWS === undefined) {
14892
- sandboxRegistry$LWS = {
14893
- __proto__: null
14894
- };
14895
- documentToSandboxRegistry$LWS.set(_document$LWS, sandboxRegistry$LWS);
15227
+ if (_document$LWS !== newDocument$LWS) {
15228
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
15229
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, _globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
15230
+ }
15231
+ } catch (_unused41$LWS) {
15232
+ // istanbul ignore next: this is a safety precaution that is unreachable via tests
15233
+ createOpaqueSecondaryWindowSandboxRecord$LWS({
15234
+ globalObject: _globalObject$LWS,
15235
+ key: __key$LWS,
15236
+ type: _type$LWS
15237
+ }, root$LWS);
15238
+ }
15239
+ });
15240
+ }, // useCapture
15241
+ true]);
14896
15242
  }
14897
15243
 
14898
- return sandboxRegistry$LWS;
15244
+ return _record$LWS;
14899
15245
  }
14900
15246
 
14901
15247
  function internalEvaluateInSandbox$LWS(evaluateOptions$LWS) {
@@ -14942,12 +15288,12 @@ function internalEvaluateInSandbox$LWS(evaluateOptions$LWS) {
14942
15288
  const {
14943
15289
  rendererFactory: rendererFactory$LWS
14944
15290
  } = _context$LWS;
14945
- let sandboxedRenderer$LWS = rendererFactoryToRendererMap$LWS.get(rendererFactory$LWS); // istanbul ignore else: conditions for this to evaluate as false ARE tested (see integration-karma/test/sandboxes/lwc-renderer.spec.js, "produces same outcome when processed more than once"), however this path appears to _ALWAYS_ be taken. Needs further investigation
15291
+ let sandboxedRenderer$LWS = rendererFactoryToRendererCache$LWS.get(rendererFactory$LWS); // istanbul ignore else: conditions for this to evaluate as false ARE tested (see integration-karma/test/sandboxes/lwc-renderer.spec.js, "produces same outcome when processed more than once"), however this path appears to _ALWAYS_ be taken. Needs further investigation
14946
15292
 
14947
15293
  if (sandboxedRenderer$LWS === undefined) {
14948
15294
  sandboxedRenderer$LWS = virtualEnvironmentEvaluator$LWS(`'use strict';
14949
15295
  (${ReflectApply$LWS$1(FunctionProtoToString$LWS, rendererFactory$LWS, [])})`)(_context$LWS.renderer);
14950
- rendererFactoryToRendererMap$LWS.set(rendererFactory$LWS, sandboxedRenderer$LWS);
15296
+ rendererFactoryToRendererCache$LWS.set(rendererFactory$LWS, sandboxedRenderer$LWS);
14951
15297
  }
14952
15298
 
14953
15299
  _context$LWS.renderer = sandboxedRenderer$LWS;
@@ -14957,7 +15303,7 @@ function internalEvaluateInSandbox$LWS(evaluateOptions$LWS) {
14957
15303
  setEvalContext$LWS(_context$LWS);
14958
15304
  }
14959
15305
 
14960
- if (helpers$LWS !== EMPTY_HELPERS$LWS) {
15306
+ if (helpers$LWS !== EMPTY_EVAL_HELPERS$LWS) {
14961
15307
  setEvalHelpers$LWS(helpers$LWS);
14962
15308
  }
14963
15309
 
@@ -14997,110 +15343,6 @@ function internalEvaluateInSandbox$LWS(evaluateOptions$LWS) {
14997
15343
  return _result$LWS;
14998
15344
  }
14999
15345
 
15000
- function proxyWrapFunctionDistortion$LWS({
15001
- BASIC_INSTRUMENTATION_DATA: BASIC_INSTRUMENTATION_DATA$LWS,
15002
- LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15003
- LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG: LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS,
15004
- instrumentation: instrumentation$LWS,
15005
- key: __key$LWS
15006
- }, factoryName$LWS, originalFunc$LWS, distortedFunc$LWS) {
15007
- const activityName$LWS = LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS ? factoryName$LWS ? ReflectApply$LWS$1(StringProtoReplace$LWS, factoryName$LWS, [LOCKER_IDENTIFIER_MARKER$LWS$1, '']) :
15008
- /* istanbul ignore next: currently unreachable via tests */
15009
- '<unknown>' : undefined;
15010
- const startActivity$LWS = LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS ? instrumentation$LWS.startActivity : undefined;
15011
- const _proxy$LWS = new ProxyCtor$LWS(originalFunc$LWS, ObjectFreeze$LWS$1({
15012
- apply(__target$LWS, thisArg$LWS, _args$LWS) {
15013
- // istanbul ignore if: this is a safety precaution that is unreachable via tests
15014
- if (thisArg$LWS === _proxy$LWS) {
15015
- thisArg$LWS = distortedFunc$LWS;
15016
- }
15017
-
15018
- let activity$LWS; // istanbul ignore if: this is a safety precaution that is unreachable via tests
15019
-
15020
- if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
15021
- activity$LWS = startActivity$LWS(activityName$LWS, BASIC_INSTRUMENTATION_DATA$LWS);
15022
- }
15023
-
15024
- try {
15025
- return ReflectApply$LWS$1(distortedFunc$LWS, thisArg$LWS, _args$LWS);
15026
- } catch (error) {
15027
- // istanbul ignore if: this is a safety precaution that is unreachable via tests
15028
- if (LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
15029
- activity$LWS.error({
15030
- sandboxKey: __key$LWS,
15031
- error
15032
- });
15033
- }
15034
-
15035
- throw error;
15036
- } finally {
15037
- // istanbul ignore if: this is a safety precaution that is unreachable via tests
15038
- if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
15039
- activity$LWS.stop();
15040
- }
15041
- }
15042
- },
15043
-
15044
- construct(__target$LWS, _args$LWS, newTarget$LWS) {
15045
- // istanbul ignore else: no non-matching path found via tests
15046
- if (newTarget$LWS === _proxy$LWS) {
15047
- newTarget$LWS = distortedFunc$LWS;
15048
- }
15049
-
15050
- let activity$LWS; // istanbul ignore if: this is a safety precaution that is unreachable via tests
15051
-
15052
- if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
15053
- activity$LWS = startActivity$LWS(activityName$LWS, BASIC_INSTRUMENTATION_DATA$LWS);
15054
- }
15055
-
15056
- try {
15057
- return ReflectConstruct$LWS(distortedFunc$LWS, _args$LWS, newTarget$LWS);
15058
- } catch (error) {
15059
- // istanbul ignore if: this is a safety precaution that is unreachable via tests
15060
- if (LOCKER_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
15061
- activity$LWS.error({
15062
- sandboxKey: __key$LWS,
15063
- error
15064
- });
15065
- }
15066
-
15067
- throw error;
15068
- } finally {
15069
- // istanbul ignore if: this is a safety precaution that is unreachable via tests
15070
- if (LOCKER_VERBOSE_DEBUG_MODE_INSTRUMENTATION_FLAG$LWS) {
15071
- activity$LWS.stop();
15072
- }
15073
- }
15074
- }
15075
-
15076
- }));
15077
- return _proxy$LWS;
15078
- }
15079
-
15080
- function setEvalContext$LWS(evalContext$LWS) {
15081
- lockerEvalContextValue$LWS = evalContext$LWS;
15082
- }
15083
-
15084
- function setEvalHelpers$LWS(evalHelpers$LWS) {
15085
- lockerEvalHelpersValue$LWS = evalHelpers$LWS;
15086
- }
15087
-
15088
- function toSourceText$LWS(__value$LWS, sourceType$LWS) {
15089
- let _sourceText$LWS = typeof __value$LWS === 'function' ? extractFunctionBodySource$LWS(__value$LWS) : toString$LWS(__value$LWS); // We workaround bundlers, like Rollup, aggressively stripping inline source
15090
- // maps by compiling them with the name "sandboxMappingURL". At runtime the
15091
- // name is changed so the inline source map is registered.
15092
-
15093
- _sourceText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, _sourceText$LWS, [// This regexp looks involved, but it prevents browsers and developer
15094
- // tools from mistaking the regexp or the replacement string for an
15095
- // actual source mapping URL.
15096
- /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
15097
- return sourceType$LWS === 1
15098
- /* SourceType.Module */
15099
- && indexOfPragma$LWS(_sourceText$LWS, 'use strict') === -1 ? // Append "'use strict'" to the extracted function body so it is
15100
- // evaluated in strict mode.
15101
- `'use strict';${_sourceText$LWS}` : _sourceText$LWS;
15102
- }
15103
-
15104
15346
  function evaluateInSandbox$LWS(__key$LWS, source$LWS, _context$LWS = EMPTY_OBJECT$LWS, endowments$LWS = EMPTY_OBJECT$LWS, instrumentation$LWS = EMPTY_OBJECT$LWS, verboseInstrumentation$LWS = false) {
15105
15347
  return internalEvaluateInSandbox$LWS({
15106
15348
  context: _context$LWS,
@@ -15118,8 +15360,73 @@ function evaluateInSandbox$LWS(__key$LWS, source$LWS, _context$LWS = EMPTY_OBJEC
15118
15360
  ,
15119
15361
  verboseInstrumentation: verboseInstrumentation$LWS
15120
15362
  });
15363
+ } // Options must be an object.
15364
+ // And must define at a minimum an `lwsKey` property.
15365
+
15366
+
15367
+ function parseOptions$LWS(_providedOptions$LWS) {
15368
+ if (typeof _providedOptions$LWS === 'object' && _providedOptions$LWS !== null) {
15369
+ const {
15370
+ lwsKey: lwsKey$LWS,
15371
+ targetElement: targetElement$LWS
15372
+ } = _providedOptions$LWS;
15373
+
15374
+ if (typeof lwsKey$LWS === 'string') {
15375
+ return {
15376
+ lwsKey: lwsKey$LWS,
15377
+ targetElement: targetElement$LWS
15378
+ };
15379
+ }
15380
+ }
15381
+
15382
+ return undefined;
15121
15383
  }
15122
15384
 
15385
+ const policyOptions$LWS = {
15386
+ __proto__: null,
15387
+ // Reject anything for createHTML until further requirements.
15388
+ createHTML: (_content$LWS, _providedOptions$LWS) => new StringCtor$LWS$1(''),
15389
+ // Defines the createScriptURL hook.
15390
+ createScriptURL: (_url$LWS, _providedOptions$LWS) => {
15391
+ const options$LWS = parseOptions$LWS(_providedOptions$LWS);
15392
+
15393
+ if (options$LWS) {
15394
+ const {
15395
+ lwsKey: lwsKey$LWS,
15396
+ targetElement: targetElement$LWS
15397
+ } = options$LWS;
15398
+ const isHTMLScriptElement$LWS = targetElement$LWS instanceof HTMLScriptElement;
15399
+
15400
+ if (isHTMLScriptElement$LWS || targetElement$LWS instanceof SVGScriptElement) {
15401
+ const {
15402
+ distortions: _distortions$LWS
15403
+ } = createRootWindowSandboxRecord$LWS({
15404
+ key: lwsKey$LWS
15405
+ });
15406
+ defineScriptAccessorProperty$LWS(targetElement$LWS, 'textContent', _distortions$LWS.get(NodeProtoTextContentGetter$LWS), // When triggered this setter distortion overwrites the
15407
+ // `targetElement` setter with the original setter from
15408
+ // `Node.prototype`. This property is removed during the
15409
+ // evaluation flow.
15410
+ _distortions$LWS.get(NodeProtoTextContentSetter$LWS));
15411
+ defineScriptAccessorProperty$LWS(targetElement$LWS, isHTMLScriptElement$LWS ? 'src' : 'href', _distortions$LWS.get(isHTMLScriptElement$LWS ? HTMLScriptElementProtoSrcGetter$LWS : SVGScriptElementProtoHrefGetter$LWS), // When triggered this setter distortion overwrites the
15412
+ // `targetElement` setter with the original setter from
15413
+ // `HTMLScriptElement.prototype` or `SVGScriptElement.prototype`.
15414
+ // This property is removed during the evaluation flow.
15415
+ _distortions$LWS.get(isHTMLScriptElement$LWS ? HTMLScriptElementProtoSrcSetter$LWS : SVGScriptElementProtoHrefSetter$LWS));
15416
+ return new StringCtor$LWS$1(_url$LWS);
15417
+ }
15418
+ }
15419
+
15420
+ return new StringCtor$LWS$1('');
15421
+ },
15422
+ // Reject anything for createScript until further requirements.
15423
+ createScript: (_sourceText$LWS, _providedOptions$LWS) => new StringCtor$LWS$1('')
15424
+ }; // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
15425
+
15426
+ // @ts-ignore: Prevent cannot find name 'trustedTypes' error.
15427
+ typeof trustedTypes === 'undefined' ? policyOptions$LWS : // @ts-ignore: Prevent cannot find name 'trustedTypes' error.
15428
+ trustedTypes.createPolicy('locker', policyOptions$LWS);
15429
+
15123
15430
  const loaderDefine = globalThis.LWR.define;
15124
15431
  /**
15125
15432
  * Mark an exports object as "live", see https://github.com/caridy/secure-javascript-environment/pull/87.