@mjhls/mjh-framework 1.0.883 → 1.0.884-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -168
- package/dist/cjs/AD.js +1 -1
- package/dist/cjs/AD300x250.js +11 -11
- package/dist/cjs/AD300x250x600.js +11 -11
- package/dist/cjs/AD728x90.js +12 -12
- package/dist/cjs/ADFloatingFooter.js +10 -10
- package/dist/cjs/ADFooter.js +3 -3
- package/dist/cjs/ADGutter.js +10 -10
- package/dist/cjs/{ADInfeed-4f661172.js → ADInfeed-2e48af77.js} +1 -1
- package/dist/cjs/ADSkyscraper.js +10 -10
- package/dist/cjs/ADSponsoredResources.js +10 -10
- package/dist/cjs/ADWebcast.js +10 -10
- package/dist/cjs/ADWelcome.js +10 -10
- package/dist/cjs/{ADlgInfeed-6242e5b5.js → ADlgInfeed-c39c7131.js} +1 -1
- package/dist/cjs/AccordionPanel.js +4 -4
- package/dist/cjs/AdSlot.js +10 -10
- package/dist/cjs/AdSlotsProvider.js +903 -10
- package/dist/cjs/AlgoliaSearch.js +264 -391
- package/dist/cjs/AlphabeticList.js +6 -6
- package/dist/cjs/ArticleCarousel.js +6 -6
- package/dist/cjs/ArticleProgramLandingPage.js +28 -28
- package/dist/cjs/ArticleSeriesLandingPage.js +24 -24
- package/dist/cjs/ArticleSeriesListing.js +16 -16
- package/dist/cjs/Auth.js +1297 -469
- package/dist/cjs/AuthWrapper.js +390 -1697
- package/dist/cjs/{AuthorComponent-421d5ec1.js → AuthorComponent-02e827ae.js} +1 -1
- package/dist/cjs/Beam.js +5 -5
- package/dist/cjs/{BlockContent-bac780ac.js → BlockContent-091a991f.js} +1 -1
- package/dist/cjs/Breadcrumbs.js +3 -3
- package/dist/cjs/CMEDeck.js +12 -12
- package/dist/cjs/Column2.js +6 -6
- package/dist/cjs/Column3.js +14 -14
- package/dist/cjs/ConferenceArticleCard.js +20 -20
- package/dist/cjs/ContentCardPaginated.js +409 -0
- package/dist/cjs/DeckContent.js +30 -30
- package/dist/cjs/DeckQueue.js +19 -19
- package/dist/cjs/DeckQueuePaginated.js +340 -0
- package/dist/cjs/{Dfp-ab12cd55.js → Dfp-f492f985.js} +8 -8
- package/dist/cjs/EventsDeck.js +31 -31
- package/dist/cjs/ExternalResources.js +25 -25
- package/dist/cjs/Feature.js +6 -6
- package/dist/cjs/ForbesHero.js +6 -6
- package/dist/cjs/GridContent.js +30 -142
- package/dist/cjs/GridContentPaginated.js +699 -0
- package/dist/cjs/GridHero.js +7 -7
- package/dist/cjs/GroupDeck.js +6 -6
- package/dist/cjs/HamMagazine.js +23 -23
- package/dist/cjs/Hero.js +5 -5
- package/dist/cjs/HighlightenVideo.js +1 -1
- package/dist/cjs/HorizontalArticleListing.js +24 -24
- package/dist/cjs/HorizontalHero.js +6 -6
- package/dist/cjs/ImageSlider-38f25e66.js +3989 -0
- package/dist/cjs/IssueContentDeck.js +6 -6
- package/dist/cjs/IssueDeck.js +8 -8
- package/dist/cjs/IssueLanding.js +58 -58
- package/dist/cjs/KMTracker.js +15 -15
- package/dist/cjs/LeftNav.js +10 -10
- package/dist/cjs/MasterDeck.js +30 -30
- package/dist/cjs/MasterDeckPaginated.js +444 -0
- package/dist/cjs/MediaSeriesCard-8d27612b.js +9411 -0
- package/dist/cjs/MediaSeriesLanding.js +57 -9538
- package/dist/cjs/MediaSeriesLandingPaginated.js +522 -0
- package/dist/cjs/NavDvm.js +5 -5
- package/dist/cjs/NavMagazine.js +22 -22
- package/dist/cjs/NavNative.js +19 -19
- package/dist/cjs/OncliveHero.js +6 -5
- package/dist/cjs/OncliveLargeHero.js +7 -7
- package/dist/cjs/PageFilter.js +3 -3
- package/dist/cjs/Pagination-2f76381b.js +51 -0
- package/dist/cjs/PartnerDetailListing.js +41 -2939
- package/dist/cjs/PartnerDetailListingPaginated.js +312 -0
- package/dist/cjs/PdfDownload.js +1 -1
- package/dist/cjs/PopUpModal.js +3 -3
- package/dist/cjs/PubSection.js +19 -19
- package/dist/cjs/PubToc.js +5 -5
- package/dist/cjs/PublicationDeck.js +5 -5
- package/dist/cjs/PublicationFeature-28c549f2.js +126 -0
- package/dist/cjs/PublicationLanding.js +34 -34
- package/dist/cjs/QueueDeckExpanded.js +21 -21
- package/dist/cjs/QueueDeckExpandedPaginated.js +1378 -0
- package/dist/cjs/RecentNews.js +1 -1
- package/dist/cjs/RelatedContent.js +33 -33
- package/dist/cjs/RelatedTopicsDropdown.js +10 -10
- package/dist/cjs/Search.js +3 -3
- package/dist/cjs/Segment.js +4 -4
- package/dist/cjs/SeriesListingDeck.js +10 -10
- package/dist/cjs/{SeriesSlider-372e418f.js → SeriesSlider-49b81b0b.js} +11 -11
- package/dist/cjs/SideFooter.js +8 -8
- package/dist/cjs/{SocialSearchComponent-80a2130a.js → SocialSearchComponent-e8477ca3.js} +7 -7
- package/dist/cjs/TaxonomyCard.js +6 -6
- package/dist/cjs/TaxonomyDescription.js +24 -24
- package/dist/cjs/TemplateNormal.js +16 -16
- package/dist/cjs/ThumbnailCard.js +5 -5
- package/dist/cjs/Ustream.js +10 -10
- package/dist/cjs/VerticalHero.js +5 -5
- package/dist/cjs/VideoProgramLandingPage.js +27 -27
- package/dist/cjs/VideoSeriesCard.js +9 -9
- package/dist/cjs/VideoSeriesFilter.js +5 -5
- package/dist/cjs/VideoSeriesLandingPage.js +25 -25
- package/dist/cjs/VideoSeriesListing.js +16 -16
- package/dist/cjs/View.js +63 -63
- package/dist/cjs/YahooHero.js +7 -7
- package/dist/cjs/YoutubeGroup.js +14 -14
- package/dist/cjs/{_is-array-bd978497.js → _is-array-aa52fa1e.js} +1 -1
- package/dist/cjs/{_iter-detect-ee3d4802.js → _iter-detect-05795553.js} +1 -1
- package/dist/cjs/{_object-sap-fee50a62.js → _object-sap-171b9ea5.js} +1 -1
- package/dist/cjs/{_object-to-array-18379aba.js → _object-to-array-9bac8737.js} +1 -1
- package/dist/cjs/{asyncToGenerator-15014394.js → asyncToGenerator-df19209d.js} +3 -3
- package/dist/cjs/{brightcove-react-player-loader.es-05029198.js → brightcove-react-player-loader.es-156bd4d6.js} +3 -4
- package/dist/cjs/{core.get-iterator-method-5cb3af28.js → core.get-iterator-method-f3c44602.js} +2 -2
- package/dist/cjs/{debounce-6191c8ee.js → debounce-529c8d06.js} +1 -1
- package/dist/cjs/{define-property-530a5e9e.js → define-property-21887c62.js} +1 -1
- package/dist/cjs/{defineProperty-5ca424cd.js → defineProperty-77a37684.js} +1 -1
- package/dist/cjs/{entities-fb0c6568.js → entities-310b46ee.js} +0 -4
- package/dist/cjs/{extends-1d905ddb.js → extends-eed4f016.js} +1 -1
- package/dist/cjs/faundadb.js +19 -19
- package/dist/cjs/getRelatedArticle.js +4 -4
- package/dist/cjs/getRootDocGroup.js +6 -6
- package/dist/cjs/getSerializers.js +24 -24
- package/dist/cjs/getSeriesDetail.js +3 -0
- package/dist/cjs/{getTargeting-41f2f52d.js → getTargeting-8874437b.js} +11 -11
- package/dist/cjs/getTargeting.js +5 -5
- package/dist/cjs/{index-79eed652.js → index-3294d3bc.js} +40 -39
- package/dist/cjs/{index-27377172.js → index-54adcbc3.js} +498 -514
- package/dist/cjs/{index-ff69979f.js → index-be0c82be.js} +22 -28
- package/dist/cjs/{index-53e27416.js → index-e2e62963.js} +9 -25
- package/dist/cjs/{index.es-e9d84959.js → index.es-9110add6.js} +5 -23
- package/dist/cjs/{index.esm-bf016399.js → index.esm-4d410430.js} +3 -2
- package/dist/cjs/{index.esm-974f47d9.js → index.esm-90433435.js} +15 -6
- package/dist/cjs/{index.esm-44f3e2d0.js → index.esm-e32d3e8e.js} +6 -3
- package/dist/cjs/{index.esm-05850a2f.js → index.esm-ff47db6f.js} +12 -5
- package/dist/cjs/index.js +43 -43
- package/dist/cjs/{inherits-337c73a7.js → inherits-12d44cca.js} +8 -8
- package/dist/cjs/inherits-8d29278d.js +110 -0
- package/dist/cjs/{keys-91f31941.js → keys-d207942e.js} +2 -2
- package/dist/cjs/{lodash-b5e0d5f6.js → lodash-fc2922d0.js} +30 -127
- package/dist/cjs/main-02daeefe.js +862 -0
- package/dist/cjs/{md5-e1ca5797.js → md5-5039b1a6.js} +1 -1
- package/dist/cjs/{moment-ca3bd9fb.js → moment-575fe24c.js} +8 -10
- package/dist/cjs/{slicedToArray-0a78cdf3.js → slicedToArray-f6d4eaa8.js} +2 -2
- package/dist/cjs/{stringify-13405ce2.js → stringify-bbc68047.js} +1 -1
- package/dist/cjs/timeDifferenceCalc.js +1 -1
- package/dist/cjs/{toConsumableArray-39fd0757.js → toConsumableArray-c9b8a0d0.js} +2 -2
- package/dist/cjs/{toNumber-f2f8744b.js → toNumber-36d1e7e5.js} +4 -39
- package/dist/cjs/{typeof-3dd6d3df.js → typeof-5f52cf64.js} +3 -3
- package/dist/cjs/urlFor.js +4 -4
- package/dist/cjs/{ustream-api-5619c1fa.js → ustream-api-9ebe112f.js} +4 -4
- package/dist/cjs/{web.dom.iterable-a9359910.js → web.dom.iterable-e34bf324.js} +1 -1
- package/dist/esm/AD.js +1 -1
- package/dist/esm/AD300x250.js +11 -11
- package/dist/esm/AD300x250x600.js +11 -11
- package/dist/esm/AD728x90.js +12 -12
- package/dist/esm/ADFloatingFooter.js +10 -10
- package/dist/esm/ADFooter.js +3 -3
- package/dist/esm/ADGutter.js +10 -10
- package/dist/esm/{ADInfeed-7db96917.js → ADInfeed-d767ebe2.js} +3 -3
- package/dist/esm/ADSkyscraper.js +10 -10
- package/dist/esm/ADSponsoredResources.js +10 -10
- package/dist/esm/ADWebcast.js +10 -10
- package/dist/esm/ADWelcome.js +10 -10
- package/dist/esm/{ADlgInfeed-a3931e68.js → ADlgInfeed-cee95aa2.js} +1 -1
- package/dist/esm/AccordionPanel.js +4 -4
- package/dist/esm/AdSlot.js +10 -10
- package/dist/esm/AdSlotsProvider.js +905 -13
- package/dist/esm/AlgoliaSearch.js +32 -159
- package/dist/esm/AlphabeticList.js +6 -6
- package/dist/esm/ArticleCarousel.js +6 -6
- package/dist/esm/ArticleProgramLandingPage.js +25 -25
- package/dist/esm/ArticleSeriesLandingPage.js +22 -22
- package/dist/esm/ArticleSeriesListing.js +18 -18
- package/dist/esm/Auth.js +1297 -469
- package/dist/esm/AuthWrapper.js +385 -1692
- package/dist/esm/{AuthorComponent-2277b67c.js → AuthorComponent-e6f95c2f.js} +1 -1
- package/dist/esm/Beam.js +5 -5
- package/dist/esm/{BlockContent-ea93e8f7.js → BlockContent-e9b4ddcf.js} +1 -1
- package/dist/esm/Breadcrumbs.js +3 -3
- package/dist/esm/CMEDeck.js +12 -12
- package/dist/esm/Column1.js +4 -4
- package/dist/esm/Column2.js +11 -11
- package/dist/esm/Column3.js +20 -20
- package/dist/esm/ConferenceArticleCard.js +20 -20
- package/dist/esm/ContentCardPaginated.js +403 -0
- package/dist/esm/DeckContent.js +45 -45
- package/dist/esm/DeckQueue.js +37 -37
- package/dist/esm/DeckQueuePaginated.js +334 -0
- package/dist/esm/{Dfp-d6a5629f.js → Dfp-f867d061.js} +5 -5
- package/dist/esm/EventsDeck.js +57 -57
- package/dist/esm/ExternalResources.js +27 -27
- package/dist/esm/Feature.js +6 -6
- package/dist/esm/ForbesHero.js +6 -6
- package/dist/esm/GridContent.js +64 -176
- package/dist/esm/GridContentPaginated.js +693 -0
- package/dist/esm/GridHero.js +7 -7
- package/dist/esm/GroupDeck.js +6 -6
- package/dist/esm/HamMagazine.js +26 -26
- package/dist/esm/Hero.js +5 -5
- package/dist/esm/HighlightenVideo.js +1 -1
- package/dist/esm/HorizontalArticleListing.js +24 -24
- package/dist/esm/HorizontalHero.js +6 -6
- package/dist/esm/ImageSlider-a3154b97.js +3980 -0
- package/dist/esm/IssueContentDeck.js +20 -20
- package/dist/esm/IssueDeck.js +30 -30
- package/dist/esm/IssueLanding.js +58 -58
- package/dist/esm/KMTracker.js +15 -15
- package/dist/esm/LeftNav.js +10 -10
- package/dist/esm/MasterDeck.js +33 -33
- package/dist/esm/MasterDeckPaginated.js +438 -0
- package/dist/esm/MediaSeriesCard-1dd7eae8.js +9403 -0
- package/dist/esm/MediaSeriesLanding.js +53 -9533
- package/dist/esm/MediaSeriesLandingPaginated.js +517 -0
- package/dist/esm/NavDvm.js +8 -8
- package/dist/esm/NavMagazine.js +25 -25
- package/dist/esm/NavNative.js +24 -24
- package/dist/esm/OncliveHero.js +6 -5
- package/dist/esm/OncliveLargeHero.js +7 -7
- package/dist/esm/PageFilter.js +3 -3
- package/dist/esm/Pagination-c0db7ca1.js +46 -0
- package/dist/esm/PartnerDetailListing.js +39 -2936
- package/dist/esm/PartnerDetailListingPaginated.js +307 -0
- package/dist/esm/PdfDownload.js +1 -1
- package/dist/esm/PopUpModal.js +3 -3
- package/dist/esm/PubSection.js +19 -19
- package/dist/esm/PubToc.js +5 -5
- package/dist/esm/PublicationDeck.js +23 -23
- package/dist/esm/PublicationFeature-fa24dedb.js +121 -0
- package/dist/esm/PublicationLanding.js +56 -56
- package/dist/esm/QueueDeckExpanded.js +21 -21
- package/dist/esm/QueueDeckExpandedPaginated.js +1372 -0
- package/dist/esm/RecentNews.js +1 -1
- package/dist/esm/RelatedContent.js +33 -33
- package/dist/esm/RelatedTopicsDropdown.js +10 -10
- package/dist/esm/RolesDeck.js +12 -12
- package/dist/esm/Search.js +5 -5
- package/dist/esm/Segment.js +4 -4
- package/dist/esm/SeriesListingDeck.js +10 -10
- package/dist/esm/{SeriesSlider-88c4133d.js → SeriesSlider-ce19fa25.js} +11 -11
- package/dist/esm/SideFooter.js +8 -8
- package/dist/esm/{SocialSearchComponent-7f3d6531.js → SocialSearchComponent-dca69151.js} +10 -10
- package/dist/esm/TaxonomyCard.js +22 -22
- package/dist/esm/TaxonomyDescription.js +24 -24
- package/dist/esm/TemplateNormal.js +19 -19
- package/dist/esm/ThumbnailCard.js +5 -5
- package/dist/esm/Ustream.js +10 -10
- package/dist/esm/VerticalHero.js +5 -5
- package/dist/esm/VideoProgramLandingPage.js +30 -30
- package/dist/esm/VideoSeriesCard.js +8 -8
- package/dist/esm/VideoSeriesFilter.js +5 -5
- package/dist/esm/VideoSeriesLandingPage.js +22 -22
- package/dist/esm/VideoSeriesListing.js +19 -19
- package/dist/esm/View.js +38 -38
- package/dist/esm/YahooHero.js +7 -7
- package/dist/esm/YoutubeGroup.js +14 -14
- package/dist/esm/{_is-array-8914b83f.js → _is-array-4df618a6.js} +1 -1
- package/dist/esm/{_iter-detect-13e31915.js → _iter-detect-130ee549.js} +1 -1
- package/dist/esm/{_object-sap-fc9da7e8.js → _object-sap-8b8ea5a9.js} +1 -1
- package/dist/esm/{_object-to-array-ee8f6d98.js → _object-to-array-c54dd835.js} +1 -1
- package/dist/esm/{asyncToGenerator-40371743.js → asyncToGenerator-7bf8bc4d.js} +3 -3
- package/dist/esm/{brightcove-react-player-loader.es-e761d404.js → brightcove-react-player-loader.es-83f53e4e.js} +3 -4
- package/dist/esm/{core.get-iterator-method-0fb60d94.js → core.get-iterator-method-86d4db69.js} +2 -2
- package/dist/esm/{debounce-89969f66.js → debounce-9207d8ee.js} +1 -1
- package/dist/esm/{define-property-73034847.js → define-property-6d26cb48.js} +1 -1
- package/dist/esm/{defineProperty-e66a2c7c.js → defineProperty-d7d9b577.js} +1 -1
- package/dist/esm/{entities-731f3fdb.js → entities-7cc3bf45.js} +0 -4
- package/dist/esm/{extends-9a61581c.js → extends-5b1796d4.js} +1 -1
- package/dist/esm/faundadb.js +5 -5
- package/dist/esm/getRelatedArticle.js +4 -4
- package/dist/esm/getRootDocGroup.js +4 -4
- package/dist/esm/getSerializers.js +24 -24
- package/dist/esm/getSeriesDetail.js +3 -0
- package/dist/esm/{getTargeting-e6820763.js → getTargeting-277c801e.js} +11 -11
- package/dist/esm/getTargeting.js +5 -5
- package/dist/esm/{index-f7fdcc91.js → index-73819142.js} +22 -28
- package/dist/esm/{index-637e8f49.js → index-aaa2dae0.js} +10 -25
- package/dist/esm/{index-afb3bbc2.js → index-d1476645.js} +517 -533
- package/dist/esm/{index-511bdaa5.js → index-ef6d5dcf.js} +40 -39
- package/dist/esm/{index.es-a6137319.js → index.es-29c1cef5.js} +5 -23
- package/dist/esm/{index.esm-3fdda599.js → index.esm-29e48d38.js} +15 -6
- package/dist/esm/{index.esm-a8ff922c.js → index.esm-cf08bf18.js} +12 -5
- package/dist/esm/{index.esm-c6715e80.js → index.esm-f8aaeeeb.js} +6 -3
- package/dist/esm/{index.esm-ed50151c.js → index.esm-fd746768.js} +3 -2
- package/dist/esm/index.js +48 -48
- package/dist/esm/{inherits-eeaf6740.js → inherits-2409637d.js} +4 -4
- package/dist/esm/inherits-77d5e4fc.js +101 -0
- package/dist/esm/{keys-a5ffafe7.js → keys-69989821.js} +2 -2
- package/dist/esm/{lodash-a818d390.js → lodash-17fdfebb.js} +30 -127
- package/dist/esm/main-c0612122.js +851 -0
- package/dist/esm/{md5-4e42248e.js → md5-9be0e905.js} +1 -1
- package/dist/esm/{moment-b6f49411.js → moment-e2f9b20c.js} +8 -10
- package/dist/esm/{slicedToArray-9c3bb613.js → slicedToArray-67a08c9c.js} +2 -2
- package/dist/esm/{stringify-ebc16384.js → stringify-70b72959.js} +1 -1
- package/dist/esm/timeDifferenceCalc.js +1 -1
- package/dist/esm/{toConsumableArray-e333293f.js → toConsumableArray-32282905.js} +2 -2
- package/dist/esm/{toNumber-e3dcad26.js → toNumber-2f7a84cd.js} +4 -39
- package/dist/esm/{typeof-938ae770.js → typeof-c05a82ba.js} +3 -3
- package/dist/esm/urlFor.js +4 -4
- package/dist/esm/{ustream-api-d325d196.js → ustream-api-4c4fe0ba.js} +4 -4
- package/dist/esm/{web.dom.iterable-6b037ff9.js → web.dom.iterable-f8f967cd.js} +1 -1
- package/package.json +112 -111
- package/dist/cjs/main-bc7d4bf8.js +0 -972
- package/dist/esm/main-ede573ee.js +0 -961
package/dist/cjs/Auth.js
CHANGED
|
@@ -5,26 +5,25 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
|
|
8
|
-
require('./core.get-iterator-method-
|
|
8
|
+
require('./core.get-iterator-method-f3c44602.js');
|
|
9
9
|
require('./_library-dd23b178.js');
|
|
10
|
-
require('./_iter-detect-
|
|
10
|
+
require('./_iter-detect-05795553.js');
|
|
11
11
|
require('./_object-pie-68c5bcbc.js');
|
|
12
|
-
var _extends = require('./extends-
|
|
13
|
-
require('./web.dom.iterable-
|
|
12
|
+
var _extends$1 = require('./extends-eed4f016.js');
|
|
13
|
+
require('./web.dom.iterable-e34bf324.js');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var React__default = _interopDefault(React);
|
|
16
16
|
var Router = require('next/router');
|
|
17
17
|
var Router__default = _interopDefault(Router);
|
|
18
|
-
var slicedToArray = require('./slicedToArray-
|
|
19
|
-
var stringify = require('./stringify-
|
|
20
|
-
var asyncToGenerator = require('./asyncToGenerator-
|
|
18
|
+
var slicedToArray = require('./slicedToArray-f6d4eaa8.js');
|
|
19
|
+
var stringify = require('./stringify-bbc68047.js');
|
|
20
|
+
var asyncToGenerator = require('./asyncToGenerator-df19209d.js');
|
|
21
21
|
var reactBootstrap = require('react-bootstrap');
|
|
22
22
|
var util = require('./util-f2c1b65b.js');
|
|
23
23
|
var index$6 = require('./index-bd6c9f56.js');
|
|
24
|
-
var useSWR = _interopDefault(require('swr'));
|
|
25
24
|
var Local = _interopDefault(require('passport-local'));
|
|
26
25
|
var mysql = _interopDefault(require('mysql'));
|
|
27
|
-
var md5 = require('./md5-
|
|
26
|
+
var md5 = require('./md5-5039b1a6.js');
|
|
28
27
|
|
|
29
28
|
var returnFormField = function returnFormField(_ref) {
|
|
30
29
|
var name = _ref.name,
|
|
@@ -65,7 +64,7 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
65
64
|
if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
|
|
66
65
|
return React__default.createElement(
|
|
67
66
|
reactBootstrap.Form.Group,
|
|
68
|
-
_extends._extends({}, opts, { controlId: name }),
|
|
67
|
+
_extends$1._extends({}, opts, { controlId: name }),
|
|
69
68
|
React__default.createElement(
|
|
70
69
|
reactBootstrap.Form.Label,
|
|
71
70
|
{ kye: name + '_label' },
|
|
@@ -87,7 +86,7 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
87
86
|
if (type == 'select') {
|
|
88
87
|
return React__default.createElement(
|
|
89
88
|
reactBootstrap.Form.Group,
|
|
90
|
-
_extends._extends({}, opts, { key: name, controlId: name }),
|
|
89
|
+
_extends$1._extends({}, opts, { key: name, controlId: name }),
|
|
91
90
|
React__default.createElement(
|
|
92
91
|
reactBootstrap.Form.Label,
|
|
93
92
|
{ key: name + '_' + label },
|
|
@@ -142,6 +141,1055 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
142
141
|
}
|
|
143
142
|
};
|
|
144
143
|
|
|
144
|
+
var has = Object.prototype.hasOwnProperty;
|
|
145
|
+
|
|
146
|
+
function dequal(foo, bar) {
|
|
147
|
+
var ctor, len;
|
|
148
|
+
if (foo === bar) return true;
|
|
149
|
+
|
|
150
|
+
if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
|
|
151
|
+
if (ctor === Date) return foo.getTime() === bar.getTime();
|
|
152
|
+
if (ctor === RegExp) return foo.toString() === bar.toString();
|
|
153
|
+
|
|
154
|
+
if (ctor === Array) {
|
|
155
|
+
if ((len=foo.length) === bar.length) {
|
|
156
|
+
while (len-- && dequal(foo[len], bar[len]));
|
|
157
|
+
}
|
|
158
|
+
return len === -1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!ctor || typeof foo === 'object') {
|
|
162
|
+
len = 0;
|
|
163
|
+
for (ctor in foo) {
|
|
164
|
+
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
|
|
165
|
+
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
|
|
166
|
+
}
|
|
167
|
+
return Object.keys(bar).length === len;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return foo !== foo && bar !== bar;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// use WeakMap to store the object->key mapping
|
|
175
|
+
// so the objects can be garbage collected.
|
|
176
|
+
// WeakMap uses a hashtable under the hood, so the lookup
|
|
177
|
+
// complexity is almost O(1).
|
|
178
|
+
var table = new WeakMap();
|
|
179
|
+
// counter of the key
|
|
180
|
+
var counter = 0;
|
|
181
|
+
// hashes an array of objects and returns a string
|
|
182
|
+
function hash(args) {
|
|
183
|
+
if (!args.length)
|
|
184
|
+
return '';
|
|
185
|
+
var key = 'arg';
|
|
186
|
+
for (var i = 0; i < args.length; ++i) {
|
|
187
|
+
if (args[i] === null) {
|
|
188
|
+
key += '@null';
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
var _hash = void 0;
|
|
192
|
+
if (typeof args[i] !== 'object' && typeof args[i] !== 'function') {
|
|
193
|
+
// need to consider the case that args[i] is a string:
|
|
194
|
+
// args[i] _hash
|
|
195
|
+
// "undefined" -> '"undefined"'
|
|
196
|
+
// undefined -> 'undefined'
|
|
197
|
+
// 123 -> '123'
|
|
198
|
+
// "null" -> '"null"'
|
|
199
|
+
if (typeof args[i] === 'string') {
|
|
200
|
+
_hash = '"' + args[i] + '"';
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
_hash = String(args[i]);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
if (!table.has(args[i])) {
|
|
208
|
+
_hash = counter;
|
|
209
|
+
table.set(args[i], counter++);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
_hash = table.get(args[i]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
key += '@' + _hash;
|
|
216
|
+
}
|
|
217
|
+
return key;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var Cache = /** @class */ (function () {
|
|
221
|
+
function Cache(initialData) {
|
|
222
|
+
if (initialData === void 0) { initialData = {}; }
|
|
223
|
+
this.cache = new Map(Object.entries(initialData));
|
|
224
|
+
this.subs = [];
|
|
225
|
+
}
|
|
226
|
+
Cache.prototype.get = function (key) {
|
|
227
|
+
var _key = this.serializeKey(key)[0];
|
|
228
|
+
return this.cache.get(_key);
|
|
229
|
+
};
|
|
230
|
+
Cache.prototype.set = function (key, value) {
|
|
231
|
+
var _key = this.serializeKey(key)[0];
|
|
232
|
+
this.cache.set(_key, value);
|
|
233
|
+
this.notify();
|
|
234
|
+
};
|
|
235
|
+
Cache.prototype.keys = function () {
|
|
236
|
+
return Array.from(this.cache.keys());
|
|
237
|
+
};
|
|
238
|
+
Cache.prototype.has = function (key) {
|
|
239
|
+
var _key = this.serializeKey(key)[0];
|
|
240
|
+
return this.cache.has(_key);
|
|
241
|
+
};
|
|
242
|
+
Cache.prototype.clear = function () {
|
|
243
|
+
this.cache.clear();
|
|
244
|
+
this.notify();
|
|
245
|
+
};
|
|
246
|
+
Cache.prototype.delete = function (key) {
|
|
247
|
+
var _key = this.serializeKey(key)[0];
|
|
248
|
+
this.cache.delete(_key);
|
|
249
|
+
this.notify();
|
|
250
|
+
};
|
|
251
|
+
// TODO: introduce namespace for the cache
|
|
252
|
+
Cache.prototype.serializeKey = function (key) {
|
|
253
|
+
var args = null;
|
|
254
|
+
if (typeof key === 'function') {
|
|
255
|
+
try {
|
|
256
|
+
key = key();
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
// dependencies not ready
|
|
260
|
+
key = '';
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (Array.isArray(key)) {
|
|
264
|
+
// args array
|
|
265
|
+
args = key;
|
|
266
|
+
key = hash(key);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
// convert null to ''
|
|
270
|
+
key = String(key || '');
|
|
271
|
+
}
|
|
272
|
+
var errorKey = key ? 'err@' + key : '';
|
|
273
|
+
var isValidatingKey = key ? 'validating@' + key : '';
|
|
274
|
+
return [key, args, errorKey, isValidatingKey];
|
|
275
|
+
};
|
|
276
|
+
Cache.prototype.subscribe = function (listener) {
|
|
277
|
+
var _this = this;
|
|
278
|
+
if (typeof listener !== 'function') {
|
|
279
|
+
throw new Error('Expected the listener to be a function.');
|
|
280
|
+
}
|
|
281
|
+
var isSubscribed = true;
|
|
282
|
+
this.subs.push(listener);
|
|
283
|
+
return function () {
|
|
284
|
+
if (!isSubscribed)
|
|
285
|
+
return;
|
|
286
|
+
isSubscribed = false;
|
|
287
|
+
var index = _this.subs.indexOf(listener);
|
|
288
|
+
if (index > -1) {
|
|
289
|
+
_this.subs[index] = _this.subs[_this.subs.length - 1];
|
|
290
|
+
_this.subs.length--;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
// Notify Cache subscribers about a change in the cache
|
|
295
|
+
Cache.prototype.notify = function () {
|
|
296
|
+
for (var _i = 0, _a = this.subs; _i < _a.length; _i++) {
|
|
297
|
+
var listener = _a[_i];
|
|
298
|
+
listener();
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
return Cache;
|
|
302
|
+
}());
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
|
|
306
|
+
* it's not reliable to detect if the browser is currently online or offline
|
|
307
|
+
* based on `navigator.onLine`.
|
|
308
|
+
* As a work around, we always assume it's online on first load, and change
|
|
309
|
+
* the status upon `online` or `offline` events.
|
|
310
|
+
*/
|
|
311
|
+
var online = true;
|
|
312
|
+
var isOnline = function () { return online; };
|
|
313
|
+
var isDocumentVisible = function () {
|
|
314
|
+
if (typeof document !== 'undefined' &&
|
|
315
|
+
document.visibilityState !== undefined) {
|
|
316
|
+
return document.visibilityState !== 'hidden';
|
|
317
|
+
}
|
|
318
|
+
// always assume it's visible
|
|
319
|
+
return true;
|
|
320
|
+
};
|
|
321
|
+
var fetcher = function (url) { return fetch(url).then(function (res) { return res.json(); }); };
|
|
322
|
+
var registerOnFocus = function (cb) {
|
|
323
|
+
if (typeof window !== 'undefined' &&
|
|
324
|
+
window.addEventListener !== undefined &&
|
|
325
|
+
typeof document !== 'undefined' &&
|
|
326
|
+
document.addEventListener !== undefined) {
|
|
327
|
+
// focus revalidate
|
|
328
|
+
document.addEventListener('visibilitychange', function () { return cb(); }, false);
|
|
329
|
+
window.addEventListener('focus', function () { return cb(); }, false);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var registerOnReconnect = function (cb) {
|
|
333
|
+
if (typeof window !== 'undefined' && window.addEventListener !== undefined) {
|
|
334
|
+
// reconnect revalidate
|
|
335
|
+
window.addEventListener('online', function () {
|
|
336
|
+
online = true;
|
|
337
|
+
cb();
|
|
338
|
+
}, false);
|
|
339
|
+
// nothing to revalidate, just update the status
|
|
340
|
+
window.addEventListener('offline', function () { return (online = false); }, false);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var webPreset = {
|
|
344
|
+
isOnline: isOnline,
|
|
345
|
+
isDocumentVisible: isDocumentVisible,
|
|
346
|
+
fetcher: fetcher,
|
|
347
|
+
registerOnFocus: registerOnFocus,
|
|
348
|
+
registerOnReconnect: registerOnReconnect
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
352
|
+
__assign = Object.assign || function(t) {
|
|
353
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
354
|
+
s = arguments[i];
|
|
355
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
356
|
+
t[p] = s[p];
|
|
357
|
+
}
|
|
358
|
+
return t;
|
|
359
|
+
};
|
|
360
|
+
return __assign.apply(this, arguments);
|
|
361
|
+
};
|
|
362
|
+
// cache
|
|
363
|
+
var cache = new Cache();
|
|
364
|
+
// error retry
|
|
365
|
+
function onErrorRetry(_, __, config, revalidate, opts) {
|
|
366
|
+
if (!config.isDocumentVisible()) {
|
|
367
|
+
// if it's hidden, stop
|
|
368
|
+
// it will auto revalidate when focus
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (typeof config.errorRetryCount === 'number' &&
|
|
372
|
+
opts.retryCount > config.errorRetryCount) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
// exponential backoff
|
|
376
|
+
var count = Math.min(opts.retryCount, 8);
|
|
377
|
+
var timeout = ~~((Math.random() + 0.5) * (1 << count)) * config.errorRetryInterval;
|
|
378
|
+
setTimeout(revalidate, timeout, opts);
|
|
379
|
+
}
|
|
380
|
+
// client side: need to adjust the config
|
|
381
|
+
// based on the browser status
|
|
382
|
+
// slow connection (<= 70Kbps)
|
|
383
|
+
var slowConnection = typeof window !== 'undefined' &&
|
|
384
|
+
// @ts-ignore
|
|
385
|
+
navigator['connection'] &&
|
|
386
|
+
// @ts-ignore
|
|
387
|
+
['slow-2g', '2g'].indexOf(navigator['connection'].effectiveType) !== -1;
|
|
388
|
+
// config
|
|
389
|
+
var defaultConfig = __assign({
|
|
390
|
+
// events
|
|
391
|
+
onLoadingSlow: function () { }, onSuccess: function () { }, onError: function () { }, onErrorRetry: onErrorRetry, errorRetryInterval: (slowConnection ? 10 : 5) * 1000, focusThrottleInterval: 5 * 1000, dedupingInterval: 2 * 1000, loadingTimeout: (slowConnection ? 5 : 3) * 1000, refreshInterval: 0, revalidateOnFocus: true, revalidateOnReconnect: true, refreshWhenHidden: false, refreshWhenOffline: false, shouldRetryOnError: true, suspense: false, compare: dequal, isPaused: function () { return false; } }, webPreset);
|
|
392
|
+
|
|
393
|
+
var IS_SERVER = typeof window === 'undefined' ||
|
|
394
|
+
// @ts-ignore
|
|
395
|
+
!!(typeof Deno !== 'undefined' && Deno && Deno.version && Deno.version.deno);
|
|
396
|
+
// polyfill for requestAnimationFrame
|
|
397
|
+
var rAF = IS_SERVER
|
|
398
|
+
? null
|
|
399
|
+
: window['requestAnimationFrame']
|
|
400
|
+
? function (f) { return window['requestAnimationFrame'](f); }
|
|
401
|
+
: function (f) { return setTimeout(f, 1); };
|
|
402
|
+
// React currently throws a warning when using useLayoutEffect on the server.
|
|
403
|
+
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
404
|
+
// useLayoutEffect in the browser.
|
|
405
|
+
var useIsomorphicLayoutEffect = IS_SERVER ? React.useEffect : React.useLayoutEffect;
|
|
406
|
+
|
|
407
|
+
var SWRConfigContext = React.createContext({});
|
|
408
|
+
SWRConfigContext.displayName = 'SWRConfigContext';
|
|
409
|
+
|
|
410
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
411
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
412
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
413
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
414
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
415
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
416
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
420
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
421
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
422
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
423
|
+
function step(op) {
|
|
424
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
425
|
+
while (_) try {
|
|
426
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
427
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
428
|
+
switch (op[0]) {
|
|
429
|
+
case 0: case 1: t = op; break;
|
|
430
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
431
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
432
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
433
|
+
default:
|
|
434
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
435
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
436
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
437
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
438
|
+
if (t[2]) _.ops.pop();
|
|
439
|
+
_.trys.pop(); continue;
|
|
440
|
+
}
|
|
441
|
+
op = body.call(thisArg, _);
|
|
442
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
443
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
// global state managers
|
|
447
|
+
var CONCURRENT_PROMISES = {};
|
|
448
|
+
var CONCURRENT_PROMISES_TS = {};
|
|
449
|
+
var FOCUS_REVALIDATORS = {};
|
|
450
|
+
var RECONNECT_REVALIDATORS = {};
|
|
451
|
+
var CACHE_REVALIDATORS = {};
|
|
452
|
+
var MUTATION_TS = {};
|
|
453
|
+
var MUTATION_END_TS = {};
|
|
454
|
+
// generate strictly increasing timestamps
|
|
455
|
+
var now = (function () {
|
|
456
|
+
var ts = 0;
|
|
457
|
+
return function () { return ++ts; };
|
|
458
|
+
})();
|
|
459
|
+
// setup DOM events listeners for `focus` and `reconnect` actions
|
|
460
|
+
if (!IS_SERVER) {
|
|
461
|
+
var revalidate_1 = function (revalidators) {
|
|
462
|
+
if (!defaultConfig.isDocumentVisible() || !defaultConfig.isOnline())
|
|
463
|
+
return;
|
|
464
|
+
for (var key in revalidators) {
|
|
465
|
+
if (revalidators[key][0])
|
|
466
|
+
revalidators[key][0]();
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
if (typeof defaultConfig.registerOnFocus === 'function') {
|
|
470
|
+
defaultConfig.registerOnFocus(function () { return revalidate_1(FOCUS_REVALIDATORS); });
|
|
471
|
+
}
|
|
472
|
+
if (typeof defaultConfig.registerOnReconnect === 'function') {
|
|
473
|
+
defaultConfig.registerOnReconnect(function () { return revalidate_1(RECONNECT_REVALIDATORS); });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
var trigger = function (_key, shouldRevalidate) {
|
|
477
|
+
if (shouldRevalidate === void 0) { shouldRevalidate = true; }
|
|
478
|
+
// we are ignoring the second argument which correspond to the arguments
|
|
479
|
+
// the fetcher will receive when key is an array
|
|
480
|
+
var _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2], keyValidating = _a[3];
|
|
481
|
+
if (!key)
|
|
482
|
+
return Promise.resolve();
|
|
483
|
+
var updaters = CACHE_REVALIDATORS[key];
|
|
484
|
+
if (key && updaters) {
|
|
485
|
+
var currentData = cache.get(key);
|
|
486
|
+
var currentError = cache.get(keyErr);
|
|
487
|
+
var currentIsValidating = cache.get(keyValidating);
|
|
488
|
+
var promises = [];
|
|
489
|
+
for (var i = 0; i < updaters.length; ++i) {
|
|
490
|
+
promises.push(updaters[i](shouldRevalidate, currentData, currentError, currentIsValidating, i > 0));
|
|
491
|
+
}
|
|
492
|
+
// return new updated value
|
|
493
|
+
return Promise.all(promises).then(function () { return cache.get(key); });
|
|
494
|
+
}
|
|
495
|
+
return Promise.resolve(cache.get(key));
|
|
496
|
+
};
|
|
497
|
+
var broadcastState = function (key, data, error, isValidating) {
|
|
498
|
+
var updaters = CACHE_REVALIDATORS[key];
|
|
499
|
+
if (key && updaters) {
|
|
500
|
+
for (var i = 0; i < updaters.length; ++i) {
|
|
501
|
+
updaters[i](false, data, error, isValidating);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
var mutate = function (_key, _data, shouldRevalidate) {
|
|
506
|
+
if (shouldRevalidate === void 0) { shouldRevalidate = true; }
|
|
507
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
508
|
+
var _a, key, keyErr, beforeMutationTs, beforeConcurrentPromisesTs, data, error, isAsyncMutation, err_1, shouldAbort, updaters, promises, i;
|
|
509
|
+
return __generator(this, function (_b) {
|
|
510
|
+
switch (_b.label) {
|
|
511
|
+
case 0:
|
|
512
|
+
_a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2];
|
|
513
|
+
if (!key)
|
|
514
|
+
return [2 /*return*/];
|
|
515
|
+
// if there is no new data to update, let's just revalidate the key
|
|
516
|
+
if (typeof _data === 'undefined')
|
|
517
|
+
return [2 /*return*/, trigger(_key, shouldRevalidate)
|
|
518
|
+
// update global timestamps
|
|
519
|
+
];
|
|
520
|
+
// update global timestamps
|
|
521
|
+
MUTATION_TS[key] = now() - 1;
|
|
522
|
+
MUTATION_END_TS[key] = 0;
|
|
523
|
+
beforeMutationTs = MUTATION_TS[key];
|
|
524
|
+
beforeConcurrentPromisesTs = CONCURRENT_PROMISES_TS[key];
|
|
525
|
+
isAsyncMutation = false;
|
|
526
|
+
if (_data && typeof _data === 'function') {
|
|
527
|
+
// `_data` is a function, call it passing current cache value
|
|
528
|
+
try {
|
|
529
|
+
_data = _data(cache.get(key));
|
|
530
|
+
}
|
|
531
|
+
catch (err) {
|
|
532
|
+
// if `_data` function throws an error synchronously, it shouldn't be cached
|
|
533
|
+
_data = undefined;
|
|
534
|
+
error = err;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (!(_data && typeof _data.then === 'function')) return [3 /*break*/, 5];
|
|
538
|
+
// `_data` is a promise
|
|
539
|
+
isAsyncMutation = true;
|
|
540
|
+
_b.label = 1;
|
|
541
|
+
case 1:
|
|
542
|
+
_b.trys.push([1, 3, , 4]);
|
|
543
|
+
return [4 /*yield*/, _data];
|
|
544
|
+
case 2:
|
|
545
|
+
data = _b.sent();
|
|
546
|
+
return [3 /*break*/, 4];
|
|
547
|
+
case 3:
|
|
548
|
+
err_1 = _b.sent();
|
|
549
|
+
error = err_1;
|
|
550
|
+
return [3 /*break*/, 4];
|
|
551
|
+
case 4: return [3 /*break*/, 6];
|
|
552
|
+
case 5:
|
|
553
|
+
data = _data;
|
|
554
|
+
_b.label = 6;
|
|
555
|
+
case 6:
|
|
556
|
+
shouldAbort = function () {
|
|
557
|
+
// check if other mutations have occurred since we've started this mutation
|
|
558
|
+
if (beforeMutationTs !== MUTATION_TS[key] ||
|
|
559
|
+
beforeConcurrentPromisesTs !== CONCURRENT_PROMISES_TS[key]) {
|
|
560
|
+
if (error)
|
|
561
|
+
throw error;
|
|
562
|
+
return true;
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
// if there's a race we don't update cache or broadcast change, just return the data
|
|
566
|
+
if (shouldAbort())
|
|
567
|
+
return [2 /*return*/, data];
|
|
568
|
+
if (typeof data !== 'undefined') {
|
|
569
|
+
// update cached data
|
|
570
|
+
cache.set(key, data);
|
|
571
|
+
}
|
|
572
|
+
// always update or reset the error
|
|
573
|
+
cache.set(keyErr, error);
|
|
574
|
+
// reset the timestamp to mark the mutation has ended
|
|
575
|
+
MUTATION_END_TS[key] = now() - 1;
|
|
576
|
+
if (!isAsyncMutation) {
|
|
577
|
+
// we skip broadcasting if there's another mutation happened synchronously
|
|
578
|
+
if (shouldAbort())
|
|
579
|
+
return [2 /*return*/, data];
|
|
580
|
+
}
|
|
581
|
+
updaters = CACHE_REVALIDATORS[key];
|
|
582
|
+
if (updaters) {
|
|
583
|
+
promises = [];
|
|
584
|
+
for (i = 0; i < updaters.length; ++i) {
|
|
585
|
+
promises.push(updaters[i](!!shouldRevalidate, data, error, undefined, i > 0));
|
|
586
|
+
}
|
|
587
|
+
// return new updated value
|
|
588
|
+
return [2 /*return*/, Promise.all(promises).then(function () {
|
|
589
|
+
if (error)
|
|
590
|
+
throw error;
|
|
591
|
+
return cache.get(key);
|
|
592
|
+
})];
|
|
593
|
+
}
|
|
594
|
+
// throw error or return data to be used by caller of mutate
|
|
595
|
+
if (error)
|
|
596
|
+
throw error;
|
|
597
|
+
return [2 /*return*/, data];
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
});
|
|
601
|
+
};
|
|
602
|
+
function useSWR() {
|
|
603
|
+
var _this = this;
|
|
604
|
+
var args = [];
|
|
605
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
606
|
+
args[_i] = arguments[_i];
|
|
607
|
+
}
|
|
608
|
+
var _key = args[0];
|
|
609
|
+
var config = Object.assign({}, defaultConfig, React.useContext(SWRConfigContext), args.length > 2
|
|
610
|
+
? args[2]
|
|
611
|
+
: args.length === 2 && typeof args[1] === 'object'
|
|
612
|
+
? args[1]
|
|
613
|
+
: {});
|
|
614
|
+
// in typescript args.length > 2 is not same as args.lenth === 3
|
|
615
|
+
// we do a safe type assertion here
|
|
616
|
+
// args.length === 3
|
|
617
|
+
var fn = (args.length > 2
|
|
618
|
+
? args[1]
|
|
619
|
+
: args.length === 2 && typeof args[1] === 'function'
|
|
620
|
+
? args[1]
|
|
621
|
+
: /**
|
|
622
|
+
pass fn as null will disable revalidate
|
|
623
|
+
https://paco.sh/blog/shared-hook-state-with-swr
|
|
624
|
+
*/
|
|
625
|
+
args[1] === null
|
|
626
|
+
? args[1]
|
|
627
|
+
: config.fetcher);
|
|
628
|
+
// we assume `key` as the identifier of the request
|
|
629
|
+
// `key` can change but `fn` shouldn't
|
|
630
|
+
// (because `revalidate` only depends on `key`)
|
|
631
|
+
// `keyErr` is the cache key for error objects
|
|
632
|
+
var _a = cache.serializeKey(_key), key = _a[0], fnArgs = _a[1], keyErr = _a[2], keyValidating = _a[3];
|
|
633
|
+
var configRef = React.useRef(config);
|
|
634
|
+
useIsomorphicLayoutEffect(function () {
|
|
635
|
+
configRef.current = config;
|
|
636
|
+
});
|
|
637
|
+
var willRevalidateOnMount = function () {
|
|
638
|
+
return (config.revalidateOnMount ||
|
|
639
|
+
(!config.initialData && config.revalidateOnMount === undefined));
|
|
640
|
+
};
|
|
641
|
+
var resolveData = function () {
|
|
642
|
+
var cachedData = cache.get(key);
|
|
643
|
+
return typeof cachedData === 'undefined' ? config.initialData : cachedData;
|
|
644
|
+
};
|
|
645
|
+
var resolveIsValidating = function () {
|
|
646
|
+
return !!cache.get(keyValidating) || (key && willRevalidateOnMount());
|
|
647
|
+
};
|
|
648
|
+
var initialData = resolveData();
|
|
649
|
+
var initialError = cache.get(keyErr);
|
|
650
|
+
var initialIsValidating = resolveIsValidating();
|
|
651
|
+
// if a state is accessed (data, error or isValidating),
|
|
652
|
+
// we add the state to dependencies so if the state is
|
|
653
|
+
// updated in the future, we can trigger a rerender
|
|
654
|
+
var stateDependencies = React.useRef({
|
|
655
|
+
data: false,
|
|
656
|
+
error: false,
|
|
657
|
+
isValidating: false
|
|
658
|
+
});
|
|
659
|
+
var stateRef = React.useRef({
|
|
660
|
+
data: initialData,
|
|
661
|
+
error: initialError,
|
|
662
|
+
isValidating: initialIsValidating
|
|
663
|
+
});
|
|
664
|
+
// display the data label in the React DevTools next to SWR hooks
|
|
665
|
+
React.useDebugValue(stateRef.current.data);
|
|
666
|
+
var rerender = React.useState({})[1];
|
|
667
|
+
var dispatch = React.useCallback(function (payload) {
|
|
668
|
+
var shouldUpdateState = false;
|
|
669
|
+
for (var k in payload) {
|
|
670
|
+
// @ts-ignore
|
|
671
|
+
if (stateRef.current[k] === payload[k]) {
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
// @ts-ignore
|
|
675
|
+
stateRef.current[k] = payload[k];
|
|
676
|
+
// @ts-ignore
|
|
677
|
+
if (stateDependencies.current[k]) {
|
|
678
|
+
shouldUpdateState = true;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (shouldUpdateState) {
|
|
682
|
+
// if component is unmounted, should skip rerender
|
|
683
|
+
// if component is not mounted, should skip rerender
|
|
684
|
+
if (unmountedRef.current || !initialMountedRef.current)
|
|
685
|
+
return;
|
|
686
|
+
rerender({});
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
// config.suspense isn't allowed to change during the lifecycle
|
|
690
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
691
|
+
[]);
|
|
692
|
+
// error ref inside revalidate (is last request errored?)
|
|
693
|
+
var unmountedRef = React.useRef(false);
|
|
694
|
+
var keyRef = React.useRef(key);
|
|
695
|
+
// check if component is mounted in suspense mode
|
|
696
|
+
var initialMountedRef = React.useRef(false);
|
|
697
|
+
// do unmount check for callbacks
|
|
698
|
+
var eventsCallback = React.useCallback(function (event) {
|
|
699
|
+
var _a;
|
|
700
|
+
var params = [];
|
|
701
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
702
|
+
params[_i - 1] = arguments[_i];
|
|
703
|
+
}
|
|
704
|
+
if (unmountedRef.current)
|
|
705
|
+
return;
|
|
706
|
+
if (!initialMountedRef.current)
|
|
707
|
+
return;
|
|
708
|
+
if (key !== keyRef.current)
|
|
709
|
+
return;
|
|
710
|
+
// @ts-ignore
|
|
711
|
+
(_a = configRef.current)[event].apply(_a, params);
|
|
712
|
+
}, [key]);
|
|
713
|
+
var boundMutate = React.useCallback(function (data, shouldRevalidate) {
|
|
714
|
+
return mutate(keyRef.current, data, shouldRevalidate);
|
|
715
|
+
}, []);
|
|
716
|
+
var addRevalidator = function (revalidators, callback) {
|
|
717
|
+
if (!revalidators[key]) {
|
|
718
|
+
revalidators[key] = [callback];
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
revalidators[key].push(callback);
|
|
722
|
+
}
|
|
723
|
+
return function () {
|
|
724
|
+
var keyedRevalidators = revalidators[key];
|
|
725
|
+
var index = keyedRevalidators.indexOf(callback);
|
|
726
|
+
if (index >= 0) {
|
|
727
|
+
// O(1): faster than splice
|
|
728
|
+
keyedRevalidators[index] =
|
|
729
|
+
keyedRevalidators[keyedRevalidators.length - 1];
|
|
730
|
+
keyedRevalidators.pop();
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
};
|
|
734
|
+
// start a revalidation
|
|
735
|
+
var revalidate = React.useCallback(function (revalidateOpts) {
|
|
736
|
+
if (revalidateOpts === void 0) { revalidateOpts = {}; }
|
|
737
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
738
|
+
var _a, retryCount, _b, dedupe, loading, shouldDeduping, newData, startAt, newState, err_2;
|
|
739
|
+
return __generator(this, function (_c) {
|
|
740
|
+
switch (_c.label) {
|
|
741
|
+
case 0:
|
|
742
|
+
if (!key || !fn)
|
|
743
|
+
return [2 /*return*/, false];
|
|
744
|
+
if (unmountedRef.current)
|
|
745
|
+
return [2 /*return*/, false];
|
|
746
|
+
if (configRef.current.isPaused())
|
|
747
|
+
return [2 /*return*/, false];
|
|
748
|
+
_a = revalidateOpts.retryCount, retryCount = _a === void 0 ? 0 : _a, _b = revalidateOpts.dedupe, dedupe = _b === void 0 ? false : _b;
|
|
749
|
+
loading = true;
|
|
750
|
+
shouldDeduping = typeof CONCURRENT_PROMISES[key] !== 'undefined' && dedupe;
|
|
751
|
+
_c.label = 1;
|
|
752
|
+
case 1:
|
|
753
|
+
_c.trys.push([1, 6, , 7]);
|
|
754
|
+
dispatch({
|
|
755
|
+
isValidating: true
|
|
756
|
+
});
|
|
757
|
+
cache.set(keyValidating, true);
|
|
758
|
+
if (!shouldDeduping) {
|
|
759
|
+
// also update other hooks
|
|
760
|
+
broadcastState(key, stateRef.current.data, stateRef.current.error, true);
|
|
761
|
+
}
|
|
762
|
+
newData = void 0;
|
|
763
|
+
startAt = void 0;
|
|
764
|
+
if (!shouldDeduping) return [3 /*break*/, 3];
|
|
765
|
+
// there's already an ongoing request,
|
|
766
|
+
// this one needs to be deduplicated.
|
|
767
|
+
startAt = CONCURRENT_PROMISES_TS[key];
|
|
768
|
+
return [4 /*yield*/, CONCURRENT_PROMISES[key]];
|
|
769
|
+
case 2:
|
|
770
|
+
newData = _c.sent();
|
|
771
|
+
return [3 /*break*/, 5];
|
|
772
|
+
case 3:
|
|
773
|
+
// if no cache being rendered currently (it shows a blank page),
|
|
774
|
+
// we trigger the loading slow event.
|
|
775
|
+
if (config.loadingTimeout && !cache.get(key)) {
|
|
776
|
+
setTimeout(function () {
|
|
777
|
+
if (loading)
|
|
778
|
+
eventsCallback('onLoadingSlow', key, config);
|
|
779
|
+
}, config.loadingTimeout);
|
|
780
|
+
}
|
|
781
|
+
if (fnArgs !== null) {
|
|
782
|
+
CONCURRENT_PROMISES[key] = fn.apply(void 0, fnArgs);
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
CONCURRENT_PROMISES[key] = fn(key);
|
|
786
|
+
}
|
|
787
|
+
CONCURRENT_PROMISES_TS[key] = startAt = now();
|
|
788
|
+
return [4 /*yield*/, CONCURRENT_PROMISES[key]];
|
|
789
|
+
case 4:
|
|
790
|
+
newData = _c.sent();
|
|
791
|
+
setTimeout(function () {
|
|
792
|
+
delete CONCURRENT_PROMISES[key];
|
|
793
|
+
delete CONCURRENT_PROMISES_TS[key];
|
|
794
|
+
}, config.dedupingInterval);
|
|
795
|
+
// trigger the success event,
|
|
796
|
+
// only do this for the original request.
|
|
797
|
+
eventsCallback('onSuccess', newData, key, config);
|
|
798
|
+
_c.label = 5;
|
|
799
|
+
case 5:
|
|
800
|
+
// if there're other ongoing request(s), started after the current one,
|
|
801
|
+
// we need to ignore the current one to avoid possible race conditions:
|
|
802
|
+
// req1------------------>res1 (current one)
|
|
803
|
+
// req2---------------->res2
|
|
804
|
+
// the request that fired later will always be kept.
|
|
805
|
+
if (CONCURRENT_PROMISES_TS[key] > startAt) {
|
|
806
|
+
return [2 /*return*/, false];
|
|
807
|
+
}
|
|
808
|
+
// if there're other mutations(s), overlapped with the current revalidation:
|
|
809
|
+
// case 1:
|
|
810
|
+
// req------------------>res
|
|
811
|
+
// mutate------>end
|
|
812
|
+
// case 2:
|
|
813
|
+
// req------------>res
|
|
814
|
+
// mutate------>end
|
|
815
|
+
// case 3:
|
|
816
|
+
// req------------------>res
|
|
817
|
+
// mutate-------...---------->
|
|
818
|
+
// we have to ignore the revalidation result (res) because it's no longer fresh.
|
|
819
|
+
// meanwhile, a new revalidation should be triggered when the mutation ends.
|
|
820
|
+
if (MUTATION_TS[key] &&
|
|
821
|
+
// case 1
|
|
822
|
+
(startAt <= MUTATION_TS[key] ||
|
|
823
|
+
// case 2
|
|
824
|
+
startAt <= MUTATION_END_TS[key] ||
|
|
825
|
+
// case 3
|
|
826
|
+
MUTATION_END_TS[key] === 0)) {
|
|
827
|
+
dispatch({ isValidating: false });
|
|
828
|
+
return [2 /*return*/, false];
|
|
829
|
+
}
|
|
830
|
+
cache.set(keyErr, undefined);
|
|
831
|
+
cache.set(keyValidating, false);
|
|
832
|
+
newState = {
|
|
833
|
+
isValidating: false
|
|
834
|
+
};
|
|
835
|
+
if (typeof stateRef.current.error !== 'undefined') {
|
|
836
|
+
// we don't have an error
|
|
837
|
+
newState.error = undefined;
|
|
838
|
+
}
|
|
839
|
+
if (!config.compare(stateRef.current.data, newData)) {
|
|
840
|
+
// deep compare to avoid extra re-render
|
|
841
|
+
// data changed
|
|
842
|
+
newState.data = newData;
|
|
843
|
+
}
|
|
844
|
+
if (!config.compare(cache.get(key), newData)) {
|
|
845
|
+
cache.set(key, newData);
|
|
846
|
+
}
|
|
847
|
+
// merge the new state
|
|
848
|
+
dispatch(newState);
|
|
849
|
+
if (!shouldDeduping) {
|
|
850
|
+
// also update other hooks
|
|
851
|
+
broadcastState(key, newData, newState.error, false);
|
|
852
|
+
}
|
|
853
|
+
return [3 /*break*/, 7];
|
|
854
|
+
case 6:
|
|
855
|
+
err_2 = _c.sent();
|
|
856
|
+
delete CONCURRENT_PROMISES[key];
|
|
857
|
+
delete CONCURRENT_PROMISES_TS[key];
|
|
858
|
+
if (configRef.current.isPaused()) {
|
|
859
|
+
dispatch({
|
|
860
|
+
isValidating: false
|
|
861
|
+
});
|
|
862
|
+
return [2 /*return*/, false];
|
|
863
|
+
}
|
|
864
|
+
cache.set(keyErr, err_2);
|
|
865
|
+
// get a new error
|
|
866
|
+
// don't use deep equal for errors
|
|
867
|
+
if (stateRef.current.error !== err_2) {
|
|
868
|
+
// we keep the stale data
|
|
869
|
+
dispatch({
|
|
870
|
+
isValidating: false,
|
|
871
|
+
error: err_2
|
|
872
|
+
});
|
|
873
|
+
if (!shouldDeduping) {
|
|
874
|
+
// also broadcast to update other hooks
|
|
875
|
+
broadcastState(key, undefined, err_2, false);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
// events and retry
|
|
879
|
+
eventsCallback('onError', err_2, key, config);
|
|
880
|
+
if (config.shouldRetryOnError) {
|
|
881
|
+
// when retrying, we always enable deduping
|
|
882
|
+
eventsCallback('onErrorRetry', err_2, key, config, revalidate, {
|
|
883
|
+
retryCount: retryCount + 1,
|
|
884
|
+
dedupe: true
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
return [3 /*break*/, 7];
|
|
888
|
+
case 7:
|
|
889
|
+
loading = false;
|
|
890
|
+
return [2 /*return*/, true];
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
},
|
|
895
|
+
// dispatch is immutable, and `eventsCallback`, `fnArgs`, `keyErr`, and `keyValidating` are based on `key`,
|
|
896
|
+
// so we can them from the deps array.
|
|
897
|
+
//
|
|
898
|
+
// FIXME:
|
|
899
|
+
// `fn` and `config` might be changed during the lifecycle,
|
|
900
|
+
// but they might be changed every render like this.
|
|
901
|
+
// useSWR('key', () => fetch('/api/'), { suspense: true })
|
|
902
|
+
// So we omit the values from the deps array
|
|
903
|
+
// even though it might cause unexpected behaviors.
|
|
904
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
905
|
+
[key]);
|
|
906
|
+
// mounted (client side rendering)
|
|
907
|
+
useIsomorphicLayoutEffect(function () {
|
|
908
|
+
if (!key)
|
|
909
|
+
return undefined;
|
|
910
|
+
// after `key` updates, we need to mark it as mounted
|
|
911
|
+
unmountedRef.current = false;
|
|
912
|
+
var isUpdating = initialMountedRef.current;
|
|
913
|
+
initialMountedRef.current = true;
|
|
914
|
+
// after the component is mounted (hydrated),
|
|
915
|
+
// we need to update the data from the cache
|
|
916
|
+
// and trigger a revalidation
|
|
917
|
+
var currentHookData = stateRef.current.data;
|
|
918
|
+
var latestKeyedData = resolveData();
|
|
919
|
+
// update the state if the key changed (not the inital render) or cache updated
|
|
920
|
+
keyRef.current = key;
|
|
921
|
+
if (!config.compare(currentHookData, latestKeyedData)) {
|
|
922
|
+
dispatch({ data: latestKeyedData });
|
|
923
|
+
}
|
|
924
|
+
// revalidate with deduping
|
|
925
|
+
var softRevalidate = function () { return revalidate({ dedupe: true }); };
|
|
926
|
+
// trigger a revalidation
|
|
927
|
+
if (isUpdating || willRevalidateOnMount()) {
|
|
928
|
+
if (typeof latestKeyedData !== 'undefined' && !IS_SERVER) {
|
|
929
|
+
// delay revalidate if there's cache
|
|
930
|
+
// to not block the rendering
|
|
931
|
+
// @ts-ignore it's safe to use requestAnimationFrame in browser
|
|
932
|
+
rAF(softRevalidate);
|
|
933
|
+
}
|
|
934
|
+
else {
|
|
935
|
+
softRevalidate();
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
var pending = false;
|
|
939
|
+
var onFocus = function () {
|
|
940
|
+
if (pending || !configRef.current.revalidateOnFocus)
|
|
941
|
+
return;
|
|
942
|
+
pending = true;
|
|
943
|
+
softRevalidate();
|
|
944
|
+
setTimeout(function () { return (pending = false); }, configRef.current.focusThrottleInterval);
|
|
945
|
+
};
|
|
946
|
+
var onReconnect = function () {
|
|
947
|
+
if (configRef.current.revalidateOnReconnect) {
|
|
948
|
+
softRevalidate();
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
// register global cache update listener
|
|
952
|
+
var onUpdate = function (shouldRevalidate, updatedData, updatedError, updatedIsValidating, dedupe) {
|
|
953
|
+
if (shouldRevalidate === void 0) { shouldRevalidate = true; }
|
|
954
|
+
if (dedupe === void 0) { dedupe = true; }
|
|
955
|
+
// update hook state
|
|
956
|
+
var newState = {};
|
|
957
|
+
var needUpdate = false;
|
|
958
|
+
if (typeof updatedData !== 'undefined' &&
|
|
959
|
+
!config.compare(stateRef.current.data, updatedData)) {
|
|
960
|
+
newState.data = updatedData;
|
|
961
|
+
needUpdate = true;
|
|
962
|
+
}
|
|
963
|
+
// always update error
|
|
964
|
+
// because it can be `undefined`
|
|
965
|
+
if (stateRef.current.error !== updatedError) {
|
|
966
|
+
newState.error = updatedError;
|
|
967
|
+
needUpdate = true;
|
|
968
|
+
}
|
|
969
|
+
if (typeof updatedIsValidating !== 'undefined' &&
|
|
970
|
+
stateRef.current.isValidating !== updatedIsValidating) {
|
|
971
|
+
newState.isValidating = updatedIsValidating;
|
|
972
|
+
needUpdate = true;
|
|
973
|
+
}
|
|
974
|
+
if (needUpdate) {
|
|
975
|
+
dispatch(newState);
|
|
976
|
+
}
|
|
977
|
+
if (shouldRevalidate) {
|
|
978
|
+
if (dedupe) {
|
|
979
|
+
return softRevalidate();
|
|
980
|
+
}
|
|
981
|
+
else {
|
|
982
|
+
return revalidate();
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return false;
|
|
986
|
+
};
|
|
987
|
+
var unsubFocus = addRevalidator(FOCUS_REVALIDATORS, onFocus);
|
|
988
|
+
var unsubReconnect = addRevalidator(RECONNECT_REVALIDATORS, onReconnect);
|
|
989
|
+
var unsubUpdate = addRevalidator(CACHE_REVALIDATORS, onUpdate);
|
|
990
|
+
return function () {
|
|
991
|
+
// cleanup
|
|
992
|
+
dispatch = function () { return null; };
|
|
993
|
+
// mark it as unmounted
|
|
994
|
+
unmountedRef.current = true;
|
|
995
|
+
unsubFocus();
|
|
996
|
+
unsubReconnect();
|
|
997
|
+
unsubUpdate();
|
|
998
|
+
};
|
|
999
|
+
}, [key, revalidate]);
|
|
1000
|
+
useIsomorphicLayoutEffect(function () {
|
|
1001
|
+
var timer = null;
|
|
1002
|
+
var tick = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1003
|
+
return __generator(this, function (_a) {
|
|
1004
|
+
switch (_a.label) {
|
|
1005
|
+
case 0:
|
|
1006
|
+
if (!(!stateRef.current.error &&
|
|
1007
|
+
(configRef.current.refreshWhenHidden ||
|
|
1008
|
+
configRef.current.isDocumentVisible()) &&
|
|
1009
|
+
(configRef.current.refreshWhenOffline || configRef.current.isOnline()))) return [3 /*break*/, 2];
|
|
1010
|
+
// only revalidate when the page is visible
|
|
1011
|
+
// if API request errored, we stop polling in this round
|
|
1012
|
+
// and let the error retry function handle it
|
|
1013
|
+
return [4 /*yield*/, revalidate({ dedupe: true })];
|
|
1014
|
+
case 1:
|
|
1015
|
+
// only revalidate when the page is visible
|
|
1016
|
+
// if API request errored, we stop polling in this round
|
|
1017
|
+
// and let the error retry function handle it
|
|
1018
|
+
_a.sent();
|
|
1019
|
+
_a.label = 2;
|
|
1020
|
+
case 2:
|
|
1021
|
+
// Read the latest refreshInterval
|
|
1022
|
+
if (configRef.current.refreshInterval && timer) {
|
|
1023
|
+
timer = setTimeout(tick, configRef.current.refreshInterval);
|
|
1024
|
+
}
|
|
1025
|
+
return [2 /*return*/];
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
}); };
|
|
1029
|
+
if (configRef.current.refreshInterval) {
|
|
1030
|
+
timer = setTimeout(tick, configRef.current.refreshInterval);
|
|
1031
|
+
}
|
|
1032
|
+
return function () {
|
|
1033
|
+
if (timer) {
|
|
1034
|
+
clearTimeout(timer);
|
|
1035
|
+
timer = null;
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
}, [
|
|
1039
|
+
config.refreshInterval,
|
|
1040
|
+
config.refreshWhenHidden,
|
|
1041
|
+
config.refreshWhenOffline,
|
|
1042
|
+
revalidate
|
|
1043
|
+
]);
|
|
1044
|
+
// suspense
|
|
1045
|
+
var latestData;
|
|
1046
|
+
var latestError;
|
|
1047
|
+
if (config.suspense) {
|
|
1048
|
+
// in suspense mode, we can't return empty state
|
|
1049
|
+
// (it should be suspended)
|
|
1050
|
+
// try to get data and error from cache
|
|
1051
|
+
latestData = cache.get(key);
|
|
1052
|
+
latestError = cache.get(keyErr);
|
|
1053
|
+
if (typeof latestData === 'undefined') {
|
|
1054
|
+
latestData = initialData;
|
|
1055
|
+
}
|
|
1056
|
+
if (typeof latestError === 'undefined') {
|
|
1057
|
+
latestError = initialError;
|
|
1058
|
+
}
|
|
1059
|
+
if (typeof latestData === 'undefined' &&
|
|
1060
|
+
typeof latestError === 'undefined') {
|
|
1061
|
+
// need to start the request if it hasn't
|
|
1062
|
+
if (!CONCURRENT_PROMISES[key]) {
|
|
1063
|
+
// trigger revalidate immediately
|
|
1064
|
+
// to get the promise
|
|
1065
|
+
// in this revalidate, should not rerender
|
|
1066
|
+
revalidate();
|
|
1067
|
+
}
|
|
1068
|
+
if (CONCURRENT_PROMISES[key] &&
|
|
1069
|
+
typeof CONCURRENT_PROMISES[key].then === 'function') {
|
|
1070
|
+
// if it is a promise
|
|
1071
|
+
throw CONCURRENT_PROMISES[key];
|
|
1072
|
+
}
|
|
1073
|
+
// it's a value, return it directly (override)
|
|
1074
|
+
latestData = CONCURRENT_PROMISES[key];
|
|
1075
|
+
}
|
|
1076
|
+
if (typeof latestData === 'undefined' && latestError) {
|
|
1077
|
+
// in suspense mode, throw error if there's no content
|
|
1078
|
+
throw latestError;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
// define returned state
|
|
1082
|
+
// can be memorized since the state is a ref
|
|
1083
|
+
var memoizedState = React.useMemo(function () {
|
|
1084
|
+
// revalidate will be deprecated in the 1.x release
|
|
1085
|
+
// because mutate() covers the same use case of revalidate().
|
|
1086
|
+
// This remains only for backward compatibility
|
|
1087
|
+
var state = { revalidate: revalidate, mutate: boundMutate };
|
|
1088
|
+
Object.defineProperties(state, {
|
|
1089
|
+
error: {
|
|
1090
|
+
// `key` might be changed in the upcoming hook re-render,
|
|
1091
|
+
// but the previous state will stay
|
|
1092
|
+
// so we need to match the latest key and data (fallback to `initialData`)
|
|
1093
|
+
get: function () {
|
|
1094
|
+
stateDependencies.current.error = true;
|
|
1095
|
+
if (config.suspense) {
|
|
1096
|
+
return latestError;
|
|
1097
|
+
}
|
|
1098
|
+
return keyRef.current === key ? stateRef.current.error : initialError;
|
|
1099
|
+
},
|
|
1100
|
+
enumerable: true
|
|
1101
|
+
},
|
|
1102
|
+
data: {
|
|
1103
|
+
get: function () {
|
|
1104
|
+
stateDependencies.current.data = true;
|
|
1105
|
+
if (config.suspense) {
|
|
1106
|
+
return latestData;
|
|
1107
|
+
}
|
|
1108
|
+
return keyRef.current === key ? stateRef.current.data : initialData;
|
|
1109
|
+
},
|
|
1110
|
+
enumerable: true
|
|
1111
|
+
},
|
|
1112
|
+
isValidating: {
|
|
1113
|
+
get: function () {
|
|
1114
|
+
stateDependencies.current.isValidating = true;
|
|
1115
|
+
return key ? stateRef.current.isValidating : false;
|
|
1116
|
+
},
|
|
1117
|
+
enumerable: true
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
return state;
|
|
1121
|
+
// `config.suspense` isn't allowed to change during the lifecycle.
|
|
1122
|
+
// `boundMutate` is immutable, and the immutability of `revalidate` depends on `key`
|
|
1123
|
+
// so we can omit them from the deps array,
|
|
1124
|
+
// but we put it to enable react-hooks/exhaustive-deps rule.
|
|
1125
|
+
// `initialData` and `initialError` are not initial values
|
|
1126
|
+
// because they are changed during the lifecycle
|
|
1127
|
+
// so we should add them in the deps array.
|
|
1128
|
+
}, [
|
|
1129
|
+
revalidate,
|
|
1130
|
+
initialData,
|
|
1131
|
+
initialError,
|
|
1132
|
+
boundMutate,
|
|
1133
|
+
key,
|
|
1134
|
+
config.suspense,
|
|
1135
|
+
latestError,
|
|
1136
|
+
latestData
|
|
1137
|
+
]);
|
|
1138
|
+
return memoizedState;
|
|
1139
|
+
}
|
|
1140
|
+
Object.defineProperty(SWRConfigContext.Provider, 'default', {
|
|
1141
|
+
value: defaultConfig
|
|
1142
|
+
});
|
|
1143
|
+
var SWRConfig = SWRConfigContext.Provider;
|
|
1144
|
+
|
|
1145
|
+
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1146
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1147
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1148
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1149
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1150
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1151
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1152
|
+
});
|
|
1153
|
+
};
|
|
1154
|
+
var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
1155
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1156
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1157
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1158
|
+
function step(op) {
|
|
1159
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1160
|
+
while (_) try {
|
|
1161
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1162
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1163
|
+
switch (op[0]) {
|
|
1164
|
+
case 0: case 1: t = op; break;
|
|
1165
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
1166
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1167
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1168
|
+
default:
|
|
1169
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1170
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1171
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1172
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1173
|
+
if (t[2]) _.ops.pop();
|
|
1174
|
+
_.trys.pop(); continue;
|
|
1175
|
+
}
|
|
1176
|
+
op = body.call(thisArg, _);
|
|
1177
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1178
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
1182
|
+
var t = {};
|
|
1183
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1184
|
+
t[p] = s[p];
|
|
1185
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1186
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1187
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1188
|
+
t[p[i]] = s[p[i]];
|
|
1189
|
+
}
|
|
1190
|
+
return t;
|
|
1191
|
+
};
|
|
1192
|
+
|
|
145
1193
|
var _this = undefined;
|
|
146
1194
|
|
|
147
1195
|
var dataHandler = function () {
|
|
@@ -1338,7 +2386,7 @@ var isArguments = function isArguments(value) {
|
|
|
1338
2386
|
var keysShim;
|
|
1339
2387
|
if (!Object.keys) {
|
|
1340
2388
|
// modified from https://github.com/es-shims/es5-shim
|
|
1341
|
-
var has = Object.prototype.hasOwnProperty;
|
|
2389
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
1342
2390
|
var toStr$1 = Object.prototype.toString;
|
|
1343
2391
|
var isArgs = isArguments; // eslint-disable-line global-require
|
|
1344
2392
|
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
@@ -1387,7 +2435,7 @@ if (!Object.keys) {
|
|
|
1387
2435
|
if (typeof window === 'undefined') { return false; }
|
|
1388
2436
|
for (var k in window) {
|
|
1389
2437
|
try {
|
|
1390
|
-
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
2438
|
+
if (!excludedKeys['$' + k] && has$1.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
1391
2439
|
try {
|
|
1392
2440
|
equalsConstructorPrototype(window[k]);
|
|
1393
2441
|
} catch (e) {
|
|
@@ -1424,7 +2472,7 @@ if (!Object.keys) {
|
|
|
1424
2472
|
}
|
|
1425
2473
|
|
|
1426
2474
|
var skipProto = hasProtoEnumBug && isFunction;
|
|
1427
|
-
if (isString && object.length > 0 && !has.call(object, 0)) {
|
|
2475
|
+
if (isString && object.length > 0 && !has$1.call(object, 0)) {
|
|
1428
2476
|
for (var i = 0; i < object.length; ++i) {
|
|
1429
2477
|
theKeys.push(String(i));
|
|
1430
2478
|
}
|
|
@@ -1436,7 +2484,7 @@ if (!Object.keys) {
|
|
|
1436
2484
|
}
|
|
1437
2485
|
} else {
|
|
1438
2486
|
for (var name in object) {
|
|
1439
|
-
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
|
2487
|
+
if (!(skipProto && name === 'prototype') && has$1.call(object, name)) {
|
|
1440
2488
|
theKeys.push(String(name));
|
|
1441
2489
|
}
|
|
1442
2490
|
}
|
|
@@ -1446,7 +2494,7 @@ if (!Object.keys) {
|
|
|
1446
2494
|
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
1447
2495
|
|
|
1448
2496
|
for (var k = 0; k < dontEnums.length; ++k) {
|
|
1449
|
-
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
|
2497
|
+
if (!(skipConstructor && dontEnums[k] === 'constructor') && has$1.call(object, dontEnums[k])) {
|
|
1450
2498
|
theKeys.push(dontEnums[k]);
|
|
1451
2499
|
}
|
|
1452
2500
|
}
|
|
@@ -1543,6 +2591,59 @@ defineProperties.supportsDescriptors = !!supportsDescriptors;
|
|
|
1543
2591
|
|
|
1544
2592
|
var defineProperties_1 = defineProperties;
|
|
1545
2593
|
|
|
2594
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
2595
|
+
var shams = function hasSymbols() {
|
|
2596
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
2597
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
2598
|
+
|
|
2599
|
+
var obj = {};
|
|
2600
|
+
var sym = Symbol('test');
|
|
2601
|
+
var symObj = Object(sym);
|
|
2602
|
+
if (typeof sym === 'string') { return false; }
|
|
2603
|
+
|
|
2604
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
2605
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
2606
|
+
|
|
2607
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
2608
|
+
// if (sym instanceof Symbol) { return false; }
|
|
2609
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
2610
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
2611
|
+
|
|
2612
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
2613
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
2614
|
+
|
|
2615
|
+
var symVal = 42;
|
|
2616
|
+
obj[sym] = symVal;
|
|
2617
|
+
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
|
|
2618
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
2619
|
+
|
|
2620
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
2621
|
+
|
|
2622
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
2623
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
2624
|
+
|
|
2625
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
2626
|
+
|
|
2627
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
2628
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
2629
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
return true;
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2635
|
+
var origSymbol = _commonjsHelpers.commonjsGlobal.Symbol;
|
|
2636
|
+
|
|
2637
|
+
|
|
2638
|
+
var hasSymbols$1 = function hasNativeSymbols() {
|
|
2639
|
+
if (typeof origSymbol !== 'function') { return false; }
|
|
2640
|
+
if (typeof Symbol !== 'function') { return false; }
|
|
2641
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
2642
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
2643
|
+
|
|
2644
|
+
return shams();
|
|
2645
|
+
};
|
|
2646
|
+
|
|
1546
2647
|
/* eslint no-invalid-this: 1 */
|
|
1547
2648
|
|
|
1548
2649
|
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
@@ -1596,74 +2697,15 @@ var implementation$1 = function bind(that) {
|
|
|
1596
2697
|
|
|
1597
2698
|
var functionBind = Function.prototype.bind || implementation$1;
|
|
1598
2699
|
|
|
1599
|
-
/*
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
var obj = {};
|
|
1605
|
-
var sym = Symbol('test');
|
|
1606
|
-
var symObj = Object(sym);
|
|
1607
|
-
if (typeof sym === 'string') { return false; }
|
|
1608
|
-
|
|
1609
|
-
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
1610
|
-
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
1611
|
-
|
|
1612
|
-
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
1613
|
-
// if (sym instanceof Symbol) { return false; }
|
|
1614
|
-
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
1615
|
-
// if (!(symObj instanceof Symbol)) { return false; }
|
|
1616
|
-
|
|
1617
|
-
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
1618
|
-
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
1619
|
-
|
|
1620
|
-
var symVal = 42;
|
|
1621
|
-
obj[sym] = symVal;
|
|
1622
|
-
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
1623
|
-
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
1624
|
-
|
|
1625
|
-
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
1626
|
-
|
|
1627
|
-
var syms = Object.getOwnPropertySymbols(obj);
|
|
1628
|
-
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
1629
|
-
|
|
1630
|
-
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
1631
|
-
|
|
1632
|
-
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
1633
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
1634
|
-
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
return true;
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
var hasSymbols$1 = function hasNativeSymbols() {
|
|
1644
|
-
if (typeof origSymbol !== 'function') { return false; }
|
|
1645
|
-
if (typeof Symbol !== 'function') { return false; }
|
|
1646
|
-
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
1647
|
-
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
1648
|
-
|
|
1649
|
-
return shams();
|
|
1650
|
-
};
|
|
1651
|
-
|
|
1652
|
-
var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
2700
|
+
/* globals
|
|
2701
|
+
Atomics,
|
|
2702
|
+
SharedArrayBuffer,
|
|
2703
|
+
*/
|
|
1653
2704
|
|
|
1654
2705
|
var undefined$1;
|
|
1655
2706
|
|
|
1656
|
-
var $SyntaxError = SyntaxError;
|
|
1657
|
-
var $Function = Function;
|
|
1658
2707
|
var $TypeError = TypeError;
|
|
1659
2708
|
|
|
1660
|
-
// eslint-disable-next-line consistent-return
|
|
1661
|
-
var getEvalledConstructor = function (expressionSyntax) {
|
|
1662
|
-
try {
|
|
1663
|
-
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
1664
|
-
} catch (e) {}
|
|
1665
|
-
};
|
|
1666
|
-
|
|
1667
2709
|
var $gOPD = Object.getOwnPropertyDescriptor;
|
|
1668
2710
|
if ($gOPD) {
|
|
1669
2711
|
try {
|
|
@@ -1673,9 +2715,7 @@ if ($gOPD) {
|
|
|
1673
2715
|
}
|
|
1674
2716
|
}
|
|
1675
2717
|
|
|
1676
|
-
var throwTypeError = function () {
|
|
1677
|
-
throw new $TypeError();
|
|
1678
|
-
};
|
|
2718
|
+
var throwTypeError = function () { throw new $TypeError(); };
|
|
1679
2719
|
var ThrowTypeError = $gOPD
|
|
1680
2720
|
? (function () {
|
|
1681
2721
|
try {
|
|
@@ -1696,351 +2736,203 @@ var ThrowTypeError = $gOPD
|
|
|
1696
2736
|
var hasSymbols$2 = hasSymbols$1();
|
|
1697
2737
|
|
|
1698
2738
|
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
|
|
1699
|
-
|
|
1700
|
-
var
|
|
2739
|
+
var generatorFunction = undefined$1;
|
|
2740
|
+
var asyncFunction = undefined$1;
|
|
2741
|
+
var asyncGenFunction = undefined$1;
|
|
1701
2742
|
|
|
1702
2743
|
var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
|
|
1703
2744
|
|
|
1704
2745
|
var INTRINSICS = {
|
|
1705
|
-
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
1706
2746
|
'%Array%': Array,
|
|
1707
2747
|
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
2748
|
+
'%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer.prototype,
|
|
1708
2749
|
'%ArrayIteratorPrototype%': hasSymbols$2 ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
2750
|
+
'%ArrayPrototype%': Array.prototype,
|
|
2751
|
+
'%ArrayProto_entries%': Array.prototype.entries,
|
|
2752
|
+
'%ArrayProto_forEach%': Array.prototype.forEach,
|
|
2753
|
+
'%ArrayProto_keys%': Array.prototype.keys,
|
|
2754
|
+
'%ArrayProto_values%': Array.prototype.values,
|
|
1709
2755
|
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
1710
|
-
'%AsyncFunction%':
|
|
1711
|
-
'%
|
|
1712
|
-
'%
|
|
1713
|
-
'%
|
|
2756
|
+
'%AsyncFunction%': asyncFunction,
|
|
2757
|
+
'%AsyncFunctionPrototype%': undefined$1,
|
|
2758
|
+
'%AsyncGenerator%': undefined$1,
|
|
2759
|
+
'%AsyncGeneratorFunction%': asyncGenFunction,
|
|
2760
|
+
'%AsyncGeneratorPrototype%': undefined$1,
|
|
2761
|
+
'%AsyncIteratorPrototype%': undefined$1,
|
|
1714
2762
|
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
|
1715
|
-
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
|
1716
2763
|
'%Boolean%': Boolean,
|
|
2764
|
+
'%BooleanPrototype%': Boolean.prototype,
|
|
1717
2765
|
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
|
2766
|
+
'%DataViewPrototype%': typeof DataView === 'undefined' ? undefined$1 : DataView.prototype,
|
|
1718
2767
|
'%Date%': Date,
|
|
2768
|
+
'%DatePrototype%': Date.prototype,
|
|
1719
2769
|
'%decodeURI%': decodeURI,
|
|
1720
2770
|
'%decodeURIComponent%': decodeURIComponent,
|
|
1721
2771
|
'%encodeURI%': encodeURI,
|
|
1722
2772
|
'%encodeURIComponent%': encodeURIComponent,
|
|
1723
2773
|
'%Error%': Error,
|
|
2774
|
+
'%ErrorPrototype%': Error.prototype,
|
|
1724
2775
|
'%eval%': eval, // eslint-disable-line no-eval
|
|
1725
2776
|
'%EvalError%': EvalError,
|
|
2777
|
+
'%EvalErrorPrototype%': EvalError.prototype,
|
|
1726
2778
|
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
2779
|
+
'%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array.prototype,
|
|
1727
2780
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
1728
|
-
'%
|
|
1729
|
-
'%Function%':
|
|
1730
|
-
'%
|
|
2781
|
+
'%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array.prototype,
|
|
2782
|
+
'%Function%': Function,
|
|
2783
|
+
'%FunctionPrototype%': Function.prototype,
|
|
2784
|
+
'%Generator%': undefined$1,
|
|
2785
|
+
'%GeneratorFunction%': generatorFunction,
|
|
2786
|
+
'%GeneratorPrototype%': undefined$1,
|
|
1731
2787
|
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
|
2788
|
+
'%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array.prototype,
|
|
1732
2789
|
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
|
2790
|
+
'%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined$1 : Int8Array.prototype,
|
|
1733
2791
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
2792
|
+
'%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array.prototype,
|
|
1734
2793
|
'%isFinite%': isFinite,
|
|
1735
2794
|
'%isNaN%': isNaN,
|
|
1736
2795
|
'%IteratorPrototype%': hasSymbols$2 ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
1737
2796
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
2797
|
+
'%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined$1,
|
|
1738
2798
|
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
1739
2799
|
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
2800
|
+
'%MapPrototype%': typeof Map === 'undefined' ? undefined$1 : Map.prototype,
|
|
1740
2801
|
'%Math%': Math,
|
|
1741
2802
|
'%Number%': Number,
|
|
2803
|
+
'%NumberPrototype%': Number.prototype,
|
|
1742
2804
|
'%Object%': Object,
|
|
2805
|
+
'%ObjectPrototype%': Object.prototype,
|
|
2806
|
+
'%ObjProto_toString%': Object.prototype.toString,
|
|
2807
|
+
'%ObjProto_valueOf%': Object.prototype.valueOf,
|
|
1743
2808
|
'%parseFloat%': parseFloat,
|
|
1744
2809
|
'%parseInt%': parseInt,
|
|
1745
2810
|
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
2811
|
+
'%PromisePrototype%': typeof Promise === 'undefined' ? undefined$1 : Promise.prototype,
|
|
2812
|
+
'%PromiseProto_then%': typeof Promise === 'undefined' ? undefined$1 : Promise.prototype.then,
|
|
2813
|
+
'%Promise_all%': typeof Promise === 'undefined' ? undefined$1 : Promise.all,
|
|
2814
|
+
'%Promise_reject%': typeof Promise === 'undefined' ? undefined$1 : Promise.reject,
|
|
2815
|
+
'%Promise_resolve%': typeof Promise === 'undefined' ? undefined$1 : Promise.resolve,
|
|
1746
2816
|
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
1747
2817
|
'%RangeError%': RangeError,
|
|
2818
|
+
'%RangeErrorPrototype%': RangeError.prototype,
|
|
1748
2819
|
'%ReferenceError%': ReferenceError,
|
|
2820
|
+
'%ReferenceErrorPrototype%': ReferenceError.prototype,
|
|
1749
2821
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
1750
2822
|
'%RegExp%': RegExp,
|
|
2823
|
+
'%RegExpPrototype%': RegExp.prototype,
|
|
1751
2824
|
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
1752
2825
|
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
2826
|
+
'%SetPrototype%': typeof Set === 'undefined' ? undefined$1 : Set.prototype,
|
|
1753
2827
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
2828
|
+
'%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer.prototype,
|
|
1754
2829
|
'%String%': String,
|
|
1755
2830
|
'%StringIteratorPrototype%': hasSymbols$2 ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
2831
|
+
'%StringPrototype%': String.prototype,
|
|
1756
2832
|
'%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
|
|
1757
|
-
'%
|
|
2833
|
+
'%SymbolPrototype%': hasSymbols$2 ? Symbol.prototype : undefined$1,
|
|
2834
|
+
'%SyntaxError%': SyntaxError,
|
|
2835
|
+
'%SyntaxErrorPrototype%': SyntaxError.prototype,
|
|
1758
2836
|
'%ThrowTypeError%': ThrowTypeError,
|
|
1759
2837
|
'%TypedArray%': TypedArray,
|
|
2838
|
+
'%TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined$1,
|
|
1760
2839
|
'%TypeError%': $TypeError,
|
|
2840
|
+
'%TypeErrorPrototype%': $TypeError.prototype,
|
|
1761
2841
|
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
2842
|
+
'%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array.prototype,
|
|
1762
2843
|
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
2844
|
+
'%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray.prototype,
|
|
1763
2845
|
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
2846
|
+
'%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array.prototype,
|
|
1764
2847
|
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
2848
|
+
'%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array.prototype,
|
|
1765
2849
|
'%URIError%': URIError,
|
|
2850
|
+
'%URIErrorPrototype%': URIError.prototype,
|
|
1766
2851
|
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
1767
|
-
'%
|
|
1768
|
-
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
var doEval = function doEval(name) {
|
|
1772
|
-
var value;
|
|
1773
|
-
if (name === '%AsyncFunction%') {
|
|
1774
|
-
value = getEvalledConstructor('async function () {}');
|
|
1775
|
-
} else if (name === '%GeneratorFunction%') {
|
|
1776
|
-
value = getEvalledConstructor('function* () {}');
|
|
1777
|
-
} else if (name === '%AsyncGeneratorFunction%') {
|
|
1778
|
-
value = getEvalledConstructor('async function* () {}');
|
|
1779
|
-
} else if (name === '%AsyncGenerator%') {
|
|
1780
|
-
var fn = doEval('%AsyncGeneratorFunction%');
|
|
1781
|
-
if (fn) {
|
|
1782
|
-
value = fn.prototype;
|
|
1783
|
-
}
|
|
1784
|
-
} else if (name === '%AsyncIteratorPrototype%') {
|
|
1785
|
-
var gen = doEval('%AsyncGenerator%');
|
|
1786
|
-
if (gen) {
|
|
1787
|
-
value = getProto(gen.prototype);
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
INTRINSICS[name] = value;
|
|
1792
|
-
|
|
1793
|
-
return value;
|
|
2852
|
+
'%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap.prototype,
|
|
2853
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet,
|
|
2854
|
+
'%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet.prototype
|
|
1794
2855
|
};
|
|
1795
2856
|
|
|
1796
|
-
|
|
1797
|
-
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
1798
|
-
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
1799
|
-
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
1800
|
-
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
1801
|
-
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
1802
|
-
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
1803
|
-
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
1804
|
-
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
1805
|
-
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
1806
|
-
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
1807
|
-
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
1808
|
-
'%DatePrototype%': ['Date', 'prototype'],
|
|
1809
|
-
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
1810
|
-
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
1811
|
-
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
1812
|
-
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
1813
|
-
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
1814
|
-
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
1815
|
-
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
1816
|
-
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
1817
|
-
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
1818
|
-
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
1819
|
-
'%JSONParse%': ['JSON', 'parse'],
|
|
1820
|
-
'%JSONStringify%': ['JSON', 'stringify'],
|
|
1821
|
-
'%MapPrototype%': ['Map', 'prototype'],
|
|
1822
|
-
'%NumberPrototype%': ['Number', 'prototype'],
|
|
1823
|
-
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
1824
|
-
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
1825
|
-
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
1826
|
-
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
1827
|
-
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
1828
|
-
'%Promise_all%': ['Promise', 'all'],
|
|
1829
|
-
'%Promise_reject%': ['Promise', 'reject'],
|
|
1830
|
-
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
1831
|
-
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
1832
|
-
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
1833
|
-
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
1834
|
-
'%SetPrototype%': ['Set', 'prototype'],
|
|
1835
|
-
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
1836
|
-
'%StringPrototype%': ['String', 'prototype'],
|
|
1837
|
-
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
1838
|
-
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
1839
|
-
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
1840
|
-
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
1841
|
-
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
1842
|
-
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
1843
|
-
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
1844
|
-
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
1845
|
-
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
1846
|
-
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
1847
|
-
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
1848
|
-
};
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
var $concat = functionBind.call(Function.call, Array.prototype.concat);
|
|
1853
|
-
var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
|
|
2857
|
+
|
|
1854
2858
|
var $replace = functionBind.call(Function.call, String.prototype.replace);
|
|
1855
|
-
var $strSlice = functionBind.call(Function.call, String.prototype.slice);
|
|
1856
2859
|
|
|
1857
2860
|
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1858
2861
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
1859
2862
|
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
1860
2863
|
var stringToPath = function stringToPath(string) {
|
|
1861
|
-
var first = $strSlice(string, 0, 1);
|
|
1862
|
-
var last = $strSlice(string, -1);
|
|
1863
|
-
if (first === '%' && last !== '%') {
|
|
1864
|
-
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
|
1865
|
-
} else if (last === '%' && first !== '%') {
|
|
1866
|
-
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
|
1867
|
-
}
|
|
1868
2864
|
var result = [];
|
|
1869
2865
|
$replace(string, rePropName, function (match, number, quote, subString) {
|
|
1870
|
-
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
|
2866
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match);
|
|
1871
2867
|
});
|
|
1872
2868
|
return result;
|
|
1873
2869
|
};
|
|
1874
2870
|
/* end adaptation */
|
|
1875
2871
|
|
|
1876
2872
|
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
if (src(LEGACY_ALIASES, intrinsicName)) {
|
|
1880
|
-
alias = LEGACY_ALIASES[intrinsicName];
|
|
1881
|
-
intrinsicName = '%' + alias[0] + '%';
|
|
2873
|
+
if (!(name in INTRINSICS)) {
|
|
2874
|
+
throw new SyntaxError('intrinsic ' + name + ' does not exist!');
|
|
1882
2875
|
}
|
|
1883
2876
|
|
|
1884
|
-
if
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
value = doEval(intrinsicName);
|
|
1888
|
-
}
|
|
1889
|
-
if (typeof value === 'undefined' && !allowMissing) {
|
|
1890
|
-
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
return {
|
|
1894
|
-
alias: alias,
|
|
1895
|
-
name: intrinsicName,
|
|
1896
|
-
value: value
|
|
1897
|
-
};
|
|
2877
|
+
// istanbul ignore if // hopefully this is impossible to test :-)
|
|
2878
|
+
if (typeof INTRINSICS[name] === 'undefined' && !allowMissing) {
|
|
2879
|
+
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
1898
2880
|
}
|
|
1899
2881
|
|
|
1900
|
-
|
|
2882
|
+
return INTRINSICS[name];
|
|
1901
2883
|
};
|
|
1902
2884
|
|
|
1903
|
-
var
|
|
2885
|
+
var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
1904
2886
|
if (typeof name !== 'string' || name.length === 0) {
|
|
1905
|
-
throw new
|
|
2887
|
+
throw new TypeError('intrinsic name must be a non-empty string');
|
|
1906
2888
|
}
|
|
1907
2889
|
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
1908
|
-
throw new
|
|
2890
|
+
throw new TypeError('"allowMissing" argument must be a boolean');
|
|
1909
2891
|
}
|
|
1910
2892
|
|
|
1911
2893
|
var parts = stringToPath(name);
|
|
1912
|
-
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
1913
|
-
|
|
1914
|
-
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
1915
|
-
var intrinsicRealName = intrinsic.name;
|
|
1916
|
-
var value = intrinsic.value;
|
|
1917
|
-
var skipFurtherCaching = false;
|
|
1918
|
-
|
|
1919
|
-
var alias = intrinsic.alias;
|
|
1920
|
-
if (alias) {
|
|
1921
|
-
intrinsicBaseName = alias[0];
|
|
1922
|
-
$spliceApply(parts, $concat([0, 1], alias));
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1926
|
-
var part = parts[i];
|
|
1927
|
-
var first = $strSlice(part, 0, 1);
|
|
1928
|
-
var last = $strSlice(part, -1);
|
|
1929
|
-
if (
|
|
1930
|
-
(
|
|
1931
|
-
(first === '"' || first === "'" || first === '`')
|
|
1932
|
-
|| (last === '"' || last === "'" || last === '`')
|
|
1933
|
-
)
|
|
1934
|
-
&& first !== last
|
|
1935
|
-
) {
|
|
1936
|
-
throw new $SyntaxError('property names with quotes must have matching quotes');
|
|
1937
|
-
}
|
|
1938
|
-
if (part === 'constructor' || !isOwn) {
|
|
1939
|
-
skipFurtherCaching = true;
|
|
1940
|
-
}
|
|
1941
2894
|
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
if (src(INTRINSICS, intrinsicRealName)) {
|
|
1946
|
-
value = INTRINSICS[intrinsicRealName];
|
|
1947
|
-
} else if (value != null) {
|
|
1948
|
-
if (!(part in value)) {
|
|
1949
|
-
if (!allowMissing) {
|
|
1950
|
-
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1951
|
-
}
|
|
1952
|
-
return void undefined$1;
|
|
1953
|
-
}
|
|
2895
|
+
var value = getBaseIntrinsic('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing);
|
|
2896
|
+
for (var i = 1; i < parts.length; i += 1) {
|
|
2897
|
+
if (value != null) {
|
|
1954
2898
|
if ($gOPD && (i + 1) >= parts.length) {
|
|
1955
|
-
var desc = $gOPD(value,
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
// By convention, when a data property is converted to an accessor
|
|
1959
|
-
// property to emulate a data property that does not suffer from
|
|
1960
|
-
// the override mistake, that accessor's getter is marked with
|
|
1961
|
-
// an `originalValue` property. Here, when we detect this, we
|
|
1962
|
-
// uphold the illusion by pretending to see that original data
|
|
1963
|
-
// property, i.e., returning the value rather than the getter
|
|
1964
|
-
// itself.
|
|
1965
|
-
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
1966
|
-
value = desc.get;
|
|
1967
|
-
} else {
|
|
1968
|
-
value = value[part];
|
|
2899
|
+
var desc = $gOPD(value, parts[i]);
|
|
2900
|
+
if (!allowMissing && !(parts[i] in value)) {
|
|
2901
|
+
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1969
2902
|
}
|
|
2903
|
+
value = desc ? (desc.get || desc.value) : value[parts[i]];
|
|
1970
2904
|
} else {
|
|
1971
|
-
|
|
1972
|
-
value = value[part];
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
if (isOwn && !skipFurtherCaching) {
|
|
1976
|
-
INTRINSICS[intrinsicRealName] = value;
|
|
2905
|
+
value = value[parts[i]];
|
|
1977
2906
|
}
|
|
1978
2907
|
}
|
|
1979
2908
|
}
|
|
1980
2909
|
return value;
|
|
1981
2910
|
};
|
|
1982
2911
|
|
|
1983
|
-
var
|
|
2912
|
+
var $Function = GetIntrinsic('%Function%');
|
|
2913
|
+
var $apply = $Function.apply;
|
|
2914
|
+
var $call = $Function.call;
|
|
1984
2915
|
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
var $apply = getIntrinsic('%Function.prototype.apply%');
|
|
1989
|
-
var $call = getIntrinsic('%Function.prototype.call%');
|
|
1990
|
-
var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
|
|
1991
|
-
|
|
1992
|
-
var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
1993
|
-
var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
|
|
1994
|
-
var $max = getIntrinsic('%Math.max%');
|
|
1995
|
-
|
|
1996
|
-
if ($defineProperty) {
|
|
1997
|
-
try {
|
|
1998
|
-
$defineProperty({}, 'a', { value: 1 });
|
|
1999
|
-
} catch (e) {
|
|
2000
|
-
// IE 8 has a broken defineProperty
|
|
2001
|
-
$defineProperty = null;
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
module.exports = function callBind(originalFunction) {
|
|
2006
|
-
var func = $reflectApply(functionBind, $call, arguments);
|
|
2007
|
-
if ($gOPD && $defineProperty) {
|
|
2008
|
-
var desc = $gOPD(func, 'length');
|
|
2009
|
-
if (desc.configurable) {
|
|
2010
|
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
2011
|
-
$defineProperty(
|
|
2012
|
-
func,
|
|
2013
|
-
'length',
|
|
2014
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
2015
|
-
);
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
return func;
|
|
2916
|
+
var callBind = function callBind() {
|
|
2917
|
+
return functionBind.apply($call, arguments);
|
|
2019
2918
|
};
|
|
2020
2919
|
|
|
2021
|
-
var
|
|
2022
|
-
return
|
|
2920
|
+
var apply = function applyBind() {
|
|
2921
|
+
return functionBind.apply($apply, arguments);
|
|
2023
2922
|
};
|
|
2923
|
+
callBind.apply = apply;
|
|
2024
2924
|
|
|
2025
|
-
|
|
2026
|
-
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
2027
|
-
} else {
|
|
2028
|
-
module.exports.apply = applyBind;
|
|
2029
|
-
}
|
|
2030
|
-
});
|
|
2031
|
-
var callBind_1 = callBind.apply;
|
|
2032
|
-
|
|
2033
|
-
var $indexOf = callBind(getIntrinsic('String.prototype.indexOf'));
|
|
2925
|
+
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
2034
2926
|
|
|
2035
2927
|
var callBound = function callBoundIntrinsic(name, allowMissing) {
|
|
2036
|
-
var intrinsic =
|
|
2037
|
-
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')
|
|
2928
|
+
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
2929
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')) {
|
|
2038
2930
|
return callBind(intrinsic);
|
|
2039
2931
|
}
|
|
2040
2932
|
return intrinsic;
|
|
2041
2933
|
};
|
|
2042
2934
|
|
|
2043
|
-
var $defineProperty =
|
|
2935
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
2044
2936
|
|
|
2045
2937
|
if ($defineProperty) {
|
|
2046
2938
|
try {
|
|
@@ -2082,13 +2974,15 @@ var DefineOwnProperty = function DefineOwnProperty(IsDataDescriptor, SameValue,
|
|
|
2082
2974
|
return true;
|
|
2083
2975
|
};
|
|
2084
2976
|
|
|
2085
|
-
var
|
|
2086
|
-
|
|
2977
|
+
var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
2978
|
+
|
|
2979
|
+
var $TypeError$1 = GetIntrinsic('%TypeError%');
|
|
2980
|
+
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
|
2087
2981
|
|
|
2088
2982
|
|
|
2089
2983
|
|
|
2090
2984
|
var predicates = {
|
|
2091
|
-
// https://
|
|
2985
|
+
// https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
|
|
2092
2986
|
'Property Descriptor': function isPropertyDescriptor(Type, Desc) {
|
|
2093
2987
|
if (Type(Desc) !== 'Object') {
|
|
2094
2988
|
return false;
|
|
@@ -2120,14 +3014,14 @@ var predicates = {
|
|
|
2120
3014
|
var assertRecord = function assertRecord(Type, recordType, argumentName, value) {
|
|
2121
3015
|
var predicate = predicates[recordType];
|
|
2122
3016
|
if (typeof predicate !== 'function') {
|
|
2123
|
-
throw new $SyntaxError
|
|
3017
|
+
throw new $SyntaxError('unknown record type: ' + recordType);
|
|
2124
3018
|
}
|
|
2125
3019
|
if (!predicate(Type, value)) {
|
|
2126
3020
|
throw new $TypeError$1(argumentName + ' must be a ' + recordType);
|
|
2127
3021
|
}
|
|
2128
3022
|
};
|
|
2129
3023
|
|
|
2130
|
-
// https://
|
|
3024
|
+
// https://www.ecma-international.org/ecma-262/5.1/#sec-8
|
|
2131
3025
|
|
|
2132
3026
|
var Type = function Type(x) {
|
|
2133
3027
|
if (x === null) {
|
|
@@ -2150,19 +3044,16 @@ var Type = function Type(x) {
|
|
|
2150
3044
|
}
|
|
2151
3045
|
};
|
|
2152
3046
|
|
|
2153
|
-
// https://
|
|
3047
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
|
|
2154
3048
|
|
|
2155
3049
|
var Type$1 = function Type$1(x) {
|
|
2156
3050
|
if (typeof x === 'symbol') {
|
|
2157
3051
|
return 'Symbol';
|
|
2158
3052
|
}
|
|
2159
|
-
if (typeof x === 'bigint') {
|
|
2160
|
-
return 'BigInt';
|
|
2161
|
-
}
|
|
2162
3053
|
return Type(x);
|
|
2163
3054
|
};
|
|
2164
3055
|
|
|
2165
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
|
|
3056
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
|
|
2166
3057
|
|
|
2167
3058
|
var FromPropertyDescriptor = function FromPropertyDescriptor(Desc) {
|
|
2168
3059
|
if (typeof Desc === 'undefined') {
|
|
@@ -2193,7 +3084,7 @@ var FromPropertyDescriptor = function FromPropertyDescriptor(Desc) {
|
|
|
2193
3084
|
return obj;
|
|
2194
3085
|
};
|
|
2195
3086
|
|
|
2196
|
-
var $gOPD$1 =
|
|
3087
|
+
var $gOPD$1 = GetIntrinsic('%Object.getOwnPropertyDescriptor%');
|
|
2197
3088
|
if ($gOPD$1) {
|
|
2198
3089
|
try {
|
|
2199
3090
|
$gOPD$1([], 'length');
|
|
@@ -2205,85 +3096,65 @@ if ($gOPD$1) {
|
|
|
2205
3096
|
|
|
2206
3097
|
var getOwnPropertyDescriptor = $gOPD$1;
|
|
2207
3098
|
|
|
2208
|
-
var $Array =
|
|
3099
|
+
var $Array = GetIntrinsic('%Array%');
|
|
2209
3100
|
|
|
2210
3101
|
// eslint-disable-next-line global-require
|
|
2211
3102
|
var toStr$4 = !$Array.isArray && callBound('Object.prototype.toString');
|
|
2212
3103
|
|
|
2213
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-isarray
|
|
3104
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-isarray
|
|
2214
3105
|
|
|
2215
3106
|
var IsArray = $Array.isArray || function IsArray(argument) {
|
|
2216
3107
|
return toStr$4(argument) === '[object Array]';
|
|
2217
3108
|
};
|
|
2218
3109
|
|
|
2219
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey
|
|
3110
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-ispropertykey
|
|
2220
3111
|
|
|
2221
3112
|
var IsPropertyKey = function IsPropertyKey(argument) {
|
|
2222
3113
|
return typeof argument === 'string' || typeof argument === 'symbol';
|
|
2223
3114
|
};
|
|
2224
3115
|
|
|
2225
|
-
var
|
|
2226
|
-
var
|
|
2227
|
-
var has$1;
|
|
2228
|
-
var $exec;
|
|
2229
|
-
var isRegexMarker;
|
|
2230
|
-
var badStringifier;
|
|
2231
|
-
|
|
2232
|
-
if (hasToStringTag) {
|
|
2233
|
-
has$1 = callBound('Object.prototype.hasOwnProperty');
|
|
2234
|
-
$exec = callBound('RegExp.prototype.exec');
|
|
2235
|
-
isRegexMarker = {};
|
|
3116
|
+
var regexExec = RegExp.prototype.exec;
|
|
3117
|
+
var gOPD = Object.getOwnPropertyDescriptor;
|
|
2236
3118
|
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
toString: throwRegexMarker,
|
|
2242
|
-
valueOf: throwRegexMarker
|
|
2243
|
-
};
|
|
3119
|
+
var tryRegexExecCall = function tryRegexExec(value) {
|
|
3120
|
+
try {
|
|
3121
|
+
var lastIndex = value.lastIndex;
|
|
3122
|
+
value.lastIndex = 0; // eslint-disable-line no-param-reassign
|
|
2244
3123
|
|
|
2245
|
-
|
|
2246
|
-
|
|
3124
|
+
regexExec.call(value);
|
|
3125
|
+
return true;
|
|
3126
|
+
} catch (e) {
|
|
3127
|
+
return false;
|
|
3128
|
+
} finally {
|
|
3129
|
+
value.lastIndex = lastIndex; // eslint-disable-line no-param-reassign
|
|
2247
3130
|
}
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
var $toString = callBound('Object.prototype.toString');
|
|
2251
|
-
var gOPD = Object.getOwnPropertyDescriptor;
|
|
3131
|
+
};
|
|
3132
|
+
var toStr$5 = Object.prototype.toString;
|
|
2252
3133
|
var regexClass = '[object RegExp]';
|
|
3134
|
+
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
|
2253
3135
|
|
|
2254
|
-
var isRegex =
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
var descriptor = gOPD(value, 'lastIndex');
|
|
2262
|
-
var hasLastIndexDataProperty = descriptor && has$1(descriptor, 'value');
|
|
2263
|
-
if (!hasLastIndexDataProperty) {
|
|
2264
|
-
return false;
|
|
2265
|
-
}
|
|
3136
|
+
var isRegex = function isRegex(value) {
|
|
3137
|
+
if (!value || typeof value !== 'object') {
|
|
3138
|
+
return false;
|
|
3139
|
+
}
|
|
3140
|
+
if (!hasToStringTag) {
|
|
3141
|
+
return toStr$5.call(value) === regexClass;
|
|
3142
|
+
}
|
|
2266
3143
|
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
}
|
|
3144
|
+
var descriptor = gOPD(value, 'lastIndex');
|
|
3145
|
+
var hasLastIndexDataProperty = descriptor && src(descriptor, 'value');
|
|
3146
|
+
if (!hasLastIndexDataProperty) {
|
|
3147
|
+
return false;
|
|
2272
3148
|
}
|
|
2273
|
-
: function isRegex(value) {
|
|
2274
|
-
// In older browsers, typeof regex incorrectly returns 'function'
|
|
2275
|
-
if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
|
|
2276
|
-
return false;
|
|
2277
|
-
}
|
|
2278
3149
|
|
|
2279
|
-
|
|
2280
|
-
|
|
3150
|
+
return tryRegexExecCall(value);
|
|
3151
|
+
};
|
|
2281
3152
|
|
|
2282
|
-
// http://
|
|
3153
|
+
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.2
|
|
2283
3154
|
|
|
2284
3155
|
var ToBoolean = function ToBoolean(value) { return !!value; };
|
|
2285
3156
|
|
|
2286
|
-
var $match =
|
|
3157
|
+
var $match = GetIntrinsic('%Symbol.match%', true);
|
|
2287
3158
|
|
|
2288
3159
|
|
|
2289
3160
|
|
|
@@ -2305,27 +3176,6 @@ var IsRegExp = function IsRegExp(argument) {
|
|
|
2305
3176
|
};
|
|
2306
3177
|
|
|
2307
3178
|
var fnToStr = Function.prototype.toString;
|
|
2308
|
-
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
|
|
2309
|
-
var badArrayLike;
|
|
2310
|
-
var isCallableMarker;
|
|
2311
|
-
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
|
2312
|
-
try {
|
|
2313
|
-
badArrayLike = Object.defineProperty({}, 'length', {
|
|
2314
|
-
get: function () {
|
|
2315
|
-
throw isCallableMarker;
|
|
2316
|
-
}
|
|
2317
|
-
});
|
|
2318
|
-
isCallableMarker = {};
|
|
2319
|
-
// eslint-disable-next-line no-throw-literal
|
|
2320
|
-
reflectApply(function () { throw 42; }, null, badArrayLike);
|
|
2321
|
-
} catch (_) {
|
|
2322
|
-
if (_ !== isCallableMarker) {
|
|
2323
|
-
reflectApply = null;
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
} else {
|
|
2327
|
-
reflectApply = null;
|
|
2328
|
-
}
|
|
2329
3179
|
|
|
2330
3180
|
var constructorRegex = /^\s*class\b/;
|
|
2331
3181
|
var isES6ClassFn = function isES6ClassFunction(value) {
|
|
@@ -2346,48 +3196,32 @@ var tryFunctionObject = function tryFunctionToStr(value) {
|
|
|
2346
3196
|
return false;
|
|
2347
3197
|
}
|
|
2348
3198
|
};
|
|
2349
|
-
var toStr$
|
|
3199
|
+
var toStr$6 = Object.prototype.toString;
|
|
2350
3200
|
var fnClass = '[object Function]';
|
|
2351
3201
|
var genClass = '[object GeneratorFunction]';
|
|
2352
3202
|
var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
|
2353
|
-
/* globals document: false */
|
|
2354
|
-
var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {};
|
|
2355
|
-
|
|
2356
|
-
var isCallable = reflectApply
|
|
2357
|
-
? function isCallable(value) {
|
|
2358
|
-
if (value === documentDotAll) { return true; }
|
|
2359
|
-
if (!value) { return false; }
|
|
2360
|
-
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
2361
|
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
2362
|
-
try {
|
|
2363
|
-
reflectApply(value, null, badArrayLike);
|
|
2364
|
-
} catch (e) {
|
|
2365
|
-
if (e !== isCallableMarker) { return false; }
|
|
2366
|
-
}
|
|
2367
|
-
return !isES6ClassFn(value);
|
|
2368
|
-
}
|
|
2369
|
-
: function isCallable(value) {
|
|
2370
|
-
if (value === documentDotAll) { return true; }
|
|
2371
|
-
if (!value) { return false; }
|
|
2372
|
-
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
2373
|
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
2374
|
-
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
|
2375
|
-
if (isES6ClassFn(value)) { return false; }
|
|
2376
|
-
var strClass = toStr$5.call(value);
|
|
2377
|
-
return strClass === fnClass || strClass === genClass;
|
|
2378
|
-
};
|
|
2379
3203
|
|
|
2380
|
-
|
|
3204
|
+
var isCallable = function isCallable(value) {
|
|
3205
|
+
if (!value) { return false; }
|
|
3206
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
3207
|
+
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
3208
|
+
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
|
3209
|
+
if (isES6ClassFn(value)) { return false; }
|
|
3210
|
+
var strClass = toStr$6.call(value);
|
|
3211
|
+
return strClass === fnClass || strClass === genClass;
|
|
3212
|
+
};
|
|
3213
|
+
|
|
3214
|
+
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.11
|
|
2381
3215
|
|
|
2382
3216
|
var IsCallable = isCallable;
|
|
2383
3217
|
|
|
2384
|
-
var $TypeError$2 =
|
|
3218
|
+
var $TypeError$2 = GetIntrinsic('%TypeError%');
|
|
2385
3219
|
|
|
2386
3220
|
|
|
2387
3221
|
|
|
2388
3222
|
|
|
2389
3223
|
|
|
2390
|
-
// https://
|
|
3224
|
+
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.5
|
|
2391
3225
|
|
|
2392
3226
|
var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
|
|
2393
3227
|
if (Type$1(Obj) !== 'Object') {
|
|
@@ -2410,7 +3244,7 @@ var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
|
|
|
2410
3244
|
if (src(Obj, 'get')) {
|
|
2411
3245
|
var getter = Obj.get;
|
|
2412
3246
|
if (typeof getter !== 'undefined' && !IsCallable(getter)) {
|
|
2413
|
-
throw new
|
|
3247
|
+
throw new TypeError('getter must be a function');
|
|
2414
3248
|
}
|
|
2415
3249
|
desc['[[Get]]'] = getter;
|
|
2416
3250
|
}
|
|
@@ -2428,7 +3262,7 @@ var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
|
|
|
2428
3262
|
return desc;
|
|
2429
3263
|
};
|
|
2430
3264
|
|
|
2431
|
-
var $TypeError$3 =
|
|
3265
|
+
var $TypeError$3 = GetIntrinsic('%TypeError%');
|
|
2432
3266
|
|
|
2433
3267
|
|
|
2434
3268
|
|
|
@@ -2442,7 +3276,7 @@ var $isEnumerable$1 = callBound('Object.prototype.propertyIsEnumerable');
|
|
|
2442
3276
|
|
|
2443
3277
|
|
|
2444
3278
|
|
|
2445
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
|
|
3279
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
|
|
2446
3280
|
|
|
2447
3281
|
var OrdinaryGetOwnProperty = function OrdinaryGetOwnProperty(O, P) {
|
|
2448
3282
|
if (Type$1(O) !== 'Object') {
|
|
@@ -2468,7 +3302,7 @@ var OrdinaryGetOwnProperty = function OrdinaryGetOwnProperty(O, P) {
|
|
|
2468
3302
|
return ToPropertyDescriptor(getOwnPropertyDescriptor(O, P));
|
|
2469
3303
|
};
|
|
2470
3304
|
|
|
2471
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
|
|
3305
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
|
|
2472
3306
|
|
|
2473
3307
|
var IsDataDescriptor = function IsDataDescriptor(Desc) {
|
|
2474
3308
|
if (typeof Desc === 'undefined') {
|
|
@@ -2488,14 +3322,14 @@ var isPrimitive = function isPrimitive(value) {
|
|
|
2488
3322
|
return value === null || (typeof value !== 'function' && typeof value !== 'object');
|
|
2489
3323
|
};
|
|
2490
3324
|
|
|
2491
|
-
var $Object =
|
|
3325
|
+
var $Object = GetIntrinsic('%Object%');
|
|
2492
3326
|
|
|
2493
3327
|
|
|
2494
3328
|
|
|
2495
3329
|
var $preventExtensions = $Object.preventExtensions;
|
|
2496
3330
|
var $isExtensible = $Object.isExtensible;
|
|
2497
3331
|
|
|
2498
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
|
|
3332
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-isextensible-o
|
|
2499
3333
|
|
|
2500
3334
|
var IsExtensible = $preventExtensions
|
|
2501
3335
|
? function IsExtensible(obj) {
|
|
@@ -2509,7 +3343,7 @@ var _isNaN = Number.isNaN || function isNaN(a) {
|
|
|
2509
3343
|
return a !== a;
|
|
2510
3344
|
};
|
|
2511
3345
|
|
|
2512
|
-
// http://
|
|
3346
|
+
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.12
|
|
2513
3347
|
|
|
2514
3348
|
var SameValue = function SameValue(x, y) {
|
|
2515
3349
|
if (x === y) { // 0 === -0, but they are not identical.
|
|
@@ -2519,7 +3353,7 @@ var SameValue = function SameValue(x, y) {
|
|
|
2519
3353
|
return _isNaN(x) && _isNaN(y);
|
|
2520
3354
|
};
|
|
2521
3355
|
|
|
2522
|
-
var $TypeError$4 =
|
|
3356
|
+
var $TypeError$4 = GetIntrinsic('%TypeError%');
|
|
2523
3357
|
|
|
2524
3358
|
|
|
2525
3359
|
|
|
@@ -2531,7 +3365,7 @@ var $TypeError$4 = getIntrinsic('%TypeError%');
|
|
|
2531
3365
|
|
|
2532
3366
|
|
|
2533
3367
|
|
|
2534
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
|
|
3368
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-createdataproperty
|
|
2535
3369
|
|
|
2536
3370
|
var CreateDataProperty = function CreateDataProperty(O, P, V) {
|
|
2537
3371
|
if (Type$1(O) !== 'Object') {
|
|
@@ -2541,8 +3375,8 @@ var CreateDataProperty = function CreateDataProperty(O, P, V) {
|
|
|
2541
3375
|
throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
|
|
2542
3376
|
}
|
|
2543
3377
|
var oldDesc = OrdinaryGetOwnProperty(O, P);
|
|
2544
|
-
var extensible =
|
|
2545
|
-
var immutable = oldDesc && (!oldDesc
|
|
3378
|
+
var extensible = oldDesc || IsExtensible(O);
|
|
3379
|
+
var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
|
|
2546
3380
|
if (immutable || !extensible) {
|
|
2547
3381
|
return false;
|
|
2548
3382
|
}
|
|
@@ -2561,9 +3395,9 @@ var CreateDataProperty = function CreateDataProperty(O, P, V) {
|
|
|
2561
3395
|
);
|
|
2562
3396
|
};
|
|
2563
3397
|
|
|
2564
|
-
var $TypeError$5 =
|
|
3398
|
+
var $TypeError$5 = GetIntrinsic('%TypeError%');
|
|
2565
3399
|
|
|
2566
|
-
// http://
|
|
3400
|
+
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.10
|
|
2567
3401
|
|
|
2568
3402
|
var CheckObjectCoercible = function CheckObjectCoercible(value, optMessage) {
|
|
2569
3403
|
if (value == null) {
|
|
@@ -2574,11 +3408,11 @@ var CheckObjectCoercible = function CheckObjectCoercible(value, optMessage) {
|
|
|
2574
3408
|
|
|
2575
3409
|
var RequireObjectCoercible = CheckObjectCoercible;
|
|
2576
3410
|
|
|
2577
|
-
var $Object$1 =
|
|
3411
|
+
var $Object$1 = GetIntrinsic('%Object%');
|
|
2578
3412
|
|
|
2579
3413
|
|
|
2580
3414
|
|
|
2581
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-toobject
|
|
3415
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-toobject
|
|
2582
3416
|
|
|
2583
3417
|
var ToObject = function ToObject(value) {
|
|
2584
3418
|
RequireObjectCoercible(value);
|
|
@@ -2588,10 +3422,10 @@ var ToObject = function ToObject(value) {
|
|
|
2588
3422
|
var $gOPD$2 = Object.getOwnPropertyDescriptor;
|
|
2589
3423
|
var $getOwnNames = Object.getOwnPropertyNames;
|
|
2590
3424
|
var $getSymbols = Object.getOwnPropertySymbols;
|
|
2591
|
-
var $concat
|
|
3425
|
+
var $concat = callBound('Array.prototype.concat');
|
|
2592
3426
|
var $reduce = callBound('Array.prototype.reduce');
|
|
2593
3427
|
var getAll = $getSymbols ? function (obj) {
|
|
2594
|
-
return $concat
|
|
3428
|
+
return $concat($getOwnNames(obj), $getSymbols(obj));
|
|
2595
3429
|
} : $getOwnNames;
|
|
2596
3430
|
|
|
2597
3431
|
var isES5 = IsCallable($gOPD$2) && IsCallable($getOwnNames);
|
|
@@ -2630,19 +3464,13 @@ var shim = function shimGetOwnPropertyDescriptors() {
|
|
|
2630
3464
|
return polyfill$1;
|
|
2631
3465
|
};
|
|
2632
3466
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
defineProperties_1(bound, {
|
|
3467
|
+
defineProperties_1(implementation$2, {
|
|
2636
3468
|
getPolyfill: polyfill,
|
|
2637
3469
|
implementation: implementation$2,
|
|
2638
3470
|
shim: shim
|
|
2639
3471
|
});
|
|
2640
3472
|
|
|
2641
|
-
var object_getownpropertydescriptors =
|
|
2642
|
-
|
|
2643
|
-
// TODO; semver-major: remove
|
|
2644
|
-
|
|
2645
|
-
var callBound$1 = callBound;
|
|
3473
|
+
var object_getownpropertydescriptors = implementation$2;
|
|
2646
3474
|
|
|
2647
3475
|
var isES5$1 = typeof Object.defineProperty === 'function'
|
|
2648
3476
|
&& typeof Object.defineProperties === 'function';
|
|
@@ -2661,14 +3489,14 @@ if (typeof Promise !== 'function') {
|
|
|
2661
3489
|
|
|
2662
3490
|
|
|
2663
3491
|
|
|
2664
|
-
var $slice = callBound
|
|
2665
|
-
var $concat$
|
|
2666
|
-
var $forEach = callBound
|
|
3492
|
+
var $slice = callBound('Array.prototype.slice');
|
|
3493
|
+
var $concat$1 = callBound('Array.prototype.concat');
|
|
3494
|
+
var $forEach = callBound('Array.prototype.forEach');
|
|
2667
3495
|
|
|
2668
|
-
var hasSymbols$
|
|
3496
|
+
var hasSymbols$3 = hasSymbols$1();
|
|
2669
3497
|
|
|
2670
|
-
var kCustomPromisifiedSymbol = hasSymbols$
|
|
2671
|
-
var kCustomPromisifyArgsSymbol = hasSymbols$
|
|
3498
|
+
var kCustomPromisifiedSymbol = hasSymbols$3 ? Symbol('util.promisify.custom') : null;
|
|
3499
|
+
var kCustomPromisifyArgsSymbol = hasSymbols$3 ? Symbol('customPromisifyArgs') : null;
|
|
2672
3500
|
|
|
2673
3501
|
var implementation$3 = function promisify(orig) {
|
|
2674
3502
|
if (typeof orig !== 'function') {
|
|
@@ -2678,7 +3506,7 @@ var implementation$3 = function promisify(orig) {
|
|
|
2678
3506
|
throw error;
|
|
2679
3507
|
}
|
|
2680
3508
|
|
|
2681
|
-
if (hasSymbols$
|
|
3509
|
+
if (hasSymbols$3 && orig[kCustomPromisifiedSymbol]) {
|
|
2682
3510
|
var customFunction = orig[kCustomPromisifiedSymbol];
|
|
2683
3511
|
if (typeof customFunction !== 'function') {
|
|
2684
3512
|
throw new TypeError('The [util.promisify.custom] property must be a function');
|
|
@@ -2700,7 +3528,7 @@ var implementation$3 = function promisify(orig) {
|
|
|
2700
3528
|
var args = $slice(arguments);
|
|
2701
3529
|
var self = this; // eslint-disable-line no-invalid-this
|
|
2702
3530
|
return new Promise(function (resolve, reject) {
|
|
2703
|
-
orig.apply(self, $concat$
|
|
3531
|
+
orig.apply(self, $concat$1(args, function (err) {
|
|
2704
3532
|
var values = arguments.length > 1 ? $slice(arguments, 1) : [];
|
|
2705
3533
|
if (err) {
|
|
2706
3534
|
reject(err);
|