From 74f1c612611aca83145c0e7ed53e1880ebfee6ae Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 11 Aug 2022 13:36:18 +0800 Subject: [PATCH] js: remove other module to avoid import error --- doric-demo/src/ComplicatedDemo.ts | 2 +- doric-demo/src/Counter.ts | 6 +- doric-demo/src/ImageDemo.ts | 552 +- doric-js/bundle/doric-lib.es5.js | 62 +- doric-js/bundle/doric-sandbox.es5.js | 8180 +++++++++++++++--------- doric-js/generateDts.js | 18 + doric-js/index.d.ts | 3684 +++++------ doric-js/index.ts | 28 + doric-js/lib/index.d.ts | 26 + doric-js/lib/src/native/navigator.d.ts | 10 +- doric-js/lib/src/native/network.d.ts | 8 +- doric-js/lib/src/native/storage.d.ts | 6 +- doric-js/package.json | 6 +- 13 files changed, 7334 insertions(+), 5254 deletions(-) create mode 100644 doric-js/generateDts.js diff --git a/doric-demo/src/ComplicatedDemo.ts b/doric-demo/src/ComplicatedDemo.ts index 1a94ab16f..015b7cdd0 100644 --- a/doric-demo/src/ComplicatedDemo.ts +++ b/doric-demo/src/ComplicatedDemo.ts @@ -48,7 +48,7 @@ class MyDemo extends Panel { }), headerImage = image({ - imageUrl: "https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg", + imageUrl: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.jj20.com%2Fup%2Fallimg%2F1112%2F12101P11147%2F1Q210011147-3.jpg&refer=http%3A%2F%2Fpic.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1662787633&t=99942c90360f55bbcfe00fa140d1c1df", layoutConfig: layoutConfig().just(), width: root.width, height: 200, diff --git a/doric-demo/src/Counter.ts b/doric-demo/src/Counter.ts index b88cc3fb9..e6a85e034 100644 --- a/doric-demo/src/Counter.ts +++ b/doric-demo/src/Counter.ts @@ -31,14 +31,14 @@ class CounterView extends ViewHolder { text({ text: `Current language is ${Environment.localeLanguage}`, onClick: function () { - const v = this as View + const v = this as unknown as View group.removeChild(v) } }), text({ text: `Current country is ${Environment.localeCountry}`, onClick: function () { - const v = this as View + const v = this as unknown as View group.removeChild(v) } }), @@ -46,7 +46,7 @@ class CounterView extends ViewHolder { text: "Click to remove", textSize: 30, onClick: function () { - const v = this as View + const v = this as unknown as View group.removeChild(v) } }), diff --git a/doric-demo/src/ImageDemo.ts b/doric-demo/src/ImageDemo.ts index f4ee79d75..e60ecf47c 100644 --- a/doric-demo/src/ImageDemo.ts +++ b/doric-demo/src/ImageDemo.ts @@ -2,291 +2,291 @@ import { AssetsResource, AndroidAssetsResource, Base64Resource, DrawableResource import { colors, label } from "./utils"; import { img_base64 } from "./image_base64"; -const imageUrl = 'https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg' +const imageUrl = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.jj20.com%2Fup%2Fallimg%2F1112%2F12101P11147%2F1Q210011147-3.jpg&refer=http%3A%2F%2Fpic.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1662787633&t=99942c90360f55bbcfe00fa140d1c1df' import logo from "./images/logo_w.png" import button from "./images/button.png" @Entry class ImageDemo extends Panel { - build(rootView: Group): void { - let imageView: Image - scroller( - vlayout( - [ - text({ - text: "Image Demo", - layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), - textSize: 30, - textColor: Color.WHITE, - backgroundColor: colors[5], - textAlignment: gravity().center(), - height: 50, - }), + build(rootView: Group): void { + let imageView: Image + scroller( + vlayout( + [ + text({ + text: "Image Demo", + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), + textSize: 30, + textColor: Color.WHITE, + backgroundColor: colors[5], + textAlignment: gravity().center(), + height: 50, + }), - label("Button"), - image({ - image: - Environment.platform === "Android" - ? new AndroidAssetsResource( - "assets/The_Parthenon_in_Athens.jpeg" - ) - : new MainBundleResource( - "assets/The_Parthenon_in_Athens.jpeg" - ), - }), - image({ - image: new AssetsResource("The_Parthenon_in_Athens.jpeg"), - }), - image({ - image: new RemoteResource( - "https://p.upyun.com/demo/webp/webp/jpg-0.webp" + label("Button"), + image({ + image: + Environment.platform === "Android" + ? new AndroidAssetsResource( + "assets/The_Parthenon_in_Athens.jpeg" + ) + : new MainBundleResource( + "assets/The_Parthenon_in_Athens.jpeg" ), - }), - image({ - image: new Base64Resource(img_base64[0]), - scaleType: ScaleType.ScaleToFill, - layoutConfig: { - widthSpec: LayoutSpec.FIT, - heightSpec: LayoutSpec.FIT, - }, - }), - image({ - imageBase64: button, - scaleType: ScaleType.ScaleToFill, - layoutConfig: { - widthSpec: LayoutSpec.JUST, - heightSpec: LayoutSpec.JUST, - }, - width: 200, - height: 150 / 2.75, - stretchInset: { - left: 100, - top: 0, - right: 100, - bottom: 0, - }, - imageScale: 2.75, - }), - image({ - imageBase64: button, - scaleType: ScaleType.ScaleToFill, - layoutConfig: { - widthSpec: LayoutSpec.JUST, - heightSpec: LayoutSpec.JUST, - }, - width: 200, - height: 75, - stretchInset: { - left: 100, - top: 0, - right: 100, - bottom: 0, - }, - imageScale: 2, - }), - label("Gif "), - image({ - imageUrl: - "https://www.w3.org/People/mimasa/test/imgformat/img/w3c_home_animation.gif", - scaleType: ScaleType.ScaleToFill, - imageScale: 3, - }), - label("APNG"), - image({ - imageUrl: - "https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png", - }), - label("Animated WebP"), - image({ - imageUrl: - "https://p.upyun.com/demo/webp/webp/animated-gif-0.webp", - }), - label("WebP"), - (imageView = image({ - imageUrl: "https://p.upyun.com/demo/webp/webp/jpg-0.webp", - layoutConfig: layoutConfig().just(), - width: 200, - height: 200, - loadCallback: (ret) => { - if (ret) { - imageView.width = ret.width; - imageView.height = ret.height; - } - }, - })), - label("ScaleToFill"), - image({ - imageUrl, - width: 300, - height: 300, - isBlur: true, - border: { - width: 2, - color: Color.GRAY, - }, - scaleType: ScaleType.ScaleToFill, - layoutConfig: layoutConfig().just(), - loadCallback: (ret) => {}, - }), - label("ScaleAspectFit"), - image({ - imageUrl, - width: 300, - height: 300, - border: { - width: 2, - color: Color.GRAY, - }, - scaleType: ScaleType.ScaleAspectFit, - layoutConfig: layoutConfig().just(), - }), - label("ScaleAspectFill"), - image({ - imageUrl, - width: 300, - height: 300, - border: { - width: 2, - color: Color.GRAY, - }, - scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().just(), - }), - label("ImageBase64"), - image({ - imageBase64: img_base64[0], - width: 300, - height: 300, - border: { - width: 2, - color: Color.GRAY, - }, - scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().just(), - }), - label("StretchInset 1"), - image({ - imageBase64: img_base64[1], - height: 60, - width: 134, - scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().just(), - }), - image({ - imageBase64: img_base64[1], - height: 60, - width: 294, - scaleType: ScaleType.ScaleToFill, - layoutConfig: layoutConfig().just(), - stretchInset: { - left: 0.85, - top: 0, - right: 0.149, - bottom: 0, - }, - }), + }), + image({ + image: new AssetsResource("The_Parthenon_in_Athens.jpeg"), + }), + image({ + image: new RemoteResource( + "https://p.upyun.com/demo/webp/webp/jpg-0.webp" + ), + }), + image({ + image: new Base64Resource(img_base64[0]), + scaleType: ScaleType.ScaleToFill, + layoutConfig: { + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, + }, + }), + image({ + imageBase64: button, + scaleType: ScaleType.ScaleToFill, + layoutConfig: { + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, + }, + width: 200, + height: 150 / 2.75, + stretchInset: { + left: 100, + top: 0, + right: 100, + bottom: 0, + }, + imageScale: 2.75, + }), + image({ + imageBase64: button, + scaleType: ScaleType.ScaleToFill, + layoutConfig: { + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, + }, + width: 200, + height: 75, + stretchInset: { + left: 100, + top: 0, + right: 100, + bottom: 0, + }, + imageScale: 2, + }), + label("Gif "), + image({ + imageUrl: + "https://www.w3.org/People/mimasa/test/imgformat/img/w3c_home_animation.gif", + scaleType: ScaleType.ScaleToFill, + imageScale: 3, + }), + label("APNG"), + image({ + imageUrl: + "https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png", + }), + label("Animated WebP"), + image({ + imageUrl: + "https://p.upyun.com/demo/webp/webp/animated-gif-0.webp", + }), + label("WebP"), + (imageView = image({ + imageUrl: "https://p.upyun.com/demo/webp/webp/jpg-0.webp", + layoutConfig: layoutConfig().just(), + width: 200, + height: 200, + loadCallback: (ret) => { + if (ret) { + imageView.width = ret.width; + imageView.height = ret.height; + } + }, + })), + label("ScaleToFill"), + image({ + imageUrl, + width: 300, + height: 300, + isBlur: true, + border: { + width: 2, + color: Color.GRAY, + }, + scaleType: ScaleType.ScaleToFill, + layoutConfig: layoutConfig().just(), + loadCallback: (ret) => { }, + }), + label("ScaleAspectFit"), + image({ + imageUrl, + width: 300, + height: 300, + border: { + width: 2, + color: Color.GRAY, + }, + scaleType: ScaleType.ScaleAspectFit, + layoutConfig: layoutConfig().just(), + }), + label("ScaleAspectFill"), + image({ + imageUrl, + width: 300, + height: 300, + border: { + width: 2, + color: Color.GRAY, + }, + scaleType: ScaleType.ScaleAspectFill, + layoutConfig: layoutConfig().just(), + }), + label("ImageBase64"), + image({ + imageBase64: img_base64[0], + width: 300, + height: 300, + border: { + width: 2, + color: Color.GRAY, + }, + scaleType: ScaleType.ScaleAspectFill, + layoutConfig: layoutConfig().just(), + }), + label("StretchInset 1"), + image({ + imageBase64: img_base64[1], + height: 60, + width: 134, + scaleType: ScaleType.ScaleAspectFill, + layoutConfig: layoutConfig().just(), + }), + image({ + imageBase64: img_base64[1], + height: 60, + width: 294, + scaleType: ScaleType.ScaleToFill, + layoutConfig: layoutConfig().just(), + stretchInset: { + left: 0.85, + top: 0, + right: 0.149, + bottom: 0, + }, + }), - label("StretchInset 2"), - image({ - image: new AssetsResource("coupon_bg2.png"), - height: 48, - width: 78, - scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().just(), - }), - image({ - image: new AssetsResource("coupon_bg2.png"), - height: 48, - width: 78 * 3, - scaleType: ScaleType.ScaleToFill, - imageScale: 1, - layoutConfig: layoutConfig().just(), - stretchInset: { - left: 0, - top: 0, - right: 76, - bottom: 0, - }, - }), + label("StretchInset 2"), + image({ + image: new AssetsResource("coupon_bg2.png"), + height: 48, + width: 78, + scaleType: ScaleType.ScaleAspectFill, + layoutConfig: layoutConfig().just(), + }), + image({ + image: new AssetsResource("coupon_bg2.png"), + height: 48, + width: 78 * 3, + scaleType: ScaleType.ScaleToFill, + imageScale: 1, + layoutConfig: layoutConfig().just(), + stretchInset: { + left: 0, + top: 0, + right: 76, + bottom: 0, + }, + }), - label("tileInset 1"), - image({ - image: new AssetsResource("dididi.png"), - height: 78, - width: 84, - backgroundColor: Color.BLACK, - scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().just(), - }), - image({ - image: new AssetsResource("dididi.png"), - height: 78, - width: 84 * 3, - imageScale: 1, - backgroundColor: Color.BLACK, - scaleType: ScaleType.Tile, - layoutConfig: layoutConfig().just(), - }), + label("tileInset 1"), + image({ + image: new AssetsResource("dididi.png"), + height: 78, + width: 84, + backgroundColor: Color.BLACK, + scaleType: ScaleType.ScaleAspectFill, + layoutConfig: layoutConfig().just(), + }), + image({ + image: new AssetsResource("dididi.png"), + height: 78, + width: 84 * 3, + imageScale: 1, + backgroundColor: Color.BLACK, + scaleType: ScaleType.Tile, + layoutConfig: layoutConfig().just(), + }), - label("tileInset 2"), - image({ - image: new AssetsResource("123.png"), - height: 288 / 2, - width: 154 / 2, - scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().just(), - }), - image({ - image: new AssetsResource("123.png"), - height: 288, - width: 154, - imageScale: 2, - scaleType: ScaleType.Tile, - layoutConfig: layoutConfig().just(), - }), - ], - { - layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), - gravity: gravity().center(), - space: 10, - } - ), - { - layoutConfig: layoutConfig().most(), - } - ) - .also((it) => { - coordinator(context).verticalScrolling({ - scrollable: it, - scrollRange: { - start: 0, - end: 100, - }, - target: "NavBar", - changing: { - name: "backgroundColor", - start: Color.WHITE, - end: Color.RED, - }, - }); - coordinator(context).verticalScrolling({ - scrollable: it, - scrollRange: { - start: 0, - end: 100, - }, - target: imageView, - changing: { - name: "width", - start: 10, - end: 200, - }, - }); - }) - .in(rootView); - } - onDestroy() { - modal(context).toast('onDestroy') - } + label("tileInset 2"), + image({ + image: new AssetsResource("123.png"), + height: 288 / 2, + width: 154 / 2, + scaleType: ScaleType.ScaleAspectFill, + layoutConfig: layoutConfig().just(), + }), + image({ + image: new AssetsResource("123.png"), + height: 288, + width: 154, + imageScale: 2, + scaleType: ScaleType.Tile, + layoutConfig: layoutConfig().just(), + }), + ], + { + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), + gravity: gravity().center(), + space: 10, + } + ), + { + layoutConfig: layoutConfig().most(), + } + ) + .also((it) => { + coordinator(context).verticalScrolling({ + scrollable: it, + scrollRange: { + start: 0, + end: 100, + }, + target: "NavBar", + changing: { + name: "backgroundColor", + start: Color.WHITE, + end: Color.RED, + }, + }); + coordinator(context).verticalScrolling({ + scrollable: it, + scrollRange: { + start: 0, + end: 100, + }, + target: imageView, + changing: { + name: "width", + start: 10, + end: 200, + }, + }); + }) + .in(rootView); + } + onDestroy() { + modal(context).toast('onDestroy') + } } \ No newline at end of file diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index 34d932af1..0bf8c344d 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -68,7 +68,7 @@ var Mutable = /** @class */ (function () { */ var __uniqueId__ = 0; function uniqueId(prefix) { - return "__" + prefix + "_" + __uniqueId__++ + "__"; + return "__".concat(prefix, "_").concat(__uniqueId__++, "__"); } function toString(message) { @@ -92,11 +92,6 @@ function toString(message) { } function log() { var arguments$1 = arguments; - - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -108,11 +103,6 @@ function log() { } function loge() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -124,11 +114,6 @@ function loge() { } function logw() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -177,11 +162,11 @@ var __values$5 = (undefined && undefined.__values) || function(o) { function Property(target, propKey) { Object.defineProperty(target, propKey, { get: function () { - return Reflect.get(this, "__prop__" + propKey, this); + return Reflect.get(this, "__prop__".concat(propKey), this); }, set: function (v) { - var oldV = Reflect.get(this, "__prop__" + propKey, this); - Reflect.set(this, "__prop__" + propKey, v, this); + var oldV = Reflect.get(this, "__prop__".concat(propKey), this); + Reflect.set(this, "__prop__".concat(propKey), v, this); if (oldV !== v) { Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]); } @@ -191,11 +176,11 @@ function Property(target, propKey) { function InconsistProperty(target, propKey) { Object.defineProperty(target, propKey, { get: function () { - return Reflect.get(this, "__prop__" + propKey, this); + return Reflect.get(this, "__prop__".concat(propKey), this); }, set: function (v) { - var oldV = Reflect.get(this, "__prop__" + propKey, this); - Reflect.set(this, "__prop__" + propKey, v, this); + var oldV = Reflect.get(this, "__prop__".concat(propKey), this); + Reflect.set(this, "__prop__".concat(propKey), v, this); Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]); }, }); @@ -359,11 +344,6 @@ var View = /** @class */ (function () { }; View.prototype.responseCallback = function (id) { var arguments$1 = arguments; - - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments$1[_i]; - } var f = this.id2Callback(id); if (f instanceof Function) { var argumentsList = []; @@ -373,7 +353,7 @@ var View = /** @class */ (function () { return Reflect.apply(f, this, argumentsList); } else { - loge("Cannot find callback:" + id + " for " + JSON.stringify(this.toModel())); + loge("Cannot find callback:".concat(id, " for ").concat(JSON.stringify(this.toModel()))); } }; View.prototype.toModel = function () { @@ -717,7 +697,7 @@ var Group = /** @class */ (function (_super) { this.addChild(e); } else if (!!e) { - loge("Not allowed to add " + typeof e); + loge("Not allowed to add ".concat(typeof e)); } }; Object.defineProperty(Group.prototype, "innerElement", { @@ -1232,7 +1212,7 @@ var Panel = /** @class */ (function () { var v = this.retrospectView(viewIds); if (v === undefined) { - loge("Cannot find view for " + viewIds); + loge("Cannot find view for ".concat(viewIds)); } else { var argumentsList = [callbackId]; @@ -1434,7 +1414,7 @@ var Color = /** @class */ (function () { } Color.parse = function (str) { if (!str.startsWith("#")) { - throw new Error("Parse color error with " + str); + throw new Error("Parse color error with ".concat(str)); } var val = parseInt(str.substr(1), 16); if (str.length === 7) { @@ -1444,7 +1424,7 @@ var Color = /** @class */ (function () { return new Color(val); } else { - throw new Error("Parse color error with " + str); + throw new Error("Parse color error with ".concat(str)); } }; Color.safeParse = function (str, defVal) { @@ -2247,7 +2227,7 @@ var MainBundleResource = /** @class */ (function (_super) { var BundleResource = /** @class */ (function (_super) { __extends$f(BundleResource, _super); function BundleResource(bundleName, fileName) { - return _super.call(this, "bundle", bundleName + "://" + fileName) || this; + return _super.call(this, "bundle", "".concat(bundleName, "://").concat(fileName)) || this; } return BundleResource; }(iOSResource)); @@ -2530,7 +2510,7 @@ var List = /** @class */ (function (_super) { List.prototype.getItem = function (itemIdx) { var view = this.renderItem(itemIdx); view.superview = this; - this.cachedViews.set("" + itemIdx, view); + this.cachedViews.set("".concat(itemIdx), view); return view; }; List.prototype.renderBunchedItems = function (start, length) { @@ -2680,7 +2660,7 @@ var Slider = /** @class */ (function (_super) { Slider.prototype.getItem = function (itemIdx) { var view = this.renderPage(itemIdx); view.superview = this; - this.cachedViews.set("" + itemIdx, view); + this.cachedViews.set("".concat(itemIdx), view); return view; }; Slider.prototype.renderBunchedItems = function (start, length) { @@ -3050,7 +3030,7 @@ exports.jsx = void 0; Reflect.set(e, "innerElement", children, e); } else { - throw new Error("Do not support " + constructor.name + " for " + children); + throw new Error("Do not support ".concat(constructor.name, " for ").concat(children)); } } return e; @@ -3184,7 +3164,7 @@ var FlowLayout = /** @class */ (function (_super) { FlowLayout.prototype.getItem = function (itemIdx) { var view = this.renderItem(itemIdx); view.superview = this; - this.cachedViews.set("" + itemIdx, view); + this.cachedViews.set("".concat(itemIdx), view); return view; }; FlowLayout.prototype.renderBunchedItems = function (start, length) { @@ -3865,7 +3845,7 @@ function navbar(context) { } function internalScheme(context, panelClass) { - return "_internal_://export?class=" + encodeURIComponent(panelClass.name) + "&context=" + context.id; + return "_internal_://export?class=".concat(encodeURIComponent(panelClass.name), "&context=").concat(context.id); } function navigator(context) { var moduleName = "navigator"; @@ -3905,9 +3885,9 @@ function transformRequest(request) { if (request.params !== undefined) { var queryStrings = []; for (var key in request.params) { - queryStrings.push(key + "=" + encodeURIComponent(request.params[key])); + queryStrings.push("".concat(key, "=").concat(encodeURIComponent(request.params[key]))); } - request.url = "" + request.url + (url.indexOf('?') >= 0 ? '&' : '?') + queryStrings.join('&'); + request.url = "".concat(request.url).concat(url.indexOf('?') >= 0 ? '&' : '?').concat(queryStrings.join('&')); } if (typeof request.data === 'object') { request.data = JSON.stringify(request.data); @@ -4183,7 +4163,7 @@ function animate(context) { } else { return function (args) { - return Promise.reject("Cannot find panel in Context:" + context.id); + return Promise.reject("Cannot find panel in Context:".concat(context.id)); }; } } diff --git a/doric-js/bundle/doric-sandbox.es5.js b/doric-js/bundle/doric-sandbox.es5.js index 268eccb25..784603a3f 100644 --- a/doric-js/bundle/doric-sandbox.es5.js +++ b/doric-js/bundle/doric-sandbox.es5.js @@ -23,7 +23,7 @@ var doric = (function (exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = - // eslint-disable-next-line es/no-global-this -- safe + // eslint-disable-next-line es-x/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe @@ -42,32 +42,39 @@ var doric = (function (exports) { // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { - // eslint-disable-next-line es/no-object-defineproperty -- required for testing + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); + var functionBindNative = !fails(function () { + // eslint-disable-next-line es-x/no-function-prototype-bind -- safe + var test = (function () { /* empty */ }).bind(); + // eslint-disable-next-line no-prototype-builtins -- safe + return typeof test != 'function' || test.hasOwnProperty('prototype'); + }); + var call$2 = Function.prototype.call; - var functionCall = call$2.bind ? call$2.bind(call$2) : function () { + var functionCall = functionBindNative ? call$2.bind(call$2) : function () { return call$2.apply(call$2, arguments); }; var $propertyIsEnumerable$2 = {}.propertyIsEnumerable; - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var getOwnPropertyDescriptor$8 = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor$a = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor$8 && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$a && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable - var f$7 = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor$8(this, V); + var f$8 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$a(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable$2; var objectPropertyIsEnumerable = { - f: f$7 + f: f$8 }; var createPropertyDescriptor = function (bitmap, value) { @@ -80,12 +87,12 @@ var doric = (function (exports) { }; var FunctionPrototype$4 = Function.prototype; - var bind$3 = FunctionPrototype$4.bind; + var bind$2 = FunctionPrototype$4.bind; var call$1 = FunctionPrototype$4.call; - var callBind = bind$3 && bind$3.bind(call$1); + var uncurryThis = functionBindNative && bind$2.bind(call$1, call$1); - var functionUncurryThis = bind$3 ? function (fn) { - return fn && callBind(call$1, fn); + var functionUncurryThis = functionBindNative ? function (fn) { + return fn && uncurryThis(fn); } : function (fn) { return fn && function () { return call$1.apply(fn, arguments); @@ -93,30 +100,30 @@ var doric = (function (exports) { }; var toString$2 = functionUncurryThis({}.toString); - var stringSlice$g = functionUncurryThis(''.slice); + var stringSlice$h = functionUncurryThis(''.slice); var classofRaw = function (it) { - return stringSlice$g(toString$2(it), 8, -1); + return stringSlice$h(toString$2(it), 8, -1); }; - var Object$7 = global_1.Object; - var split$4 = functionUncurryThis(''.split); + var $Object$6 = Object; + var split$3 = functionUncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe - return !Object$7('z').propertyIsEnumerable(0); + return !$Object$6('z').propertyIsEnumerable(0); }) ? function (it) { - return classofRaw(it) == 'String' ? split$4(it, '') : Object$7(it); - } : Object$7; + return classofRaw(it) == 'String' ? split$3(it, '') : $Object$6(it); + } : $Object$6; - var TypeError$F = global_1.TypeError; + var $TypeError$z = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible = function (it) { - if (it == undefined) { throw TypeError$F("Can't call method on " + it); } + if (it == undefined) { throw $TypeError$z("Can't call method on " + it); } return it; }; @@ -151,8 +158,8 @@ var doric = (function (exports) { var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; var process$5 = global_1.process; - var Deno = global_1.Deno; - var versions = process$5 && process$5.versions || Deno && Deno.version; + var Deno$1 = global_1.Deno; + var versions = process$5 && process$5.versions || Deno$1 && Deno$1.version; var v8 = versions && versions.v8; var match, version; @@ -175,11 +182,11 @@ var doric = (function (exports) { var engineV8Version = version; - /* eslint-disable es/no-symbol -- required for testing */ + /* eslint-disable es-x/no-symbol -- required for testing */ - // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing + // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion @@ -189,38 +196,38 @@ var doric = (function (exports) { !Symbol.sham && engineV8Version && engineV8Version < 41; }); - /* eslint-disable es/no-symbol -- required for testing */ + /* eslint-disable es-x/no-symbol -- required for testing */ var useSymbolAsUid = nativeSymbol && !Symbol.sham && typeof Symbol.iterator == 'symbol'; - var Object$6 = global_1.Object; + var $Object$5 = Object; var isSymbol = useSymbolAsUid ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); - return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$6(it)); + return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$5(it)); }; - var String$6 = global_1.String; + var $String$5 = String; var tryToString = function (argument) { try { - return String$6(argument); + return $String$5(argument); } catch (error) { return 'Object'; } }; - var TypeError$E = global_1.TypeError; + var $TypeError$y = TypeError; // `Assert: IsCallable(argument) is true` var aCallable = function (argument) { if (isCallable(argument)) { return argument; } - throw TypeError$E(tryToString(argument) + ' is not a function'); + throw $TypeError$y(tryToString(argument) + ' is not a function'); }; // `GetMethod` abstract operation @@ -230,7 +237,7 @@ var doric = (function (exports) { return func == null ? undefined : aCallable(func); }; - var TypeError$D = global_1.TypeError; + var $TypeError$x = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive @@ -239,15 +246,15 @@ var doric = (function (exports) { if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) { return val; } if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) { return val; } if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) { return val; } - throw TypeError$D("Can't convert object to primitive value"); + throw $TypeError$x("Can't convert object to primitive value"); }; var isPure = false; - // eslint-disable-next-line es/no-object-defineproperty -- safe + // eslint-disable-next-line es-x/no-object-defineproperty -- safe var defineProperty$f = Object.defineProperty; - var setGlobal = function (key, value) { + var defineGlobalProperty = function (key, value) { try { defineProperty$f(global_1, key, { value: value, configurable: true, writable: true }); } catch (error) { @@ -256,7 +263,7 @@ var doric = (function (exports) { }; var SHARED = '__core-js_shared__'; - var store$3 = global_1[SHARED] || setGlobal(SHARED, {}); + var store$3 = global_1[SHARED] || defineGlobalProperty(SHARED, {}); var sharedStore = store$3; @@ -264,24 +271,27 @@ var doric = (function (exports) { (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.19.0', + version: '3.24.1', mode: 'global', - copyright: '© 2021 Denis Pushkarev (zloirock.ru)' + copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', + license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE', + source: 'https://github.com/zloirock/core-js' }); }); - var Object$5 = global_1.Object; + var $Object$4 = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject = function (argument) { - return Object$5(requireObjectCoercible(argument)); + return $Object$4(requireObjectCoercible(argument)); }; var hasOwnProperty = functionUncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty + // eslint-disable-next-line es-x/no-object-hasown -- safe var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject(it), key); }; @@ -312,20 +322,20 @@ var doric = (function (exports) { } return WellKnownSymbolsStore$1[name]; }; - var TypeError$C = global_1.TypeError; - var TO_PRIMITIVE$2 = wellKnownSymbol('toPrimitive'); + var $TypeError$w = TypeError; + var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive var toPrimitive = function (input, pref) { if (!isObject(input) || isSymbol(input)) { return input; } - var exoticToPrim = getMethod(input, TO_PRIMITIVE$2); + var exoticToPrim = getMethod(input, TO_PRIMITIVE$1); var result; if (exoticToPrim) { if (pref === undefined) { pref = 'default'; } result = functionCall(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) { return result; } - throw TypeError$C("Can't convert object to primitive value"); + throw $TypeError$w("Can't convert object to primitive value"); } if (pref === undefined) { pref = 'number'; } return ordinaryToPrimitive(input, pref); @@ -346,61 +356,91 @@ var doric = (function (exports) { return EXISTS$1 ? document$3.createElement(it) : {}; }; - // Thank's IE8 for his funny defineProperty + // Thanks to IE8 for its funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { - // eslint-disable-next-line es/no-object-defineproperty -- requied for testing + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - var f$6 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) { + var f$7 = descriptors ? $getOwnPropertyDescriptor$2 : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (ie8DomDefine) { try { - return $getOwnPropertyDescriptor$1(O, P); + return $getOwnPropertyDescriptor$2(O, P); } catch (error) { /* empty */ } } if (hasOwnProperty_1(O, P)) { return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]); } }; var objectGetOwnPropertyDescriptor = { - f: f$6 + f: f$7 }; - var String$5 = global_1.String; - var TypeError$B = global_1.TypeError; + // V8 ~ Chrome 36- + // https://bugs.chromium.org/p/v8/issues/detail?id=3334 + var v8PrototypeDefineBug = descriptors && fails(function () { + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing + return Object.defineProperty(function () { /* empty */ }, 'prototype', { + value: 42, + writable: false + }).prototype != 42; + }); + + var $String$4 = String; + var $TypeError$v = TypeError; // `Assert: Type(argument) is Object` var anObject = function (argument) { if (isObject(argument)) { return argument; } - throw TypeError$B(String$5(argument) + ' is not an object'); + throw $TypeError$v($String$4(argument) + ' is not an object'); }; - var TypeError$A = global_1.TypeError; - // eslint-disable-next-line es/no-object-defineproperty -- safe + var $TypeError$u = TypeError; + // eslint-disable-next-line es-x/no-object-defineproperty -- safe var $defineProperty$1 = Object.defineProperty; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + var ENUMERABLE = 'enumerable'; + var CONFIGURABLE$1 = 'configurable'; + var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - var f$5 = descriptors ? $defineProperty$1 : function defineProperty(O, P, Attributes) { + var f$6 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) { + anObject(O); + P = toPropertyKey(P); + anObject(Attributes); + if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { + var current = $getOwnPropertyDescriptor$1(O, P); + if (current && current[WRITABLE]) { + O[P] = Attributes.value; + Attributes = { + configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1], + enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], + writable: false + }; + } + } return $defineProperty$1(O, P, Attributes); + } : $defineProperty$1 : function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (ie8DomDefine) { try { return $defineProperty$1(O, P, Attributes); } catch (error) { /* empty */ } } - if ('get' in Attributes || 'set' in Attributes) { throw TypeError$A('Accessors not supported'); } + if ('get' in Attributes || 'set' in Attributes) { throw $TypeError$u('Accessors not supported'); } if ('value' in Attributes) { O[P] = Attributes.value; } return O; }; var objectDefineProperty = { - f: f$5 + f: f$6 }; var createNonEnumerableProperty = descriptors ? function (object, key, value) { @@ -410,6 +450,21 @@ var doric = (function (exports) { return object; }; + var FunctionPrototype$3 = Function.prototype; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getDescriptor = descriptors && Object.getOwnPropertyDescriptor; + + var EXISTS = hasOwnProperty_1(FunctionPrototype$3, 'name'); + // additional protection from minified / mangled / dropped function names + var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; + var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$3, 'name').configurable)); + + var functionName = { + EXISTS: EXISTS, + PROPER: PROPER, + CONFIGURABLE: CONFIGURABLE + }; + var functionToString$1 = functionUncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper @@ -434,7 +489,7 @@ var doric = (function (exports) { var hiddenKeys$1 = {}; var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; - var TypeError$z = global_1.TypeError; + var TypeError$8 = global_1.TypeError; var WeakMap$3 = global_1.WeakMap; var set$3, get$2, has; @@ -442,11 +497,11 @@ var doric = (function (exports) { return has(it) ? get$2(it) : set$3(it, {}); }; - var getterFor = function (TYPE) { + var getterFor$2 = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get$2(it)).type !== TYPE) { - throw TypeError$z('Incompatible receiver, ' + TYPE + ' required'); + throw TypeError$8('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; @@ -457,7 +512,7 @@ var doric = (function (exports) { var wmhas = functionUncurryThis(store$2.has); var wmset = functionUncurryThis(store$2.set); set$3 = function (it, metadata) { - if (wmhas(store$2, it)) { throw new TypeError$z(OBJECT_ALREADY_INITIALIZED); } + if (wmhas(store$2, it)) { throw new TypeError$8(OBJECT_ALREADY_INITIALIZED); } metadata.facade = it; wmset(store$2, it, metadata); return metadata; @@ -472,7 +527,7 @@ var doric = (function (exports) { var STATE = sharedKey('state'); hiddenKeys$1[STATE] = true; set$3 = function (it, metadata) { - if (hasOwnProperty_1(it, STATE)) { throw new TypeError$z(OBJECT_ALREADY_INITIALIZED); } + if (hasOwnProperty_1(it, STATE)) { throw new TypeError$8(OBJECT_ALREADY_INITIALIZED); } metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; @@ -490,94 +545,116 @@ var doric = (function (exports) { get: get$2, has: has, enforce: enforce, - getterFor: getterFor + getterFor: getterFor$2 }; - var FunctionPrototype$3 = Function.prototype; - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var getDescriptor = descriptors && Object.getOwnPropertyDescriptor; - - var EXISTS = hasOwnProperty_1(FunctionPrototype$3, 'name'); - // additional protection from minified / mangled / dropped function names - var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; - var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$3, 'name').configurable)); + var makeBuiltIn_1 = createCommonjsModule(function (module) { + var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE; - var functionName = { - EXISTS: EXISTS, - PROPER: PROPER, - CONFIGURABLE: CONFIGURABLE - }; - var redefine = createCommonjsModule(function (module) { - var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE; - var getInternalState = internalState.get; var enforceInternalState = internalState.enforce; + var getInternalState = internalState.get; + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + var defineProperty = Object.defineProperty; + + var CONFIGURABLE_LENGTH = descriptors && !fails(function () { + return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; + }); + var TEMPLATE = String(String).split('String'); - (module.exports = function (O, key, value, options) { - var unsafe = options ? !!options.unsafe : false; - var simple = options ? !!options.enumerable : false; - var noTargetGet = options ? !!options.noTargetGet : false; - var name = options && options.name !== undefined ? options.name : key; - var state; - if (isCallable(value)) { - if (String(name).slice(0, 7) === 'Symbol(') { - name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; - } - if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { - createNonEnumerableProperty(value, 'name', name); - } - state = enforceInternalState(value); - if (!state.source) { - state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); - } + var makeBuiltIn = module.exports = function (value, name, options) { + if (String(name).slice(0, 7) === 'Symbol(') { + name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; } - if (O === global_1) { - if (simple) { O[key] = value; } - else { setGlobal(key, value); } - return; - } else if (!unsafe) { - delete O[key]; - } else if (!noTargetGet && O[key]) { - simple = true; + if (options && options.getter) { name = 'get ' + name; } + if (options && options.setter) { name = 'set ' + name; } + if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { + if (descriptors) { defineProperty(value, 'name', { value: name, configurable: true }); } + else { value.name = name; } } - if (simple) { O[key] = value; } - else { createNonEnumerableProperty(O, key, value); } + if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) { + defineProperty(value, 'length', { value: options.arity }); + } + try { + if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) { + if (descriptors) { defineProperty(value, 'prototype', { writable: false }); } + // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable + } else if (value.prototype) { value.prototype = undefined; } + } catch (error) { /* empty */ } + var state = enforceInternalState(value); + if (!hasOwnProperty_1(state, 'source')) { + state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); + } return value; + }; + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative - })(Function.prototype, 'toString', function toString() { + // eslint-disable-next-line no-extend-native -- required + Function.prototype.toString = makeBuiltIn(function toString() { return isCallable(this) && getInternalState(this).source || inspectSource(this); + }, 'toString'); }); - }); - var ceil$2 = Math.ceil; + var defineBuiltIn = function (O, key, value, options) { + if (!options) { options = {}; } + var simple = options.enumerable; + var name = options.name !== undefined ? options.name : key; + if (isCallable(value)) { makeBuiltIn_1(value, name, options); } + if (options.global) { + if (simple) { O[key] = value; } + else { defineGlobalProperty(key, value); } + } else { + try { + if (!options.unsafe) { delete O[key]; } + else if (O[key]) { simple = true; } + } catch (error) { /* empty */ } + if (simple) { O[key] = value; } + else { objectDefineProperty.f(O, key, { + value: value, + enumerable: false, + configurable: !options.nonConfigurable, + writable: !options.nonWritable + }); } + } return O; + }; + + var ceil$1 = Math.ceil; var floor$a = Math.floor; + // `Math.trunc` method + // https://tc39.es/ecma262/#sec-math.trunc + // eslint-disable-next-line es-x/no-math-trunc -- safe + var mathTrunc = Math.trunc || function trunc(x) { + var n = +x; + return (n > 0 ? floor$a : ceil$1)(n); + }; + // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity var toIntegerOrInfinity = function (argument) { var number = +argument; - // eslint-disable-next-line no-self-compare -- safe - return number !== number || number === 0 ? 0 : (number > 0 ? floor$a : ceil$2)(number); + // eslint-disable-next-line no-self-compare -- NaN check + return number !== number || number === 0 ? 0 : mathTrunc(number); }; - var max$6 = Math.max; - var min$a = Math.min; + var max$9 = Math.max; + var min$c = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex = function (index, length) { var integer = toIntegerOrInfinity(index); - return integer < 0 ? max$6(integer + length, 0) : min$a(integer, length); + return integer < 0 ? max$9(integer + length, 0) : min$c(integer, length); }; - var min$9 = Math.min; + var min$b = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength var toLength = function (argument) { - return argument > 0 ? min$9(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + return argument > 0 ? min$b(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; // `LengthOfArrayLike` abstract operation @@ -618,17 +695,17 @@ var doric = (function (exports) { var indexOf$2 = arrayIncludes.indexOf; - var push$j = functionUncurryThis([].push); + var push$m = functionUncurryThis([].push); var objectKeysInternal = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; - for (key in O) { !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$j(result, key); } + for (key in O) { !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$m(result, key); } // Don't enum bug & hidden keys while (names.length > i) { if (hasOwnProperty_1(O, key = names[i++])) { - ~indexOf$2(result, key) || push$j(result, key); + ~indexOf$2(result, key) || push$m(result, key); } } return result; }; @@ -648,20 +725,20 @@ var doric = (function (exports) { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames - // eslint-disable-next-line es/no-object-getownpropertynames -- safe - var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe + var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys); }; var objectGetOwnPropertyNames = { - f: f$4 + f: f$5 }; - // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe - var f$3 = Object.getOwnPropertySymbols; + // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe + var f$4 = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { - f: f$3 + f: f$4 }; var concat$4 = functionUncurryThis([].concat); @@ -673,13 +750,15 @@ var doric = (function (exports) { return getOwnPropertySymbols ? concat$4(keys, getOwnPropertySymbols(it)) : keys; }; - var copyConstructorProperties = function (target, source) { + var copyConstructorProperties = function (target, source, exceptions) { var keys = ownKeys(source); var defineProperty = objectDefineProperty.f; var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; - if (!hasOwnProperty_1(target, key)) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } + if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) { + defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } } }; @@ -703,7 +782,7 @@ var doric = (function (exports) { var isForced_1 = isForced; - var getOwnPropertyDescriptor$7 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$9 = objectGetOwnPropertyDescriptor.f; @@ -711,19 +790,19 @@ var doric = (function (exports) { /* - options.target - name of the target object - options.global - target is the global object - options.stat - export as static methods of target - options.proto - export as prototype methods of target - options.real - real prototype method for the `pure` version - options.forced - export even if the native feature is available - options.bind - bind methods to the target, required for the `pure` version - options.wrap - wrap constructors to preventing global pollution, required for the `pure` version - options.unsafe - use the simple assignment of property instead of delete + defineProperty - options.sham - add a flag to not completely full polyfills - options.enumerable - export as enumerable property - options.noTargetGet - prevent calling a getter on target - options.name - the .name of the function if it does not match the key + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.dontCallGetSet - prevent calling a getter on target + options.name - the .name of the function if it does not match the key */ var _export = function (options, source) { var TARGET = options.target; @@ -733,14 +812,14 @@ var doric = (function (exports) { if (GLOBAL) { target = global_1; } else if (STATIC) { - target = global_1[TARGET] || setGlobal(TARGET, {}); + target = global_1[TARGET] || defineGlobalProperty(TARGET, {}); } else { target = (global_1[TARGET] || {}).prototype; } if (target) { for (key in source) { sourceProperty = source[key]; - if (options.noTargetGet) { - descriptor = getOwnPropertyDescriptor$7(target, key); + if (options.dontCallGetSet) { + descriptor = getOwnPropertyDescriptor$9(target, key); targetProperty = descriptor && descriptor.value; } else { targetProperty = target[key]; } FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); @@ -753,37 +832,19 @@ var doric = (function (exports) { if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } - // extend global - redefine(target, key, sourceProperty, options); + defineBuiltIn(target, key, sourceProperty, options); } } }; - var FunctionPrototype$2 = Function.prototype; - var apply = FunctionPrototype$2.apply; - var bind$2 = FunctionPrototype$2.bind; - var call = FunctionPrototype$2.call; - - // eslint-disable-next-line es/no-reflect -- safe - var functionApply = typeof Reflect == 'object' && Reflect.apply || (bind$2 ? call.bind(apply) : function () { - return call.apply(apply, arguments); - }); - - // `IsArray` abstract operation - // https://tc39.es/ecma262/#sec-isarray - // eslint-disable-next-line es/no-array-isarray -- safe - var isArray = Array.isArray || function isArray(argument) { - return classofRaw(argument) == 'Array'; - }; - - var TO_STRING_TAG$8 = wellKnownSymbol('toStringTag'); + var TO_STRING_TAG$9 = wellKnownSymbol('toStringTag'); var test$2 = {}; - test$2[TO_STRING_TAG$8] = 'z'; + test$2[TO_STRING_TAG$9] = 'z'; var toStringTagSupport = String(test$2) === '[object z]'; - var TO_STRING_TAG$7 = wellKnownSymbol('toStringTag'); - var Object$4 = global_1.Object; + var TO_STRING_TAG$8 = wellKnownSymbol('toStringTag'); + var $Object$3 = Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; @@ -800,34 +861,34 @@ var doric = (function (exports) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case - : typeof (tag = tryGet(O = Object$4(it), TO_STRING_TAG$7)) == 'string' ? tag + : typeof (tag = tryGet(O = $Object$3(it), TO_STRING_TAG$8)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result; }; - var String$4 = global_1.String; + var $String$3 = String; var toString_1 = function (argument) { if (classof(argument) === 'Symbol') { throw TypeError('Cannot convert a Symbol value to a string'); } - return String$4(argument); + return $String$3(argument); }; // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys - // eslint-disable-next-line es/no-object-keys -- safe - var objectKeys = Object.keys || function keys(O) { + // eslint-disable-next-line es-x/no-object-keys -- safe + var objectKeys$1 = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties - // eslint-disable-next-line es/no-object-defineproperties -- safe - var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { + // eslint-disable-next-line es-x/no-object-defineproperties -- safe + var f$3 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var props = toIndexedObject(Properties); - var keys = objectKeys(Properties); + var keys = objectKeys$1(Properties); var length = keys.length; var index = 0; var key; @@ -835,6 +896,10 @@ var doric = (function (exports) { return O; }; + var objectDefineProperties = { + f: f$3 + }; + var html = getBuiltIn('document', 'documentElement'); /* global ActiveXObject -- old IE, WSH */ @@ -908,6 +973,7 @@ var doric = (function (exports) { // `Object.create` method // https://tc39.es/ecma262/#sec-object.create + // eslint-disable-next-line es-x/no-object-create -- safe var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { @@ -917,12 +983,29 @@ var doric = (function (exports) { // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else { result = NullProtoObject(); } - return Properties === undefined ? result : objectDefineProperties(result, Properties); + return Properties === undefined ? result : objectDefineProperties.f(result, Properties); }; - var arraySlice$1 = functionUncurryThis([].slice); + var createProperty = function (object, key, value) { + var propertyKey = toPropertyKey(key); + if (propertyKey in object) { objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); } + else { object[propertyKey] = value; } + }; + + var $Array$a = Array; + var max$8 = Math.max; + + var arraySliceSimple = function (O, start, end) { + var length = lengthOfArrayLike(O); + var k = toAbsoluteIndex(start, length); + var fin = toAbsoluteIndex(end === undefined ? length : end, length); + var result = $Array$a(max$8(fin - k, 0)); + for (var n = 0; k < fin; k++, n++) { createProperty(result, n, O[k]); } + result.length = n; + return result; + }; - /* eslint-disable es/no-object-getownpropertynames -- safe */ + /* eslint-disable es-x/no-object-getownpropertynames -- safe */ var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; @@ -935,7 +1018,7 @@ var doric = (function (exports) { try { return $getOwnPropertyNames$1(it); } catch (error) { - return arraySlice$1(windowNames); + return arraySliceSimple(windowNames); } }; @@ -967,15 +1050,32 @@ var doric = (function (exports) { }); } }; + var symbolDefineToPrimitive = function () { + var Symbol = getBuiltIn('Symbol'); + var SymbolPrototype = Symbol && Symbol.prototype; + var valueOf = SymbolPrototype && SymbolPrototype.valueOf; + var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); + + if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) { + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + // eslint-disable-next-line no-unused-vars -- required for .length + defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) { + return functionCall(valueOf, this); + }, { arity: 1 }); + } + }; + var defineProperty$d = objectDefineProperty.f; - var TO_STRING_TAG$6 = wellKnownSymbol('toStringTag'); + var TO_STRING_TAG$7 = wellKnownSymbol('toStringTag'); - var setToStringTag = function (it, TAG, STATIC) { - if (it && !hasOwnProperty_1(it = STATIC ? it : it.prototype, TO_STRING_TAG$6)) { - defineProperty$d(it, TO_STRING_TAG$6, { configurable: true, value: TAG }); + var setToStringTag = function (target, TAG, STATIC) { + if (target && !STATIC) { target = target.prototype; } + if (target && !hasOwnProperty_1(target, TO_STRING_TAG$7)) { + defineProperty$d(target, TO_STRING_TAG$7, { configurable: true, value: TAG }); } }; @@ -984,19 +1084,26 @@ var doric = (function (exports) { // optional / simple context binding var functionBindContext = function (fn, that) { aCallable(fn); - return that === undefined ? fn : bind$1 ? bind$1(fn, that) : function (/* ...args */) { + return that === undefined ? fn : functionBindNative ? bind$1(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; + // `IsArray` abstract operation + // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es-x/no-array-isarray -- safe + var isArray = Array.isArray || function isArray(argument) { + return classofRaw(argument) == 'Array'; + }; + var noop = function () { /* empty */ }; var empty = []; var construct$1 = getBuiltIn('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; - var exec$9 = functionUncurryThis(constructorRegExp.exec); - var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); + var exec$b = functionUncurryThis(constructorRegExp.exec); + var INCORRECT_TO_STRING$2 = !constructorRegExp.exec(noop); - var isConstructorModern = function (argument) { + var isConstructorModern = function isConstructor(argument) { if (!isCallable(argument)) { return false; } try { construct$1(noop, empty, argument); @@ -1006,16 +1113,25 @@ var doric = (function (exports) { } }; - var isConstructorLegacy = function (argument) { + var isConstructorLegacy = function isConstructor(argument) { if (!isCallable(argument)) { return false; } switch (classof(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; + } + try { // we can't check .prototype since constructors produced by .bind haven't it - } return INCORRECT_TO_STRING || !!exec$9(constructorRegExp, inspectSource(argument)); + // `Function#toString` throws on some built-it function in some legacy engines + // (for example, `DOMQuad` and similar in FF41-) + return INCORRECT_TO_STRING$2 || !!exec$b(constructorRegExp, inspectSource(argument)); + } catch (error) { + return true; + } }; + isConstructorLegacy.sham = true; + // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor var isConstructor = !construct$1 || fails(function () { @@ -1027,7 +1143,7 @@ var doric = (function (exports) { }) ? isConstructorLegacy : isConstructorModern; var SPECIES$6 = wellKnownSymbol('species'); - var Array$a = global_1.Array; + var $Array$9 = Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate @@ -1036,12 +1152,12 @@ var doric = (function (exports) { if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback - if (isConstructor(C) && (C === Array$a || isArray(C.prototype))) { C = undefined; } + if (isConstructor(C) && (C === $Array$9 || isArray(C.prototype))) { C = undefined; } else if (isObject(C)) { C = C[SPECIES$6]; if (C === null) { C = undefined; } } - } return C === undefined ? Array$a : C; + } return C === undefined ? $Array$9 : C; }; // `ArraySpeciesCreate` abstract operation @@ -1050,7 +1166,7 @@ var doric = (function (exports) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; - var push$i = functionUncurryThis([].push); + var push$l = functionUncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod$7 = function (TYPE) { @@ -1079,10 +1195,10 @@ var doric = (function (exports) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex - case 2: push$i(target, value); // filter + case 2: push$l(target, value); // filter } } else { switch (TYPE) { case 4: return false; // every - case 7: push$i(target, value); // filterReject + case 7: push$l(target, value); // filterReject } } } } } @@ -1122,27 +1238,23 @@ var doric = (function (exports) { var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; var PROTOTYPE$1 = 'prototype'; - var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive'); - var setInternalState$h = internalState.set; - var getInternalState$g = internalState.getterFor(SYMBOL); + var setInternalState$i = internalState.set; + var getInternalState$e = internalState.getterFor(SYMBOL); var ObjectPrototype$4 = Object[PROTOTYPE$1]; var $Symbol = global_1.Symbol; var SymbolPrototype$1 = $Symbol && $Symbol[PROTOTYPE$1]; - var TypeError$y = global_1.TypeError; + var TypeError$7 = global_1.TypeError; var QObject = global_1.QObject; - var $stringify$1 = getBuiltIn('JSON', 'stringify'); var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; var nativeDefineProperty = objectDefineProperty.f; var nativeGetOwnPropertyNames = objectGetOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = objectPropertyIsEnumerable.f; - var push$h = functionUncurryThis([].push); + var push$k = functionUncurryThis([].push); var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); - var StringToSymbolRegistry = shared('string-to-symbol-registry'); - var SymbolToStringRegistry = shared('symbol-to-string-registry'); var WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 @@ -1164,7 +1276,7 @@ var doric = (function (exports) { var wrap$1 = function (tag, description) { var symbol = AllSymbols[tag] = objectCreate(SymbolPrototype$1); - setInternalState$h(symbol, { + setInternalState$i(symbol, { type: SYMBOL, tag: tag, description: description @@ -1192,7 +1304,7 @@ var doric = (function (exports) { var $defineProperties = function defineProperties(O, Properties) { anObject(O); var properties = toIndexedObject(Properties); - var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); + var keys = objectKeys$1(properties).concat($getOwnPropertySymbols(properties)); $forEach$3(keys, function (key) { if (!descriptors || functionCall($propertyIsEnumerable$1, properties, key)) { $defineProperty(O, key, properties[key]); } }); @@ -1226,18 +1338,18 @@ var doric = (function (exports) { var names = nativeGetOwnPropertyNames(toIndexedObject(O)); var result = []; $forEach$3(names, function (key) { - if (!hasOwnProperty_1(AllSymbols, key) && !hasOwnProperty_1(hiddenKeys$1, key)) { push$h(result, key); } + if (!hasOwnProperty_1(AllSymbols, key) && !hasOwnProperty_1(hiddenKeys$1, key)) { push$k(result, key); } }); return result; }; - var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { + var $getOwnPropertySymbols = function (O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$4; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; $forEach$3(names, function (key) { if (hasOwnProperty_1(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwnProperty_1(ObjectPrototype$4, key))) { - push$h(result, AllSymbols[key]); + push$k(result, AllSymbols[key]); } }); return result; @@ -1247,7 +1359,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-symbol-constructor if (!nativeSymbol) { $Symbol = function Symbol() { - if (objectIsPrototypeOf(SymbolPrototype$1, this)) { throw TypeError$y('Symbol is not a constructor'); } + if (objectIsPrototypeOf(SymbolPrototype$1, this)) { throw TypeError$7('Symbol is not a constructor'); } var description = !arguments.length || arguments[0] === undefined ? undefined : toString_1(arguments[0]); var tag = uid(description); var setter = function (value) { @@ -1261,16 +1373,17 @@ var doric = (function (exports) { SymbolPrototype$1 = $Symbol[PROTOTYPE$1]; - redefine(SymbolPrototype$1, 'toString', function toString() { - return getInternalState$g(this).tag; + defineBuiltIn(SymbolPrototype$1, 'toString', function toString() { + return getInternalState$e(this).tag; }); - redefine($Symbol, 'withoutSetter', function (description) { + defineBuiltIn($Symbol, 'withoutSetter', function (description) { return wrap$1(uid(description), description); }); objectPropertyIsEnumerable.f = $propertyIsEnumerable$1; objectDefineProperty.f = $defineProperty; + objectDefineProperties.f = $defineProperties; objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor; objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames; objectGetOwnPropertySymbols.f = $getOwnPropertySymbols; @@ -1284,40 +1397,24 @@ var doric = (function (exports) { nativeDefineProperty(SymbolPrototype$1, 'description', { configurable: true, get: function description() { - return getInternalState$g(this).description; + return getInternalState$e(this).description; } }); { - redefine(ObjectPrototype$4, 'propertyIsEnumerable', $propertyIsEnumerable$1, { unsafe: true }); + defineBuiltIn(ObjectPrototype$4, 'propertyIsEnumerable', $propertyIsEnumerable$1, { unsafe: true }); } } } - _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, { + _export({ global: true, constructor: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, { Symbol: $Symbol }); - $forEach$3(objectKeys(WellKnownSymbolsStore), function (name) { + $forEach$3(objectKeys$1(WellKnownSymbolsStore), function (name) { defineWellKnownSymbol(name); }); _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { - // `Symbol.for` method - // https://tc39.es/ecma262/#sec-symbol.for - 'for': function (key) { - var string = toString_1(key); - if (hasOwnProperty_1(StringToSymbolRegistry, string)) { return StringToSymbolRegistry[string]; } - var symbol = $Symbol(string); - StringToSymbolRegistry[string] = symbol; - SymbolToStringRegistry[symbol] = string; - return symbol; - }, - // `Symbol.keyFor` method - // https://tc39.es/ecma262/#sec-symbol.keyfor - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) { throw TypeError$y(sym + ' is not a symbol'); } - if (hasOwnProperty_1(SymbolToStringRegistry, sym)) { return SymbolToStringRegistry[sym]; } - }, useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } }); @@ -1340,64 +1437,132 @@ var doric = (function (exports) { _export({ target: 'Object', stat: true, forced: !nativeSymbol }, { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames - getOwnPropertyNames: $getOwnPropertyNames, - // `Object.getOwnPropertySymbols` method - // https://tc39.es/ecma262/#sec-object.getownpropertysymbols - getOwnPropertySymbols: $getOwnPropertySymbols + getOwnPropertyNames: $getOwnPropertyNames }); - // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives - // https://bugs.chromium.org/p/v8/issues/detail?id=3443 - _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, { - getOwnPropertySymbols: function getOwnPropertySymbols(it) { - return objectGetOwnPropertySymbols.f(toObject(it)); + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + symbolDefineToPrimitive(); + + // `Symbol.prototype[@@toStringTag]` property + // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag + setToStringTag($Symbol, SYMBOL); + + hiddenKeys$1[HIDDEN] = true; + + /* eslint-disable es-x/no-symbol -- safe */ + var nativeSymbolRegistry = nativeSymbol && !!Symbol['for'] && !!Symbol.keyFor; + + var StringToSymbolRegistry = shared('string-to-symbol-registry'); + var SymbolToStringRegistry$1 = shared('symbol-to-string-registry'); + + // `Symbol.for` method + // https://tc39.es/ecma262/#sec-symbol.for + _export({ target: 'Symbol', stat: true, forced: !nativeSymbolRegistry }, { + 'for': function (key) { + var string = toString_1(key); + if (hasOwnProperty_1(StringToSymbolRegistry, string)) { return StringToSymbolRegistry[string]; } + var symbol = getBuiltIn('Symbol')(string); + StringToSymbolRegistry[string] = symbol; + SymbolToStringRegistry$1[symbol] = string; + return symbol; } }); - // `JSON.stringify` method behavior with symbols - // https://tc39.es/ecma262/#sec-json.stringify - if ($stringify$1) { - var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () { - var symbol = $Symbol(); - // MS Edge converts symbol values to JSON as {} - return $stringify$1([symbol]) != '[null]' - // WebKit converts symbol values to JSON as null - || $stringify$1({ a: symbol }) != '{}' - // V8 throws on boxed symbols - || $stringify$1(Object(symbol)) != '{}'; - }); + var SymbolToStringRegistry = shared('symbol-to-string-registry'); + + // `Symbol.keyFor` method + // https://tc39.es/ecma262/#sec-symbol.keyfor + _export({ target: 'Symbol', stat: true, forced: !nativeSymbolRegistry }, { + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) { throw TypeError(tryToString(sym) + ' is not a symbol'); } + if (hasOwnProperty_1(SymbolToStringRegistry, sym)) { return SymbolToStringRegistry[sym]; } + } + }); + + var FunctionPrototype$2 = Function.prototype; + var apply = FunctionPrototype$2.apply; + var call = FunctionPrototype$2.call; + + // eslint-disable-next-line es-x/no-reflect -- safe + var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () { + return call.apply(apply, arguments); + }); + + var arraySlice$1 = functionUncurryThis([].slice); + + var $stringify = getBuiltIn('JSON', 'stringify'); + var exec$a = functionUncurryThis(/./.exec); + var charAt$h = functionUncurryThis(''.charAt); + var charCodeAt$5 = functionUncurryThis(''.charCodeAt); + var replace$b = functionUncurryThis(''.replace); + var numberToString$3 = functionUncurryThis(1.0.toString); + + var tester = /[\uD800-\uDFFF]/g; + var low = /^[\uD800-\uDBFF]$/; + var hi = /^[\uDC00-\uDFFF]$/; + + var WRONG_SYMBOLS_CONVERSION = !nativeSymbol || fails(function () { + var symbol = getBuiltIn('Symbol')(); + // MS Edge converts symbol values to JSON as {} + return $stringify([symbol]) != '[null]' + // WebKit converts symbol values to JSON as null + || $stringify({ a: symbol }) != '{}' + // V8 throws on boxed symbols + || $stringify(Object(symbol)) != '{}'; + }); + + // https://github.com/tc39/proposal-well-formed-stringify + var ILL_FORMED_UNICODE = fails(function () { + return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' + || $stringify('\uDEAD') !== '"\\udead"'; + }); - _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, { + var stringifyWithSymbolsFix = function (it, replacer) { + var args = arraySlice$1(arguments); + var $replacer = replacer; + if (!isObject(replacer) && it === undefined || isSymbol(it)) { return; } // IE8 returns string on undefined + if (!isArray(replacer)) { replacer = function (key, value) { + if (isCallable($replacer)) { value = functionCall($replacer, this, key, value); } + if (!isSymbol(value)) { return value; } + }; } + args[1] = replacer; + return functionApply($stringify, null, args); + }; + + var fixIllFormed = function (match, offset, string) { + var prev = charAt$h(string, offset - 1); + var next = charAt$h(string, offset + 1); + if ((exec$a(low, match) && !exec$a(hi, next)) || (exec$a(hi, match) && !exec$a(low, prev))) { + return '\\u' + numberToString$3(charCodeAt$5(match, 0), 16); + } return match; + }; + + if ($stringify) { + // `JSON.stringify` method + // https://tc39.es/ecma262/#sec-json.stringify + _export({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { var args = arraySlice$1(arguments); - var $replacer = replacer; - if (!isObject(replacer) && it === undefined || isSymbol(it)) { return; } // IE8 returns string on undefined - if (!isArray(replacer)) { replacer = function (key, value) { - if (isCallable($replacer)) { value = functionCall($replacer, this, key, value); } - if (!isSymbol(value)) { return value; } - }; } - args[1] = replacer; - return functionApply($stringify$1, null, args); + var result = functionApply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); + return ILL_FORMED_UNICODE && typeof result == 'string' ? replace$b(result, tester, fixIllFormed) : result; } }); } - // `Symbol.prototype[@@toPrimitive]` method - // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive - if (!SymbolPrototype$1[TO_PRIMITIVE$1]) { - var valueOf = SymbolPrototype$1.valueOf; - // eslint-disable-next-line no-unused-vars -- required for .length - redefine(SymbolPrototype$1, TO_PRIMITIVE$1, function (hint) { - // TODO: improve hint logic - return functionCall(valueOf, this); - }); - } - // `Symbol.prototype[@@toStringTag]` property - // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag - setToStringTag($Symbol, SYMBOL); + // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives + // https://bugs.chromium.org/p/v8/issues/detail?id=3443 + var FORCED$n = !nativeSymbol || fails(function () { objectGetOwnPropertySymbols.f(1); }); - hiddenKeys$1[HIDDEN] = true; + // `Object.getOwnPropertySymbols` method + // https://tc39.es/ecma262/#sec-object.getownpropertysymbols + _export({ target: 'Object', stat: true, forced: FORCED$n }, { + getOwnPropertySymbols: function getOwnPropertySymbols(it) { + var $getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : []; + } + }); var defineProperty$c = objectDefineProperty.f; @@ -1430,7 +1595,7 @@ var doric = (function (exports) { var symbolValueOf = functionUncurryThis(SymbolPrototype.valueOf); var regexp = /^Symbol\((.*)\)[^)]+$/; var replace$a = functionUncurryThis(''.replace); - var stringSlice$f = functionUncurryThis(''.slice); + var stringSlice$g = functionUncurryThis(''.slice); defineProperty$c(SymbolPrototype, 'description', { configurable: true, @@ -1438,12 +1603,12 @@ var doric = (function (exports) { var symbol = symbolValueOf(this); var string = symbolToString(symbol); if (hasOwnProperty_1(EmptyStringDescriptionStore, symbol)) { return ''; } - var desc = NATIVE_SYMBOL ? stringSlice$f(string, 7, -1) : replace$a(string, regexp, '$1'); + var desc = NATIVE_SYMBOL ? stringSlice$g(string, 7, -1) : replace$a(string, regexp, '$1'); return desc === '' ? undefined : desc; } }); - _export({ global: true, forced: true }, { + _export({ global: true, constructor: true, forced: true }, { Symbol: SymbolWrapper }); } @@ -1492,42 +1657,28 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + symbolDefineToPrimitive(); + // `Symbol.toStringTag` well-known symbol // https://tc39.es/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); + // `Symbol.prototype[@@toStringTag]` property + // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag + setToStringTag(getBuiltIn('Symbol'), 'Symbol'); + // `Symbol.unscopables` well-known symbol // https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); - var correctPrototypeGetter = !fails(function () { - function F() { /* empty */ } - F.prototype.constructor = null; - // eslint-disable-next-line es/no-object-getprototypeof -- required for testing - return Object.getPrototypeOf(new F()) !== F.prototype; - }); - - var IE_PROTO = sharedKey('IE_PROTO'); - var Object$3 = global_1.Object; - var ObjectPrototype$3 = Object$3.prototype; - - // `Object.getPrototypeOf` method - // https://tc39.es/ecma262/#sec-object.getprototypeof - var objectGetPrototypeOf = correctPrototypeGetter ? Object$3.getPrototypeOf : function (O) { - var object = toObject(O); - if (hasOwnProperty_1(object, IE_PROTO)) { return object[IE_PROTO]; } - var constructor = object.constructor; - if (isCallable(constructor) && object instanceof constructor) { - return constructor.prototype; - } return object instanceof Object$3 ? ObjectPrototype$3 : null; - }; - - var String$3 = global_1.String; - var TypeError$x = global_1.TypeError; + var $String$2 = String; + var $TypeError$t = TypeError; var aPossiblePrototype = function (argument) { if (typeof argument == 'object' || isCallable(argument)) { return argument; } - throw TypeError$x("Can't set " + String$3(argument) + ' as a prototype'); + throw $TypeError$t("Can't set " + $String$2(argument) + ' as a prototype'); }; /* eslint-disable no-proto -- safe */ @@ -1538,13 +1689,13 @@ var doric = (function (exports) { // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. - // eslint-disable-next-line es/no-object-setprototypeof -- safe + // eslint-disable-next-line es-x/no-object-setprototypeof -- safe var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); setter(test, []); CORRECT_SETTER = test instanceof Array; @@ -1558,25 +1709,36 @@ var doric = (function (exports) { }; }() : undefined); - var replace$9 = functionUncurryThis(''.replace); - var split$3 = functionUncurryThis(''.split); - var join$7 = functionUncurryThis([].join); - - var TEST = (function (arg) { return String(Error(arg).stack); })('zxcasd'); - var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; - var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); - var IS_FIREFOX_OR_SAFARI_STACK = /@[^\n]*\n/.test(TEST) && !/zxcasd/.test(TEST); + var defineProperty$b = objectDefineProperty.f; - var clearErrorStack = function (stack, dropEntries) { - if (typeof stack != 'string') { return stack; } - if (IS_V8_OR_CHAKRA_STACK) { - while (dropEntries--) { stack = replace$9(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } - } else if (IS_FIREFOX_OR_SAFARI_STACK) { - return join$7(arraySlice$1(split$3(stack, '\n'), dropEntries), '\n'); - } return stack; + var proxyAccessor = function (Target, Source, key) { + key in Target || defineProperty$b(Target, key, { + configurable: true, + get: function () { return Source[key]; }, + set: function (it) { Source[key] = it; } + }); }; - // `InstallErrorCause` abstract operation + // makes subclassing work correct for wrapped built-ins + var inheritIfRequired = function ($this, dummy, Wrapper) { + var NewTarget, NewTargetPrototype; + if ( + // it can work only with native `setPrototypeOf` + objectSetPrototypeOf && + // we haven't completely correct pre-ES6 way for getting `new.target`, so use this + isCallable(NewTarget = dummy.constructor) && + NewTarget !== Wrapper && + isObject(NewTargetPrototype = NewTarget.prototype) && + NewTargetPrototype !== Wrapper.prototype + ) { objectSetPrototypeOf($this, NewTargetPrototype); } + return $this; + }; + + var normalizeStringArgument = function (argument, $default) { + return argument === undefined ? arguments.length < 2 ? '' : $default : toString_1(argument); + }; + + // `InstallErrorCause` abstract operation // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause var installErrorCause = function (O, options) { if (isObject(options) && 'cause' in options) { @@ -1584,14 +1746,198 @@ var doric = (function (exports) { } }; + var $Error$1 = Error; + var replace$9 = functionUncurryThis(''.replace); + + var TEST = (function (arg) { return String($Error$1(arg).stack); })('zxcasd'); + var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; + var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); + + var clearErrorStack = function (stack, dropEntries) { + if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error$1.prepareStackTrace) { + while (dropEntries--) { stack = replace$9(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } + } return stack; + }; + + var errorStackInstallable = !fails(function () { + var error = Error('a'); + if (!('stack' in error)) { return true; } + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); + return error.stack !== 7; + }); + + var wrapErrorConstructorWithCause = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) { + var STACK_TRACE_LIMIT = 'stackTraceLimit'; + var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1; + var path = FULL_NAME.split('.'); + var ERROR_NAME = path[path.length - 1]; + var OriginalError = getBuiltIn.apply(null, path); + + if (!OriginalError) { return; } + + var OriginalErrorPrototype = OriginalError.prototype; + + // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006 + if (hasOwnProperty_1(OriginalErrorPrototype, 'cause')) { delete OriginalErrorPrototype.cause; } + + if (!FORCED) { return OriginalError; } + + var BaseError = getBuiltIn('Error'); + + var WrappedError = wrapper(function (a, b) { + var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined); + var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError(); + if (message !== undefined) { createNonEnumerableProperty(result, 'message', message); } + if (errorStackInstallable) { createNonEnumerableProperty(result, 'stack', clearErrorStack(result.stack, 2)); } + if (this && objectIsPrototypeOf(OriginalErrorPrototype, this)) { inheritIfRequired(result, this, WrappedError); } + if (arguments.length > OPTIONS_POSITION) { installErrorCause(result, arguments[OPTIONS_POSITION]); } + return result; + }); + + WrappedError.prototype = OriginalErrorPrototype; + + if (ERROR_NAME !== 'Error') { + if (objectSetPrototypeOf) { objectSetPrototypeOf(WrappedError, BaseError); } + else { copyConstructorProperties(WrappedError, BaseError, { name: true }); } + } else if (descriptors && STACK_TRACE_LIMIT in OriginalError) { + proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT); + proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace'); + } + + copyConstructorProperties(WrappedError, OriginalError); + + { try { + // Safari 13- bug: WebAssembly errors does not have a proper `.name` + if (OriginalErrorPrototype.name !== ERROR_NAME) { + createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME); + } + OriginalErrorPrototype.constructor = WrappedError; + } catch (error) { /* empty */ } } + + return WrappedError; + }; + + /* eslint-disable no-unused-vars -- required for functions `.length` */ + + + + + + var WEB_ASSEMBLY = 'WebAssembly'; + var WebAssembly$1 = global_1[WEB_ASSEMBLY]; + + var FORCED$m = Error('e', { cause: 7 }).cause !== 7; + + var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) { + var O = {}; + O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$m); + _export({ global: true, constructor: true, arity: 1, forced: FORCED$m }, O); + }; + + var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) { + if (WebAssembly$1 && WebAssembly$1[ERROR_NAME]) { + var O = {}; + O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$m); + _export({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$m }, O); + } + }; + + // https://github.com/tc39/proposal-error-cause + exportGlobalErrorCauseWrapper('Error', function (init) { + return function Error(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('EvalError', function (init) { + return function EvalError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('RangeError', function (init) { + return function RangeError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('ReferenceError', function (init) { + return function ReferenceError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('SyntaxError', function (init) { + return function SyntaxError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('TypeError', function (init) { + return function TypeError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('URIError', function (init) { + return function URIError(message) { return functionApply(init, this, arguments); }; + }); + exportWebAssemblyErrorCauseWrapper('CompileError', function (init) { + return function CompileError(message) { return functionApply(init, this, arguments); }; + }); + exportWebAssemblyErrorCauseWrapper('LinkError', function (init) { + return function LinkError(message) { return functionApply(init, this, arguments); }; + }); + exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) { + return function RuntimeError(message) { return functionApply(init, this, arguments); }; + }); + + var nativeErrorToString = Error.prototype.toString; + + var INCORRECT_TO_STRING$1 = fails(function () { + if (descriptors) { + // Chrome 32- incorrectly call accessor + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + var object = objectCreate(Object.defineProperty({}, 'name', { get: function () { + return this === object; + } })); + if (nativeErrorToString.call(object) !== 'true') { return true; } + } + // FF10- does not properly handle non-strings + return nativeErrorToString.call({ message: 1, name: 2 }) !== '2: 1' + // IE8 does not properly handle defaults + || nativeErrorToString.call({}) !== 'Error'; + }); + + var errorToString = INCORRECT_TO_STRING$1 ? function toString() { + var O = anObject(this); + var name = normalizeStringArgument(O.name, 'Error'); + var message = normalizeStringArgument(O.message); + return !name ? message : !message ? name : name + ': ' + message; + } : nativeErrorToString; + + var ErrorPrototype$1 = Error.prototype; + + // `Error.prototype.toString` method fix + // https://tc39.es/ecma262/#sec-error.prototype.tostring + if (ErrorPrototype$1.toString !== errorToString) { + defineBuiltIn(ErrorPrototype$1, 'toString', errorToString); + } + + var correctPrototypeGetter = !fails(function () { + function F() { /* empty */ } + F.prototype.constructor = null; + // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing + return Object.getPrototypeOf(new F()) !== F.prototype; + }); + + var IE_PROTO = sharedKey('IE_PROTO'); + var $Object$2 = Object; + var ObjectPrototype$3 = $Object$2.prototype; + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + // eslint-disable-next-line es-x/no-object-getprototypeof -- safe + var objectGetPrototypeOf = correctPrototypeGetter ? $Object$2.getPrototypeOf : function (O) { + var object = toObject(O); + if (hasOwnProperty_1(object, IE_PROTO)) { return object[IE_PROTO]; } + var constructor = object.constructor; + if (isCallable(constructor) && object instanceof constructor) { + return constructor.prototype; + } return object instanceof $Object$2 ? ObjectPrototype$3 : null; + }; + var iterators = {}; var ITERATOR$a = wellKnownSymbol('iterator'); - var ArrayPrototype$1 = Array.prototype; + var ArrayPrototype$2 = Array.prototype; // check on default Array iterator var isArrayIteratorMethod = function (it) { - return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$a] === it); + return it !== undefined && (iterators.Array === it || ArrayPrototype$2[ITERATOR$a] === it); }; var ITERATOR$9 = wellKnownSymbol('iterator'); @@ -1602,12 +1948,12 @@ var doric = (function (exports) { || iterators[classof(it)]; } }; - var TypeError$w = global_1.TypeError; + var $TypeError$s = TypeError; var getIterator = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) { return anObject(functionCall(iteratorMethod, argument)); } - throw TypeError$w(tryToString(argument) + ' is not iterable'); + throw $TypeError$s(tryToString(argument) + ' is not iterable'); }; var iteratorClose = function (iterator, kind, value) { @@ -1630,7 +1976,7 @@ var doric = (function (exports) { return value; }; - var TypeError$v = global_1.TypeError; + var $TypeError$r = TypeError; var Result = function (stopped, result) { this.stopped = stopped; @@ -1642,6 +1988,7 @@ var doric = (function (exports) { var iterate = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); + var IS_RECORD = !!(options && options.IS_RECORD); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = functionBindContext(unboundFunction, that); @@ -1659,11 +2006,13 @@ var doric = (function (exports) { } return INTERRUPTED ? fn(value, stop) : fn(value); }; - if (IS_ITERATOR) { + if (IS_RECORD) { + iterator = iterable.iterator; + } else if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); - if (!iterFn) { throw TypeError$v(tryToString(iterable) + ' is not iterable'); } + if (!iterFn) { throw $TypeError$r(tryToString(iterable) + ' is not iterable'); } // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { @@ -1674,7 +2023,7 @@ var doric = (function (exports) { iterator = getIterator(iterable, iterFn); } - next = iterator.next; + next = IS_RECORD ? iterable.next : iterator.next; while (!(step = functionCall(next, iterator)).done) { try { result = callFn(step.value); @@ -1685,58 +2034,69 @@ var doric = (function (exports) { } return new Result(false); }; - var normalizeStringArgument = function (argument, $default) { - return argument === undefined ? arguments.length < 2 ? '' : $default : toString_1(argument); - }; - - var errorStackInstallable = !fails(function () { - var error = Error('a'); - if (!('stack' in error)) { return true; } - // eslint-disable-next-line es/no-object-defineproperty -- safe - Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); - return error.stack !== 7; - }); - - var Error$2 = global_1.Error; - var push$g = [].push; + var TO_STRING_TAG$6 = wellKnownSymbol('toStringTag'); + var $Error = Error; + var push$j = [].push; - var $AggregateError = function AggregateError(errors, message /* , options */) { - var that = objectIsPrototypeOf(AggregateErrorPrototype, this) ? this : objectCreate(AggregateErrorPrototype); + var $AggregateError$1 = function AggregateError(errors, message /* , options */) { var options = arguments.length > 2 ? arguments[2] : undefined; + var isInstance = objectIsPrototypeOf(AggregateErrorPrototype, this); + var that; if (objectSetPrototypeOf) { - that = objectSetPrototypeOf(new Error$2(undefined), objectGetPrototypeOf(that)); + that = objectSetPrototypeOf(new $Error(), isInstance ? objectGetPrototypeOf(this) : AggregateErrorPrototype); + } else { + that = isInstance ? this : objectCreate(AggregateErrorPrototype); + createNonEnumerableProperty(that, TO_STRING_TAG$6, 'Error'); } - createNonEnumerableProperty(that, 'message', normalizeStringArgument(message, '')); + if (message !== undefined) { createNonEnumerableProperty(that, 'message', normalizeStringArgument(message)); } if (errorStackInstallable) { createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1)); } installErrorCause(that, options); var errorsArray = []; - iterate(errors, push$g, { that: errorsArray }); + iterate(errors, push$j, { that: errorsArray }); createNonEnumerableProperty(that, 'errors', errorsArray); return that; }; - if (objectSetPrototypeOf) { objectSetPrototypeOf($AggregateError, Error$2); } - else { copyConstructorProperties($AggregateError, Error$2); } + if (objectSetPrototypeOf) { objectSetPrototypeOf($AggregateError$1, $Error); } + else { copyConstructorProperties($AggregateError$1, $Error, { name: true }); } - var AggregateErrorPrototype = $AggregateError.prototype = objectCreate(Error$2.prototype, { - constructor: createPropertyDescriptor(1, $AggregateError), + var AggregateErrorPrototype = $AggregateError$1.prototype = objectCreate($Error.prototype, { + constructor: createPropertyDescriptor(1, $AggregateError$1), message: createPropertyDescriptor(1, ''), name: createPropertyDescriptor(1, 'AggregateError') }); // `AggregateError` constructor // https://tc39.es/ecma262/#sec-aggregate-error-constructor - _export({ global: true }, { - AggregateError: $AggregateError + _export({ global: true, constructor: true, arity: 2 }, { + AggregateError: $AggregateError$1 + }); + + var AGGREGATE_ERROR = 'AggregateError'; + var $AggregateError = getBuiltIn(AGGREGATE_ERROR); + var FORCED$l = !fails(function () { + return $AggregateError([1]).errors[0] !== 1; + }) && fails(function () { + return $AggregateError([1], AGGREGATE_ERROR, { cause: 7 }).cause !== 7; + }); + + // https://github.com/tc39/proposal-error-cause + _export({ global: true, constructor: true, arity: 2, forced: FORCED$l }, { + AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) { + // eslint-disable-next-line no-unused-vars -- required for functions `.length` + return function AggregateError(errors, message) { return functionApply(init, this, arguments); }; + }, FORCED$l, true) }); + var defineProperty$a = objectDefineProperty.f; + var UNSCOPABLES = wellKnownSymbol('unscopables'); - var ArrayPrototype = Array.prototype; + var ArrayPrototype$1 = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables - if (ArrayPrototype[UNSCOPABLES] == undefined) { - objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, { + if (ArrayPrototype$1[UNSCOPABLES] == undefined) { + defineProperty$a(ArrayPrototype$1, UNSCOPABLES, { configurable: true, value: objectCreate(null) }); @@ -1744,7 +2104,7 @@ var doric = (function (exports) { // add a key to Array.prototype[@@unscopables] var addToUnscopables = function (key) { - ArrayPrototype[UNSCOPABLES][key] = true; + ArrayPrototype$1[UNSCOPABLES][key] = true; }; // `Array.prototype.at` method @@ -1761,10 +2121,12 @@ var doric = (function (exports) { addToUnscopables('at'); - var createProperty = function (object, key, value) { - var propertyKey = toPropertyKey(key); - if (propertyKey in object) { objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); } - else { object[propertyKey] = value; } + var $TypeError$q = TypeError; + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 + + var doesNotExceedSafeInteger = function (it) { + if (it > MAX_SAFE_INTEGER) { throw $TypeError$q('Maximum allowed index exceeded'); } + return it; }; var SPECIES$5 = wellKnownSymbol('species'); @@ -1784,9 +2146,6 @@ var doric = (function (exports) { }; var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); - var MAX_SAFE_INTEGER$2 = 0x1FFFFFFFFFFFFF; - var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; - var TypeError$u = global_1.TypeError; // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation @@ -1805,12 +2164,12 @@ var doric = (function (exports) { return spreadable !== undefined ? !!spreadable : isArray(O); }; - var FORCED$q = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; + var FORCED$k = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species - _export({ target: 'Array', proto: true, forced: FORCED$q }, { + _export({ target: 'Array', proto: true, arity: 1, forced: FORCED$k }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { var arguments$1 = arguments; @@ -1823,10 +2182,10 @@ var doric = (function (exports) { E = i === -1 ? O : arguments$1[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike(E); - if (n + len > MAX_SAFE_INTEGER$2) { throw TypeError$u(MAXIMUM_ALLOWED_INDEX_EXCEEDED); } + doesNotExceedSafeInteger(n + len); for (k = 0; k < len; k++, n++) { if (k in E) { createProperty(A, n, E[k]); } } } else { - if (n >= MAX_SAFE_INTEGER$2) { throw TypeError$u(MAXIMUM_ALLOWED_INDEX_EXCEEDED); } + doesNotExceedSafeInteger(n + 1); createProperty(A, n++, E); } } @@ -1835,18 +2194,24 @@ var doric = (function (exports) { } }); - var min$8 = Math.min; + var $TypeError$p = TypeError; + + var deletePropertyOrThrow = function (O, P) { + if (!delete O[P]) { throw $TypeError$p('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O)); } + }; + + var min$a = Math.min; // `Array.prototype.copyWithin` method implementation // https://tc39.es/ecma262/#sec-array.prototype.copywithin - // eslint-disable-next-line es/no-array-prototype-copywithin -- safe + // eslint-disable-next-line es-x/no-array-prototype-copywithin -- safe var arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { var O = toObject(this); var len = lengthOfArrayLike(O); var to = toAbsoluteIndex(target, len); var from = toAbsoluteIndex(start, len); var end = arguments.length > 2 ? arguments[2] : undefined; - var count = min$8((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); + var count = min$a((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); var inc = 1; if (from < to && to < from + count) { inc = -1; @@ -1855,7 +2220,7 @@ var doric = (function (exports) { } while (count-- > 0) { if (from in O) { O[to] = O[from]; } - else { delete O[to]; } + else { deletePropertyOrThrow(O, to); } to += inc; from += inc; } return O; @@ -1873,8 +2238,8 @@ var doric = (function (exports) { var arrayMethodIsStrict = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails(function () { - // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing - method.call(null, argument || function () { throw 1; }, 1); + // eslint-disable-next-line no-useless-call -- required for testing + method.call(null, argument || function () { return 1; }, 1); }); }; @@ -1967,7 +2332,61 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND_INDEX); - var TypeError$t = global_1.TypeError; + // `Array.prototype.{ findLast, findLastIndex }` methods implementation + var createMethod$6 = function (TYPE) { + var IS_FIND_LAST_INDEX = TYPE == 1; + return function ($this, callbackfn, that) { + var O = toObject($this); + var self = indexedObject(O); + var boundFunction = functionBindContext(callbackfn, that); + var index = lengthOfArrayLike(self); + var value, result; + while (index-- > 0) { + value = self[index]; + result = boundFunction(value, index, O); + if (result) { switch (TYPE) { + case 0: return value; // findLast + case 1: return index; // findLastIndex + } } + } + return IS_FIND_LAST_INDEX ? -1 : undefined; + }; + }; + + var arrayIterationFromLast = { + // `Array.prototype.findLast` method + // https://github.com/tc39/proposal-array-find-from-last + findLast: createMethod$6(0), + // `Array.prototype.findLastIndex` method + // https://github.com/tc39/proposal-array-find-from-last + findLastIndex: createMethod$6(1) + }; + + var $findLast$1 = arrayIterationFromLast.findLast; + + + // `Array.prototype.findLast` method + // https://github.com/tc39/proposal-array-find-from-last + _export({ target: 'Array', proto: true }, { + findLast: function findLast(callbackfn /* , that = undefined */) { + return $findLast$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + addToUnscopables('findLast'); + + var $findLastIndex$1 = arrayIterationFromLast.findLastIndex; + + + // `Array.prototype.findLastIndex` method + // https://github.com/tc39/proposal-array-find-from-last + _export({ target: 'Array', proto: true }, { + findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) { + return $findLastIndex$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + addToUnscopables('findLastIndex'); // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray @@ -1985,7 +2404,7 @@ var doric = (function (exports) { elementLen = lengthOfArrayLike(element); targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1; } else { - if (targetIndex >= 0x1FFFFFFFFFFFFF) { throw TypeError$t('Exceed the acceptable array length'); } + doesNotExceedSafeInteger(targetIndex + 1); target[targetIndex] = element; } @@ -2034,12 +2453,12 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype.foreach var arrayForEach = !STRICT_METHOD$7 ? function forEach(callbackfn /* , thisArg */) { return $forEach$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - // eslint-disable-next-line es/no-array-prototype-foreach -- safe + // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe } : [].forEach; // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach - // eslint-disable-next-line es/no-array-prototype-foreach -- safe + // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, { forEach: arrayForEach }); @@ -2053,7 +2472,7 @@ var doric = (function (exports) { } }; - var Array$9 = global_1.Array; + var $Array$8 = Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from @@ -2068,7 +2487,7 @@ var doric = (function (exports) { var index = 0; var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case - if (iteratorMethod && !(this == Array$9 && isArrayIteratorMethod(iteratorMethod))) { + if (iteratorMethod && !(this === $Array$8 && isArrayIteratorMethod(iteratorMethod))) { iterator = getIterator(O, iteratorMethod); next = iterator.next; result = IS_CONSTRUCTOR ? new this() : []; @@ -2078,7 +2497,7 @@ var doric = (function (exports) { } } else { length = lengthOfArrayLike(O); - result = IS_CONSTRUCTOR ? new this(length) : Array$9(length); + result = IS_CONSTRUCTOR ? new this(length) : $Array$8(length); for (;length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; createProperty(result, index, value); @@ -2104,7 +2523,7 @@ var doric = (function (exports) { iteratorWithReturn[ITERATOR$8] = function () { return this; }; - // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing + // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } @@ -2125,23 +2544,29 @@ var doric = (function (exports) { return ITERATION_SUPPORT; }; - var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration(function (iterable) { - // eslint-disable-next-line es/no-array-from -- required for testing + var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { + // eslint-disable-next-line es-x/no-array-from -- required for testing Array.from(iterable); }); // `Array.from` method // https://tc39.es/ecma262/#sec-array.from - _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, { + _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: arrayFrom }); var $includes$1 = arrayIncludes.includes; + + // FF99+ bug + var BROKEN_ON_SPARSE = fails(function () { + return !Array(1).includes(); + }); + // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes$1(this, el, arguments.length > 1 ? arguments[1] : undefined); } @@ -2150,7 +2575,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); - /* eslint-disable es/no-array-prototype-indexof -- required for testing */ + /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */ var $IndexOf = arrayIncludes.indexOf; @@ -2186,7 +2611,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype$5, PrototypeOfArrayIteratorPrototype, arrayIterator$1; - /* eslint-disable es/no-array-prototype-keys -- safe */ + /* eslint-disable es-x/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator$1 = [].keys(); // Safari 8 has buggy iterators w/o `next` @@ -2208,7 +2633,7 @@ var doric = (function (exports) { // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator if (!isCallable(IteratorPrototype$5[ITERATOR$7])) { - redefine(IteratorPrototype$5, ITERATOR$7, function () { + defineBuiltIn(IteratorPrototype$5, ITERATOR$7, function () { return this; }); } @@ -2226,15 +2651,15 @@ var doric = (function (exports) { var returnThis$1 = function () { return this; }; - var createIteratorConstructor = function (IteratorConstructor, NAME, next) { + var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + ' Iterator'; - IteratorConstructor.prototype = objectCreate(IteratorPrototype$4, { next: createPropertyDescriptor(1, next) }); + IteratorConstructor.prototype = objectCreate(IteratorPrototype$4, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false); iterators[TO_STRING_TAG] = returnThis$1; return IteratorConstructor; }; - var PROPER_FUNCTION_NAME$4 = functionName.PROPER; + var PROPER_FUNCTION_NAME$3 = functionName.PROPER; var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE; var IteratorPrototype$3 = iteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS; @@ -2276,7 +2701,7 @@ var doric = (function (exports) { if (objectSetPrototypeOf) { objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$3); } else if (!isCallable(CurrentIteratorPrototype[ITERATOR$6])) { - redefine(CurrentIteratorPrototype, ITERATOR$6, returnThis); + defineBuiltIn(CurrentIteratorPrototype, ITERATOR$6, returnThis); } } // Set @@toStringTag to native iterators @@ -2285,7 +2710,7 @@ var doric = (function (exports) { } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF - if (PROPER_FUNCTION_NAME$4 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + if (PROPER_FUNCTION_NAME$3 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { if (CONFIGURABLE_FUNCTION_NAME$1) { createNonEnumerableProperty(IterablePrototype, 'name', VALUES); } else { @@ -2303,23 +2728,28 @@ var doric = (function (exports) { }; if (FORCED) { for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { - redefine(IterablePrototype, KEY, methods[KEY]); + defineBuiltIn(IterablePrototype, KEY, methods[KEY]); } } } else { _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } } // define iterator if (IterablePrototype[ITERATOR$6] !== defaultIterator) { - redefine(IterablePrototype, ITERATOR$6, defaultIterator, { name: DEFAULT }); + defineBuiltIn(IterablePrototype, ITERATOR$6, defaultIterator, { name: DEFAULT }); } iterators[NAME] = defaultIterator; return methods; }; + var defineProperty$9 = objectDefineProperty.f; + + + + var ARRAY_ITERATOR = 'Array Iterator'; - var setInternalState$g = internalState.set; - var getInternalState$f = internalState.getterFor(ARRAY_ITERATOR); + var setInternalState$h = internalState.set; + var getInternalState$d = internalState.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.es/ecma262/#sec-array.prototype.entries @@ -2332,7 +2762,7 @@ var doric = (function (exports) { // `CreateArrayIterator` internal method // https://tc39.es/ecma262/#sec-createarrayiterator var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { - setInternalState$g(this, { + setInternalState$h(this, { type: ARRAY_ITERATOR, target: toIndexedObject(iterated), // target index: 0, // next index @@ -2341,7 +2771,7 @@ var doric = (function (exports) { // `%ArrayIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next }, function () { - var state = getInternalState$f(this); + var state = getInternalState$d(this); var target = state.target; var kind = state.kind; var index = state.index++; @@ -2357,13 +2787,18 @@ var doric = (function (exports) { // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.es/ecma262/#sec-createunmappedargumentsobject // https://tc39.es/ecma262/#sec-createmappedargumentsobject - iterators.Arguments = iterators.Array; + var values = iterators.Arguments = iterators.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); + // V8 ~ Chrome 45- bug + if (descriptors && values.name !== 'values') { try { + defineProperty$9(values, 'name', { value: 'values' }); + } catch (error) { /* empty */ } } + var un$Join = functionUncurryThis([].join); var ES3_STRINGS = indexedObject != Object; @@ -2377,28 +2812,28 @@ var doric = (function (exports) { } }); - /* eslint-disable es/no-array-prototype-lastindexof -- safe */ + /* eslint-disable es-x/no-array-prototype-lastindexof -- safe */ - var min$7 = Math.min; + var min$9 = Math.min; var $lastIndexOf = [].lastIndexOf; var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; var STRICT_METHOD$4 = arrayMethodIsStrict('lastIndexOf'); - var FORCED$p = NEGATIVE_ZERO || !STRICT_METHOD$4; + var FORCED$j = NEGATIVE_ZERO || !STRICT_METHOD$4; // `Array.prototype.lastIndexOf` method implementation // https://tc39.es/ecma262/#sec-array.prototype.lastindexof - var arrayLastIndexOf = FORCED$p ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + var arrayLastIndexOf = FORCED$j ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) { return functionApply($lastIndexOf, this, arguments) || 0; } var O = toIndexedObject(this); var length = lengthOfArrayLike(O); var index = length - 1; - if (arguments.length > 1) { index = min$7(index, toIntegerOrInfinity(arguments[1])); } + if (arguments.length > 1) { index = min$9(index, toIntegerOrInfinity(arguments[1])); } if (index < 0) { index = length + index; } for (;index >= 0; index--) { if (index in O && O[index] === searchElement) { return index || 0; } } return -1; @@ -2406,7 +2841,7 @@ var doric = (function (exports) { // `Array.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-array.prototype.lastindexof - // eslint-disable-next-line es/no-array-prototype-lastindexof -- required for testing + // eslint-disable-next-line es-x/no-array-prototype-lastindexof -- required for testing _export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, { lastIndexOf: arrayLastIndexOf }); @@ -2425,11 +2860,12 @@ var doric = (function (exports) { } }); - var Array$8 = global_1.Array; + var $Array$7 = Array; var ISNT_GENERIC = fails(function () { function F() { /* empty */ } - return !(Array$8.of.call(F) instanceof F); + // eslint-disable-next-line es-x/no-array-of -- safe + return !($Array$7.of.call(F) instanceof F); }); // `Array.of` method @@ -2441,17 +2877,52 @@ var doric = (function (exports) { var index = 0; var argumentsLength = arguments.length; - var result = new (isConstructor(this) ? this : Array$8)(argumentsLength); + var result = new (isConstructor(this) ? this : $Array$7)(argumentsLength); while (argumentsLength > index) { createProperty(result, index, arguments$1[index++]); } result.length = argumentsLength; return result; } }); - var TypeError$s = global_1.TypeError; + var INCORRECT_TO_LENGTH = fails(function () { + return [].push.call({ length: 0x100000000 }, 1) !== 4294967297; + }); + + // V8 and Safari <= 15.4, FF < 23 throws InternalError + // https://bugs.chromium.org/p/v8/issues/detail?id=12681 + var SILENT_ON_NON_WRITABLE_LENGTH$1 = !function () { + try { + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).push(); + } catch (error) { + return error instanceof TypeError; + } + }(); + + // `Array.prototype.push` method + // https://tc39.es/ecma262/#sec-array.prototype.push + _export({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_TO_LENGTH || SILENT_ON_NON_WRITABLE_LENGTH$1 }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + push: function push(item) { + var arguments$1 = arguments; + + var O = toObject(this); + var len = lengthOfArrayLike(O); + var argCount = arguments.length; + doesNotExceedSafeInteger(len + argCount); + for (var i = 0; i < argCount; i++) { + O[len] = arguments$1[i]; + len++; + } + O.length = len; + return len; + } + }); + + var $TypeError$o = TypeError; // `Array.prototype.{ reduce, reduceRight }` methods implementation - var createMethod$6 = function (IS_RIGHT) { + var createMethod$5 = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aCallable(callbackfn); var O = toObject(that); @@ -2467,7 +2938,7 @@ var doric = (function (exports) { } index += i; if (IS_RIGHT ? index < 0 : length <= index) { - throw TypeError$s('Reduce of empty array with no initial value'); + throw $TypeError$o('Reduce of empty array with no initial value'); } } } for (;IS_RIGHT ? index >= 0 : length > index; index += i) { if (index in self) { @@ -2480,10 +2951,10 @@ var doric = (function (exports) { var arrayReduce = { // `Array.prototype.reduce` method // https://tc39.es/ecma262/#sec-array.prototype.reduce - left: createMethod$6(false), + left: createMethod$5(false), // `Array.prototype.reduceRight` method // https://tc39.es/ecma262/#sec-array.prototype.reduceright - right: createMethod$6(true) + right: createMethod$5(true) }; var engineIsNode = classofRaw(global_1.process) == 'process'; @@ -2543,8 +3014,8 @@ var doric = (function (exports) { var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice'); var SPECIES$4 = wellKnownSymbol('species'); - var Array$7 = global_1.Array; - var max$5 = Math.max; + var $Array$6 = Array; + var max$7 = Math.max; // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice @@ -2560,17 +3031,17 @@ var doric = (function (exports) { if (isArray(O)) { Constructor = O.constructor; // cross-realm fallback - if (isConstructor(Constructor) && (Constructor === Array$7 || isArray(Constructor.prototype))) { + if (isConstructor(Constructor) && (Constructor === $Array$6 || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { Constructor = Constructor[SPECIES$4]; if (Constructor === null) { Constructor = undefined; } } - if (Constructor === Array$7 || Constructor === undefined) { + if (Constructor === $Array$6 || Constructor === undefined) { return arraySlice$1(O, k, fin); } } - result = new (Constructor === undefined ? Array$7 : Constructor)(max$5(fin - k, 0)); + result = new (Constructor === undefined ? $Array$6 : Constructor)(max$7(fin - k, 0)); for (n = 0; k < fin; k++, n++) { if (k in O) { createProperty(result, n, O[k]); } } result.length = n; return result; @@ -2597,8 +3068,8 @@ var doric = (function (exports) { var middle = floor$9(length / 2); return length < 8 ? insertionSort(array, comparefn) : merge( array, - mergeSort(arraySlice$1(array, 0, middle), comparefn), - mergeSort(arraySlice$1(array, middle), comparefn), + mergeSort(arraySliceSimple(array, 0, middle), comparefn), + mergeSort(arraySliceSimple(array, middle), comparefn), comparefn ); }; @@ -2645,7 +3116,7 @@ var doric = (function (exports) { var test = []; var un$Sort$1 = functionUncurryThis(test.sort); - var push$f = functionUncurryThis(test.push); + var push$i = functionUncurryThis(test.push); // IE8- var FAILS_ON_UNDEFINED = fails(function () { @@ -2693,7 +3164,7 @@ var doric = (function (exports) { return result !== 'DGBEFHACIJK'; }); - var FORCED$o = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1; + var FORCED$i = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1; var getSortCompare$1 = function (comparefn) { return function (x, y) { @@ -2706,7 +3177,7 @@ var doric = (function (exports) { // `Array.prototype.sort` method // https://tc39.es/ecma262/#sec-array.prototype.sort - _export({ target: 'Array', proto: true, forced: FORCED$o }, { + _export({ target: 'Array', proto: true, forced: FORCED$i }, { sort: function sort(comparefn) { if (comparefn !== undefined) { aCallable(comparefn); } @@ -2719,7 +3190,7 @@ var doric = (function (exports) { var itemsLength, index; for (index = 0; index < arrayLength; index++) { - if (index in array) { push$f(items, array[index]); } + if (index in array) { push$i(items, array[index]); } } arraySort(items, getSortCompare$1(comparefn)); @@ -2728,7 +3199,7 @@ var doric = (function (exports) { index = 0; while (index < itemsLength) { array[index] = items[index++]; } - while (index < arrayLength) { delete array[index++]; } + while (index < arrayLength) { deletePropertyOrThrow(array, index++); } return array; } @@ -2754,11 +3225,8 @@ var doric = (function (exports) { var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); - var TypeError$r = global_1.TypeError; - var max$4 = Math.max; - var min$6 = Math.min; - var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; - var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; + var max$6 = Math.max; + var min$8 = Math.min; // `Array.prototype.splice` method // https://tc39.es/ecma262/#sec-array.prototype.splice @@ -2779,11 +3247,9 @@ var doric = (function (exports) { actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; - actualDeleteCount = min$6(max$4(toIntegerOrInfinity(deleteCount), 0), len - actualStart); - } - if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { - throw TypeError$r(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); + actualDeleteCount = min$8(max$6(toIntegerOrInfinity(deleteCount), 0), len - actualStart); } + doesNotExceedSafeInteger(len + insertCount - actualDeleteCount); A = arraySpeciesCreate(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; @@ -2795,15 +3261,15 @@ var doric = (function (exports) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) { O[to] = O[from]; } - else { delete O[to]; } + else { deletePropertyOrThrow(O, to); } } - for (k = len; k > len - actualDeleteCount + insertCount; k--) { delete O[k - 1]; } + for (k = len; k > len - actualDeleteCount + insertCount; k--) { deletePropertyOrThrow(O, k - 1); } } else if (insertCount > actualDeleteCount) { for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) { O[to] = O[from]; } - else { delete O[to]; } + else { deletePropertyOrThrow(O, to); } } } for (k = 0; k < insertCount; k++) { @@ -2828,22 +3294,60 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flatMap'); - // eslint-disable-next-line es/no-typed-arrays -- safe + // IE8- + var INCORRECT_RESULT = [].unshift(0) !== 1; + + // V8 ~ Chrome < 71 and Safari <= 15.4, FF < 23 throws InternalError + var SILENT_ON_NON_WRITABLE_LENGTH = !function () { + try { + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).unshift(); + } catch (error) { + return error instanceof TypeError; + } + }(); + + // `Array.prototype.unshift` method + // https://tc39.es/ecma262/#sec-array.prototype.unshift + _export({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_RESULT || SILENT_ON_NON_WRITABLE_LENGTH }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + unshift: function unshift(item) { + var arguments$1 = arguments; + + var O = toObject(this); + var len = lengthOfArrayLike(O); + var argCount = arguments.length; + if (argCount) { + doesNotExceedSafeInteger(len + argCount); + var k = len; + while (k--) { + var to = k + argCount; + if (k in O) { O[to] = O[k]; } + else { deletePropertyOrThrow(O, to); } + } + for (var j = 0; j < argCount; j++) { + O[j] = arguments$1[j]; + } + } return O.length = len + argCount; + } + }); + + // eslint-disable-next-line es-x/no-typed-arrays -- safe var arrayBufferNative = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined'; - var redefineAll = function (target, src, options) { - for (var key in src) { redefine(target, key, src[key], options); } + var defineBuiltIns = function (target, src, options) { + for (var key in src) { defineBuiltIn(target, key, src[key], options); } return target; }; - var TypeError$q = global_1.TypeError; + var $TypeError$n = TypeError; var anInstance = function (it, Prototype) { if (objectIsPrototypeOf(Prototype, it)) { return it; } - throw TypeError$q('Incorrect invocation'); + throw $TypeError$n('Incorrect invocation'); }; - var RangeError$b = global_1.RangeError; + var $RangeError$c = RangeError; // `ToIndex` abstract operation // https://tc39.es/ecma262/#sec-toindex @@ -2851,30 +3355,28 @@ var doric = (function (exports) { if (it === undefined) { return 0; } var number = toIntegerOrInfinity(it); var length = toLength(number); - if (number !== length) { throw RangeError$b('Wrong length or index'); } + if (number !== length) { throw $RangeError$c('Wrong length or index'); } return length; }; // IEEE754 conversions based on https://github.com/feross/ieee754 - - - var Array$6 = global_1.Array; - var abs$7 = Math.abs; - var pow$4 = Math.pow; + var $Array$5 = Array; + var abs$8 = Math.abs; + var pow$5 = Math.pow; var floor$8 = Math.floor; var log$9 = Math.log; var LN2$2 = Math.LN2; var pack = function (number, mantissaLength, bytes) { - var buffer = Array$6(bytes); + var buffer = $Array$5(bytes); var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; - var rt = mantissaLength === 23 ? pow$4(2, -24) - pow$4(2, -77) : 0; + var rt = mantissaLength === 23 ? pow$5(2, -24) - pow$5(2, -77) : 0; var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0; var index = 0; var exponent, mantissa, c; - number = abs$7(number); + number = abs$8(number); // eslint-disable-next-line no-self-compare -- NaN check if (number != number || number === Infinity) { // eslint-disable-next-line no-self-compare -- NaN check @@ -2882,14 +3384,15 @@ var doric = (function (exports) { exponent = eMax; } else { exponent = floor$8(log$9(number) / LN2$2); - if (number * (c = pow$4(2, -exponent)) < 1) { + c = pow$5(2, -exponent); + if (number * c < 1) { exponent--; c *= 2; } if (exponent + eBias >= 1) { number += rt / c; } else { - number += rt * pow$4(2, 1 - eBias); + number += rt * pow$5(2, 1 - eBias); } if (number * c >= 2) { exponent++; @@ -2899,17 +3402,25 @@ var doric = (function (exports) { mantissa = 0; exponent = eMax; } else if (exponent + eBias >= 1) { - mantissa = (number * c - 1) * pow$4(2, mantissaLength); + mantissa = (number * c - 1) * pow$5(2, mantissaLength); exponent = exponent + eBias; } else { - mantissa = number * pow$4(2, eBias - 1) * pow$4(2, mantissaLength); + mantissa = number * pow$5(2, eBias - 1) * pow$5(2, mantissaLength); exponent = 0; } } - for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8){ } + while (mantissaLength >= 8) { + buffer[index++] = mantissa & 255; + mantissa /= 256; + mantissaLength -= 8; + } exponent = exponent << mantissaLength | mantissa; exponentLength += mantissaLength; - for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8){ } + while (exponentLength > 0) { + buffer[index++] = exponent & 255; + exponent /= 256; + exponentLength -= 8; + } buffer[--index] |= sign * 128; return buffer; }; @@ -2925,19 +3436,25 @@ var doric = (function (exports) { var exponent = sign & 127; var mantissa; sign >>= 7; - for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8){ } + while (nBits > 0) { + exponent = exponent * 256 + buffer[index--]; + nBits -= 8; + } mantissa = exponent & (1 << -nBits) - 1; exponent >>= -nBits; nBits += mantissaLength; - for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8){ } + while (nBits > 0) { + mantissa = mantissa * 256 + buffer[index--]; + nBits -= 8; + } if (exponent === 0) { exponent = 1 - eBias; } else if (exponent === eMax) { return mantissa ? NaN : sign ? -Infinity : Infinity; } else { - mantissa = mantissa + pow$4(2, mantissaLength); + mantissa = mantissa + pow$5(2, mantissaLength); exponent = exponent - eBias; - } return (sign ? -1 : 1) * mantissa * pow$4(2, exponent - mantissaLength); + } return (sign ? -1 : 1) * mantissa * pow$5(2, exponent - mantissaLength); }; var ieee754 = { @@ -2946,17 +3463,17 @@ var doric = (function (exports) { }; var getOwnPropertyNames$3 = objectGetOwnPropertyNames.f; - var defineProperty$b = objectDefineProperty.f; + var defineProperty$8 = objectDefineProperty.f; - var PROPER_FUNCTION_NAME$3 = functionName.PROPER; + var PROPER_FUNCTION_NAME$2 = functionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE; - var getInternalState$e = internalState.get; - var setInternalState$f = internalState.set; - var ARRAY_BUFFER$1 = 'ArrayBuffer'; + var getInternalState$c = internalState.get; + var setInternalState$g = internalState.set; + var ARRAY_BUFFER$1 = 'ArrayBuffer'; var DATA_VIEW = 'DataView'; var PROTOTYPE = 'prototype'; var WRONG_LENGTH = 'Wrong length'; @@ -2967,8 +3484,8 @@ var doric = (function (exports) { var $DataView = global_1[DATA_VIEW]; var DataViewPrototype$1 = $DataView && $DataView[PROTOTYPE]; var ObjectPrototype$2 = Object.prototype; - var Array$5 = global_1.Array; - var RangeError$a = global_1.RangeError; + var Array$2 = global_1.Array; + var RangeError$3 = global_1.RangeError; var fill = functionUncurryThis(arrayFill); var reverse = functionUncurryThis([].reverse); @@ -3000,24 +3517,24 @@ var doric = (function (exports) { }; var addGetter = function (Constructor, key) { - defineProperty$b(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$e(this)[key]; } }); + defineProperty$8(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$c(this)[key]; } }); }; var get$1 = function (view, count, index, isLittleEndian) { var intIndex = toIndex(index); - var store = getInternalState$e(view); - if (intIndex + count > store.byteLength) { throw RangeError$a(WRONG_INDEX); } - var bytes = getInternalState$e(store.buffer).bytes; + var store = getInternalState$c(view); + if (intIndex + count > store.byteLength) { throw RangeError$3(WRONG_INDEX); } + var bytes = getInternalState$c(store.buffer).bytes; var start = intIndex + store.byteOffset; - var pack = arraySlice$1(bytes, start, start + count); + var pack = arraySliceSimple(bytes, start, start + count); return isLittleEndian ? pack : reverse(pack); }; var set$2 = function (view, count, index, conversion, value, isLittleEndian) { var intIndex = toIndex(index); - var store = getInternalState$e(view); - if (intIndex + count > store.byteLength) { throw RangeError$a(WRONG_INDEX); } - var bytes = getInternalState$e(store.buffer).bytes; + var store = getInternalState$c(view); + if (intIndex + count > store.byteLength) { throw RangeError$3(WRONG_INDEX); } + var bytes = getInternalState$c(store.buffer).bytes; var start = intIndex + store.byteOffset; var pack = conversion(+value); for (var i = 0; i < count; i++) { bytes[start + i] = pack[isLittleEndian ? i : count - i - 1]; } @@ -3027,8 +3544,8 @@ var doric = (function (exports) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, ArrayBufferPrototype); var byteLength = toIndex(length); - setInternalState$f(this, { - bytes: fill(Array$5(byteLength), 0), + setInternalState$g(this, { + bytes: fill(Array$2(byteLength), 0), byteLength: byteLength }); if (!descriptors) { this.byteLength = byteLength; } @@ -3039,12 +3556,12 @@ var doric = (function (exports) { $DataView = function DataView(buffer, byteOffset, byteLength) { anInstance(this, DataViewPrototype$1); anInstance(buffer, ArrayBufferPrototype); - var bufferLength = getInternalState$e(buffer).byteLength; + var bufferLength = getInternalState$c(buffer).byteLength; var offset = toIntegerOrInfinity(byteOffset); - if (offset < 0 || offset > bufferLength) { throw RangeError$a('Wrong offset'); } + if (offset < 0 || offset > bufferLength) { throw RangeError$3('Wrong offset'); } byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); - if (offset + byteLength > bufferLength) { throw RangeError$a(WRONG_LENGTH); } - setInternalState$f(this, { + if (offset + byteLength > bufferLength) { throw RangeError$3(WRONG_LENGTH); } + setInternalState$g(this, { buffer: buffer, byteLength: byteLength, byteOffset: offset @@ -3065,7 +3582,7 @@ var doric = (function (exports) { addGetter($DataView, 'byteOffset'); } - redefineAll(DataViewPrototype$1, { + defineBuiltIns(DataViewPrototype$1, { getInt8: function getInt8(byteOffset) { return get$1(this, 1, byteOffset)[0] << 24 >> 24; }, @@ -3118,7 +3635,7 @@ var doric = (function (exports) { } }); } else { - var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME$3 && NativeArrayBuffer$1.name !== ARRAY_BUFFER$1; + var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME$2 && NativeArrayBuffer$1.name !== ARRAY_BUFFER$1; /* eslint-disable no-new -- required for testing */ if (!fails(function () { NativeArrayBuffer$1(1); @@ -3138,9 +3655,9 @@ var doric = (function (exports) { $ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype; - for (var keys$2 = getOwnPropertyNames$3(NativeArrayBuffer$1), j$1 = 0, key$1; keys$2.length > j$1;) { - if (!((key$1 = keys$2[j$1++]) in $ArrayBuffer)) { - createNonEnumerableProperty($ArrayBuffer, key$1, NativeArrayBuffer$1[key$1]); + for (var keys$2 = getOwnPropertyNames$3(NativeArrayBuffer$1), j$1 = 0, key$3; keys$2.length > j$1;) { + if (!((key$3 = keys$2[j$1++]) in $ArrayBuffer)) { + createNonEnumerableProperty($ArrayBuffer, key$3, NativeArrayBuffer$1[key$3]); } } @@ -3159,7 +3676,7 @@ var doric = (function (exports) { var $setInt8 = functionUncurryThis(DataViewPrototype$1.setInt8); testView.setInt8(0, 2147483648); testView.setInt8(1, 2147483649); - if (testView.getInt8(0) || !testView.getInt8(1)) { redefineAll(DataViewPrototype$1, { + if (testView.getInt8(0) || !testView.getInt8(1)) { defineBuiltIns(DataViewPrototype$1, { setInt8: function setInt8(byteOffset, value) { $setInt8(this, byteOffset, value << 24 >> 24); }, @@ -3183,34 +3700,37 @@ var doric = (function (exports) { // `ArrayBuffer` constructor // https://tc39.es/ecma262/#sec-arraybuffer-constructor - _export({ global: true, forced: NativeArrayBuffer !== ArrayBuffer$3 }, { + _export({ global: true, constructor: true, forced: NativeArrayBuffer !== ArrayBuffer$3 }, { ArrayBuffer: ArrayBuffer$3 }); setSpecies(ARRAY_BUFFER); - var defineProperty$a = objectDefineProperty.f; + var defineProperty$7 = objectDefineProperty.f; - var Int8Array$3 = global_1.Int8Array; - var Int8ArrayPrototype = Int8Array$3 && Int8Array$3.prototype; - var Uint8ClampedArray = global_1.Uint8ClampedArray; - var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; - var TypedArray = Int8Array$3 && objectGetPrototypeOf(Int8Array$3); - var TypedArrayPrototype = Int8ArrayPrototype && objectGetPrototypeOf(Int8ArrayPrototype); + + var enforceInternalState$2 = internalState.enforce; + var getInternalState$b = internalState.get; + var Int8Array$4 = global_1.Int8Array; + var Int8ArrayPrototype$1 = Int8Array$4 && Int8Array$4.prototype; + var Uint8ClampedArray$1 = global_1.Uint8ClampedArray; + var Uint8ClampedArrayPrototype = Uint8ClampedArray$1 && Uint8ClampedArray$1.prototype; + var TypedArray = Int8Array$4 && objectGetPrototypeOf(Int8Array$4); + var TypedArrayPrototype$1 = Int8ArrayPrototype$1 && objectGetPrototypeOf(Int8ArrayPrototype$1); var ObjectPrototype$1 = Object.prototype; - var TypeError$p = global_1.TypeError; + var TypeError$6 = global_1.TypeError; var TO_STRING_TAG$5 = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); - var TYPED_ARRAY_CONSTRUCTOR$1 = uid('TYPED_ARRAY_CONSTRUCTOR'); + var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor'; // Fixing native typed arrays in Opera Presto crashes the browser, see #595 var NATIVE_ARRAY_BUFFER_VIEWS$2 = arrayBufferNative && !!objectSetPrototypeOf && classof(global_1.opera) !== 'Opera'; - var TYPED_ARRAY_TAG_REQIRED = false; + var TYPED_ARRAY_TAG_REQUIRED = false; var NAME$1, Constructor, Prototype; var TypedArrayConstructorsList = { @@ -3238,6 +3758,13 @@ var doric = (function (exports) { || hasOwnProperty_1(BigIntArrayConstructorsList, klass); }; + var getTypedArrayConstructor$5 = function (it) { + var proto = objectGetPrototypeOf(it); + if (!isObject(proto)) { return; } + var state = getInternalState$b(proto); + return (state && hasOwnProperty_1(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor$5(proto); + }; + var isTypedArray = function (it) { if (!isObject(it)) { return false; } var klass = classof(it); @@ -3245,27 +3772,32 @@ var doric = (function (exports) { || hasOwnProperty_1(BigIntArrayConstructorsList, klass); }; - var aTypedArray$t = function (it) { + var aTypedArray$x = function (it) { if (isTypedArray(it)) { return it; } - throw TypeError$p('Target is not a typed array'); + throw TypeError$6('Target is not a typed array'); }; var aTypedArrayConstructor$4 = function (C) { if (isCallable(C) && (!objectSetPrototypeOf || objectIsPrototypeOf(TypedArray, C))) { return C; } - throw TypeError$p(tryToString(C) + ' is not a typed array constructor'); + throw TypeError$6(tryToString(C) + ' is not a typed array constructor'); }; - var exportTypedArrayMethod$u = function (KEY, property, forced) { + var exportTypedArrayMethod$y = function (KEY, property, forced, options) { if (!descriptors) { return; } if (forced) { for (var ARRAY in TypedArrayConstructorsList) { var TypedArrayConstructor = global_1[ARRAY]; if (TypedArrayConstructor && hasOwnProperty_1(TypedArrayConstructor.prototype, KEY)) { try { delete TypedArrayConstructor.prototype[KEY]; - } catch (error) { /* empty */ } } + } catch (error) { + // old WebKit bug - some methods are non-configurable + try { + TypedArrayConstructor.prototype[KEY] = property; + } catch (error2) { /* empty */ } + } } } } - if (!TypedArrayPrototype[KEY] || forced) { - redefine(TypedArrayPrototype, KEY, forced ? property - : NATIVE_ARRAY_BUFFER_VIEWS$2 && Int8ArrayPrototype[KEY] || property); + if (!TypedArrayPrototype$1[KEY] || forced) { + defineBuiltIn(TypedArrayPrototype$1, KEY, forced ? property + : NATIVE_ARRAY_BUFFER_VIEWS$2 && Int8ArrayPrototype$1[KEY] || property, options); } }; @@ -3282,14 +3814,14 @@ var doric = (function (exports) { if (!TypedArray[KEY] || forced) { // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable try { - return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS$2 && TypedArray[KEY] || property); + return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS$2 && TypedArray[KEY] || property); } catch (error$1) { /* empty */ } } else { return; } } for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global_1[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { - redefine(TypedArrayConstructor, KEY, property); + defineBuiltIn(TypedArrayConstructor, KEY, property); } } }; @@ -3297,42 +3829,42 @@ var doric = (function (exports) { for (NAME$1 in TypedArrayConstructorsList) { Constructor = global_1[NAME$1]; Prototype = Constructor && Constructor.prototype; - if (Prototype) { createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor); } + if (Prototype) { enforceInternalState$2(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; } else { NATIVE_ARRAY_BUFFER_VIEWS$2 = false; } } for (NAME$1 in BigIntArrayConstructorsList) { Constructor = global_1[NAME$1]; Prototype = Constructor && Constructor.prototype; - if (Prototype) { createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor); } + if (Prototype) { enforceInternalState$2(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; } } // WebKit bug - typed arrays constructors prototype is Object.prototype if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !isCallable(TypedArray) || TypedArray === Function.prototype) { // eslint-disable-next-line no-shadow -- safe TypedArray = function TypedArray() { - throw TypeError$p('Incorrect invocation'); + throw TypeError$6('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS$2) { for (NAME$1 in TypedArrayConstructorsList) { if (global_1[NAME$1]) { objectSetPrototypeOf(global_1[NAME$1], TypedArray); } } } } - if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype$1) { - TypedArrayPrototype = TypedArray.prototype; + if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !TypedArrayPrototype$1 || TypedArrayPrototype$1 === ObjectPrototype$1) { + TypedArrayPrototype$1 = TypedArray.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS$2) { for (NAME$1 in TypedArrayConstructorsList) { - if (global_1[NAME$1]) { objectSetPrototypeOf(global_1[NAME$1].prototype, TypedArrayPrototype); } + if (global_1[NAME$1]) { objectSetPrototypeOf(global_1[NAME$1].prototype, TypedArrayPrototype$1); } } } } // WebKit bug - one more object in Uint8ClampedArray prototype chain - if (NATIVE_ARRAY_BUFFER_VIEWS$2 && objectGetPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { - objectSetPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); + if (NATIVE_ARRAY_BUFFER_VIEWS$2 && objectGetPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype$1) { + objectSetPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype$1); } - if (descriptors && !hasOwnProperty_1(TypedArrayPrototype, TO_STRING_TAG$5)) { - TYPED_ARRAY_TAG_REQIRED = true; - defineProperty$a(TypedArrayPrototype, TO_STRING_TAG$5, { get: function () { + if (descriptors && !hasOwnProperty_1(TypedArrayPrototype$1, TO_STRING_TAG$5)) { + TYPED_ARRAY_TAG_REQUIRED = true; + defineProperty$7(TypedArrayPrototype$1, TO_STRING_TAG$5, { get: function () { return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } }); for (NAME$1 in TypedArrayConstructorsList) { if (global_1[NAME$1]) { @@ -3342,16 +3874,16 @@ var doric = (function (exports) { var arrayBufferViewCore = { NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS$2, - TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$1, - TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, - aTypedArray: aTypedArray$t, + TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG, + aTypedArray: aTypedArray$x, aTypedArrayConstructor: aTypedArrayConstructor$4, - exportTypedArrayMethod: exportTypedArrayMethod$u, + exportTypedArrayMethod: exportTypedArrayMethod$y, exportTypedArrayStaticMethod: exportTypedArrayStaticMethod$3, + getTypedArrayConstructor: getTypedArrayConstructor$5, isView: isView, isTypedArray: isTypedArray, TypedArray: TypedArray, - TypedArrayPrototype: TypedArrayPrototype + TypedArrayPrototype: TypedArrayPrototype$1 }; var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; @@ -3362,12 +3894,12 @@ var doric = (function (exports) { isView: arrayBufferViewCore.isView }); - var TypeError$o = global_1.TypeError; + var $TypeError$m = TypeError; // `Assert: IsConstructor(argument) is true` var aConstructor = function (argument) { if (isConstructor(argument)) { return argument; } - throw TypeError$o(tryToString(argument) + ' is not a constructor'); + throw $TypeError$m(tryToString(argument) + ' is not a constructor'); }; var SPECIES$2 = wellKnownSymbol('species'); @@ -3413,11 +3945,11 @@ var doric = (function (exports) { // `DataView` constructor // https://tc39.es/ecma262/#sec-dataview-constructor - _export({ global: true, forced: !arrayBufferNative }, { + _export({ global: true, constructor: true, forced: !arrayBufferNative }, { DataView: arrayBuffer.DataView }); - var FORCED$n = fails(function () { + var FORCED$h = fails(function () { return new Date(16e11).getYear() !== 120; }); @@ -3425,25 +3957,29 @@ var doric = (function (exports) { // `Date.prototype.getYear` method // https://tc39.es/ecma262/#sec-date.prototype.getyear - _export({ target: 'Date', proto: true, forced: FORCED$n }, { + _export({ target: 'Date', proto: true, forced: FORCED$h }, { getYear: function getYear() { return getFullYear(this) - 1900; } }); - var Date$1 = global_1.Date; - var getTime$3 = functionUncurryThis(Date$1.prototype.getTime); + // TODO: Remove from `core-js@4` + + + + var $Date = Date; + var getTime$4 = functionUncurryThis($Date.prototype.getTime); // `Date.now` method // https://tc39.es/ecma262/#sec-date.now _export({ target: 'Date', stat: true }, { now: function now() { - return getTime$3(new Date$1()); + return getTime$4(new $Date()); } }); var DatePrototype$3 = Date.prototype; - var getTime$2 = functionUncurryThis(DatePrototype$3.getTime); + var getTime$3 = functionUncurryThis(DatePrototype$3.getTime); var setFullYear = functionUncurryThis(DatePrototype$3.setFullYear); // `Date.prototype.setYear` method @@ -3451,7 +3987,7 @@ var doric = (function (exports) { _export({ target: 'Date', proto: true }, { setYear: function setYear(year) { // validate - getTime$2(this); + getTime$3(this); var yi = toIntegerOrInfinity(year); var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi; return setFullYear(this, yyyy); @@ -3464,7 +4000,7 @@ var doric = (function (exports) { toGMTString: Date.prototype.toUTCString }); - var RangeError$9 = global_1.RangeError; + var $RangeError$b = RangeError; // `String.prototype.repeat` method implementation // https://tc39.es/ecma262/#sec-string.prototype.repeat @@ -3472,7 +4008,7 @@ var doric = (function (exports) { var str = toString_1(requireObjectCoercible(this)); var result = ''; var n = toIntegerOrInfinity(count); - if (n < 0 || n == Infinity) { throw RangeError$9('Wrong number of repetitions'); } + if (n < 0 || n == Infinity) { throw $RangeError$b('Wrong number of repetitions'); } for (;n > 0; (n >>>= 1) && (str += str)) { if (n & 1) { result += str; } } return result; }; @@ -3484,12 +4020,12 @@ var doric = (function (exports) { - var repeat$1 = functionUncurryThis(stringRepeat); - var stringSlice$e = functionUncurryThis(''.slice); - var ceil$1 = Math.ceil; + var repeat$2 = functionUncurryThis(stringRepeat); + var stringSlice$f = functionUncurryThis(''.slice); + var ceil = Math.ceil; // `String.prototype.{ padStart, padEnd }` methods implementation - var createMethod$5 = function (IS_END) { + var createMethod$4 = function (IS_END) { return function ($this, maxLength, fillString) { var S = toString_1(requireObjectCoercible($this)); var intMaxLength = toLength(maxLength); @@ -3498,8 +4034,8 @@ var doric = (function (exports) { var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr == '') { return S; } fillLen = intMaxLength - stringLength; - stringFiller = repeat$1(fillStr, ceil$1(fillLen / fillStr.length)); - if (stringFiller.length > fillLen) { stringFiller = stringSlice$e(stringFiller, 0, fillLen); } + stringFiller = repeat$2(fillStr, ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) { stringFiller = stringSlice$f(stringFiller, 0, fillLen); } return IS_END ? S + stringFiller : stringFiller + S; }; }; @@ -3507,19 +4043,19 @@ var doric = (function (exports) { var stringPad = { // `String.prototype.padStart` method // https://tc39.es/ecma262/#sec-string.prototype.padstart - start: createMethod$5(false), + start: createMethod$4(false), // `String.prototype.padEnd` method // https://tc39.es/ecma262/#sec-string.prototype.padend - end: createMethod$5(true) + end: createMethod$4(true) }; var padStart = stringPad.start; - var RangeError$8 = global_1.RangeError; - var abs$6 = Math.abs; + var $RangeError$a = RangeError; + var abs$7 = Math.abs; var DatePrototype$2 = Date.prototype; var n$DateToISOString = DatePrototype$2.toISOString; - var getTime$1 = functionUncurryThis(DatePrototype$2.getTime); + var getTime$2 = functionUncurryThis(DatePrototype$2.getTime); var getUTCDate = functionUncurryThis(DatePrototype$2.getUTCDate); var getUTCFullYear = functionUncurryThis(DatePrototype$2.getUTCFullYear); var getUTCHours = functionUncurryThis(DatePrototype$2.getUTCHours); @@ -3536,12 +4072,12 @@ var doric = (function (exports) { }) || !fails(function () { n$DateToISOString.call(new Date(NaN)); })) ? function toISOString() { - if (!isFinite(getTime$1(this))) { throw RangeError$8('Invalid time value'); } + if (!isFinite(getTime$2(this))) { throw $RangeError$a('Invalid time value'); } var date = this; var year = getUTCFullYear(date); var milliseconds = getUTCMilliseconds(date); var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; - return sign + padStart(abs$6(year), sign ? 6 : 4, 0) + + return sign + padStart(abs$7(year), sign ? 6 : 4, 0) + '-' + padStart(getUTCMonth(date) + 1, 2, 0) + '-' + padStart(getUTCDate(date), 2, 0) + 'T' + padStart(getUTCHours(date), 2, 0) + @@ -3558,14 +4094,14 @@ var doric = (function (exports) { toISOString: dateToIsoString }); - var FORCED$m = fails(function () { + var FORCED$g = fails(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; }); // `Date.prototype.toJSON` method // https://tc39.es/ecma262/#sec-date.prototype.tojson - _export({ target: 'Date', proto: true, forced: FORCED$m }, { + _export({ target: 'Date', proto: true, arity: 1, forced: FORCED$g }, { // eslint-disable-next-line no-unused-vars -- required for `.length` toJSON: function toJSON(key) { var O = toObject(this); @@ -3574,14 +4110,14 @@ var doric = (function (exports) { } }); - var TypeError$n = global_1.TypeError; + var $TypeError$l = TypeError; // `Date.prototype[@@toPrimitive](hint)` method implementation // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive var dateToPrimitive = function (hint) { anObject(this); if (hint === 'string' || hint === 'default') { hint = 'string'; } - else if (hint !== 'number') { throw TypeError$n('Incorrect hint'); } + else if (hint !== 'number') { throw $TypeError$l('Incorrect hint'); } return ordinaryToPrimitive(this, hint); }; @@ -3591,35 +4127,39 @@ var doric = (function (exports) { // `Date.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive if (!hasOwnProperty_1(DatePrototype$1, TO_PRIMITIVE)) { - redefine(DatePrototype$1, TO_PRIMITIVE, dateToPrimitive); + defineBuiltIn(DatePrototype$1, TO_PRIMITIVE, dateToPrimitive); } + // TODO: Remove from `core-js@4` + + + var DatePrototype = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING$1 = 'toString'; var un$DateToString = functionUncurryThis(DatePrototype[TO_STRING$1]); - var getTime = functionUncurryThis(DatePrototype.getTime); + var getTime$1 = functionUncurryThis(DatePrototype.getTime); // `Date.prototype.toString` method // https://tc39.es/ecma262/#sec-date.prototype.tostring if (String(new Date(NaN)) != INVALID_DATE) { - redefine(DatePrototype, TO_STRING$1, function toString() { - var value = getTime(this); + defineBuiltIn(DatePrototype, TO_STRING$1, function toString() { + var value = getTime$1(this); // eslint-disable-next-line no-self-compare -- NaN check return value === value ? un$DateToString(this) : INVALID_DATE; }); } - var charAt$f = functionUncurryThis(''.charAt); + var charAt$g = functionUncurryThis(''.charAt); var charCodeAt$4 = functionUncurryThis(''.charCodeAt); - var exec$8 = functionUncurryThis(/./.exec); - var numberToString$3 = functionUncurryThis(1.0.toString); + var exec$9 = functionUncurryThis(/./.exec); + var numberToString$2 = functionUncurryThis(1.0.toString); var toUpperCase = functionUncurryThis(''.toUpperCase); var raw = /[\w*+\-./@]/; var hex$1 = function (code, length) { - var result = numberToString$3(code, 16); + var result = numberToString$2(code, 16); while (result.length < length) { result = '0' + result; } return result; }; @@ -3634,8 +4174,8 @@ var doric = (function (exports) { var index = 0; var chr, code; while (index < length) { - chr = charAt$f(str, index++); - if (exec$8(raw, chr)) { + chr = charAt$g(str, index++); + if (exec$9(raw, chr)) { result += chr; } else { code = charCodeAt$4(chr, 0); @@ -3649,21 +4189,21 @@ var doric = (function (exports) { } }); - var Function$3 = global_1.Function; + var $Function = Function; var concat$3 = functionUncurryThis([].concat); - var join$6 = functionUncurryThis([].join); + var join$7 = functionUncurryThis([].join); var factories = {}; var construct = function (C, argsLength, args) { if (!hasOwnProperty_1(factories, argsLength)) { for (var list = [], i = 0; i < argsLength; i++) { list[i] = 'a[' + i + ']'; } - factories[argsLength] = Function$3('C,a', 'return new C(' + join$6(list, ',') + ')'); + factories[argsLength] = $Function('C,a', 'return new C(' + join$7(list, ',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind - var functionBind = Function$3.bind || function bind(that /* , ...args */) { + var functionBind = functionBindNative ? $Function.bind : function bind(that /* , ...args */) { var F = aCallable(this); var Prototype = F.prototype; var partArgs = arraySlice$1(arguments, 1); @@ -3675,9 +4215,13 @@ var doric = (function (exports) { return boundFunction; }; + // TODO: Remove from `core-js@4` + + + // `Function.prototype.bind` method // https://tc39.es/ecma262/#sec-function.prototype.bind - _export({ target: 'Function', proto: true }, { + _export({ target: 'Function', proto: true, forced: Function.bind !== functionBind }, { bind: functionBind }); @@ -3687,30 +4231,30 @@ var doric = (function (exports) { // `Function.prototype[@@hasInstance]` method // https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance if (!(HAS_INSTANCE in FunctionPrototype$1)) { - objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: function (O) { + objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: makeBuiltIn_1(function (O) { if (!isCallable(this) || !isObject(O)) { return false; } var P = this.prototype; if (!isObject(P)) { return O instanceof this; } // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: while (O = objectGetPrototypeOf(O)) { if (P === O) { return true; } } return false; - } }); + }, HAS_INSTANCE) }); } var FUNCTION_NAME_EXISTS = functionName.EXISTS; - var defineProperty$9 = objectDefineProperty.f; + var defineProperty$6 = objectDefineProperty.f; var FunctionPrototype = Function.prototype; var functionToString = functionUncurryThis(FunctionPrototype.toString); - var nameRE = /^\s*function ([^ (]*)/; + var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/; var regExpExec = functionUncurryThis(nameRE.exec); var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name if (descriptors && !FUNCTION_NAME_EXISTS) { - defineProperty$9(FunctionPrototype, NAME, { + defineProperty$6(FunctionPrototype, NAME, { configurable: true, get: function () { try { @@ -3728,53 +4272,35 @@ var doric = (function (exports) { globalThis: global_1 }); - var Array$4 = global_1.Array; - var $stringify = getBuiltIn('JSON', 'stringify'); - var exec$7 = functionUncurryThis(/./.exec); - var charAt$e = functionUncurryThis(''.charAt); - var charCodeAt$3 = functionUncurryThis(''.charCodeAt); - var replace$8 = functionUncurryThis(''.replace); - var numberToString$2 = functionUncurryThis(1.0.toString); + // JSON[@@toStringTag] property + // https://tc39.es/ecma262/#sec-json-@@tostringtag + setToStringTag(global_1.JSON, 'JSON', true); - var tester = /[\uD800-\uDFFF]/g; - var low = /^[\uD800-\uDBFF]$/; - var hi = /^[\uDC00-\uDFFF]$/; + // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it - var fix = function (match, offset, string) { - var prev = charAt$e(string, offset - 1); - var next = charAt$e(string, offset + 1); - if ((exec$7(low, match) && !exec$7(hi, next)) || (exec$7(hi, match) && !exec$7(low, prev))) { - return '\\u' + numberToString$2(charCodeAt$3(match, 0), 16); - } return match; - }; - var FORCED$l = fails(function () { - return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' - || $stringify('\uDEAD') !== '"\\udead"'; + var arrayBufferNonExtensible = fails(function () { + if (typeof ArrayBuffer == 'function') { + var buffer = new ArrayBuffer(8); + // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe + if (Object.isExtensible(buffer)) { Object.defineProperty(buffer, 'a', { value: 8 }); } + } }); - if ($stringify) { - // `JSON.stringify` method - // https://tc39.es/ecma262/#sec-json.stringify - // https://github.com/tc39/proposal-well-formed-stringify - _export({ target: 'JSON', stat: true, forced: FORCED$l }, { - // eslint-disable-next-line no-unused-vars -- required for `.length` - stringify: function stringify(it, replacer, space) { - var arguments$1 = arguments; - - for (var i = 0, l = arguments.length, args = Array$4(l); i < l; i++) { args[i] = arguments$1[i]; } - var result = functionApply($stringify, null, args); - return typeof result == 'string' ? replace$8(result, tester, fix) : result; - } - }); - } + // eslint-disable-next-line es-x/no-object-isextensible -- safe + var $isExtensible = Object.isExtensible; + var FAILS_ON_PRIMITIVES$9 = fails(function () { $isExtensible(1); }); - // JSON[@@toStringTag] property - // https://tc39.es/ecma262/#sec-json-@@tostringtag - setToStringTag(global_1.JSON, 'JSON', true); + // `Object.isExtensible` method + // https://tc39.es/ecma262/#sec-object.isextensible + var objectIsExtensible = (FAILS_ON_PRIMITIVES$9 || arrayBufferNonExtensible) ? function isExtensible(it) { + if (!isObject(it)) { return false; } + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') { return false; } + return $isExtensible ? $isExtensible(it) : true; + } : $isExtensible; var freezing = !fails(function () { - // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing + // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing return Object.isExtensible(Object.preventExtensions({})); }); @@ -3785,15 +4311,11 @@ var doric = (function (exports) { + var REQUIRED = false; var METADATA = uid('meta'); var id = 0; - // eslint-disable-next-line es/no-object-isextensible -- safe - var isExtensible = Object.isExtensible || function () { - return true; - }; - var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + id++, // object ID @@ -3806,7 +4328,7 @@ var doric = (function (exports) { if (!isObject(it)) { return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; } if (!hasOwnProperty_1(it, METADATA)) { // can't set metadata to uncaught frozen object - if (!isExtensible(it)) { return 'F'; } + if (!objectIsExtensible(it)) { return 'F'; } // not necessary to add metadata if (!create) { return 'E'; } // add missing metadata @@ -3818,7 +4340,7 @@ var doric = (function (exports) { var getWeakData = function (it, create) { if (!hasOwnProperty_1(it, METADATA)) { // can't set metadata to uncaught frozen object - if (!isExtensible(it)) { return true; } + if (!objectIsExtensible(it)) { return true; } // not necessary to add metadata if (!create) { return false; } // add missing metadata @@ -3829,7 +4351,7 @@ var doric = (function (exports) { // add metadata on freeze-family methods calling var onFreeze = function (it) { - if (freezing && REQUIRED && isExtensible(it) && !hasOwnProperty_1(it, METADATA)) { setMetadata(it); } + if (freezing && REQUIRED && objectIsExtensible(it) && !hasOwnProperty_1(it, METADATA)) { setMetadata(it); } return it; }; @@ -3869,21 +4391,6 @@ var doric = (function (exports) { hiddenKeys$1[METADATA] = true; }); - // makes subclassing work correct for wrapped built-ins - var inheritIfRequired = function ($this, dummy, Wrapper) { - var NewTarget, NewTargetPrototype; - if ( - // it can work only with native `setPrototypeOf` - objectSetPrototypeOf && - // we haven't completely correct pre-ES6 way for getting `new.target`, so use this - isCallable(NewTarget = dummy.constructor) && - NewTarget !== Wrapper && - isObject(NewTargetPrototype = NewTarget.prototype) && - NewTargetPrototype !== Wrapper.prototype - ) { objectSetPrototypeOf($this, NewTargetPrototype); } - return $this; - }; - var collection = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; @@ -3895,7 +4402,7 @@ var doric = (function (exports) { var fixMethod = function (KEY) { var uncurriedNativeMethod = functionUncurryThis(NativePrototype[KEY]); - redefine(NativePrototype, KEY, + defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) { uncurriedNativeMethod(this, value === 0 ? 0 : value); return this; @@ -3965,7 +4472,7 @@ var doric = (function (exports) { } exported[CONSTRUCTOR_NAME] = Constructor; - _export({ global: true, forced: Constructor != NativeConstructor }, exported); + _export({ global: true, constructor: true, forced: Constructor != NativeConstructor }, exported); setToStringTag(Constructor, CONSTRUCTOR_NAME); @@ -3974,7 +4481,7 @@ var doric = (function (exports) { return Constructor; }; - var defineProperty$8 = objectDefineProperty.f; + var defineProperty$5 = objectDefineProperty.f; @@ -3986,14 +4493,14 @@ var doric = (function (exports) { var fastKey = internalMetadata.fastKey; - var setInternalState$e = internalState.set; + var setInternalState$f = internalState.set; var internalStateGetterFor$1 = internalState.getterFor; var collectionStrong = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); - setInternalState$e(that, { + setInternalState$f(that, { type: CONSTRUCTOR_NAME, index: objectCreate(null), first: undefined, @@ -4046,7 +4553,7 @@ var doric = (function (exports) { } }; - redefineAll(Prototype, { + defineBuiltIns(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear @@ -4106,7 +4613,7 @@ var doric = (function (exports) { } }); - redefineAll(Prototype, IS_MAP ? { + defineBuiltIns(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { @@ -4125,7 +4632,7 @@ var doric = (function (exports) { return define(this, value = value === 0 ? 0 : value, value); } }); - if (descriptors) { defineProperty$8(Prototype, 'size', { + if (descriptors) { defineProperty$5(Prototype, 'size', { get: function () { return getInternalState(this).size; } @@ -4146,7 +4653,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { - setInternalState$e(this, { + setInternalState$f(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), @@ -4188,18 +4695,19 @@ var doric = (function (exports) { // `Math.log1p` method implementation // https://tc39.es/ecma262/#sec-math.log1p - // eslint-disable-next-line es/no-math-log1p -- safe + // eslint-disable-next-line es-x/no-math-log1p -- safe var mathLog1p = Math.log1p || function log1p(x) { - return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log$8(1 + x); + var n = +x; + return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log$8(1 + n); }; - // eslint-disable-next-line es/no-math-acosh -- required for testing + // eslint-disable-next-line es-x/no-math-acosh -- required for testing var $acosh = Math.acosh; var log$7 = Math.log; var sqrt$2 = Math.sqrt; var LN2$1 = Math.LN2; - var FORCED$k = !$acosh + var FORCED$f = !$acosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 || Math.floor($acosh(Number.MAX_VALUE)) != 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN @@ -4207,21 +4715,23 @@ var doric = (function (exports) { // `Math.acosh` method // https://tc39.es/ecma262/#sec-math.acosh - _export({ target: 'Math', stat: true, forced: FORCED$k }, { + _export({ target: 'Math', stat: true, forced: FORCED$f }, { acosh: function acosh(x) { - return (x = +x) < 1 ? NaN : x > 94906265.62425156 - ? log$7(x) + LN2$1 - : mathLog1p(x - 1 + sqrt$2(x - 1) * sqrt$2(x + 1)); + var n = +x; + return n < 1 ? NaN : n > 94906265.62425156 + ? log$7(n) + LN2$1 + : mathLog1p(n - 1 + sqrt$2(n - 1) * sqrt$2(n + 1)); } }); - // eslint-disable-next-line es/no-math-asinh -- required for testing + // eslint-disable-next-line es-x/no-math-asinh -- required for testing var $asinh = Math.asinh; var log$6 = Math.log; var sqrt$1 = Math.sqrt; function asinh(x) { - return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log$6(x + sqrt$1(x * x + 1)); + var n = +x; + return !isFinite(n) || n == 0 ? n : n < 0 ? -asinh(-n) : log$6(n + sqrt$1(n * n + 1)); } // `Math.asinh` method @@ -4231,7 +4741,7 @@ var doric = (function (exports) { asinh: asinh }); - // eslint-disable-next-line es/no-math-atanh -- required for testing + // eslint-disable-next-line es-x/no-math-atanh -- required for testing var $atanh = Math.atanh; var log$5 = Math.log; @@ -4240,26 +4750,29 @@ var doric = (function (exports) { // Tor Browser bug: Math.atanh(-0) -> 0 _export({ target: 'Math', stat: true, forced: !($atanh && 1 / $atanh(-0) < 0) }, { atanh: function atanh(x) { - return (x = +x) == 0 ? x : log$5((1 + x) / (1 - x)) / 2; + var n = +x; + return n == 0 ? n : log$5((1 + n) / (1 - n)) / 2; } }); // `Math.sign` method implementation // https://tc39.es/ecma262/#sec-math.sign - // eslint-disable-next-line es/no-math-sign -- safe + // eslint-disable-next-line es-x/no-math-sign -- safe var mathSign = Math.sign || function sign(x) { + var n = +x; // eslint-disable-next-line no-self-compare -- NaN check - return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; + return n == 0 || n != n ? n : n < 0 ? -1 : 1; }; - var abs$5 = Math.abs; - var pow$3 = Math.pow; + var abs$6 = Math.abs; + var pow$4 = Math.pow; // `Math.cbrt` method // https://tc39.es/ecma262/#sec-math.cbrt _export({ target: 'Math', stat: true }, { cbrt: function cbrt(x) { - return mathSign(x = +x) * pow$3(abs$5(x), 1 / 3); + var n = +x; + return mathSign(n) * pow$4(abs$6(n), 1 / 3); } }); @@ -4271,11 +4784,12 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math.clz32 _export({ target: 'Math', stat: true }, { clz32: function clz32(x) { - return (x >>>= 0) ? 31 - floor$7(log$4(x + 0.5) * LOG2E) : 32; + var n = x >>> 0; + return n ? 31 - floor$7(log$4(n + 0.5) * LOG2E) : 32; } }); - // eslint-disable-next-line es/no-math-expm1 -- safe + // eslint-disable-next-line es-x/no-math-expm1 -- safe var $expm1 = Math.expm1; var exp$2 = Math.exp; @@ -4287,34 +4801,35 @@ var doric = (function (exports) { // Tor Browser bug || $expm1(-2e-17) != -2e-17 ) ? function expm1(x) { - return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp$2(x) - 1; + var n = +x; + return n == 0 ? n : n > -1e-6 && n < 1e-6 ? n + n * n / 2 : exp$2(n) - 1; } : $expm1; - // eslint-disable-next-line es/no-math-cosh -- required for testing + // eslint-disable-next-line es-x/no-math-cosh -- required for testing var $cosh = Math.cosh; - var abs$4 = Math.abs; + var abs$5 = Math.abs; var E$1 = Math.E; // `Math.cosh` method // https://tc39.es/ecma262/#sec-math.cosh _export({ target: 'Math', stat: true, forced: !$cosh || $cosh(710) === Infinity }, { cosh: function cosh(x) { - var t = mathExpm1(abs$4(x) - 1) + 1; + var t = mathExpm1(abs$5(x) - 1) + 1; return (t + 1 / (t * E$1 * E$1)) * (E$1 / 2); } }); // `Math.expm1` method // https://tc39.es/ecma262/#sec-math.expm1 - // eslint-disable-next-line es/no-math-expm1 -- required for testing + // eslint-disable-next-line es-x/no-math-expm1 -- required for testing _export({ target: 'Math', stat: true, forced: mathExpm1 != Math.expm1 }, { expm1: mathExpm1 }); - var abs$3 = Math.abs; - var pow$2 = Math.pow; - var EPSILON = pow$2(2, -52); - var EPSILON32 = pow$2(2, -23); - var MAX32 = pow$2(2, 127) * (2 - EPSILON32); - var MIN32 = pow$2(2, -126); + var abs$4 = Math.abs; + var pow$3 = Math.pow; + var EPSILON = pow$3(2, -52); + var EPSILON32 = pow$3(2, -23); + var MAX32 = pow$3(2, 127) * (2 - EPSILON32); + var MIN32 = pow$3(2, -126); var roundTiesToEven = function (n) { return n + 1 / EPSILON - 1 / EPSILON; @@ -4322,10 +4837,11 @@ var doric = (function (exports) { // `Math.fround` method implementation // https://tc39.es/ecma262/#sec-math.fround - // eslint-disable-next-line es/no-math-fround -- safe + // eslint-disable-next-line es-x/no-math-fround -- safe var mathFround = Math.fround || function fround(x) { - var $abs = abs$3(x); - var $sign = mathSign(x); + var n = +x; + var $abs = abs$4(n); + var $sign = mathSign(n); var a, result; if ($abs < MIN32) { return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; } a = (1 + EPSILON32 / EPSILON) * $abs; @@ -4339,9 +4855,9 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math.fround _export({ target: 'Math', stat: true }, { fround: mathFround }); - // eslint-disable-next-line es/no-math-hypot -- required for testing + // eslint-disable-next-line es-x/no-math-hypot -- required for testing var $hypot = Math.hypot; - var abs$2 = Math.abs; + var abs$3 = Math.abs; var sqrt = Math.sqrt; // Chrome 77 bug @@ -4350,7 +4866,7 @@ var doric = (function (exports) { // `Math.hypot` method // https://tc39.es/ecma262/#sec-math.hypot - _export({ target: 'Math', stat: true, forced: BUGGY }, { + _export({ target: 'Math', stat: true, arity: 2, forced: BUGGY }, { // eslint-disable-next-line no-unused-vars -- required for `.length` hypot: function hypot(value1, value2) { var arguments$1 = arguments; @@ -4361,7 +4877,7 @@ var doric = (function (exports) { var larg = 0; var arg, div; while (i < aLen) { - arg = abs$2(arguments$1[i++]); + arg = abs$3(arguments$1[i++]); if (larg < arg) { div = larg / arg; sum = sum * div * div + 1; @@ -4375,17 +4891,17 @@ var doric = (function (exports) { } }); - // eslint-disable-next-line es/no-math-imul -- required for testing + // eslint-disable-next-line es-x/no-math-imul -- required for testing var $imul = Math.imul; - var FORCED$j = fails(function () { + var FORCED$e = fails(function () { return $imul(0xFFFFFFFF, 5) != -5 || $imul.length != 2; }); // `Math.imul` method // https://tc39.es/ecma262/#sec-math.imul // some WebKit versions fails with big numbers, some has wrong arity - _export({ target: 'Math', stat: true, forced: FORCED$j }, { + _export({ target: 'Math', stat: true, forced: FORCED$e }, { imul: function imul(x, y) { var UINT16 = 0xFFFF; var xn = +x; @@ -4399,12 +4915,15 @@ var doric = (function (exports) { var log$3 = Math.log; var LOG10E = Math.LOG10E; + // eslint-disable-next-line es-x/no-math-log10 -- safe + var mathLog10 = Math.log10 || function log10(x) { + return log$3(x) * LOG10E; + }; + // `Math.log10` method // https://tc39.es/ecma262/#sec-math.log10 _export({ target: 'Math', stat: true }, { - log10: function log10(x) { - return log$3(x) * LOG10E; - } + log10: mathLog10 }); // `Math.log1p` method @@ -4428,21 +4947,22 @@ var doric = (function (exports) { sign: mathSign }); - var abs$1 = Math.abs; + var abs$2 = Math.abs; var exp$1 = Math.exp; var E = Math.E; - var FORCED$i = fails(function () { - // eslint-disable-next-line es/no-math-sinh -- required for testing + var FORCED$d = fails(function () { + // eslint-disable-next-line es-x/no-math-sinh -- required for testing return Math.sinh(-2e-17) != -2e-17; }); // `Math.sinh` method // https://tc39.es/ecma262/#sec-math.sinh // V8 near Chromium 38 has a problem with very small numbers - _export({ target: 'Math', stat: true, forced: FORCED$i }, { + _export({ target: 'Math', stat: true, forced: FORCED$d }, { sinh: function sinh(x) { - return abs$1(x = +x) < 1 ? (mathExpm1(x) - mathExpm1(-x)) / 2 : (exp$1(x - 1) - exp$1(-x - 1)) * (E / 2); + var n = +x; + return abs$2(n) < 1 ? (mathExpm1(n) - mathExpm1(-n)) / 2 : (exp$1(n - 1) - exp$1(-n - 1)) * (E / 2); } }); @@ -4452,9 +4972,10 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math.tanh _export({ target: 'Math', stat: true }, { tanh: function tanh(x) { - var a = mathExpm1(x = +x); - var b = mathExpm1(-x); - return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); + var n = +x; + var a = mathExpm1(n); + var b = mathExpm1(-n); + return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(n) + exp(-n)); } }); @@ -4462,15 +4983,10 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math-@@tostringtag setToStringTag(Math, 'Math', true); - var ceil = Math.ceil; - var floor$6 = Math.floor; - // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc _export({ target: 'Math', stat: true }, { - trunc: function trunc(it) { - return (it > 0 ? floor$6 : ceil)(it); - } + trunc: mathTrunc }); // `thisNumberValue` abstract operation @@ -4478,20 +4994,20 @@ var doric = (function (exports) { var thisNumberValue = functionUncurryThis(1.0.valueOf); // a string of all valid unicode whitespaces - var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + + var whitespaces$1 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - var replace$7 = functionUncurryThis(''.replace); - var whitespace = '[' + whitespaces + ']'; + var replace$8 = functionUncurryThis(''.replace); + var whitespace = '[' + whitespaces$1 + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation - var createMethod$4 = function (TYPE) { + var createMethod$3 = function (TYPE) { return function ($this) { var string = toString_1(requireObjectCoercible($this)); - if (TYPE & 1) { string = replace$7(string, ltrim, ''); } - if (TYPE & 2) { string = replace$7(string, rtrim, ''); } + if (TYPE & 1) { string = replace$8(string, ltrim, ''); } + if (TYPE & 2) { string = replace$8(string, rtrim, ''); } return string; }; }; @@ -4499,27 +5015,27 @@ var doric = (function (exports) { var stringTrim = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart - start: createMethod$4(1), + start: createMethod$3(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend - end: createMethod$4(2), + end: createMethod$3(2), // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim - trim: createMethod$4(3) + trim: createMethod$3(3) }; var getOwnPropertyNames$2 = objectGetOwnPropertyNames.f; - var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; - var defineProperty$7 = objectDefineProperty.f; + var getOwnPropertyDescriptor$8 = objectGetOwnPropertyDescriptor.f; + var defineProperty$4 = objectDefineProperty.f; var trim$2 = stringTrim.trim; var NUMBER = 'Number'; var NativeNumber = global_1[NUMBER]; var NumberPrototype = NativeNumber.prototype; - var TypeError$m = global_1.TypeError; + var TypeError$5 = global_1.TypeError; var arraySlice = functionUncurryThis(''.slice); - var charCodeAt$2 = functionUncurryThis(''.charCodeAt); + var charCodeAt$3 = functionUncurryThis(''.charCodeAt); // `ToNumeric` abstract operation // https://tc39.es/ecma262/#sec-tonumeric @@ -4533,15 +5049,15 @@ var doric = (function (exports) { var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; - if (isSymbol(it)) { throw TypeError$m('Cannot convert a Symbol value to a number'); } + if (isSymbol(it)) { throw TypeError$5('Cannot convert a Symbol value to a number'); } if (typeof it == 'string' && it.length > 2) { it = trim$2(it); - first = charCodeAt$2(it, 0); + first = charCodeAt$3(it, 0); if (first === 43 || first === 45) { - third = charCodeAt$2(it, 2); + third = charCodeAt$3(it, 2); if (third === 88 || third === 120) { return NaN; } // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { - switch (charCodeAt$2(it, 1)) { + switch (charCodeAt$3(it, 1)) { case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i default: return +it; @@ -4549,7 +5065,7 @@ var doric = (function (exports) { digits = arraySlice(it, 2); length = digits.length; for (index = 0; index < length; index++) { - code = charCodeAt$2(digits, index); + code = charCodeAt$3(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) { return NaN; } @@ -4575,19 +5091,19 @@ var doric = (function (exports) { 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range' - ).split(','), j = 0, key; keys$1.length > j; j++) { - if (hasOwnProperty_1(NativeNumber, key = keys$1[j]) && !hasOwnProperty_1(NumberWrapper, key)) { - defineProperty$7(NumberWrapper, key, getOwnPropertyDescriptor$6(NativeNumber, key)); + ).split(','), j = 0, key$2; keys$1.length > j; j++) { + if (hasOwnProperty_1(NativeNumber, key$2 = keys$1[j]) && !hasOwnProperty_1(NumberWrapper, key$2)) { + defineProperty$4(NumberWrapper, key$2, getOwnPropertyDescriptor$8(NativeNumber, key$2)); } } NumberWrapper.prototype = NumberPrototype; NumberPrototype.constructor = NumberWrapper; - redefine(global_1, NUMBER, NumberWrapper); + defineBuiltIn(global_1, NUMBER, NumberWrapper, { constructor: true }); } // `Number.EPSILON` constant // https://tc39.es/ecma262/#sec-number.epsilon - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, { EPSILON: Math.pow(2, -52) }); @@ -4595,7 +5111,7 @@ var doric = (function (exports) { // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite - // eslint-disable-next-line es/no-number-isfinite -- safe + // eslint-disable-next-line es-x/no-number-isfinite -- safe var numberIsFinite = Number.isFinite || function isFinite(it) { return typeof it == 'number' && globalIsFinite(it); }; @@ -4604,13 +5120,13 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-number.isfinite _export({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); - var floor$5 = Math.floor; + var floor$6 = Math.floor; // `IsIntegralNumber` abstract operation // https://tc39.es/ecma262/#sec-isintegralnumber - // eslint-disable-next-line es/no-number-isinteger -- safe + // eslint-disable-next-line es-x/no-number-isinteger -- safe var isIntegralNumber = Number.isInteger || function isInteger(it) { - return !isObject(it) && isFinite(it) && floor$5(it) === it; + return !isObject(it) && isFinite(it) && floor$6(it) === it; }; // `Number.isInteger` method @@ -4628,50 +5144,50 @@ var doric = (function (exports) { } }); - var abs = Math.abs; + var abs$1 = Math.abs; // `Number.isSafeInteger` method // https://tc39.es/ecma262/#sec-number.issafeinteger _export({ target: 'Number', stat: true }, { isSafeInteger: function isSafeInteger(number) { - return isIntegralNumber(number) && abs(number) <= 0x1FFFFFFFFFFFFF; + return isIntegralNumber(number) && abs$1(number) <= 0x1FFFFFFFFFFFFF; } }); // `Number.MAX_SAFE_INTEGER` constant // https://tc39.es/ecma262/#sec-number.max_safe_integer - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, { MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF }); // `Number.MIN_SAFE_INTEGER` constant // https://tc39.es/ecma262/#sec-number.min_safe_integer - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); var trim$1 = stringTrim.trim; - var charAt$d = functionUncurryThis(''.charAt); + var charAt$f = functionUncurryThis(''.charAt); var n$ParseFloat = global_1.parseFloat; var Symbol$2 = global_1.Symbol; var ITERATOR$5 = Symbol$2 && Symbol$2.iterator; - var FORCED$h = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity + var FORCED$c = 1 / n$ParseFloat(whitespaces$1 + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols || (ITERATOR$5 && !fails(function () { n$ParseFloat(Object(ITERATOR$5)); })); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string - var numberParseFloat = FORCED$h ? function parseFloat(string) { + var numberParseFloat = FORCED$c ? function parseFloat(string) { var trimmedString = trim$1(toString_1(string)); var result = n$ParseFloat(trimmedString); - return result === 0 && charAt$d(trimmedString, 0) == '-' ? -0 : result; + return result === 0 && charAt$f(trimmedString, 0) == '-' ? -0 : result; } : n$ParseFloat; // `Number.parseFloat` method // https://tc39.es/ecma262/#sec-number.parseFloat - // eslint-disable-next-line es/no-number-parsefloat -- required for testing + // eslint-disable-next-line es-x/no-number-parsefloat -- required for testing _export({ target: 'Number', stat: true, forced: Number.parseFloat != numberParseFloat }, { parseFloat: numberParseFloat }); @@ -4683,27 +5199,118 @@ var doric = (function (exports) { var Symbol$1 = global_1.Symbol; var ITERATOR$4 = Symbol$1 && Symbol$1.iterator; var hex = /^[+-]?0x/i; - var exec$6 = functionUncurryThis(hex.exec); - var FORCED$g = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22 + var exec$8 = functionUncurryThis(hex.exec); + var FORCED$b = $parseInt(whitespaces$1 + '08') !== 8 || $parseInt(whitespaces$1 + '0x16') !== 22 // MS Edge 18- broken with boxed symbols || (ITERATOR$4 && !fails(function () { $parseInt(Object(ITERATOR$4)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix - var numberParseInt = FORCED$g ? function parseInt(string, radix) { + var numberParseInt = FORCED$b ? function parseInt(string, radix) { var S = trim(toString_1(string)); - return $parseInt(S, (radix >>> 0) || (exec$6(hex, S) ? 16 : 10)); + return $parseInt(S, (radix >>> 0) || (exec$8(hex, S) ? 16 : 10)); } : $parseInt; // `Number.parseInt` method // https://tc39.es/ecma262/#sec-number.parseint - // eslint-disable-next-line es/no-number-parseint -- required for testing + // eslint-disable-next-line es-x/no-number-parseint -- required for testing _export({ target: 'Number', stat: true, forced: Number.parseInt != numberParseInt }, { parseInt: numberParseInt }); - var RangeError$7 = global_1.RangeError; - var String$2 = global_1.String; + var $RangeError$9 = RangeError; + var $String$1 = String; + var $isFinite = isFinite; + var abs = Math.abs; + var floor$5 = Math.floor; + var pow$2 = Math.pow; + var round = Math.round; + var un$ToExponential = functionUncurryThis(1.0.toExponential); + var repeat$1 = functionUncurryThis(stringRepeat); + var stringSlice$e = functionUncurryThis(''.slice); + + // Edge 17- + var ROUNDS_PROPERLY = un$ToExponential(-6.9e-11, 4) === '-6.9000e-11' + // IE11- && Edge 14- + && un$ToExponential(1.255, 2) === '1.25e+0' + // FF86-, V8 ~ Chrome 49-50 + && un$ToExponential(12345, 3) === '1.235e+4' + // FF86-, V8 ~ Chrome 49-50 + && un$ToExponential(25, 0) === '3e+1'; + + // IE8- + var THROWS_ON_INFINITY_FRACTION = fails(function () { + un$ToExponential(1, Infinity); + }) && fails(function () { + un$ToExponential(1, -Infinity); + }); + + // Safari <11 && FF <50 + var PROPER_NON_FINITE_THIS_CHECK = !fails(function () { + un$ToExponential(Infinity, Infinity); + }) && !fails(function () { + un$ToExponential(NaN, Infinity); + }); + + var FORCED$a = !ROUNDS_PROPERLY || !THROWS_ON_INFINITY_FRACTION || !PROPER_NON_FINITE_THIS_CHECK; + + // `Number.prototype.toExponential` method + // https://tc39.es/ecma262/#sec-number.prototype.toexponential + _export({ target: 'Number', proto: true, forced: FORCED$a }, { + toExponential: function toExponential(fractionDigits) { + var x = thisNumberValue(this); + if (fractionDigits === undefined) { return un$ToExponential(x); } + var f = toIntegerOrInfinity(fractionDigits); + if (!$isFinite(x)) { return String(x); } + // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation + if (f < 0 || f > 20) { throw $RangeError$9('Incorrect fraction digits'); } + if (ROUNDS_PROPERLY) { return un$ToExponential(x, f); } + var s = ''; + var m = ''; + var e = 0; + var c = ''; + var d = ''; + if (x < 0) { + s = '-'; + x = -x; + } + if (x === 0) { + e = 0; + m = repeat$1('0', f + 1); + } else { + // this block is based on https://gist.github.com/SheetJSDev/1100ad56b9f856c95299ed0e068eea08 + // TODO: improve accuracy with big fraction digits + var l = mathLog10(x); + e = floor$5(l); + var n = 0; + var w = pow$2(10, e - f); + n = round(x / w); + if (2 * x >= (2 * n + 1) * w) { + n += 1; + } + if (n >= pow$2(10, f + 1)) { + n /= 10; + e += 1; + } + m = $String$1(n); + } + if (f !== 0) { + m = stringSlice$e(m, 0, 1) + '.' + stringSlice$e(m, 1); + } + if (e === 0) { + c = '+'; + d = '0'; + } else { + c = e > 0 ? '+' : '-'; + d = $String$1(abs(e)); + } + m += 'e' + c + d; + return s + m; + } + }); + + var $RangeError$8 = RangeError; + var $String = String; var floor$4 = Math.floor; var repeat = functionUncurryThis(stringRepeat); var stringSlice$d = functionUncurryThis(''.slice); @@ -4751,13 +5358,13 @@ var doric = (function (exports) { var s = ''; while (--index >= 0) { if (s !== '' || index === 0 || data[index] !== 0) { - var t = String$2(data[index]); + var t = $String(data[index]); s = s === '' ? t : s + repeat('0', 7 - t.length) + t; } } return s; }; - var FORCED$f = fails(function () { + var FORCED$9 = fails(function () { return un$ToFixed(0.00008, 3) !== '0.000' || un$ToFixed(0.9, 0) !== '1' || un$ToFixed(1.255, 2) !== '1.25' || @@ -4769,7 +5376,7 @@ var doric = (function (exports) { // `Number.prototype.toFixed` method // https://tc39.es/ecma262/#sec-number.prototype.tofixed - _export({ target: 'Number', proto: true, forced: FORCED$f }, { + _export({ target: 'Number', proto: true, forced: FORCED$9 }, { toFixed: function toFixed(fractionDigits) { var number = thisNumberValue(this); var fractDigits = toIntegerOrInfinity(fractionDigits); @@ -4778,10 +5385,11 @@ var doric = (function (exports) { var result = '0'; var e, z, j, k; - if (fractDigits < 0 || fractDigits > 20) { throw RangeError$7('Incorrect fraction digits'); } + // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation + if (fractDigits < 0 || fractDigits > 20) { throw $RangeError$8('Incorrect fraction digits'); } // eslint-disable-next-line no-self-compare -- NaN check if (number != number) { return 'NaN'; } - if (number <= -1e21 || number >= 1e21) { return String$2(number); } + if (number <= -1e21 || number >= 1e21) { return $String(number); } if (number < 0) { sign = '-'; number = -number; @@ -4827,7 +5435,7 @@ var doric = (function (exports) { var un$ToPrecision = functionUncurryThis(1.0.toPrecision); - var FORCED$e = fails(function () { + var FORCED$8 = fails(function () { // IE7- return un$ToPrecision(1, undefined) !== '1'; }) || !fails(function () { @@ -4837,7 +5445,7 @@ var doric = (function (exports) { // `Number.prototype.toPrecision` method // https://tc39.es/ecma262/#sec-number.prototype.toprecision - _export({ target: 'Number', proto: true, forced: FORCED$e }, { + _export({ target: 'Number', proto: true, forced: FORCED$8 }, { toPrecision: function toPrecision(precision) { return precision === undefined ? un$ToPrecision(thisNumberValue(this)) @@ -4845,20 +5453,20 @@ var doric = (function (exports) { } }); - // eslint-disable-next-line es/no-object-assign -- safe + // eslint-disable-next-line es-x/no-object-assign -- safe var $assign = Object.assign; - // eslint-disable-next-line es/no-object-defineproperty -- required for testing - var defineProperty$6 = Object.defineProperty; + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing + var defineProperty$3 = Object.defineProperty; var concat$2 = functionUncurryThis([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign var objectAssign = !$assign || fails(function () { // should have correct order of operations (Edge bug) - if (descriptors && $assign({ b: 1 }, $assign(defineProperty$6({}, 'a', { + if (descriptors && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', { enumerable: true, get: function () { - defineProperty$6(this, 'b', { + defineProperty$3(this, 'b', { value: 3, enumerable: false }); @@ -4867,12 +5475,12 @@ var doric = (function (exports) { // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; - // eslint-disable-next-line es/no-symbol -- safe + // eslint-disable-next-line es-x/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet; + return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { var arguments$1 = arguments; // eslint-disable-line no-unused-vars -- required for `.length` @@ -4883,7 +5491,7 @@ var doric = (function (exports) { var propertyIsEnumerable = objectPropertyIsEnumerable.f; while (argumentsLength > index) { var S = indexedObject(arguments$1[index++]); - var keys = getOwnPropertySymbols ? concat$2(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S); + var keys = getOwnPropertySymbols ? concat$2(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S); var length = keys.length; var j = 0; var key; @@ -4896,11 +5504,16 @@ var doric = (function (exports) { // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign - // eslint-disable-next-line es/no-object-assign -- required for testing - _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { + // eslint-disable-next-line es-x/no-object-assign -- required for testing + _export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, { assign: objectAssign }); + // TODO: Remove from `core-js@4` + + + + // `Object.create` method // https://tc39.es/ecma262/#sec-object.create _export({ target: 'Object', stat: true, sham: !descriptors }, { @@ -4914,7 +5527,7 @@ var doric = (function (exports) { if (engineWebkitVersion && engineWebkitVersion < 535) { return; } var key = Math.random(); // In FF throws only define methods - // eslint-disable-next-line no-undef, no-useless-call -- required for testing + // eslint-disable-next-line no-undef, no-useless-call, es-x/no-legacy-object-prototype-accessor-methods -- required for testing __defineSetter__.call(null, key, function () { /* empty */ }); delete global_1[key]; }); @@ -4929,16 +5542,22 @@ var doric = (function (exports) { }); } + var defineProperties$1 = objectDefineProperties.f; + // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties - _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperties: objectDefineProperties + // eslint-disable-next-line es-x/no-object-defineproperties -- safe + _export({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties$1, sham: !descriptors }, { + defineProperties: defineProperties$1 }); + var defineProperty$2 = objectDefineProperty.f; + // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperty: objectDefineProperty.f + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + _export({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty$2, sham: !descriptors }, { + defineProperty: defineProperty$2 }); // `Object.prototype.__defineSetter__` method @@ -4954,13 +5573,13 @@ var doric = (function (exports) { var $propertyIsEnumerable = objectPropertyIsEnumerable.f; var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable); - var push$e = functionUncurryThis([].push); + var push$h = functionUncurryThis([].push); // `Object.{ entries, values }` methods implementation - var createMethod$3 = function (TO_ENTRIES) { + var createMethod$2 = function (TO_ENTRIES) { return function (it) { var O = toIndexedObject(it); - var keys = objectKeys(O); + var keys = objectKeys$1(O); var length = keys.length; var i = 0; var result = []; @@ -4968,7 +5587,7 @@ var doric = (function (exports) { while (length > i) { key = keys[i++]; if (!descriptors || propertyIsEnumerable(O, key)) { - push$e(result, TO_ENTRIES ? [key, O[key]] : O[key]); + push$h(result, TO_ENTRIES ? [key, O[key]] : O[key]); } } return result; @@ -4978,10 +5597,10 @@ var doric = (function (exports) { var objectToArray = { // `Object.entries` method // https://tc39.es/ecma262/#sec-object.entries - entries: createMethod$3(true), + entries: createMethod$2(true), // `Object.values` method // https://tc39.es/ecma262/#sec-object.values - values: createMethod$3(false) + values: createMethod$2(false) }; var $entries = objectToArray.entries; @@ -4996,13 +5615,13 @@ var doric = (function (exports) { var onFreeze$2 = internalMetadata.onFreeze; - // eslint-disable-next-line es/no-object-freeze -- safe + // eslint-disable-next-line es-x/no-object-freeze -- safe var $freeze = Object.freeze; - var FAILS_ON_PRIMITIVES$9 = fails(function () { $freeze(1); }); + var FAILS_ON_PRIMITIVES$8 = fails(function () { $freeze(1); }); // `Object.freeze` method // https://tc39.es/ecma262/#sec-object.freeze - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$9, sham: !freezing }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$8, sham: !freezing }, { freeze: function freeze(it) { return $freeze && isObject(it) ? $freeze(onFreeze$2(it)) : it; } @@ -5023,12 +5642,12 @@ var doric = (function (exports) { var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; - var FAILS_ON_PRIMITIVES$8 = fails(function () { nativeGetOwnPropertyDescriptor(1); }); - var FORCED$d = !descriptors || FAILS_ON_PRIMITIVES$8; + var FAILS_ON_PRIMITIVES$7 = fails(function () { nativeGetOwnPropertyDescriptor(1); }); + var FORCED$7 = !descriptors || FAILS_ON_PRIMITIVES$7; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - _export({ target: 'Object', stat: true, forced: FORCED$d, sham: !descriptors }, { + _export({ target: 'Object', stat: true, forced: FORCED$7, sham: !descriptors }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); } @@ -5054,20 +5673,20 @@ var doric = (function (exports) { var getOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f; - // eslint-disable-next-line es/no-object-getownpropertynames -- required for testing - var FAILS_ON_PRIMITIVES$7 = fails(function () { return !Object.getOwnPropertyNames(1); }); + // eslint-disable-next-line es-x/no-object-getownpropertynames -- required for testing + var FAILS_ON_PRIMITIVES$6 = fails(function () { return !Object.getOwnPropertyNames(1); }); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$7 }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { getOwnPropertyNames: getOwnPropertyNames$1 }); - var FAILS_ON_PRIMITIVES$6 = fails(function () { objectGetPrototypeOf(1); }); + var FAILS_ON_PRIMITIVES$5 = fails(function () { objectGetPrototypeOf(1); }); // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6, sham: !correctPrototypeGetter }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5, sham: !correctPrototypeGetter }, { getPrototypeOf: function getPrototypeOf(it) { return objectGetPrototypeOf(toObject(it)); } @@ -5081,7 +5700,7 @@ var doric = (function (exports) { // `SameValue` abstract operation // https://tc39.es/ecma262/#sec-samevalue - // eslint-disable-next-line es/no-object-is -- safe + // eslint-disable-next-line es-x/no-object-is -- safe var sameValue = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; @@ -5093,53 +5712,52 @@ var doric = (function (exports) { is: sameValue }); - // eslint-disable-next-line es/no-object-isextensible -- safe - var $isExtensible = Object.isExtensible; - var FAILS_ON_PRIMITIVES$5 = fails(function () { $isExtensible(1); }); - // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5 }, { - isExtensible: function isExtensible(it) { - return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; - } + // eslint-disable-next-line es-x/no-object-isextensible -- safe + _export({ target: 'Object', stat: true, forced: Object.isExtensible !== objectIsExtensible }, { + isExtensible: objectIsExtensible }); - // eslint-disable-next-line es/no-object-isfrozen -- safe + // eslint-disable-next-line es-x/no-object-isfrozen -- safe var $isFrozen = Object.isFrozen; var FAILS_ON_PRIMITIVES$4 = fails(function () { $isFrozen(1); }); // `Object.isFrozen` method // https://tc39.es/ecma262/#sec-object.isfrozen - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 || arrayBufferNonExtensible }, { isFrozen: function isFrozen(it) { - return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + if (!isObject(it)) { return true; } + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') { return true; } + return $isFrozen ? $isFrozen(it) : false; } }); - // eslint-disable-next-line es/no-object-issealed -- safe + // eslint-disable-next-line es-x/no-object-issealed -- safe var $isSealed = Object.isSealed; var FAILS_ON_PRIMITIVES$3 = fails(function () { $isSealed(1); }); // `Object.isSealed` method // https://tc39.es/ecma262/#sec-object.issealed - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 || arrayBufferNonExtensible }, { isSealed: function isSealed(it) { - return isObject(it) ? $isSealed ? $isSealed(it) : false : true; + if (!isObject(it)) { return true; } + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') { return true; } + return $isSealed ? $isSealed(it) : false; } }); - var FAILS_ON_PRIMITIVES$2 = fails(function () { objectKeys(1); }); + var FAILS_ON_PRIMITIVES$2 = fails(function () { objectKeys$1(1); }); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { keys: function keys(it) { - return objectKeys(toObject(it)); + return objectKeys$1(toObject(it)); } }); - var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$7 = objectGetOwnPropertyDescriptor.f; // `Object.prototype.__lookupGetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ @@ -5150,13 +5768,13 @@ var doric = (function (exports) { var key = toPropertyKey(P); var desc; do { - if (desc = getOwnPropertyDescriptor$5(O, key)) { return desc.get; } + if (desc = getOwnPropertyDescriptor$7(O, key)) { return desc.get; } } while (O = objectGetPrototypeOf(O)); } }); } - var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; // `Object.prototype.__lookupSetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ @@ -5167,7 +5785,7 @@ var doric = (function (exports) { var key = toPropertyKey(P); var desc; do { - if (desc = getOwnPropertyDescriptor$4(O, key)) { return desc.set; } + if (desc = getOwnPropertyDescriptor$6(O, key)) { return desc.set; } } while (O = objectGetPrototypeOf(O)); } }); @@ -5177,7 +5795,7 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-object-preventextensions -- safe + // eslint-disable-next-line es-x/no-object-preventextensions -- safe var $preventExtensions = Object.preventExtensions; var FAILS_ON_PRIMITIVES$1 = fails(function () { $preventExtensions(1); }); @@ -5193,7 +5811,7 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-object-seal -- safe + // eslint-disable-next-line es-x/no-object-seal -- safe var $seal = Object.seal; var FAILS_ON_PRIMITIVES = fails(function () { $seal(1); }); @@ -5220,7 +5838,7 @@ var doric = (function (exports) { // `Object.prototype.toString` method // https://tc39.es/ecma262/#sec-object.prototype.tostring if (!toStringTagSupport) { - redefine(Object.prototype, 'toString', objectToString, { unsafe: true }); + defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true }); } var $values = objectToArray.values; @@ -5245,7 +5863,12 @@ var doric = (function (exports) { parseInt: numberParseInt }); - var nativePromiseConstructor = global_1.Promise; + var $TypeError$k = TypeError; + + var validateArgumentsLength = function (passed, required) { + if (passed < required) { throw $TypeError$k('Not enough arguments'); } + return passed; + }; var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent); @@ -5257,7 +5880,7 @@ var doric = (function (exports) { var MessageChannel = global_1.MessageChannel; var String$1 = global_1.String; var counter = 0; - var queue = {}; + var queue$1 = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var location, defer, channel, port; @@ -5267,9 +5890,9 @@ var doric = (function (exports) { } catch (error) { /* empty */ } var run = function (id) { - if (hasOwnProperty_1(queue, id)) { - var fn = queue[id]; - delete queue[id]; + if (hasOwnProperty_1(queue$1, id)) { + var fn = queue$1[id]; + delete queue$1[id]; fn(); } }; @@ -5291,16 +5914,18 @@ var doric = (function (exports) { // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set$1 || !clear) { - set$1 = function setImmediate(fn) { + set$1 = function setImmediate(handler) { + validateArgumentsLength(arguments.length, 1); + var fn = isCallable(handler) ? handler : Function$2(handler); var args = arraySlice$1(arguments, 1); - queue[++counter] = function () { - functionApply(isCallable(fn) ? fn : Function$2(fn), undefined, args); + queue$1[++counter] = function () { + functionApply(fn, undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { - delete queue[id]; + delete queue$1[id]; }; // Node.js 0.8- if (engineIsNode) { @@ -5355,7 +5980,7 @@ var doric = (function (exports) { var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent); - var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; var macrotask = task$1.set; @@ -5367,7 +5992,7 @@ var doric = (function (exports) { var process$3 = global_1.process; var Promise$4 = global_1.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` - var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask'); + var queueMicrotaskDescriptor = getOwnPropertyDescriptor$5(global_1, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify$1, toggle, node, promise, then; @@ -5418,7 +6043,7 @@ var doric = (function (exports) { // for other environments - macrotask based on: // - setImmediate // - MessageChannel - // - window.postMessag + // - window.postMessage // - onreadystatechange // - setTimeout } else { @@ -5439,36 +6064,6 @@ var doric = (function (exports) { } last = task; }; - var PromiseCapability = function (C) { - var resolve, reject; - this.promise = new C(function ($$resolve, $$reject) { - if (resolve !== undefined || reject !== undefined) { throw TypeError('Bad Promise constructor'); } - resolve = $$resolve; - reject = $$reject; - }); - this.resolve = aCallable(resolve); - this.reject = aCallable(reject); - }; - - // `NewPromiseCapability` abstract operation - // https://tc39.es/ecma262/#sec-newpromisecapability - var f = function (C) { - return new PromiseCapability(C); - }; - - var newPromiseCapability$1 = { - f: f - }; - - var promiseResolve = function (C, x) { - anObject(C); - if (isObject(x) && x.constructor === C) { return x; } - var promiseCapability = newPromiseCapability$1.f(C); - var resolve = promiseCapability.resolve; - resolve(x); - return promiseCapability.promise; - }; - var hostReportErrors = function (a, b) { var console = global_1.console; if (console && console.error) { @@ -5484,52 +6079,47 @@ var doric = (function (exports) { } }; - var engineIsBrowser = typeof window == 'object'; - - var task = task$1.set; - - - - - - + var Queue = function () { + this.head = null; + this.tail = null; + }; + Queue.prototype = { + add: function (item) { + var entry = { item: item, next: null }; + if (this.head) { this.tail.next = entry; } + else { this.head = entry; } + this.tail = entry; + }, + get: function () { + var entry = this.head; + if (entry) { + this.head = entry.next; + if (this.tail === entry) { this.tail = null; } + return entry.item; + } + } + }; + var queue = Queue; + var promiseNativeConstructor = global_1.Promise; + /* global Deno -- Deno case */ + var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; + var engineIsBrowser = !engineIsDeno && !engineIsNode + && typeof window == 'object' + && typeof document == 'object'; + promiseNativeConstructor && promiseNativeConstructor.prototype; var SPECIES$1 = wellKnownSymbol('species'); - var PROMISE = 'Promise'; - - var getInternalState$d = internalState.get; - var setInternalState$d = internalState.set; - var getInternalPromiseState = internalState.getterFor(PROMISE); - var NativePromisePrototype = nativePromiseConstructor && nativePromiseConstructor.prototype; - var PromiseConstructor = nativePromiseConstructor; - var PromisePrototype = NativePromisePrototype; - var TypeError$l = global_1.TypeError; - var document$1 = global_1.document; - var process$2 = global_1.process; - var newPromiseCapability = newPromiseCapability$1.f; - var newGenericPromiseCapability = newPromiseCapability; - - var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent); - var NATIVE_REJECTION_EVENT = isCallable(global_1.PromiseRejectionEvent); - var UNHANDLED_REJECTION = 'unhandledrejection'; - var REJECTION_HANDLED = 'rejectionhandled'; - var PENDING = 0; - var FULFILLED = 1; - var REJECTED = 2; - var HANDLED = 1; - var UNHANDLED = 2; var SUBCLASSING = false; + var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable(global_1.PromiseRejectionEvent); - var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; - - var FORCED$c = isForced_1(PROMISE, function () { - var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor); - var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor); + var FORCED_PROMISE_CONSTRUCTOR$5 = isForced_1('Promise', function () { + var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(promiseNativeConstructor); + var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(promiseNativeConstructor); // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // We can't detect it synchronously, so just check versions @@ -5537,73 +6127,133 @@ var doric = (function (exports) { // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 - if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { return false; } - // Detect correctness of subclassing with @@species support - var promise = new PromiseConstructor(function (resolve) { resolve(1); }); - var FakePromise = function (exec) { - exec(function () { /* empty */ }, function () { /* empty */ }); - }; - var constructor = promise.constructor = {}; - constructor[SPECIES$1] = FakePromise; - SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; - if (!SUBCLASSING) { return true; } + if (!engineV8Version || engineV8Version < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { + // Detect correctness of subclassing with @@species support + var promise = new promiseNativeConstructor(function (resolve) { resolve(1); }); + var FakePromise = function (exec) { + exec(function () { /* empty */ }, function () { /* empty */ }); + }; + var constructor = promise.constructor = {}; + constructor[SPECIES$1] = FakePromise; + SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; + if (!SUBCLASSING) { return true; } // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test - return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT; + } return !GLOBAL_CORE_JS_PROMISE && (engineIsBrowser || engineIsDeno) && !NATIVE_PROMISE_REJECTION_EVENT$1; }); - var INCORRECT_ITERATION = FORCED$c || !checkCorrectnessOfIteration(function (iterable) { - PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); - }); - - // helpers - var isThenable = function (it) { - var then; - return isObject(it) && isCallable(then = it.then) ? then : false; + var promiseConstructorDetection = { + CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5, + REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1, + SUBCLASSING: SUBCLASSING }; - var notify = function (state, isReject) { - if (state.notified) { return; } + var PromiseCapability = function (C) { + var resolve, reject; + this.promise = new C(function ($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) { throw TypeError('Bad Promise constructor'); } + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aCallable(resolve); + this.reject = aCallable(reject); + }; + + // `NewPromiseCapability` abstract operation + // https://tc39.es/ecma262/#sec-newpromisecapability + var f = function (C) { + return new PromiseCapability(C); + }; + + var newPromiseCapability$1 = { + f: f + }; + + var task = task$1.set; + + + + + + + + + + var PROMISE = 'Promise'; + var FORCED_PROMISE_CONSTRUCTOR$4 = promiseConstructorDetection.CONSTRUCTOR; + var NATIVE_PROMISE_REJECTION_EVENT = promiseConstructorDetection.REJECTION_EVENT; + var NATIVE_PROMISE_SUBCLASSING = promiseConstructorDetection.SUBCLASSING; + var getInternalPromiseState = internalState.getterFor(PROMISE); + var setInternalState$e = internalState.set; + var NativePromisePrototype$2 = promiseNativeConstructor && promiseNativeConstructor.prototype; + var PromiseConstructor = promiseNativeConstructor; + var PromisePrototype = NativePromisePrototype$2; + var TypeError$4 = global_1.TypeError; + var document$1 = global_1.document; + var process$2 = global_1.process; + var newPromiseCapability = newPromiseCapability$1.f; + var newGenericPromiseCapability = newPromiseCapability; + + var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent); + var UNHANDLED_REJECTION = 'unhandledrejection'; + var REJECTION_HANDLED = 'rejectionhandled'; + var PENDING = 0; + var FULFILLED = 1; + var REJECTED = 2; + var HANDLED = 1; + var UNHANDLED = 2; + + var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; + + // helpers + var isThenable = function (it) { + var then; + return isObject(it) && isCallable(then = it.then) ? then : false; + }; + + var callReaction = function (reaction, state) { + var value = state.value; + var ok = state.state == FULFILLED; + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (state.rejection === UNHANDLED) { onHandleUnhandled(state); } + state.rejection = HANDLED; + } + if (handler === true) { result = value; } + else { + if (domain) { domain.enter(); } + result = handler(value); // can throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError$4('Promise-chain cycle')); + } else if (then = isThenable(result)) { + functionCall(then, result, resolve, reject); + } else { resolve(result); } + } else { reject(value); } + } catch (error) { + if (domain && !exited) { domain.exit(); } + reject(error); + } + }; + + var notify = function (state, isReject) { + if (state.notified) { return; } state.notified = true; - var chain = state.reactions; microtask(function () { - var value = state.value; - var ok = state.state == FULFILLED; - var index = 0; - // variable length - can't use forEach - while (chain.length > index) { - var reaction = chain[index++]; - var handler = ok ? reaction.ok : reaction.fail; - var resolve = reaction.resolve; - var reject = reaction.reject; - var domain = reaction.domain; - var result, then, exited; - try { - if (handler) { - if (!ok) { - if (state.rejection === UNHANDLED) { onHandleUnhandled(state); } - state.rejection = HANDLED; - } - if (handler === true) { result = value; } - else { - if (domain) { domain.enter(); } - result = handler(value); // can throw - if (domain) { - domain.exit(); - exited = true; - } - } - if (result === reaction.promise) { - reject(TypeError$l('Promise-chain cycle')); - } else if (then = isThenable(result)) { - functionCall(then, result, resolve, reject); - } else { resolve(result); } - } else { reject(value); } - } catch (error) { - if (domain && !exited) { domain.exit(); } - reject(error); - } + var reactions = state.reactions; + var reaction; + while (reaction = reactions.get()) { + callReaction(reaction, state); } - state.reactions = []; state.notified = false; if (isReject && !state.rejection) { onUnhandled(state); } }); @@ -5618,7 +6268,7 @@ var doric = (function (exports) { event.initEvent(name, false, true); global_1.dispatchEvent(event); } else { event = { promise: promise, reason: reason }; } - if (!NATIVE_REJECTION_EVENT && (handler = global_1['on' + name])) { handler(event); } + if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global_1['on' + name])) { handler(event); } else if (name === UNHANDLED_REJECTION) { hostReportErrors('Unhandled promise rejection', reason); } }; @@ -5674,7 +6324,7 @@ var doric = (function (exports) { state.done = true; if (unwrap) { state = unwrap; } try { - if (state.facade === value) { throw TypeError$l("Promise can't be resolved itself"); } + if (state.facade === value) { throw TypeError$4("Promise can't be resolved itself"); } var then = isThenable(value); if (then) { microtask(function () { @@ -5699,130 +6349,111 @@ var doric = (function (exports) { }; // constructor polyfill - if (FORCED$c) { + if (FORCED_PROMISE_CONSTRUCTOR$4) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromisePrototype); aCallable(executor); functionCall(Internal, this); - var state = getInternalState$d(this); + var state = getInternalPromiseState(this); try { executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { internalReject(state, error); } }; + PromisePrototype = PromiseConstructor.prototype; + // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { - setInternalState$d(this, { + setInternalState$e(this, { type: PROMISE, done: false, notified: false, parent: false, - reactions: [], + reactions: new queue(), rejection: false, state: PENDING, value: undefined }); }; - Internal.prototype = redefineAll(PromisePrototype, { - // `Promise.prototype.then` method - // https://tc39.es/ecma262/#sec-promise.prototype.then - then: function then(onFulfilled, onRejected) { - var state = getInternalPromiseState(this); - var reactions = state.reactions; - var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); - reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; - reaction.fail = isCallable(onRejected) && onRejected; - reaction.domain = engineIsNode ? process$2.domain : undefined; - state.parent = true; - reactions[reactions.length] = reaction; - if (state.state != PENDING) { notify(state, false); } - return reaction.promise; - }, - // `Promise.prototype.catch` method - // https://tc39.es/ecma262/#sec-promise.prototype.catch - 'catch': function (onRejected) { - return this.then(undefined, onRejected); - } + + // `Promise.prototype.then` method + // https://tc39.es/ecma262/#sec-promise.prototype.then + Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) { + var state = getInternalPromiseState(this); + var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); + state.parent = true; + reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; + reaction.fail = isCallable(onRejected) && onRejected; + reaction.domain = engineIsNode ? process$2.domain : undefined; + if (state.state == PENDING) { state.reactions.add(reaction); } + else { microtask(function () { + callReaction(reaction, state); + }); } + return reaction.promise; }); + OwnPromiseCapability = function () { var promise = new Internal(); - var state = getInternalState$d(promise); + var state = getInternalPromiseState(promise); this.promise = promise; this.resolve = bind(internalResolve, state); this.reject = bind(internalReject, state); }; + newPromiseCapability$1.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; - if (isCallable(nativePromiseConstructor) && NativePromisePrototype !== Object.prototype) { - nativeThen = NativePromisePrototype.then; + if (isCallable(promiseNativeConstructor) && NativePromisePrototype$2 !== Object.prototype) { + nativeThen = NativePromisePrototype$2.then; - if (!SUBCLASSING) { + if (!NATIVE_PROMISE_SUBCLASSING) { // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs - redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { + defineBuiltIn(NativePromisePrototype$2, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { functionCall(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); - - // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` - redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs try { - delete NativePromisePrototype.constructor; + delete NativePromisePrototype$2.constructor; } catch (error) { /* empty */ } // make `instanceof Promise` work for native promise-based APIs if (objectSetPrototypeOf) { - objectSetPrototypeOf(NativePromisePrototype, PromisePrototype); + objectSetPrototypeOf(NativePromisePrototype$2, PromisePrototype); } } } - _export({ global: true, wrap: true, forced: FORCED$c }, { + _export({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, { Promise: PromiseConstructor }); setToStringTag(PromiseConstructor, PROMISE, false); setSpecies(PROMISE); - PromiseWrapper = getBuiltIn(PROMISE); - - // statics - _export({ target: PROMISE, stat: true, forced: FORCED$c }, { - // `Promise.reject` method - // https://tc39.es/ecma262/#sec-promise.reject - reject: function reject(r) { - var capability = newPromiseCapability(this); - functionCall(capability.reject, undefined, r); - return capability.promise; - } - }); + var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR; - _export({ target: PROMISE, stat: true, forced: FORCED$c }, { - // `Promise.resolve` method - // https://tc39.es/ecma262/#sec-promise.resolve - resolve: function resolve(x) { - return promiseResolve(this, x); - } + var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) { + promiseNativeConstructor.all(iterable).then(undefined, function () { /* empty */ }); }); - _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { - // `Promise.all` method - // https://tc39.es/ecma262/#sec-promise.all + // `Promise.all` method + // https://tc39.es/ecma262/#sec-promise.all + _export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, { all: function all(iterable) { var C = this; - var capability = newPromiseCapability(C); + var capability = newPromiseCapability$1.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { @@ -5845,12 +6476,39 @@ var doric = (function (exports) { }); if (result.error) { reject(result.value); } return capability.promise; - }, - // `Promise.race` method - // https://tc39.es/ecma262/#sec-promise.race + } + }); + + var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR; + + + + + + var NativePromisePrototype$1 = promiseNativeConstructor && promiseNativeConstructor.prototype; + + // `Promise.prototype.catch` method + // https://tc39.es/ecma262/#sec-promise.prototype.catch + _export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, { + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + + // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` + if (isCallable(promiseNativeConstructor)) { + var method$1 = getBuiltIn('Promise').prototype['catch']; + if (NativePromisePrototype$1['catch'] !== method$1) { + defineBuiltIn(NativePromisePrototype$1, 'catch', method$1, { unsafe: true }); + } + } + + // `Promise.race` method + // https://tc39.es/ecma262/#sec-promise.race + _export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, { race: function race(iterable) { var C = this; - var capability = newPromiseCapability(C); + var capability = newPromiseCapability$1.f(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); @@ -5863,6 +6521,40 @@ var doric = (function (exports) { } }); + var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR; + + // `Promise.reject` method + // https://tc39.es/ecma262/#sec-promise.reject + _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, { + reject: function reject(r) { + var capability = newPromiseCapability$1.f(this); + functionCall(capability.reject, undefined, r); + return capability.promise; + } + }); + + var promiseResolve = function (C, x) { + anObject(C); + if (isObject(x) && x.constructor === C) { return x; } + var promiseCapability = newPromiseCapability$1.f(C); + var resolve = promiseCapability.resolve; + resolve(x); + return promiseCapability.promise; + }; + + var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR; + + + getBuiltIn('Promise'); + + // `Promise.resolve` method + // https://tc39.es/ecma262/#sec-promise.resolve + _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { + resolve: function resolve(x) { + return promiseResolve(this, x); + } + }); + // `Promise.allSettled` method // https://tc39.es/ecma262/#sec-promise.allsettled _export({ target: 'Promise', stat: true }, { @@ -5938,9 +6630,12 @@ var doric = (function (exports) { } }); + var NativePromisePrototype = promiseNativeConstructor && promiseNativeConstructor.prototype; + // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 - var NON_GENERIC = !!nativePromiseConstructor && fails(function () { - nativePromiseConstructor.prototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); + var NON_GENERIC = !!promiseNativeConstructor && fails(function () { + // eslint-disable-next-line unicorn/no-thenable -- required for testing + NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); // `Promise.prototype.finally` method @@ -5961,16 +6656,16 @@ var doric = (function (exports) { }); // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then` - if (isCallable(nativePromiseConstructor)) { + if (isCallable(promiseNativeConstructor)) { var method = getBuiltIn('Promise').prototype['finally']; - if (nativePromiseConstructor.prototype['finally'] !== method) { - redefine(nativePromiseConstructor.prototype, 'finally', method, { unsafe: true }); + if (NativePromisePrototype['finally'] !== method) { + defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true }); } } // MS Edge argumentsList argument is optional var OPTIONAL_ARGUMENTS_LIST = !fails(function () { - // eslint-disable-next-line es/no-reflect -- required for testing + // eslint-disable-next-line es-x/no-reflect -- required for testing Reflect.apply(function () { /* empty */ }); }); @@ -5984,7 +6679,7 @@ var doric = (function (exports) { var nativeConstruct = getBuiltIn('Reflect', 'construct'); var ObjectPrototype = Object.prototype; - var push$d = [].push; + var push$g = [].push; // `Reflect.construct` method // https://tc39.es/ecma262/#sec-reflect.construct @@ -5999,9 +6694,9 @@ var doric = (function (exports) { nativeConstruct(function () { /* empty */ }); }); - var FORCED$b = NEW_TARGET_BUG || ARGS_BUG; + var FORCED$6 = NEW_TARGET_BUG || ARGS_BUG; - _export({ target: 'Reflect', stat: true, forced: FORCED$b, sham: FORCED$b }, { + _export({ target: 'Reflect', stat: true, forced: FORCED$6, sham: FORCED$6 }, { construct: function construct(Target, args /* , newTarget */) { aConstructor(Target); anObject(args); @@ -6018,7 +6713,7 @@ var doric = (function (exports) { } // w/o altered newTarget, lot of arguments case var $args = [null]; - functionApply(push$d, $args, args); + functionApply(push$g, $args, args); return new (functionApply(functionBind, Target, $args))(); } // with altered newTarget, not support built-in constructors @@ -6031,7 +6726,7 @@ var doric = (function (exports) { // MS Edge has broken Reflect.defineProperty - throwing instead of returning false var ERROR_INSTEAD_OF_FALSE = fails(function () { - // eslint-disable-next-line es/no-reflect -- required for testing + // eslint-disable-next-line es-x/no-reflect -- required for testing Reflect.defineProperty(objectDefineProperty.f({}, 1, { value: 1 }), 1, { value: 2 }); }); @@ -6051,13 +6746,13 @@ var doric = (function (exports) { } }); - var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; // `Reflect.deleteProperty` method // https://tc39.es/ecma262/#sec-reflect.deleteproperty _export({ target: 'Reflect', stat: true }, { deleteProperty: function deleteProperty(target, propertyKey) { - var descriptor = getOwnPropertyDescriptor$2(anObject(target), propertyKey); + var descriptor = getOwnPropertyDescriptor$4(anObject(target), propertyKey); return descriptor && !descriptor.configurable ? false : delete target[propertyKey]; } }); @@ -6107,15 +6802,12 @@ var doric = (function (exports) { } }); - // eslint-disable-next-line es/no-object-isextensible -- safe - var objectIsExtensible = Object.isExtensible; - // `Reflect.isExtensible` method // https://tc39.es/ecma262/#sec-reflect.isextensible _export({ target: 'Reflect', stat: true }, { isExtensible: function isExtensible(target) { anObject(target); - return objectIsExtensible ? objectIsExtensible(target) : true; + return objectIsExtensible(target); } }); @@ -6171,7 +6863,7 @@ var doric = (function (exports) { var MS_EDGE_BUG = fails(function () { var Constructor = function () { /* empty */ }; var object = objectDefineProperty.f(new Constructor(), 'a', { configurable: true }); - // eslint-disable-next-line es/no-reflect -- required for testing + // eslint-disable-next-line es-x/no-reflect -- required for testing return Reflect.set(Constructor.prototype, 'a', 1, object) !== false; }); @@ -6214,25 +6906,41 @@ var doric = (function (exports) { var regexpFlags = function () { var that = anObject(this); var result = ''; + if (that.hasIndices) { result += 'd'; } if (that.global) { result += 'g'; } if (that.ignoreCase) { result += 'i'; } if (that.multiline) { result += 'm'; } if (that.dotAll) { result += 's'; } if (that.unicode) { result += 'u'; } + if (that.unicodeSets) { result += 'v'; } if (that.sticky) { result += 'y'; } return result; }; + var RegExpPrototype$7 = RegExp.prototype; + + var regexpGetFlags = function (R) { + var flags = R.flags; + return flags === undefined && !('flags' in RegExpPrototype$7) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype$7, R) + ? functionCall(regexpFlags, R) : flags; + }; + // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var $RegExp$2 = global_1.RegExp; - var UNSUPPORTED_Y$4 = fails(function () { + var UNSUPPORTED_Y$3 = fails(function () { var re = $RegExp$2('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; }); - var BROKEN_CARET = fails(function () { + // UC Browser bug + // https://github.com/zloirock/core-js/issues/1008 + var MISSED_STICKY$2 = UNSUPPORTED_Y$3 || fails(function () { + return !$RegExp$2('a', 'y').sticky; + }); + + var BROKEN_CARET = UNSUPPORTED_Y$3 || fails(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = $RegExp$2('^r', 'gy'); re.lastIndex = 2; @@ -6240,8 +6948,9 @@ var doric = (function (exports) { }); var regexpStickyHelpers = { - UNSUPPORTED_Y: UNSUPPORTED_Y$4, - BROKEN_CARET: BROKEN_CARET + BROKEN_CARET: BROKEN_CARET, + MISSED_STICKY: MISSED_STICKY$2, + UNSUPPORTED_Y: UNSUPPORTED_Y$3 }; // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError @@ -6261,7 +6970,6 @@ var doric = (function (exports) { 'b'.replace(re, '$c') !== 'bc'; }); - var defineProperty$5 = objectDefineProperty.f; var getOwnPropertyNames = objectGetOwnPropertyNames.f; @@ -6271,7 +6979,8 @@ var doric = (function (exports) { - var enforceInternalState = internalState.enforce; + + var enforceInternalState$1 = internalState.enforce; @@ -6279,15 +6988,14 @@ var doric = (function (exports) { var MATCH$1 = wellKnownSymbol('match'); var NativeRegExp = global_1.RegExp; - var RegExpPrototype$7 = NativeRegExp.prototype; - var SyntaxError$1 = global_1.SyntaxError; - var getFlags$3 = functionUncurryThis(regexpFlags); - var exec$5 = functionUncurryThis(RegExpPrototype$7.exec); - var charAt$c = functionUncurryThis(''.charAt); - var replace$6 = functionUncurryThis(''.replace); + var RegExpPrototype$6 = NativeRegExp.prototype; + var SyntaxError$2 = global_1.SyntaxError; + var exec$7 = functionUncurryThis(RegExpPrototype$6.exec); + var charAt$e = functionUncurryThis(''.charAt); + var replace$7 = functionUncurryThis(''.replace); var stringIndexOf$4 = functionUncurryThis(''.indexOf); var stringSlice$c = functionUncurryThis(''.slice); - // TODO: Use only propper RegExpIdentifierName + // TODO: Use only proper RegExpIdentifierName var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/; var re1 = /a/g; var re2 = /a/g; @@ -6295,10 +7003,11 @@ var doric = (function (exports) { // "new" should create a new object, old webkit bug var CORRECT_NEW = new NativeRegExp(re1) !== re1; - var UNSUPPORTED_Y$3 = regexpStickyHelpers.UNSUPPORTED_Y; + var MISSED_STICKY$1 = regexpStickyHelpers.MISSED_STICKY; + var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y; var BASE_FORCED = descriptors && - (!CORRECT_NEW || UNSUPPORTED_Y$3 || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () { + (!CORRECT_NEW || MISSED_STICKY$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () { re2[MATCH$1] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; @@ -6311,9 +7020,9 @@ var doric = (function (exports) { var brackets = false; var chr; for (; index <= length; index++) { - chr = charAt$c(string, index); + chr = charAt$e(string, index); if (chr === '\\') { - result += chr + charAt$c(string, ++index); + result += chr + charAt$e(string, ++index); continue; } if (!brackets && chr === '.') { @@ -6340,9 +7049,9 @@ var doric = (function (exports) { var groupname = ''; var chr; for (; index <= length; index++) { - chr = charAt$c(string, index); + chr = charAt$e(string, index); if (chr === '\\') { - chr = chr + charAt$c(string, ++index); + chr = chr + charAt$e(string, ++index); } else if (chr === ']') { brackets = false; } else if (!brackets) { switch (true) { @@ -6350,7 +7059,7 @@ var doric = (function (exports) { brackets = true; break; case chr === '(': - if (exec$5(IS_NCG, stringSlice$c(string, index + 1))) { + if (exec$7(IS_NCG, stringSlice$c(string, index + 1))) { index += 2; ncg = true; } @@ -6359,7 +7068,7 @@ var doric = (function (exports) { continue; case chr === '>' && ncg: if (groupname === '' || hasOwnProperty_1(names, groupname)) { - throw new SyntaxError$1('Invalid capture group name'); + throw new SyntaxError$2('Invalid capture group name'); } names[groupname] = true; named[named.length] = [groupname, groupid]; @@ -6376,7 +7085,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-regexp-constructor if (isForced_1('RegExp', BASE_FORCED)) { var RegExpWrapper = function RegExp(pattern, flags) { - var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$7, this); + var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$6, this); var patternIsRegExp = isRegexp(pattern); var flagsAreUndefined = flags === undefined; var groups = []; @@ -6387,9 +7096,9 @@ var doric = (function (exports) { return pattern; } - if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$7, pattern)) { + if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$6, pattern)) { pattern = pattern.source; - if (flagsAreUndefined) { flags = 'flags' in rawPattern ? rawPattern.flags : getFlags$3(rawPattern); } + if (flagsAreUndefined) { flags = regexpGetFlags(rawPattern); } } pattern = pattern === undefined ? '' : toString_1(pattern); @@ -6398,14 +7107,14 @@ var doric = (function (exports) { if (regexpUnsupportedDotAll && 'dotAll' in re1) { dotAll = !!flags && stringIndexOf$4(flags, 's') > -1; - if (dotAll) { flags = replace$6(flags, /s/g, ''); } + if (dotAll) { flags = replace$7(flags, /s/g, ''); } } rawFlags = flags; - if (UNSUPPORTED_Y$3 && 'sticky' in re1) { + if (MISSED_STICKY$1 && 'sticky' in re1) { sticky = !!flags && stringIndexOf$4(flags, 'y') > -1; - if (sticky) { flags = replace$6(flags, /y/g, ''); } + if (sticky && UNSUPPORTED_Y$2) { flags = replace$7(flags, /y/g, ''); } } if (regexpUnsupportedNcg) { @@ -6414,10 +7123,10 @@ var doric = (function (exports) { groups = handled[1]; } - result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$7, RegExpWrapper); + result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$6, RegExpWrapper); if (dotAll || sticky || groups.length) { - state = enforceInternalState(result); + state = enforceInternalState$1(result); if (dotAll) { state.dotAll = true; state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags); @@ -6434,45 +7143,42 @@ var doric = (function (exports) { return result; }; - var proxy = function (key) { - key in RegExpWrapper || defineProperty$5(RegExpWrapper, key, { - configurable: true, - get: function () { return NativeRegExp[key]; }, - set: function (it) { NativeRegExp[key] = it; } - }); - }; - - for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) { - proxy(keys[index++]); + for (var keys = getOwnPropertyNames(NativeRegExp), index$1 = 0; keys.length > index$1;) { + proxyAccessor(RegExpWrapper, NativeRegExp, keys[index$1++]); } - RegExpPrototype$7.constructor = RegExpWrapper; - RegExpWrapper.prototype = RegExpPrototype$7; - redefine(global_1, 'RegExp', RegExpWrapper); + RegExpPrototype$6.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$6; + defineBuiltIn(global_1, 'RegExp', RegExpWrapper, { constructor: true }); } // https://tc39.es/ecma262/#sec-get-regexp-@@species setSpecies('RegExp'); - var defineProperty$4 = objectDefineProperty.f; - var getInternalState$c = internalState.get; + var defineBuiltInAccessor = function (target, name, descriptor) { + if (descriptor.get) { makeBuiltIn_1(descriptor.get, name, { getter: true }); } + if (descriptor.set) { makeBuiltIn_1(descriptor.set, name, { setter: true }); } + return objectDefineProperty.f(target, name, descriptor); + }; + + var getInternalState$a = internalState.get; - var RegExpPrototype$6 = RegExp.prototype; - var TypeError$k = global_1.TypeError; + var RegExpPrototype$5 = RegExp.prototype; + var $TypeError$j = TypeError; // `RegExp.prototype.dotAll` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall if (descriptors && regexpUnsupportedDotAll) { - defineProperty$4(RegExpPrototype$6, 'dotAll', { + defineBuiltInAccessor(RegExpPrototype$5, 'dotAll', { configurable: true, - get: function () { - if (this === RegExpPrototype$6) { return undefined; } + get: function dotAll() { + if (this === RegExpPrototype$5) { return undefined; } // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (classofRaw(this) === 'RegExp') { - return !!getInternalState$c(this).dotAll; + return !!getInternalState$a(this).dotAll; } - throw TypeError$k('Incompatible receiver, RegExp required'); + throw $TypeError$j('Incompatible receiver, RegExp required'); } }); } @@ -6486,16 +7192,16 @@ var doric = (function (exports) { - var getInternalState$b = internalState.get; + var getInternalState$9 = internalState.get; var nativeReplace = shared('native-string-replace', String.prototype.replace); var nativeExec = RegExp.prototype.exec; var patchedExec = nativeExec; - var charAt$b = functionUncurryThis(''.charAt); + var charAt$d = functionUncurryThis(''.charAt); var indexOf$1 = functionUncurryThis(''.indexOf); - var replace$5 = functionUncurryThis(''.replace); + var replace$6 = functionUncurryThis(''.replace); var stringSlice$b = functionUncurryThis(''.slice); var UPDATES_LAST_INDEX_WRONG = (function () { @@ -6506,18 +7212,17 @@ var doric = (function (exports) { return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); - var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; + var UNSUPPORTED_Y$1 = regexpStickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg; + var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg; if (PATCH) { - // eslint-disable-next-line max-statements -- TODO patchedExec = function exec(string) { var re = this; - var state = getInternalState$b(re); + var state = getInternalState$9(re); var str = toString_1(string); var raw = state.raw; var result, reCopy, lastIndex, match, i, object, group; @@ -6530,21 +7235,21 @@ var doric = (function (exports) { } var groups = state.groups; - var sticky = UNSUPPORTED_Y$2 && re.sticky; + var sticky = UNSUPPORTED_Y$1 && re.sticky; var flags = functionCall(regexpFlags, re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { - flags = replace$5(flags, 'y', ''); + flags = replace$6(flags, 'y', ''); if (indexOf$1(flags, 'g') === -1) { flags += 'g'; } strCopy = stringSlice$b(str, re.lastIndex); // Support anchored sticky behavior. - if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$b(str, re.lastIndex - 1) !== '\n')) { + if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$d(str, re.lastIndex - 1) !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; @@ -6573,7 +7278,7 @@ var doric = (function (exports) { } if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` - // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ + // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/ functionCall(nativeReplace, match[0], reCopy, function () { var arguments$1 = arguments; @@ -6603,41 +7308,77 @@ var doric = (function (exports) { exec: regexpExec }); - var RegExpPrototype$5 = RegExp.prototype; + // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError + var RegExp$2 = global_1.RegExp; + var RegExpPrototype$4 = RegExp$2.prototype; + + var FORCED$5 = descriptors && fails(function () { + var INDICES_SUPPORT = true; + try { + RegExp$2('.', 'd'); + } catch (error) { + INDICES_SUPPORT = false; + } - var FORCED$a = descriptors && fails(function () { - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - return Object.getOwnPropertyDescriptor(RegExpPrototype$5, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; + var O = {}; + // modern V8 bug + var calls = ''; + var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; + + var addGetter = function (key, chr) { + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty(O, key, { get: function () { + calls += chr; + return true; + } }); + }; + + var pairs = { + dotAll: 's', + global: 'g', + ignoreCase: 'i', + multiline: 'm', + sticky: 'y' + }; + + if (INDICES_SUPPORT) { pairs.hasIndices = 'd'; } + + for (var key in pairs) { addGetter(key, pairs[key]); } + + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var result = Object.getOwnPropertyDescriptor(RegExpPrototype$4, 'flags').get.call(O); + + return result !== expected || calls !== expected; }); // `RegExp.prototype.flags` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags - if (FORCED$a) { objectDefineProperty.f(RegExpPrototype$5, 'flags', { + if (FORCED$5) { defineBuiltInAccessor(RegExpPrototype$4, 'flags', { configurable: true, get: regexpFlags }); } - var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y; + var MISSED_STICKY = regexpStickyHelpers.MISSED_STICKY; - var defineProperty$3 = objectDefineProperty.f; - var getInternalState$a = internalState.get; - var RegExpPrototype$4 = RegExp.prototype; - var TypeError$j = global_1.TypeError; + var getInternalState$8 = internalState.get; + + var RegExpPrototype$3 = RegExp.prototype; + var $TypeError$i = TypeError; // `RegExp.prototype.sticky` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky - if (descriptors && UNSUPPORTED_Y$1) { - defineProperty$3(RegExpPrototype$4, 'sticky', { + if (descriptors && MISSED_STICKY) { + defineBuiltInAccessor(RegExpPrototype$3, 'sticky', { configurable: true, - get: function () { - if (this === RegExpPrototype$4) { return undefined; } + get: function sticky() { + if (this === RegExpPrototype$3) { return undefined; } // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (classofRaw(this) === 'RegExp') { - return !!getInternalState$a(this).sticky; + return !!getInternalState$8(this).sticky; } - throw TypeError$j('Incompatible receiver, RegExp required'); + throw $TypeError$i('Incompatible receiver, RegExp required'); } }); } @@ -6650,7 +7391,6 @@ var doric = (function (exports) { - var DELEGATES_TO_EXEC = function () { var execCalled = false; var re = /[ac]/; @@ -6661,7 +7401,7 @@ var doric = (function (exports) { return re.test('abc') === true && execCalled; }(); - var Error$1 = global_1.Error; + var $TypeError$h = TypeError; var un$Test = functionUncurryThis(/./.test); // `RegExp.prototype.test` method @@ -6672,14 +7412,13 @@ var doric = (function (exports) { if (!isCallable(exec)) { return un$Test(this, str); } var result = functionCall(exec, this, str); if (result !== null && !isObject(result)) { - throw new Error$1('RegExp exec method returned something other than an Object or null'); + throw new $TypeError$h('RegExp exec method returned something other than an Object or null'); } return !!result; } }); - var PROPER_FUNCTION_NAME$2 = functionName.PROPER; - + var PROPER_FUNCTION_NAME$1 = functionName.PROPER; @@ -6687,23 +7426,21 @@ var doric = (function (exports) { var TO_STRING = 'toString'; - var RegExpPrototype$3 = RegExp.prototype; - var n$ToString = RegExpPrototype$3[TO_STRING]; - var getFlags$2 = functionUncurryThis(regexpFlags); + var RegExpPrototype$2 = RegExp.prototype; + var n$ToString = RegExpPrototype$2[TO_STRING]; var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name - var INCORRECT_NAME = PROPER_FUNCTION_NAME$2 && n$ToString.name != TO_STRING; + var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && n$ToString.name != TO_STRING; // `RegExp.prototype.toString` method // https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { - redefine(RegExp.prototype, TO_STRING, function toString() { + defineBuiltIn(RegExp.prototype, TO_STRING, function toString() { var R = anObject(this); - var p = toString_1(R.source); - var rf = R.flags; - var f = toString_1(rf === undefined && objectIsPrototypeOf(RegExpPrototype$3, R) && !('flags' in RegExpPrototype$3) ? getFlags$2(R) : rf); - return '/' + p + '/' + f; + var pattern = toString_1(R.source); + var flags = toString_1(regexpGetFlags(R)); + return '/' + pattern + '/' + flags; }, { unsafe: true }); } @@ -6713,40 +7450,41 @@ var doric = (function (exports) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); - var charAt$a = functionUncurryThis(''.charAt); + var charAt$c = functionUncurryThis(''.charAt); - var FORCED$9 = fails(function () { - return '𠮷'.at(0) !== '\uD842'; + var FORCED$4 = fails(function () { + // eslint-disable-next-line es-x/no-array-string-prototype-at -- safe + return '𠮷'.at(-2) !== '\uD842'; }); // `String.prototype.at` method // https://github.com/tc39/proposal-relative-indexing-method - _export({ target: 'String', proto: true, forced: FORCED$9 }, { + _export({ target: 'String', proto: true, forced: FORCED$4 }, { at: function at(index) { var S = toString_1(requireObjectCoercible(this)); var len = S.length; var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; - return (k < 0 || k >= len) ? undefined : charAt$a(S, k); + return (k < 0 || k >= len) ? undefined : charAt$c(S, k); } }); - var charAt$9 = functionUncurryThis(''.charAt); - var charCodeAt$1 = functionUncurryThis(''.charCodeAt); + var charAt$b = functionUncurryThis(''.charAt); + var charCodeAt$2 = functionUncurryThis(''.charCodeAt); var stringSlice$a = functionUncurryThis(''.slice); - var createMethod$2 = function (CONVERT_TO_STRING) { + var createMethod$1 = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString_1(requireObjectCoercible($this)); var position = toIntegerOrInfinity(pos); var size = S.length; var first, second; if (position < 0 || position >= size) { return CONVERT_TO_STRING ? '' : undefined; } - first = charCodeAt$1(S, position); + first = charCodeAt$2(S, position); return first < 0xD800 || first > 0xDBFF || position + 1 === size - || (second = charCodeAt$1(S, position + 1)) < 0xDC00 || second > 0xDFFF + || (second = charCodeAt$2(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING - ? charAt$9(S, position) + ? charAt$b(S, position) : first : CONVERT_TO_STRING ? stringSlice$a(S, position, position + 2) @@ -6757,10 +7495,10 @@ var doric = (function (exports) { var stringMultibyte = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat - codeAt: createMethod$2(false), + codeAt: createMethod$1(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at - charAt: createMethod$2(true) + charAt: createMethod$1(true) }; var codeAt$2 = stringMultibyte.codeAt; @@ -6773,11 +7511,11 @@ var doric = (function (exports) { } }); - var TypeError$i = global_1.TypeError; + var $TypeError$g = TypeError; var notARegexp = function (it) { if (isRegexp(it)) { - throw TypeError$i("The method doesn't accept regular expressions"); + throw $TypeError$g("The method doesn't accept regular expressions"); } return it; }; @@ -6795,7 +7533,7 @@ var doric = (function (exports) { } return false; }; - var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; @@ -6803,15 +7541,15 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-string-prototype-endswith -- safe + // eslint-disable-next-line es-x/no-string-prototype-endswith -- safe var un$EndsWith = functionUncurryThis(''.endsWith); - var slice = functionUncurryThis(''.slice); - var min$5 = Math.min; + var slice$2 = functionUncurryThis(''.slice); + var min$7 = Math.min; var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('endsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () { - var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'endsWith'); + var descriptor = getOwnPropertyDescriptor$3(String.prototype, 'endsWith'); return descriptor && !descriptor.writable; }(); @@ -6823,26 +7561,26 @@ var doric = (function (exports) { notARegexp(searchString); var endPosition = arguments.length > 1 ? arguments[1] : undefined; var len = that.length; - var end = endPosition === undefined ? len : min$5(toLength(endPosition), len); + var end = endPosition === undefined ? len : min$7(toLength(endPosition), len); var search = toString_1(searchString); return un$EndsWith ? un$EndsWith(that, search, end) - : slice(that, end - search.length, end) === search; + : slice$2(that, end - search.length, end) === search; } }); - var RangeError$6 = global_1.RangeError; - var fromCharCode$2 = String.fromCharCode; - // eslint-disable-next-line es/no-string-fromcodepoint -- required for testing + var $RangeError$7 = RangeError; + var fromCharCode$3 = String.fromCharCode; + // eslint-disable-next-line es-x/no-string-fromcodepoint -- required for testing var $fromCodePoint = String.fromCodePoint; - var join$5 = functionUncurryThis([].join); + var join$6 = functionUncurryThis([].join); // length should be 1, old FF problem var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1; // `String.fromCodePoint` method // https://tc39.es/ecma262/#sec-string.fromcodepoint - _export({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { + _export({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, { // eslint-disable-next-line no-unused-vars -- required for `.length` fromCodePoint: function fromCodePoint(x) { var arguments$1 = arguments; @@ -6853,11 +7591,11 @@ var doric = (function (exports) { var code; while (length > i) { code = +arguments$1[i++]; - if (toAbsoluteIndex(code, 0x10FFFF) !== code) { throw RangeError$6(code + ' is not a valid code point'); } + if (toAbsoluteIndex(code, 0x10FFFF) !== code) { throw $RangeError$7(code + ' is not a valid code point'); } elements[i] = code < 0x10000 - ? fromCharCode$2(code) - : fromCharCode$2(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); - } return join$5(elements, ''); + ? fromCharCode$3(code) + : fromCharCode$3(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); + } return join$6(elements, ''); } }); @@ -6875,19 +7613,19 @@ var doric = (function (exports) { } }); - var charAt$8 = stringMultibyte.charAt; + var charAt$a = stringMultibyte.charAt; var STRING_ITERATOR$1 = 'String Iterator'; - var setInternalState$c = internalState.set; - var getInternalState$9 = internalState.getterFor(STRING_ITERATOR$1); + var setInternalState$d = internalState.set; + var getInternalState$7 = internalState.getterFor(STRING_ITERATOR$1); // `String.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { - setInternalState$c(this, { + setInternalState$d(this, { type: STRING_ITERATOR$1, string: toString_1(iterated), index: 0 @@ -6895,12 +7633,12 @@ var doric = (function (exports) { // `%StringIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next }, function next() { - var state = getInternalState$9(this); + var state = getInternalState$7(this); var string = state.string; var index = state.index; var point; if (index >= string.length) { return { value: undefined, done: true }; } - point = charAt$8(string, index); + point = charAt$a(string, index); state.index += point.length; return { value: point, done: false }; }); @@ -6915,7 +7653,7 @@ var doric = (function (exports) { var SPECIES = wellKnownSymbol('species'); - var RegExpPrototype$2 = RegExp.prototype; + var RegExpPrototype$1 = RegExp.prototype; var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { var SYMBOL = wellKnownSymbol(KEY); @@ -6960,7 +7698,7 @@ var doric = (function (exports) { var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { var uncurriedNativeMethod = functionUncurryThis(nativeMethod); var $exec = regexp.exec; - if ($exec === regexpExec || $exec === RegExpPrototype$2.exec) { + if ($exec === regexpExec || $exec === RegExpPrototype$1.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. @@ -6972,22 +7710,22 @@ var doric = (function (exports) { return { done: false }; }); - redefine(String.prototype, KEY, methods[0]); - redefine(RegExpPrototype$2, SYMBOL, methods[1]); + defineBuiltIn(String.prototype, KEY, methods[0]); + defineBuiltIn(RegExpPrototype$1, SYMBOL, methods[1]); } - if (SHAM) { createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true); } + if (SHAM) { createNonEnumerableProperty(RegExpPrototype$1[SYMBOL], 'sham', true); } }; - var charAt$7 = stringMultibyte.charAt; + var charAt$9 = stringMultibyte.charAt; // `AdvanceStringIndex` abstract operation // https://tc39.es/ecma262/#sec-advancestringindex var advanceStringIndex = function (S, index, unicode) { - return index + (unicode ? charAt$7(S, index).length : 1); + return index + (unicode ? charAt$9(S, index).length : 1); }; - var TypeError$h = global_1.TypeError; + var $TypeError$f = TypeError; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec @@ -6999,7 +7737,7 @@ var doric = (function (exports) { return result; } if (classofRaw(R) === 'RegExp') { return functionCall(regexpExec, R, S); } - throw TypeError$h('RegExp#exec called on incompatible receiver'); + throw $TypeError$f('RegExp#exec called on incompatible receiver'); }; // @@match logic @@ -7039,9 +7777,7 @@ var doric = (function (exports) { ]; }); - /* eslint-disable es/no-string-prototype-matchall -- safe */ - - + /* eslint-disable es-x/no-string-prototype-matchall -- safe */ @@ -7066,11 +7802,10 @@ var doric = (function (exports) { var MATCH_ALL = wellKnownSymbol('matchAll'); var REGEXP_STRING = 'RegExp String'; var REGEXP_STRING_ITERATOR = REGEXP_STRING + ' Iterator'; - var setInternalState$b = internalState.set; - var getInternalState$8 = internalState.getterFor(REGEXP_STRING_ITERATOR); - var RegExpPrototype$1 = RegExp.prototype; - var TypeError$g = global_1.TypeError; - var getFlags$1 = functionUncurryThis(regexpFlags); + var setInternalState$c = internalState.set; + var getInternalState$6 = internalState.getterFor(REGEXP_STRING_ITERATOR); + var RegExpPrototype = RegExp.prototype; + var $TypeError$e = TypeError; var stringIndexOf$2 = functionUncurryThis(''.indexOf); var un$MatchAll = functionUncurryThis(''.matchAll); @@ -7079,7 +7814,7 @@ var doric = (function (exports) { }); var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, $global, fullUnicode) { - setInternalState$b(this, { + setInternalState$c(this, { type: REGEXP_STRING_ITERATOR, regexp: regexp, string: string, @@ -7088,7 +7823,7 @@ var doric = (function (exports) { done: false }); }, REGEXP_STRING, function next() { - var state = getInternalState$8(this); + var state = getInternalState$6(this); if (state.done) { return { value: undefined, done: true }; } var R = state.regexp; var S = state.string; @@ -7105,13 +7840,9 @@ var doric = (function (exports) { var $matchAll = function (string) { var R = anObject(this); var S = toString_1(string); - var C, flagsValue, flags, matcher, $global, fullUnicode; - C = speciesConstructor(R, RegExp); - flagsValue = R.flags; - if (flagsValue === undefined && objectIsPrototypeOf(RegExpPrototype$1, R) && !('flags' in RegExpPrototype$1)) { - flagsValue = getFlags$1(R); - } - flags = flagsValue === undefined ? '' : toString_1(flagsValue); + var C = speciesConstructor(R, RegExp); + var flags = toString_1(regexpGetFlags(R)); + var matcher, $global, fullUnicode; matcher = new C(C === RegExp ? R.source : R, flags); $global = !!~stringIndexOf$2(flags, 'g'); fullUnicode = !!~stringIndexOf$2(flags, 'u'); @@ -7127,11 +7858,8 @@ var doric = (function (exports) { var flags, S, matcher, rx; if (regexp != null) { if (isRegexp(regexp)) { - flags = toString_1(requireObjectCoercible('flags' in RegExpPrototype$1 - ? regexp.flags - : getFlags$1(regexp) - )); - if (!~stringIndexOf$2(flags, 'g')) { throw TypeError$g('`.matchAll` does not allow non-global regexes'); } + flags = toString_1(requireObjectCoercible(regexpGetFlags(regexp))); + if (!~stringIndexOf$2(flags, 'g')) { throw $TypeError$e('`.matchAll` does not allow non-global regexes'); } } if (WORKS_WITH_NON_GLOBAL_REGEX) { return un$MatchAll(O, regexp); } matcher = getMethod(regexp, MATCH_ALL); @@ -7144,7 +7872,7 @@ var doric = (function (exports) { } }); - MATCH_ALL in RegExpPrototype$1 || redefine(RegExpPrototype$1, MATCH_ALL, $matchAll); + MATCH_ALL in RegExpPrototype || defineBuiltIn(RegExpPrototype, MATCH_ALL, $matchAll); // https://github.com/zloirock/core-js/issues/280 @@ -7173,8 +7901,8 @@ var doric = (function (exports) { } }); - var push$c = functionUncurryThis([].push); - var join$4 = functionUncurryThis([].join); + var push$f = functionUncurryThis([].push); + var join$5 = functionUncurryThis([].join); // `String.raw` method // https://tc39.es/ecma262/#sec-string.raw @@ -7188,9 +7916,9 @@ var doric = (function (exports) { var elements = []; var i = 0; while (literalSegments > i) { - push$c(elements, toString_1(rawTemplate[i++])); - if (i === literalSegments) { return join$4(elements, ''); } - if (i < argumentsLength) { push$c(elements, toString_1(arguments$1[i])); } + push$f(elements, toString_1(rawTemplate[i++])); + if (i === literalSegments) { return join$5(elements, ''); } + if (i < argumentsLength) { push$f(elements, toString_1(arguments$1[i])); } } } }); @@ -7202,8 +7930,8 @@ var doric = (function (exports) { }); var floor$3 = Math.floor; - var charAt$6 = functionUncurryThis(''.charAt); - var replace$4 = functionUncurryThis(''.replace); + var charAt$8 = functionUncurryThis(''.charAt); + var replace$5 = functionUncurryThis(''.replace); var stringSlice$9 = functionUncurryThis(''.slice); var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; @@ -7218,9 +7946,9 @@ var doric = (function (exports) { namedCaptures = toObject(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } - return replace$4(replacement, symbols, function (match, ch) { + return replace$5(replacement, symbols, function (match, ch) { var capture; - switch (charAt$6(ch, 0)) { + switch (charAt$8(ch, 0)) { case '$': return '$'; case '&': return matched; case '`': return stringSlice$9(str, 0, position); @@ -7234,7 +7962,7 @@ var doric = (function (exports) { if (n > m) { var f = floor$3(n / 10); if (f === 0) { return match; } - if (f <= m) { return captures[f - 1] === undefined ? charAt$6(ch, 1) : captures[f - 1] + charAt$6(ch, 1); } + if (f <= m) { return captures[f - 1] === undefined ? charAt$8(ch, 1) : captures[f - 1] + charAt$8(ch, 1); } return match; } capture = captures[n - 1]; @@ -7244,10 +7972,10 @@ var doric = (function (exports) { }; var REPLACE$1 = wellKnownSymbol('replace'); - var max$3 = Math.max; - var min$4 = Math.min; + var max$5 = Math.max; + var min$6 = Math.min; var concat$1 = functionUncurryThis([].concat); - var push$b = functionUncurryThis([].push); + var push$e = functionUncurryThis([].push); var stringIndexOf$1 = functionUncurryThis(''.indexOf); var stringSlice$8 = functionUncurryThis(''.slice); @@ -7323,7 +8051,7 @@ var doric = (function (exports) { var result = regexpExecAbstract(rx, S); if (result === null) { break; } - push$b(results, result); + push$e(results, result); if (!global) { break; } var matchStr = toString_1(result[0]); @@ -7336,18 +8064,18 @@ var doric = (function (exports) { result = results[i]; var matched = toString_1(result[0]); - var position = max$3(min$4(toIntegerOrInfinity(result.index), S.length), 0); + var position = max$5(min$6(toIntegerOrInfinity(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. - for (var j = 1; j < result.length; j++) { push$b(captures, maybeToString(result[j])); } + for (var j = 1; j < result.length; j++) { push$e(captures, maybeToString(result[j])); } var namedCaptures = result.groups; if (functionalReplace) { var replacerArgs = concat$1([matched], captures, position, S); - if (namedCaptures !== undefined) { push$b(replacerArgs, namedCaptures); } + if (namedCaptures !== undefined) { push$e(replacerArgs, namedCaptures); } var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs)); } else { replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); @@ -7363,13 +8091,11 @@ var doric = (function (exports) { }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); var REPLACE = wellKnownSymbol('replace'); - var RegExpPrototype = RegExp.prototype; - var TypeError$f = global_1.TypeError; - var getFlags = functionUncurryThis(regexpFlags); + var $TypeError$d = TypeError; var indexOf = functionUncurryThis(''.indexOf); functionUncurryThis(''.replace); var stringSlice$7 = functionUncurryThis(''.slice); - var max$2 = Math.max; + var max$4 = Math.max; var stringIndexOf = function (string, searchValue, fromIndex) { if (fromIndex > string.length) { return -1; } @@ -7389,11 +8115,8 @@ var doric = (function (exports) { if (searchValue != null) { IS_REG_EXP = isRegexp(searchValue); if (IS_REG_EXP) { - flags = toString_1(requireObjectCoercible('flags' in RegExpPrototype - ? searchValue.flags - : getFlags(searchValue) - )); - if (!~indexOf(flags, 'g')) { throw TypeError$f('`.replaceAll` does not allow non-global regexes'); } + flags = toString_1(requireObjectCoercible(regexpGetFlags(searchValue))); + if (!~indexOf(flags, 'g')) { throw $TypeError$d('`.replaceAll` does not allow non-global regexes'); } } replacer = getMethod(searchValue, REPLACE); if (replacer) { @@ -7405,7 +8128,7 @@ var doric = (function (exports) { functionalReplace = isCallable(replaceValue); if (!functionalReplace) { replaceValue = toString_1(replaceValue); } searchLength = searchString.length; - advanceBy = max$2(1, searchLength); + advanceBy = max$4(1, searchLength); position = stringIndexOf(string, searchString, 0); while (position !== -1) { replacement = functionalReplace @@ -7452,10 +8175,10 @@ var doric = (function (exports) { var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y; var MAX_UINT32 = 0xFFFFFFFF; - var min$3 = Math.min; + var min$5 = Math.min; var $push = [].push; - var exec$4 = functionUncurryThis(/./.exec); - var push$a = functionUncurryThis($push); + var exec$6 = functionUncurryThis(/./.exec); + var push$d = functionUncurryThis($push); var stringSlice$6 = functionUncurryThis(''.slice); // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec @@ -7504,8 +8227,8 @@ var doric = (function (exports) { while (match = functionCall(regexpExec, separatorCopy, string)) { lastIndex = separatorCopy.lastIndex; if (lastIndex > lastLastIndex) { - push$a(output, stringSlice$6(string, lastLastIndex, match.index)); - if (match.length > 1 && match.index < string.length) { functionApply($push, output, arraySlice$1(match, 1)); } + push$d(output, stringSlice$6(string, lastLastIndex, match.index)); + if (match.length > 1 && match.index < string.length) { functionApply($push, output, arraySliceSimple(match, 1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= lim) { break; } @@ -7513,9 +8236,9 @@ var doric = (function (exports) { if (separatorCopy.lastIndex === match.index) { separatorCopy.lastIndex++; } // Avoid an infinite loop } if (lastLastIndex === string.length) { - if (lastLength || !exec$4(separatorCopy, '')) { push$a(output, ''); } - } else { push$a(output, stringSlice$6(string, lastLastIndex)); } - return output.length > lim ? arraySlice$1(output, 0, lim) : output; + if (lastLength || !exec$6(separatorCopy, '')) { push$d(output, ''); } + } else { push$d(output, stringSlice$6(string, lastLastIndex)); } + return output.length > lim ? arraySliceSimple(output, 0, lim) : output; }; // Chakra, V8 } else if ('0'.split(undefined, 0).length) { @@ -7569,26 +8292,26 @@ var doric = (function (exports) { var e; if ( z === null || - (e = min$3(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p + (e = min$5(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { - push$a(A, stringSlice$6(S, p, q)); + push$d(A, stringSlice$6(S, p, q)); if (A.length === lim) { return A; } for (var i = 1; i <= z.length - 1; i++) { - push$a(A, z[i]); + push$d(A, z[i]); if (A.length === lim) { return A; } } q = p = e; } } - push$a(A, stringSlice$6(S, p)); + push$d(A, stringSlice$6(S, p)); return A; } ]; }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); - var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; @@ -7596,15 +8319,15 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-string-prototype-startswith -- safe + // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe var un$StartsWith = functionUncurryThis(''.startsWith); var stringSlice$5 = functionUncurryThis(''.slice); - var min$2 = Math.min; + var min$4 = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () { - var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); + var descriptor = getOwnPropertyDescriptor$2(String.prototype, 'startsWith'); return descriptor && !descriptor.writable; }(); @@ -7614,7 +8337,7 @@ var doric = (function (exports) { startsWith: function startsWith(searchString /* , position = 0 */) { var that = toString_1(requireObjectCoercible(this)); notARegexp(searchString); - var index = toLength(min$2(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var index = toLength(min$4(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = toString_1(searchString); return un$StartsWith ? un$StartsWith(that, search, index) @@ -7623,30 +8346,30 @@ var doric = (function (exports) { }); var stringSlice$4 = functionUncurryThis(''.slice); - var max$1 = Math.max; - var min$1 = Math.min; + var max$3 = Math.max; + var min$3 = Math.min; - // eslint-disable-next-line unicorn/prefer-string-slice -- required for testing - var FORCED$8 = !''.substr || 'ab'.substr(-1) !== 'b'; + // eslint-disable-next-line unicorn/prefer-string-slice, es-x/no-string-prototype-substr -- required for testing + var FORCED$3 = !''.substr || 'ab'.substr(-1) !== 'b'; // `String.prototype.substr` method // https://tc39.es/ecma262/#sec-string.prototype.substr - _export({ target: 'String', proto: true, forced: FORCED$8 }, { + _export({ target: 'String', proto: true, forced: FORCED$3 }, { substr: function substr(start, length) { var that = toString_1(requireObjectCoercible(this)); var size = that.length; var intStart = toIntegerOrInfinity(start); var intLength, intEnd; if (intStart === Infinity) { intStart = 0; } - if (intStart < 0) { intStart = max$1(size + intStart, 0); } + if (intStart < 0) { intStart = max$3(size + intStart, 0); } intLength = length === undefined ? size : toIntegerOrInfinity(length); if (intLength <= 0 || intLength === Infinity) { return ''; } - intEnd = min$1(intStart + intLength, size); + intEnd = min$3(intStart + intLength, size); return intStart >= intEnd ? '' : stringSlice$4(that, intStart, intEnd); } }); - var PROPER_FUNCTION_NAME$1 = functionName.PROPER; + var PROPER_FUNCTION_NAME = functionName.PROPER; @@ -7656,9 +8379,9 @@ var doric = (function (exports) { // of whitespaces and has a correct name var stringTrimForced = function (METHOD_NAME) { return fails(function () { - return !!whitespaces[METHOD_NAME]() + return !!whitespaces$1[METHOD_NAME]() || non[METHOD_NAME]() !== non - || (PROPER_FUNCTION_NAME$1 && whitespaces[METHOD_NAME].name !== METHOD_NAME); + || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME); }); }; @@ -7676,48 +8399,72 @@ var doric = (function (exports) { var $trimEnd = stringTrim.end; - var FORCED$7 = stringTrimForced('trimEnd'); - - var trimEnd = FORCED$7 ? function trimEnd() { + // `String.prototype.{ trimEnd, trimRight }` method + // https://tc39.es/ecma262/#sec-string.prototype.trimend + // https://tc39.es/ecma262/#String.prototype.trimright + var stringTrimEnd = stringTrimForced('trimEnd') ? function trimEnd() { return $trimEnd(this); - // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe } : ''.trimEnd; - // `String.prototype.{ trimEnd, trimRight }` methods + // `String.prototype.trimRight` method // https://tc39.es/ecma262/#sec-string.prototype.trimend - // https://tc39.es/ecma262/#String.prototype.trimright - _export({ target: 'String', proto: true, name: 'trimEnd', forced: FORCED$7 }, { - trimEnd: trimEnd, - trimRight: trimEnd + // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe + _export({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimRight !== stringTrimEnd }, { + trimRight: stringTrimEnd }); - var $trimStart = stringTrim.start; + // TODO: Remove this line from `core-js@4` - var FORCED$6 = stringTrimForced('trimStart'); - var trimStart = FORCED$6 ? function trimStart() { - return $trimStart(this); - // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe - } : ''.trimStart; - // `String.prototype.{ trimStart, trimLeft }` methods - // https://tc39.es/ecma262/#sec-string.prototype.trimstart + // `String.prototype.trimEnd` method + // https://tc39.es/ecma262/#sec-string.prototype.trimend + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + _export({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimEnd !== stringTrimEnd }, { + trimEnd: stringTrimEnd + }); + + var $trimStart = stringTrim.start; + + + // `String.prototype.{ trimStart, trimLeft }` method + // https://tc39.es/ecma262/#sec-string.prototype.trimstart // https://tc39.es/ecma262/#String.prototype.trimleft - _export({ target: 'String', proto: true, name: 'trimStart', forced: FORCED$6 }, { - trimStart: trimStart, - trimLeft: trimStart + var stringTrimStart = stringTrimForced('trimStart') ? function trimStart() { + return $trimStart(this); + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + } : ''.trimStart; + + // `String.prototype.trimLeft` method + // https://tc39.es/ecma262/#sec-string.prototype.trimleft + // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe + _export({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimLeft !== stringTrimStart }, { + trimLeft: stringTrimStart + }); + + // TODO: Remove this line from `core-js@4` + + + + + // `String.prototype.trimStart` method + // https://tc39.es/ecma262/#sec-string.prototype.trimstart + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + _export({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !== stringTrimStart }, { + trimStart: stringTrimStart }); var quot = /"/g; - var replace$3 = functionUncurryThis(''.replace); + var replace$4 = functionUncurryThis(''.replace); // `CreateHTML` abstract operation // https://tc39.es/ecma262/#sec-createhtml var createHtml = function (string, tag, attribute, value) { var S = toString_1(requireObjectCoercible(string)); var p1 = '<' + tag; - if (attribute !== '') { p1 += ' ' + attribute + '="' + replace$3(toString_1(value), quot, '"') + '"'; } + if (attribute !== '') { p1 += ' ' + attribute + '="' + replace$4(toString_1(value), quot, '"') + '"'; } return p1 + '>' + S + ''; }; @@ -7841,35 +8588,35 @@ var doric = (function (exports) { var NATIVE_ARRAY_BUFFER_VIEWS = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; var ArrayBuffer$1 = global_1.ArrayBuffer; - var Int8Array$2 = global_1.Int8Array; + var Int8Array$3 = global_1.Int8Array; var typedArrayConstructorsRequireWrappers = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { - Int8Array$2(1); + Int8Array$3(1); }) || !fails(function () { - new Int8Array$2(-1); + new Int8Array$3(-1); }) || !checkCorrectnessOfIteration(function (iterable) { - new Int8Array$2(); - new Int8Array$2(null); - new Int8Array$2(1.5); - new Int8Array$2(iterable); + new Int8Array$3(); + new Int8Array$3(null); + new Int8Array$3(1.5); + new Int8Array$3(iterable); }, true) || fails(function () { // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill - return new Int8Array$2(new ArrayBuffer$1(2), 1, undefined).length !== 1; + return new Int8Array$3(new ArrayBuffer$1(2), 1, undefined).length !== 1; }); - var RangeError$5 = global_1.RangeError; + var $RangeError$6 = RangeError; var toPositiveInteger = function (it) { var result = toIntegerOrInfinity(it); - if (result < 0) { throw RangeError$5("The argument can't be less than 0"); } + if (result < 0) { throw $RangeError$6("The argument can't be less than 0"); } return result; }; - var RangeError$4 = global_1.RangeError; + var $RangeError$5 = RangeError; var toOffset = function (it, BYTES) { var offset = toPositiveInteger(it); - if (offset % BYTES) { throw RangeError$4('Wrong offset'); } + if (offset % BYTES) { throw $RangeError$5('Wrong offset'); } return offset; }; @@ -7936,6 +8683,7 @@ var doric = (function (exports) { var getInternalState = internalState.get; var setInternalState = internalState.set; + var enforceInternalState = internalState.enforce; var nativeDefineProperty = objectDefineProperty.f; var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; var round = Math.round; @@ -7944,7 +8692,6 @@ var doric = (function (exports) { var ArrayBufferPrototype = ArrayBuffer.prototype; var DataView = arrayBuffer.DataView; var NATIVE_ARRAY_BUFFER_VIEWS = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; - var TYPED_ARRAY_CONSTRUCTOR = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; var TYPED_ARRAY_TAG = arrayBufferViewCore.TYPED_ARRAY_TAG; var TypedArray = arrayBufferViewCore.TypedArray; var TypedArrayPrototype = arrayBufferViewCore.TypedArrayPrototype; @@ -8121,17 +8868,17 @@ var doric = (function (exports) { createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor); } - createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor); + enforceInternalState(TypedArrayConstructorPrototype).TypedArrayConstructor = TypedArrayConstructor; if (TYPED_ARRAY_TAG) { createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME); } + var FORCED = TypedArrayConstructor != NativeTypedArrayConstructor; + exported[CONSTRUCTOR_NAME] = TypedArrayConstructor; - _export({ - global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS - }, exported); + _export({ global: true, constructor: true, forced: FORCED, sham: !NATIVE_ARRAY_BUFFER_VIEWS }, exported); if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) { createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES); @@ -8218,13 +8965,13 @@ var doric = (function (exports) { }; }); - var aTypedArray$s = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$t = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$w = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$x = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.at` method // https://github.com/tc39/proposal-relative-indexing-method - exportTypedArrayMethod$t('at', function at(index) { - var O = aTypedArray$s(this); + exportTypedArrayMethod$x('at', function at(index) { + var O = aTypedArray$w(this); var len = lengthOfArrayLike(O); var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; @@ -8232,57 +8979,73 @@ var doric = (function (exports) { }); var u$ArrayCopyWithin = functionUncurryThis(arrayCopyWithin); - var aTypedArray$r = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$s = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$v = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$w = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.copyWithin` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin - exportTypedArrayMethod$s('copyWithin', function copyWithin(target, start /* , end */) { - return u$ArrayCopyWithin(aTypedArray$r(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + exportTypedArrayMethod$w('copyWithin', function copyWithin(target, start /* , end */) { + return u$ArrayCopyWithin(aTypedArray$v(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); var $every$1 = arrayIteration.every; - var aTypedArray$q = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$r = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$u = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$v = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.every` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.every - exportTypedArrayMethod$r('every', function every(callbackfn /* , thisArg */) { - return $every$1(aTypedArray$q(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$v('every', function every(callbackfn /* , thisArg */) { + return $every$1(aTypedArray$u(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); - var aTypedArray$p = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$q = arrayBufferViewCore.exportTypedArrayMethod; + var $TypeError$c = TypeError; + + // `ToBigInt` abstract operation + // https://tc39.es/ecma262/#sec-tobigint + var toBigInt = function (argument) { + var prim = toPrimitive(argument, 'number'); + if (typeof prim == 'number') { throw $TypeError$c("Can't convert number to bigint"); } + // eslint-disable-next-line es-x/no-bigint -- safe + return BigInt(prim); + }; + + var aTypedArray$t = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$u = arrayBufferViewCore.exportTypedArrayMethod; + var slice$1 = functionUncurryThis(''.slice); + + // V8 ~ Chrome < 59, Safari < 14.1, FF < 55, Edge <=18 + var CONVERSION_BUG = fails(function () { + var count = 0; + // eslint-disable-next-line es-x/no-typed-arrays -- safe + new Int8Array(2).fill({ valueOf: function () { return count++; } }); + return count !== 1; + }); // `%TypedArray%.prototype.fill` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill - exportTypedArrayMethod$q('fill', function fill(value /* , start, end */) { + exportTypedArrayMethod$u('fill', function fill(value /* , start, end */) { var length = arguments.length; - return functionCall( - arrayFill, - aTypedArray$p(this), - value, - length > 1 ? arguments[1] : undefined, - length > 2 ? arguments[2] : undefined - ); - }); + aTypedArray$t(this); + var actualValue = slice$1(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value; + return functionCall(arrayFill, this, actualValue, length > 1 ? arguments[1] : undefined, length > 2 ? arguments[2] : undefined); + }, CONVERSION_BUG); var arrayFromConstructorAndList = function (Constructor, list) { var index = 0; - var length = list.length; + var length = lengthOfArrayLike(list); var result = new Constructor(length); while (length > index) { result[index] = list[index++]; } return result; }; - var TYPED_ARRAY_CONSTRUCTOR = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; var aTypedArrayConstructor$2 = arrayBufferViewCore.aTypedArrayConstructor; + var getTypedArrayConstructor$4 = arrayBufferViewCore.getTypedArrayConstructor; // a part of `TypedArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#typedarray-species-create var typedArraySpeciesConstructor = function (originalArray) { - return aTypedArrayConstructor$2(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR])); + return aTypedArrayConstructor$2(speciesConstructor(originalArray, getTypedArrayConstructor$4(originalArray))); }; var typedArrayFromSpeciesAndList = function (instance, list) { @@ -8292,47 +9055,69 @@ var doric = (function (exports) { var $filter = arrayIteration.filter; - var aTypedArray$o = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$p = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$s = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$t = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filter` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter - exportTypedArrayMethod$p('filter', function filter(callbackfn /* , thisArg */) { - var list = $filter(aTypedArray$o(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$t('filter', function filter(callbackfn /* , thisArg */) { + var list = $filter(aTypedArray$s(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return typedArrayFromSpeciesAndList(this, list); }); var $find$1 = arrayIteration.find; - var aTypedArray$n = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$o = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$r = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$s = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.find` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.find - exportTypedArrayMethod$o('find', function find(predicate /* , thisArg */) { - return $find$1(aTypedArray$n(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$s('find', function find(predicate /* , thisArg */) { + return $find$1(aTypedArray$r(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); var $findIndex = arrayIteration.findIndex; - var aTypedArray$m = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$n = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$q = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$r = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findIndex` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex - exportTypedArrayMethod$n('findIndex', function findIndex(predicate /* , thisArg */) { - return $findIndex(aTypedArray$m(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$r('findIndex', function findIndex(predicate /* , thisArg */) { + return $findIndex(aTypedArray$q(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }); + + var $findLast = arrayIterationFromLast.findLast; + + var aTypedArray$p = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$q = arrayBufferViewCore.exportTypedArrayMethod; + + // `%TypedArray%.prototype.findLast` method + // https://github.com/tc39/proposal-array-find-from-last + exportTypedArrayMethod$q('findLast', function findLast(predicate /* , thisArg */) { + return $findLast(aTypedArray$p(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }); + + var $findLastIndex = arrayIterationFromLast.findLastIndex; + + var aTypedArray$o = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$p = arrayBufferViewCore.exportTypedArrayMethod; + + // `%TypedArray%.prototype.findLastIndex` method + // https://github.com/tc39/proposal-array-find-from-last + exportTypedArrayMethod$p('findLastIndex', function findLastIndex(predicate /* , thisArg */) { + return $findLastIndex(aTypedArray$o(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); var $forEach$1 = arrayIteration.forEach; - var aTypedArray$l = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$m = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$n = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$o = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.forEach` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach - exportTypedArrayMethod$m('forEach', function forEach(callbackfn /* , thisArg */) { - $forEach$1(aTypedArray$l(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$o('forEach', function forEach(callbackfn /* , thisArg */) { + $forEach$1(aTypedArray$n(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); var exportTypedArrayStaticMethod$2 = arrayBufferViewCore.exportTypedArrayStaticMethod; @@ -8344,93 +9129,95 @@ var doric = (function (exports) { var $includes = arrayIncludes.includes; - var aTypedArray$k = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$l = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$m = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$n = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.includes` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes - exportTypedArrayMethod$l('includes', function includes(searchElement /* , fromIndex */) { - return $includes(aTypedArray$k(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$n('includes', function includes(searchElement /* , fromIndex */) { + return $includes(aTypedArray$m(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); var $indexOf = arrayIncludes.indexOf; - var aTypedArray$j = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$k = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$l = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$m = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.indexOf` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof - exportTypedArrayMethod$k('indexOf', function indexOf(searchElement /* , fromIndex */) { - return $indexOf(aTypedArray$j(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$m('indexOf', function indexOf(searchElement /* , fromIndex */) { + return $indexOf(aTypedArray$l(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); - var PROPER_FUNCTION_NAME = functionName.PROPER; - - - - var ITERATOR$3 = wellKnownSymbol('iterator'); var Uint8Array$2 = global_1.Uint8Array; var arrayValues = functionUncurryThis(es_array_iterator.values); var arrayKeys = functionUncurryThis(es_array_iterator.keys); var arrayEntries = functionUncurryThis(es_array_iterator.entries); - var aTypedArray$i = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$j = arrayBufferViewCore.exportTypedArrayMethod; - var nativeTypedArrayIterator = Uint8Array$2 && Uint8Array$2.prototype[ITERATOR$3]; + var aTypedArray$k = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$l = arrayBufferViewCore.exportTypedArrayMethod; + var TypedArrayPrototype = Uint8Array$2 && Uint8Array$2.prototype; + + var GENERIC = !fails(function () { + TypedArrayPrototype[ITERATOR$3].call([1]); + }); - var PROPER_ARRAY_VALUES_NAME = !!nativeTypedArrayIterator && nativeTypedArrayIterator.name === 'values'; + var ITERATOR_IS_VALUES = !!TypedArrayPrototype + && TypedArrayPrototype.values + && TypedArrayPrototype[ITERATOR$3] === TypedArrayPrototype.values + && TypedArrayPrototype.values.name === 'values'; var typedArrayValues = function values() { - return arrayValues(aTypedArray$i(this)); + return arrayValues(aTypedArray$k(this)); }; // `%TypedArray%.prototype.entries` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries - exportTypedArrayMethod$j('entries', function entries() { - return arrayEntries(aTypedArray$i(this)); - }); + exportTypedArrayMethod$l('entries', function entries() { + return arrayEntries(aTypedArray$k(this)); + }, GENERIC); // `%TypedArray%.prototype.keys` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys - exportTypedArrayMethod$j('keys', function keys() { - return arrayKeys(aTypedArray$i(this)); - }); + exportTypedArrayMethod$l('keys', function keys() { + return arrayKeys(aTypedArray$k(this)); + }, GENERIC); // `%TypedArray%.prototype.values` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values - exportTypedArrayMethod$j('values', typedArrayValues, PROPER_FUNCTION_NAME && !PROPER_ARRAY_VALUES_NAME); + exportTypedArrayMethod$l('values', typedArrayValues, GENERIC || !ITERATOR_IS_VALUES, { name: 'values' }); // `%TypedArray%.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator - exportTypedArrayMethod$j(ITERATOR$3, typedArrayValues, PROPER_FUNCTION_NAME && !PROPER_ARRAY_VALUES_NAME); + exportTypedArrayMethod$l(ITERATOR$3, typedArrayValues, GENERIC || !ITERATOR_IS_VALUES, { name: 'values' }); - var aTypedArray$h = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$i = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$j = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$k = arrayBufferViewCore.exportTypedArrayMethod; var $join = functionUncurryThis([].join); // `%TypedArray%.prototype.join` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join - exportTypedArrayMethod$i('join', function join(separator) { - return $join(aTypedArray$h(this), separator); + exportTypedArrayMethod$k('join', function join(separator) { + return $join(aTypedArray$j(this), separator); }); - var aTypedArray$g = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$h = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$i = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$j = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof - exportTypedArrayMethod$h('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { + exportTypedArrayMethod$j('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { var length = arguments.length; - return functionApply(arrayLastIndexOf, aTypedArray$g(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]); + return functionApply(arrayLastIndexOf, aTypedArray$i(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]); }); var $map = arrayIteration.map; - var aTypedArray$f = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$g = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$h = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$i = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.map` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.map - exportTypedArrayMethod$g('map', function map(mapfn /* , thisArg */) { - return $map(aTypedArray$f(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { + exportTypedArrayMethod$i('map', function map(mapfn /* , thisArg */) { + return $map(aTypedArray$h(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { return new (typedArraySpeciesConstructor(O))(length); }); }); @@ -8452,37 +9239,37 @@ var doric = (function (exports) { var $reduce = arrayReduce.left; - var aTypedArray$e = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$f = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$g = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$h = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduce` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce - exportTypedArrayMethod$f('reduce', function reduce(callbackfn /* , initialValue */) { + exportTypedArrayMethod$h('reduce', function reduce(callbackfn /* , initialValue */) { var length = arguments.length; - return $reduce(aTypedArray$e(this), callbackfn, length, length > 1 ? arguments[1] : undefined); + return $reduce(aTypedArray$g(this), callbackfn, length, length > 1 ? arguments[1] : undefined); }); var $reduceRight = arrayReduce.right; - var aTypedArray$d = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$f = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$g = arrayBufferViewCore.exportTypedArrayMethod; - // `%TypedArray%.prototype.reduceRicht` method + // `%TypedArray%.prototype.reduceRight` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright - exportTypedArrayMethod$e('reduceRight', function reduceRight(callbackfn /* , initialValue */) { + exportTypedArrayMethod$g('reduceRight', function reduceRight(callbackfn /* , initialValue */) { var length = arguments.length; - return $reduceRight(aTypedArray$d(this), callbackfn, length, length > 1 ? arguments[1] : undefined); + return $reduceRight(aTypedArray$f(this), callbackfn, length, length > 1 ? arguments[1] : undefined); }); - var aTypedArray$c = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$e = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$f = arrayBufferViewCore.exportTypedArrayMethod; var floor$2 = Math.floor; // `%TypedArray%.prototype.reverse` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse - exportTypedArrayMethod$d('reverse', function reverse() { + exportTypedArrayMethod$f('reverse', function reverse() { var that = this; - var length = aTypedArray$c(that).length; + var length = aTypedArray$e(that).length; var middle = floor$2(length / 2); var index = 0; var value; @@ -8493,62 +9280,75 @@ var doric = (function (exports) { } return that; }); - var RangeError$3 = global_1.RangeError; - var aTypedArray$b = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$c = arrayBufferViewCore.exportTypedArrayMethod; + var RangeError$2 = global_1.RangeError; + var Int8Array$2 = global_1.Int8Array; + var Int8ArrayPrototype = Int8Array$2 && Int8Array$2.prototype; + var $set = Int8ArrayPrototype && Int8ArrayPrototype.set; + var aTypedArray$d = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod; + + var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails(function () { + // eslint-disable-next-line es-x/no-typed-arrays -- required for testing + var array = new Uint8ClampedArray(2); + functionCall($set, array, { length: 1, 0: 3 }, 1); + return array[1] !== 3; + }); - var FORCED$5 = fails(function () { - // eslint-disable-next-line es/no-typed-arrays -- required for testing - new Int8Array(1).set({}); + // https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other + var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () { + var array = new Int8Array$2(2); + array.set(1); + array.set('2', 1); + return array[0] !== 0 || array[1] !== 2; }); // `%TypedArray%.prototype.set` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set - exportTypedArrayMethod$c('set', function set(arrayLike /* , offset */) { - aTypedArray$b(this); + exportTypedArrayMethod$e('set', function set(arrayLike /* , offset */) { + aTypedArray$d(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); - var length = this.length; var src = toObject(arrayLike); + if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) { return functionCall($set, this, src, offset); } + var length = this.length; var len = lengthOfArrayLike(src); var index = 0; - if (len + offset > length) { throw RangeError$3('Wrong length'); } + if (len + offset > length) { throw RangeError$2('Wrong length'); } while (index < len) { this[offset + index] = src[index++]; } - }, FORCED$5); + }, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG); - var aTypedArray$a = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$b = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$c = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod; - var FORCED$4 = fails(function () { - // eslint-disable-next-line es/no-typed-arrays -- required for testing + var FORCED$2 = fails(function () { + // eslint-disable-next-line es-x/no-typed-arrays -- required for testing new Int8Array(1).slice(); }); // `%TypedArray%.prototype.slice` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice - exportTypedArrayMethod$b('slice', function slice(start, end) { - var list = arraySlice$1(aTypedArray$a(this), start, end); + exportTypedArrayMethod$d('slice', function slice(start, end) { + var list = arraySlice$1(aTypedArray$c(this), start, end); var C = typedArraySpeciesConstructor(this); var index = 0; var length = list.length; var result = new C(length); while (length > index) { result[index] = list[index++]; } return result; - }, FORCED$4); + }, FORCED$2); var $some$1 = arrayIteration.some; - var aTypedArray$9 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$a = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$b = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$c = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.some` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.some - exportTypedArrayMethod$a('some', function some(callbackfn /* , thisArg */) { - return $some$1(aTypedArray$9(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$c('some', function some(callbackfn /* , thisArg */) { + return $some$1(aTypedArray$b(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); - var Array$3 = global_1.Array; - var aTypedArray$8 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$9 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$a = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$b = arrayBufferViewCore.exportTypedArrayMethod; var Uint16Array = global_1.Uint16Array; var un$Sort = Uint16Array && functionUncurryThis(Uint16Array.prototype.sort); @@ -8567,7 +9367,7 @@ var doric = (function (exports) { if (engineWebkitVersion) { return engineWebkitVersion < 602; } var array = new Uint16Array(516); - var expected = Array$3(516); + var expected = Array(516); var index, mod; for (index = 0; index < 516; index++) { @@ -8599,20 +9399,20 @@ var doric = (function (exports) { // `%TypedArray%.prototype.sort` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort - exportTypedArrayMethod$9('sort', function sort(comparefn) { + exportTypedArrayMethod$b('sort', function sort(comparefn) { if (comparefn !== undefined) { aCallable(comparefn); } if (STABLE_SORT) { return un$Sort(this, comparefn); } - return arraySort(aTypedArray$8(this), getSortCompare(comparefn)); + return arraySort(aTypedArray$a(this), getSortCompare(comparefn)); }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS); - var aTypedArray$7 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$9 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$a = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.subarray` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray - exportTypedArrayMethod$8('subarray', function subarray(begin, end) { - var O = aTypedArray$7(this); + exportTypedArrayMethod$a('subarray', function subarray(begin, end) { + var O = aTypedArray$9(this); var length = O.length; var beginIndex = toAbsoluteIndex(begin, length); var C = typedArraySpeciesConstructor(O); @@ -8624,8 +9424,8 @@ var doric = (function (exports) { }); var Int8Array$1 = global_1.Int8Array; - var aTypedArray$6 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$8 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$9 = arrayBufferViewCore.exportTypedArrayMethod; var $toLocaleString = [].toLocaleString; // iOS Safari 6.x fails here @@ -8633,7 +9433,7 @@ var doric = (function (exports) { $toLocaleString.call(new Int8Array$1(1)); }); - var FORCED$3 = fails(function () { + var FORCED$1 = fails(function () { return [1, 2].toLocaleString() != new Int8Array$1([1, 2]).toLocaleString(); }) || !fails(function () { Int8Array$1.prototype.toLocaleString.call([1, 2]); @@ -8641,15 +9441,15 @@ var doric = (function (exports) { // `%TypedArray%.prototype.toLocaleString` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring - exportTypedArrayMethod$7('toLocaleString', function toLocaleString() { + exportTypedArrayMethod$9('toLocaleString', function toLocaleString() { return functionApply( $toLocaleString, - TO_LOCALE_STRING_BUG ? arraySlice$1(aTypedArray$6(this)) : aTypedArray$6(this), + TO_LOCALE_STRING_BUG ? arraySlice$1(aTypedArray$8(this)) : aTypedArray$8(this), arraySlice$1(arguments) ); - }, FORCED$3); + }, FORCED$1); - var exportTypedArrayMethod$6 = arrayBufferViewCore.exportTypedArrayMethod; + var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod; @@ -8657,11 +9457,11 @@ var doric = (function (exports) { var Uint8Array$1 = global_1.Uint8Array; var Uint8ArrayPrototype = Uint8Array$1 && Uint8Array$1.prototype || {}; var arrayToString = [].toString; - var join$3 = functionUncurryThis([].join); + var join$4 = functionUncurryThis([].join); if (fails(function () { arrayToString.call({}); })) { arrayToString = function toString() { - return join$3(this); + return join$4(this); }; } @@ -8669,11 +9469,11 @@ var doric = (function (exports) { // `%TypedArray%.prototype.toString` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring - exportTypedArrayMethod$6('toString', arrayToString, IS_NOT_ARRAY_METHOD); + exportTypedArrayMethod$8('toString', arrayToString, IS_NOT_ARRAY_METHOD); - var fromCharCode$1 = String.fromCharCode; - var charAt$5 = functionUncurryThis(''.charAt); - var exec$3 = functionUncurryThis(/./.exec); + var fromCharCode$2 = String.fromCharCode; + var charAt$7 = functionUncurryThis(''.charAt); + var exec$5 = functionUncurryThis(/./.exec); var stringSlice$3 = functionUncurryThis(''.slice); var hex2 = /^[\da-f]{2}$/i; @@ -8689,19 +9489,19 @@ var doric = (function (exports) { var index = 0; var chr, part; while (index < length) { - chr = charAt$5(str, index++); + chr = charAt$7(str, index++); if (chr === '%') { - if (charAt$5(str, index) === 'u') { + if (charAt$7(str, index) === 'u') { part = stringSlice$3(str, index + 1, index + 5); - if (exec$3(hex4, part)) { - result += fromCharCode$1(parseInt(part, 16)); + if (exec$5(hex4, part)) { + result += fromCharCode$2(parseInt(part, 16)); index += 5; continue; } } else { part = stringSlice$3(str, index, index + 2); - if (exec$3(hex2, part)) { - result += fromCharCode$1(parseInt(part, 16)); + if (exec$5(hex2, part)) { + result += fromCharCode$2(parseInt(part, 16)); index += 2; continue; } @@ -8721,7 +9521,7 @@ var doric = (function (exports) { - var setInternalState$a = internalState.set; + var setInternalState$b = internalState.set; var internalStateGetterFor = internalState.getterFor; var find$1 = arrayIteration.find; var findIndex = arrayIteration.findIndex; @@ -8769,7 +9569,7 @@ var doric = (function (exports) { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); - setInternalState$a(that, { + setInternalState$b(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: undefined @@ -8789,7 +9589,7 @@ var doric = (function (exports) { return that; }; - redefineAll(Prototype, { + defineBuiltIns(Prototype, { // `{ WeakMap, WeakSet }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.delete // https://tc39.es/ecma262/#sec-weakset.prototype.delete @@ -8812,7 +9612,7 @@ var doric = (function (exports) { } }); - redefineAll(Prototype, IS_MAP ? { + defineBuiltIns(Prototype, IS_MAP ? { // `WeakMap.prototype.get(key)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.get get: function get(key) { @@ -8840,12 +9640,10 @@ var doric = (function (exports) { } }; - var enforceIternalState = internalState.enforce; + var enforceInternalState = internalState.enforce; var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1; - // eslint-disable-next-line es/no-object-isextensible -- safe - var isExtensible = Object.isExtensible; var InternalWeakMap; var wrapper = function (init) { @@ -8869,31 +9667,31 @@ var doric = (function (exports) { var nativeHas = functionUncurryThis(WeakMapPrototype.has); var nativeGet = functionUncurryThis(WeakMapPrototype.get); var nativeSet = functionUncurryThis(WeakMapPrototype.set); - redefineAll(WeakMapPrototype, { + defineBuiltIns(WeakMapPrototype, { 'delete': function (key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } return nativeDelete(this, key) || state.frozen['delete'](key); } return nativeDelete(this, key); }, has: function has(key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set(key, value) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else { nativeSet(this, key, value); } @@ -8929,7 +9727,7 @@ var doric = (function (exports) { if (!AsyncIteratorPrototype) { AsyncIteratorPrototype = {}; } if (!isCallable(AsyncIteratorPrototype[ASYNC_ITERATOR$3])) { - redefine(AsyncIteratorPrototype, ASYNC_ITERATOR$3, function () { + defineBuiltIn(AsyncIteratorPrototype, ASYNC_ITERATOR$3, function () { return this; }); } @@ -8938,8 +9736,9 @@ var doric = (function (exports) { var Promise$3 = getBuiltIn('Promise'); - var setInternalState$9 = internalState.set; - var getInternalState$7 = internalState.get; + var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator'; + var setInternalState$a = internalState.set; + var getInternalState$5 = internalState.getterFor(ASYNC_FROM_SYNC_ITERATOR); var asyncFromSyncIteratorContinuation = function (result, resolve, reject) { var done = result.done; @@ -8949,38 +9748,27 @@ var doric = (function (exports) { }; var AsyncFromSyncIterator = function AsyncIterator(iterator) { - setInternalState$9(this, { + setInternalState$a(this, { + type: ASYNC_FROM_SYNC_ITERATOR, iterator: anObject(iterator), next: iterator.next }); }; - AsyncFromSyncIterator.prototype = redefineAll(objectCreate(asyncIteratorPrototype), { - next: function next(arg) { - var state = getInternalState$7(this); - var hasArg = !!arguments.length; + AsyncFromSyncIterator.prototype = defineBuiltIns(objectCreate(asyncIteratorPrototype), { + next: function next() { + var state = getInternalState$5(this); return new Promise$3(function (resolve, reject) { - var result = anObject(functionApply(state.next, state.iterator, hasArg ? [arg] : [])); + var result = anObject(functionCall(state.next, state.iterator)); asyncFromSyncIteratorContinuation(result, resolve, reject); }); }, - 'return': function (arg) { - var iterator = getInternalState$7(this).iterator; - var hasArg = !!arguments.length; + 'return': function () { + var iterator = getInternalState$5(this).iterator; return new Promise$3(function (resolve, reject) { var $return = getMethod(iterator, 'return'); - if ($return === undefined) { return resolve({ done: true, value: arg }); } - var result = anObject(functionApply($return, iterator, hasArg ? [arg] : [])); - asyncFromSyncIteratorContinuation(result, resolve, reject); - }); - }, - 'throw': function (arg) { - var iterator = getInternalState$7(this).iterator; - var hasArg = !!arguments.length; - return new Promise$3(function (resolve, reject) { - var $throw = getMethod(iterator, 'throw'); - if ($throw === undefined) { return reject(arg); } - var result = anObject(functionApply($throw, iterator, hasArg ? [arg] : [])); + if ($return === undefined) { return resolve({ done: true, value: undefined }); } + var result = anObject(functionCall($return, iterator)); asyncFromSyncIteratorContinuation(result, resolve, reject); }); } @@ -8999,6 +9787,28 @@ var doric = (function (exports) { return global_1[CONSTRUCTOR].prototype; }; + var getIteratorDirect = function (obj) { + return { + iterator: obj, + next: aCallable(anObject(obj).next) + }; + }; + + var asyncIteratorClose = function (iterator, method, argument, reject) { + try { + var returnMethod = getMethod(iterator, 'return'); + if (returnMethod) { + return getBuiltIn('Promise').resolve(functionCall(returnMethod, iterator)).then(function () { + method(argument); + }, function (error) { + reject(error); + }); + } + } catch (error2) { + return reject(error2); + } method(argument); + }; + // https://github.com/tc39/proposal-iterator-helpers // https://github.com/tc39/proposal-array-from-async @@ -9008,47 +9818,31 @@ var doric = (function (exports) { - var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; - var TypeError$e = global_1.TypeError; - var createMethod$1 = function (TYPE) { + var createMethod = function (TYPE) { var IS_TO_ARRAY = TYPE == 0; var IS_FOR_EACH = TYPE == 1; var IS_EVERY = TYPE == 2; var IS_SOME = TYPE == 3; - return function (iterator, fn, target) { - anObject(iterator); + return function (object, fn, target) { + var record = getIteratorDirect(object); var Promise = getBuiltIn('Promise'); - var next = aCallable(iterator.next); + var iterator = record.iterator; + var next = record.next; var index = 0; var MAPPING = fn !== undefined; if (MAPPING || !IS_TO_ARRAY) { aCallable(fn); } return new Promise(function (resolve, reject) { - var closeIteration = function (method, argument) { - try { - var returnMethod = getMethod(iterator, 'return'); - if (returnMethod) { - return Promise.resolve(functionCall(returnMethod, iterator)).then(function () { - method(argument); - }, function (error) { - reject(error); - }); - } - } catch (error2) { - return reject(error2); - } method(argument); - }; - - var onError = function (error) { - closeIteration(reject, error); + var ifAbruptCloseAsyncIterator = function (error) { + asyncIteratorClose(iterator, reject, error, reject); }; var loop = function () { try { - if (IS_TO_ARRAY && (index > MAX_SAFE_INTEGER) && MAPPING) { - throw TypeError$e('The allowed number of iterations has been exceeded'); - } + if (IS_TO_ARRAY && MAPPING) { try { + doesNotExceedSafeInteger(index); + } catch (error5) { ifAbruptCloseAsyncIterator(error5); } } Promise.resolve(anObject(functionCall(next, iterator))).then(function (step) { try { if (anObject(step).done) { @@ -9058,27 +9852,31 @@ var doric = (function (exports) { } else { resolve(IS_SOME ? false : IS_EVERY || undefined); } } else { var value = step.value; - if (MAPPING) { - Promise.resolve(IS_TO_ARRAY ? fn(value, index) : fn(value)).then(function (result) { - if (IS_FOR_EACH) { - loop(); - } else if (IS_EVERY) { - result ? loop() : closeIteration(resolve, false); - } else if (IS_TO_ARRAY) { - target[index++] = result; - loop(); - } else { - result ? closeIteration(resolve, IS_SOME || value) : loop(); - } - }, onError); - } else { - target[index++] = value; - loop(); - } + try { + if (MAPPING) { + Promise.resolve(IS_TO_ARRAY ? fn(value, index) : fn(value)).then(function (result) { + if (IS_FOR_EACH) { + loop(); + } else if (IS_EVERY) { + result ? loop() : asyncIteratorClose(iterator, resolve, false, reject); + } else if (IS_TO_ARRAY) { + try { + target[index++] = result; + loop(); + } catch (error4) { ifAbruptCloseAsyncIterator(error4); } + } else { + result ? asyncIteratorClose(iterator, resolve, IS_SOME || value, reject) : loop(); + } + }, ifAbruptCloseAsyncIterator); + } else { + target[index++] = value; + loop(); + } + } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } - } catch (error) { onError(error); } - }, onError); - } catch (error2) { onError(error2); } + } catch (error2) { reject(error2); } + }, reject); + } catch (error) { reject(error); } }; loop(); @@ -9087,11 +9885,11 @@ var doric = (function (exports) { }; var asyncIteratorIteration = { - toArray: createMethod$1(0), - forEach: createMethod$1(1), - every: createMethod$1(2), - some: createMethod$1(3), - find: createMethod$1(4) + toArray: createMethod(0), + forEach: createMethod(1), + every: createMethod(2), + some: createMethod(3), + find: createMethod(4) }; var toArray = asyncIteratorIteration.toArray; @@ -9121,7 +9919,7 @@ var doric = (function (exports) { // `Array.fromAsync` method // https://github.com/tc39/proposal-array-from-async - _export({ target: 'Array', stat: true }, { + _export({ target: 'Array', stat: true, forced: true }, { fromAsync: arrayFromAsync }); @@ -9132,7 +9930,7 @@ var doric = (function (exports) { // `Array.prototype.filterOut` method // https://github.com/tc39/proposal-array-filtering - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: true }, { filterOut: function filterOut(callbackfn /* , thisArg */) { return $filterReject$3(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -9145,7 +9943,7 @@ var doric = (function (exports) { // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: true }, { filterReject: function filterReject(callbackfn /* , thisArg */) { return $filterReject$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -9153,66 +9951,10 @@ var doric = (function (exports) { addToUnscopables('filterReject'); - // `Array.prototype.{ findLast, findLastIndex }` methods implementation - var createMethod = function (TYPE) { - var IS_FIND_LAST_INDEX = TYPE == 1; - return function ($this, callbackfn, that) { - var O = toObject($this); - var self = indexedObject(O); - var boundFunction = functionBindContext(callbackfn, that); - var index = lengthOfArrayLike(self); - var value, result; - while (index-- > 0) { - value = self[index]; - result = boundFunction(value, index, O); - if (result) { switch (TYPE) { - case 0: return value; // findLast - case 1: return index; // findLastIndex - } } - } - return IS_FIND_LAST_INDEX ? -1 : undefined; - }; - }; - - var arrayIterationFromLast = { - // `Array.prototype.findLast` method - // https://github.com/tc39/proposal-array-find-from-last - findLast: createMethod(0), - // `Array.prototype.findLastIndex` method - // https://github.com/tc39/proposal-array-find-from-last - findLastIndex: createMethod(1) - }; - - var $findLast$1 = arrayIterationFromLast.findLast; - - - // `Array.prototype.findLast` method - // https://github.com/tc39/proposal-array-find-from-last - _export({ target: 'Array', proto: true }, { - findLast: function findLast(callbackfn /* , that = undefined */) { - return $findLast$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } - }); - - addToUnscopables('findLast'); - - var $findLastIndex$1 = arrayIterationFromLast.findLastIndex; - - - // `Array.prototype.findLastIndex` method - // https://github.com/tc39/proposal-array-find-from-last - _export({ target: 'Array', proto: true }, { - findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) { - return $findLastIndex$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } - }); - - addToUnscopables('findLastIndex'); - - var Array$2 = global_1.Array; - var push$9 = functionUncurryThis([].push); + var $Array$4 = Array; + var push$c = functionUncurryThis([].push); - var arrayGroupBy = function ($this, callbackfn, that, specificConstructor) { + var arrayGroup = function ($this, callbackfn, that, specificConstructor) { var O = toObject($this); var self = indexedObject(O); var boundFunction = functionBindContext(callbackfn, that); @@ -9225,34 +9967,101 @@ var doric = (function (exports) { key = toPropertyKey(boundFunction(value, index, O)); // in some IE10 builds, `hasOwnProperty` returns incorrect result on integer keys // but since it's a `null` prototype object, we can safely use `in` - if (key in target) { push$9(target[key], value); } + if (key in target) { push$c(target[key], value); } else { target[key] = [value]; } } + // TODO: Remove this block from `core-js@4` if (specificConstructor) { Constructor = specificConstructor(O); - if (Constructor !== Array$2) { + if (Constructor !== $Array$4) { for (key in target) { target[key] = arrayFromConstructorAndList(Constructor, target[key]); } } } return target; }; - // `Array.prototype.groupBy` method + // `Array.prototype.group` method // https://github.com/tc39/proposal-array-grouping _export({ target: 'Array', proto: true }, { - groupBy: function groupBy(callbackfn /* , thisArg */) { + group: function group(callbackfn /* , thisArg */) { var thisArg = arguments.length > 1 ? arguments[1] : undefined; - return arrayGroupBy(this, callbackfn, thisArg, arraySpeciesConstructor); + return arrayGroup(this, callbackfn, thisArg); } }); - addToUnscopables('groupBy'); + addToUnscopables('group'); - // eslint-disable-next-line es/no-object-isfrozen -- safe - var isFrozen = Object.isFrozen; + // TODO: Remove from `core-js@4` - var isFrozenStringArray = function (array, allowUndefined) { - if (!isFrozen || !isArray(array) || !isFrozen(array)) { return false; } - var index = 0; + + + + + // `Array.prototype.groupBy` method + // https://github.com/tc39/proposal-array-grouping + // https://bugs.webkit.org/show_bug.cgi?id=236541 + _export({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupBy') }, { + groupBy: function groupBy(callbackfn /* , thisArg */) { + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + return arrayGroup(this, callbackfn, thisArg); + } + }); + + addToUnscopables('groupBy'); + + var Map$5 = getBuiltIn('Map'); + var MapPrototype$2 = Map$5.prototype; + var mapGet$1 = functionUncurryThis(MapPrototype$2.get); + var mapHas$2 = functionUncurryThis(MapPrototype$2.has); + var mapSet$2 = functionUncurryThis(MapPrototype$2.set); + var push$b = functionUncurryThis([].push); + + // `Array.prototype.groupToMap` method + // https://github.com/tc39/proposal-array-grouping + var arrayGroupToMap = function groupToMap(callbackfn /* , thisArg */) { + var O = toObject(this); + var self = indexedObject(O); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var map = new Map$5(); + var length = lengthOfArrayLike(self); + var index = 0; + var key, value; + for (;length > index; index++) { + value = self[index]; + key = boundFunction(value, index, O); + if (mapHas$2(map, key)) { push$b(mapGet$1(map, key), value); } + else { mapSet$2(map, key, [value]); } + } return map; + }; + + // TODO: Remove from `core-js@4` + + + + + + // `Array.prototype.groupByToMap` method + // https://github.com/tc39/proposal-array-grouping + // https://bugs.webkit.org/show_bug.cgi?id=236541 + _export({ target: 'Array', proto: true, name: 'groupToMap', forced: !arrayMethodIsStrict('groupByToMap') }, { + groupByToMap: arrayGroupToMap + }); + + addToUnscopables('groupByToMap'); + + // `Array.prototype.groupToMap` method + // https://github.com/tc39/proposal-array-grouping + _export({ target: 'Array', proto: true }, { + groupToMap: arrayGroupToMap + }); + + addToUnscopables('groupToMap'); + + // eslint-disable-next-line es-x/no-object-isfrozen -- safe + var isFrozen = Object.isFrozen; + + var isFrozenStringArray = function (array, allowUndefined) { + if (!isFrozen || !isArray(array) || !isFrozen(array)) { return false; } + var index = 0; var length = array.length; var element; while (index < length) { @@ -9265,21 +10074,25 @@ var doric = (function (exports) { // `Array.isTemplateObject` method // https://github.com/tc39/proposal-array-is-template-object - _export({ target: 'Array', stat: true }, { + _export({ target: 'Array', stat: true, sham: true, forced: true }, { isTemplateObject: function isTemplateObject(value) { if (!isFrozenStringArray(value, true)) { return false; } var raw = value.raw; - if (raw.length !== value.length || !isFrozenStringArray(raw, false)) { return false; } - return true; + return raw.length === value.length && isFrozenStringArray(raw, false); } }); - var defineProperty$2 = objectDefineProperty.f; + // TODO: Remove from `core-js@4` + + + + + // `Array.prototype.lastIndex` getter // https://github.com/keithamus/proposal-array-last - if (descriptors && !('lastIndex' in [])) { - defineProperty$2(Array.prototype, 'lastIndex', { + if (descriptors) { + defineBuiltInAccessor(Array.prototype, 'lastIndex', { configurable: true, get: function lastIndex() { var O = toObject(this); @@ -9291,12 +10104,17 @@ var doric = (function (exports) { addToUnscopables('lastIndex'); } - var defineProperty$1 = objectDefineProperty.f; + // TODO: Remove from `core-js@4` + + + + + // `Array.prototype.lastIndex` accessor // https://github.com/keithamus/proposal-array-last - if (descriptors && !('lastItem' in [])) { - defineProperty$1(Array.prototype, 'lastItem', { + if (descriptors) { + defineBuiltInAccessor(Array.prototype, 'lastItem', { configurable: true, get: function lastItem() { var O = toObject(this); @@ -9313,12 +10131,88 @@ var doric = (function (exports) { addToUnscopables('lastItem'); } - var Map$3 = getBuiltIn('Map'); - var MapPrototype = Map$3.prototype; - var mapForEach = functionUncurryThis(MapPrototype.forEach); - var mapHas = functionUncurryThis(MapPrototype.has); - var mapSet = functionUncurryThis(MapPrototype.set); - var push$8 = functionUncurryThis([].push); + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed + var arrayToReversed = function (O, C) { + var len = lengthOfArrayLike(O); + var A = new C(len); + var k = 0; + for (; k < len; k++) { A[k] = O[len - k - 1]; } + return A; + }; + + var $Array$3 = Array; + + // `Array.prototype.toReversed` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed + _export({ target: 'Array', proto: true }, { + toReversed: function toReversed() { + return arrayToReversed(toIndexedObject(this), $Array$3); + } + }); + + addToUnscopables('toReversed'); + + var $Array$2 = Array; + var sort$1 = functionUncurryThis(entryVirtual('Array').sort); + + // `Array.prototype.toSorted` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted + _export({ target: 'Array', proto: true }, { + toSorted: function toSorted(compareFn) { + if (compareFn !== undefined) { aCallable(compareFn); } + var O = toIndexedObject(this); + var A = arrayFromConstructorAndList($Array$2, O); + return sort$1(A, compareFn); + } + }); + + addToUnscopables('toSorted'); + + var $Array$1 = Array; + var max$2 = Math.max; + var min$2 = Math.min; + + // `Array.prototype.toSpliced` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced + _export({ target: 'Array', proto: true }, { + toSpliced: function toSpliced(start, deleteCount /* , ...items */) { + var arguments$1 = arguments; + + var O = toIndexedObject(this); + var len = lengthOfArrayLike(O); + var actualStart = toAbsoluteIndex(start, len); + var argumentsLength = arguments.length; + var k = 0; + var insertCount, actualDeleteCount, newLen, A; + if (argumentsLength === 0) { + insertCount = actualDeleteCount = 0; + } else if (argumentsLength === 1) { + insertCount = 0; + actualDeleteCount = len - actualStart; + } else { + insertCount = argumentsLength - 2; + actualDeleteCount = min$2(max$2(toIntegerOrInfinity(deleteCount), 0), len - actualStart); + } + newLen = doesNotExceedSafeInteger(len + insertCount - actualDeleteCount); + A = $Array$1(newLen); + + for (; k < actualStart; k++) { A[k] = O[k]; } + for (; k < actualStart + insertCount; k++) { A[k] = arguments$1[k - actualStart + 2]; } + for (; k < newLen; k++) { A[k] = O[k + actualDeleteCount - insertCount]; } + + return A; + } + }); + + addToUnscopables('toSpliced'); + + var Map$4 = getBuiltIn('Map'); + var MapPrototype$1 = Map$4.prototype; + var mapForEach = functionUncurryThis(MapPrototype$1.forEach); + var mapHas$1 = functionUncurryThis(MapPrototype$1.has); + var mapSet$1 = functionUncurryThis(MapPrototype$1.set); + var push$a = functionUncurryThis([].push); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique @@ -9326,7 +10220,7 @@ var doric = (function (exports) { var that = toObject(this); var length = lengthOfArrayLike(that); var result = arraySpeciesCreate(that, 0); - var map = new Map$3(); + var map = new Map$4(); var resolverFunction = resolver != null ? aCallable(resolver) : function (value) { return value; }; @@ -9334,22 +10228,47 @@ var doric = (function (exports) { for (index = 0; index < length; index++) { item = that[index]; key = resolverFunction(item); - if (!mapHas(map, key)) { mapSet(map, key, item); } + if (!mapHas$1(map, key)) { mapSet$1(map, key, item); } } mapForEach(map, function (value) { - push$8(result, value); + push$a(result, value); }); return result; }; // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: true }, { uniqueBy: arrayUniqueBy$2 }); addToUnscopables('uniqueBy'); + var $RangeError$4 = RangeError; + + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with + var arrayWith = function (O, C, index, value) { + var len = lengthOfArrayLike(O); + var relativeIndex = toIntegerOrInfinity(index); + var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex; + if (actualIndex >= len || actualIndex < 0) { throw $RangeError$4('Incorrect index'); } + var A = new C(len); + var k = 0; + for (; k < len; k++) { A[k] = k === actualIndex ? value : O[k]; } + return A; + }; + + var $Array = Array; + + // `Array.prototype.with` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with + _export({ target: 'Array', proto: true }, { + 'with': function (index, value) { + return arrayWith(toIndexedObject(this), $Array, index, value); + } + }); + // https://github.com/tc39/proposal-iterator-helpers @@ -9375,67 +10294,121 @@ var doric = (function (exports) { createNonEnumerableProperty(asyncIteratorPrototype, 'constructor', AsyncIteratorConstructor); } - _export({ global: true, forced: isPure }, { + _export({ global: true, constructor: true, forced: isPure }, { AsyncIterator: AsyncIteratorConstructor }); var Promise$2 = getBuiltIn('Promise'); - var setInternalState$8 = internalState.set; - var getInternalState$6 = internalState.get; + var ASYNC_ITERATOR_HELPER = 'AsyncIteratorHelper'; + var WRAP_FOR_VALID_ASYNC_ITERATOR = 'WrapForValidAsyncIterator'; + var setInternalState$9 = internalState.set; var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag'); - var asyncIteratorCreateProxy = function (nextHandler, IS_ITERATOR) { - var AsyncIteratorProxy = function AsyncIterator(state) { - state.next = aCallable(state.iterator.next); - state.done = false; - state.ignoreArgument = !IS_ITERATOR; - setInternalState$8(this, state); + var createAsyncIteratorProxyPrototype = function (IS_ITERATOR) { + var IS_GENERATOR = !IS_ITERATOR; + var ASYNC_ITERATOR_PROXY = IS_ITERATOR ? WRAP_FOR_VALID_ASYNC_ITERATOR : ASYNC_ITERATOR_HELPER; + + var getInternalState = internalState.getterFor(ASYNC_ITERATOR_PROXY); + + var getStateOrEarlyExit = function (that) { + var stateCompletion = perform(function () { + return getInternalState(that); + }); + + var stateError = stateCompletion.error; + var state = stateCompletion.value; + + if (stateError || (IS_GENERATOR && state.done)) { + return { exit: true, value: stateError ? Promise$2.reject(state) : Promise$2.resolve({ done: true, value: undefined }) }; + } return { exit: false, value: state }; }; - AsyncIteratorProxy.prototype = redefineAll(objectCreate(asyncIteratorPrototype), { - next: function next(arg) { - var that = this; - var hasArgument = !!arguments.length; - return new Promise$2(function (resolve) { - var state = getInternalState$6(that); - var args = hasArgument ? [state.ignoreArgument ? undefined : arg] : IS_ITERATOR ? [] : [undefined]; - state.ignoreArgument = false; - resolve(state.done ? { done: true, value: undefined } : anObject(functionCall(nextHandler, state, Promise$2, args))); - }); - }, - 'return': function (value) { - var that = this; - return new Promise$2(function (resolve, reject) { - var state = getInternalState$6(that); - var iterator = state.iterator; - state.done = true; - var $$return = getMethod(iterator, 'return'); - if ($$return === undefined) { return resolve({ done: true, value: value }); } - Promise$2.resolve(functionCall($$return, iterator, value)).then(function (result) { - anObject(result); - resolve({ done: true, value: value }); - }, reject); + var enqueue = function (state, handler) { + var task = function () { + var promise = handler(); + if (IS_GENERATOR) { + state.awaiting = promise; + var clean = function () { + if (state.awaiting === promise) { state.awaiting = null; } + }; + promise.then(clean, clean); + } return promise; + }; + + return state.awaiting ? state.awaiting = state.awaiting.then(task, task) : task(); + }; + + var AsyncIteratorProxyPrototype = defineBuiltIns(objectCreate(asyncIteratorPrototype), { + next: function next() { + var stateCompletion = getStateOrEarlyExit(this); + var exit = stateCompletion.exit; + var state = stateCompletion.value; + + return exit ? state : enqueue(state, function () { + var handlerCompletion = perform(function () { + return anObject(state.nextHandler(Promise$2)); + }); + var handlerError = handlerCompletion.error; + var value = handlerCompletion.value; + if (handlerError) { state.done = true; } + return handlerError ? Promise$2.reject(value) : Promise$2.resolve(value); }); }, - 'throw': function (value) { - var that = this; - return new Promise$2(function (resolve, reject) { - var state = getInternalState$6(that); - var iterator = state.iterator; - state.done = true; - var $$throw = getMethod(iterator, 'throw'); - if ($$throw === undefined) { return reject(value); } - resolve(functionCall($$throw, iterator, value)); + 'return': function () { + var stateCompletion = getStateOrEarlyExit(this); + var exit = stateCompletion.exit; + var state = stateCompletion.value; + + return exit ? state : enqueue(state, function () { + return new Promise$2(function (resolve, reject) { + var iterator = state.iterator; + var innerIterator = state.innerIterator; + state.done = true; + if (innerIterator) { try { + iteratorClose(innerIterator, 'return'); + } catch (error) { + return iteratorClose(iterator, 'throw', error); + } } + var $$return = getMethod(iterator, 'return'); + if ($$return === undefined) { return resolve({ done: true, value: undefined }); } + Promise$2.resolve(functionCall($$return, iterator)).then(function (result) { + anObject(result); + resolve({ done: true, value: undefined }); + }, reject); + }); }); } }); - if (!IS_ITERATOR) { - createNonEnumerableProperty(AsyncIteratorProxy.prototype, TO_STRING_TAG$3, 'Generator'); + if (IS_GENERATOR) { + createNonEnumerableProperty(AsyncIteratorProxyPrototype, TO_STRING_TAG$3, 'Async Iterator Helper'); } + return AsyncIteratorProxyPrototype; + }; + + var AsyncIteratorHelperPrototype = createAsyncIteratorProxyPrototype(false); + var WrapForValidAsyncIteratorPrototype = createAsyncIteratorProxyPrototype(true); + + var asyncIteratorCreateProxy = function (nextHandler, IS_ITERATOR) { + var ASYNC_ITERATOR_PROXY = IS_ITERATOR ? WRAP_FOR_VALID_ASYNC_ITERATOR : ASYNC_ITERATOR_HELPER; + + var AsyncIteratorProxy = function AsyncIterator(record, state) { + if (state) { + state.iterator = record.iterator; + state.next = record.next; + } else { state = record; } + state.type = ASYNC_ITERATOR_PROXY; + state.nextHandler = nextHandler; + state.done = false; + state.awaiting = null; + setInternalState$9(this, state); + }; + + AsyncIteratorProxy.prototype = IS_ITERATOR ? WrapForValidAsyncIteratorPrototype : AsyncIteratorHelperPrototype; + return AsyncIteratorProxy; }; @@ -9445,28 +10418,45 @@ var doric = (function (exports) { - var AsyncIteratorProxy$6 = asyncIteratorCreateProxy(function (Promise, args) { + var AsyncIteratorProxy$5 = asyncIteratorCreateProxy(function (Promise) { var state = this; var iterator = state.iterator; - return Promise.resolve(anObject(functionApply(state.next, iterator, args))).then(function (step) { + return Promise.resolve(anObject(functionCall(state.next, iterator))).then(function (step) { if (anObject(step).done) { state.done = true; return { done: true, value: undefined }; } return { done: false, value: [state.index++, step.value] }; + }).then(null, function (error) { + state.done = true; + throw error; }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { - asIndexedPairs: function asIndexedPairs() { - return new AsyncIteratorProxy$6({ - iterator: anObject(this), - index: 0 - }); - } + var asyncIteratorIndexed = function indexed() { + return new AsyncIteratorProxy$5(getIteratorDirect(this), { + index: 0 + }); + }; + + // TODO: Remove from `core-js@4` + // https://github.com/tc39/proposal-iterator-helpers + + + + _export({ target: 'AsyncIterator', name: 'indexed', proto: true, real: true, forced: true }, { + asIndexedPairs: asyncIteratorIndexed }); + var $RangeError$3 = RangeError; + + var notANan = function (it) { + // eslint-disable-next-line no-self-compare -- NaN check + if (it === it) { return it; } + throw $RangeError$3('NaN is not allowed'); + }; + // https://github.com/tc39/proposal-iterator-helpers @@ -9474,15 +10464,20 @@ var doric = (function (exports) { - var AsyncIteratorProxy$5 = asyncIteratorCreateProxy(function (Promise, args) { + + + var AsyncIteratorProxy$4 = asyncIteratorCreateProxy(function (Promise) { var state = this; return new Promise(function (resolve, reject) { + var doneAndReject = function (error) { + state.done = true; + reject(error); + }; + var loop = function () { try { - Promise.resolve( - anObject(functionApply(state.next, state.iterator, state.remaining ? [] : args)) - ).then(function (step) { + Promise.resolve(anObject(functionCall(state.next, state.iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; @@ -9491,20 +10486,19 @@ var doric = (function (exports) { state.remaining--; loop(); } else { resolve({ done: false, value: step.value }); } - } catch (err) { reject(err); } - }, reject); - } catch (error) { reject(error); } + } catch (err) { doneAndReject(err); } + }, doneAndReject); + } catch (error) { doneAndReject(error); } }; loop(); }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { drop: function drop(limit) { - return new AsyncIteratorProxy$5({ - iterator: anObject(this), - remaining: toPositiveInteger(limit) + return new AsyncIteratorProxy$4(getIteratorDirect(this), { + remaining: toPositiveInteger(notANan(+limit)) }); } }); @@ -9513,7 +10507,7 @@ var doric = (function (exports) { var $every = asyncIteratorIteration.every; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { every: function every(fn) { return $every(this, fn); } @@ -9526,37 +10520,50 @@ var doric = (function (exports) { - var AsyncIteratorProxy$4 = asyncIteratorCreateProxy(function (Promise, args) { + + + var AsyncIteratorProxy$3 = asyncIteratorCreateProxy(function (Promise) { var state = this; + var iterator = state.iterator; var filterer = state.filterer; return new Promise(function (resolve, reject) { + var doneAndReject = function (error) { + state.done = true; + reject(error); + }; + + var ifAbruptCloseAsyncIterator = function (error) { + asyncIteratorClose(iterator, doneAndReject, error, doneAndReject); + }; + var loop = function () { try { - Promise.resolve(anObject(functionApply(state.next, state.iterator, args))).then(function (step) { + Promise.resolve(anObject(functionCall(state.next, iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve({ done: true, value: undefined }); } else { var value = step.value; - Promise.resolve(filterer(value)).then(function (selected) { - selected ? resolve({ done: false, value: value }) : loop(); - }, reject); + try { + Promise.resolve(filterer(value)).then(function (selected) { + selected ? resolve({ done: false, value: value }) : loop(); + }, ifAbruptCloseAsyncIterator); + } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } - } catch (err) { reject(err); } - }, reject); - } catch (error) { reject(error); } + } catch (error2) { doneAndReject(error2); } + }, doneAndReject); + } catch (error) { doneAndReject(error); } }; loop(); }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { filter: function filter(filterer) { - return new AsyncIteratorProxy$4({ - iterator: anObject(this), + return new AsyncIteratorProxy$3(getIteratorDirect(this), { filterer: aCallable(filterer) }); } @@ -9566,7 +10573,7 @@ var doric = (function (exports) { var $find = asyncIteratorIteration.find; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { find: function find(fn) { return $find(this, fn); } @@ -9580,31 +10587,46 @@ var doric = (function (exports) { - var AsyncIteratorProxy$3 = asyncIteratorCreateProxy(function (Promise) { + + + var AsyncIteratorProxy$2 = asyncIteratorCreateProxy(function (Promise) { var state = this; + var iterator = state.iterator; var mapper = state.mapper; var innerIterator; return new Promise(function (resolve, reject) { + var doneAndReject = function (error) { + state.done = true; + reject(error); + }; + + var ifAbruptCloseAsyncIterator = function (error) { + asyncIteratorClose(iterator, doneAndReject, error, doneAndReject); + }; + var outerLoop = function () { try { - Promise.resolve(anObject(functionCall(state.next, state.iterator))).then(function (step) { + Promise.resolve(anObject(functionCall(state.next, iterator))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve({ done: true, value: undefined }); } else { - Promise.resolve(mapper(step.value)).then(function (mapped) { - try { - state.innerIterator = innerIterator = getAsyncIterator(mapped); - state.innerNext = aCallable(innerIterator.next); - return innerLoop(); - } catch (error2) { reject(error2); } - }, reject); + var value = step.value; + try { + Promise.resolve(mapper(value)).then(function (mapped) { + try { + state.innerIterator = innerIterator = getAsyncIterator(mapped); + state.innerNext = aCallable(innerIterator.next); + innerLoop(); + } catch (error4) { ifAbruptCloseAsyncIterator(error4); } + }, ifAbruptCloseAsyncIterator); + } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } - } catch (error1) { reject(error1); } - }, reject); - } catch (error) { reject(error); } + } catch (error2) { doneAndReject(error2); } + }, doneAndReject); + } catch (error) { doneAndReject(error); } }; var innerLoop = function () { @@ -9616,9 +10638,9 @@ var doric = (function (exports) { state.innerIterator = state.innerNext = null; outerLoop(); } else { resolve({ done: false, value: result.value }); } - } catch (error1) { reject(error1); } - }, reject); - } catch (error) { reject(error); } + } catch (error1) { ifAbruptCloseAsyncIterator(error1); } + }, ifAbruptCloseAsyncIterator); + } catch (error) { ifAbruptCloseAsyncIterator(error); } } else { outerLoop(); } }; @@ -9626,10 +10648,9 @@ var doric = (function (exports) { }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { flatMap: function flatMap(mapper) { - return new AsyncIteratorProxy$3({ - iterator: anObject(this), + return new AsyncIteratorProxy$2(getIteratorDirect(this), { mapper: aCallable(mapper), innerIterator: null, innerNext: null @@ -9641,14 +10662,17 @@ var doric = (function (exports) { var $forEach = asyncIteratorIteration.forEach; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { forEach: function forEach(fn) { return $forEach(this, fn); } }); - // https://github.com/tc39/proposal-iterator-helpers + var asyncIteratorWrap = asyncIteratorCreateProxy(function () { + return functionCall(this.next, this.iterator); + }, true); + // https://github.com/tc39/proposal-iterator-helpers @@ -9664,11 +10688,7 @@ var doric = (function (exports) { var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); - var AsyncIteratorProxy$2 = asyncIteratorCreateProxy(function (Promise, args) { - return anObject(functionApply(this.next, this.iterator, args)); - }, true); - - _export({ target: 'AsyncIterator', stat: true }, { + _export({ target: 'AsyncIterator', stat: true, forced: true }, { from: function from(O) { var object = toObject(O); var usingIterator = getMethod(object, ASYNC_ITERATOR); @@ -9679,9 +10699,9 @@ var doric = (function (exports) { } if (iterator === undefined) { usingIterator = getIteratorMethod(object); - if (usingIterator) { return new asyncFromSyncIterator(getIterator(object, usingIterator)); } + if (usingIterator) { iterator = new asyncFromSyncIterator(getIterator(object, usingIterator)); } } - return new AsyncIteratorProxy$2({ iterator: iterator !== undefined ? iterator : object }); + return new asyncIteratorWrap(getIteratorDirect(iterator !== undefined ? iterator : object)); } }); @@ -9689,28 +10709,55 @@ var doric = (function (exports) { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { + indexed: asyncIteratorIndexed + }); + + // https://github.com/tc39/proposal-iterator-helpers + + + + + - var AsyncIteratorProxy$1 = asyncIteratorCreateProxy(function (Promise, args) { + var AsyncIteratorProxy$1 = asyncIteratorCreateProxy(function (Promise) { var state = this; + var iterator = state.iterator; var mapper = state.mapper; - return Promise.resolve(anObject(functionApply(state.next, state.iterator, args))).then(function (step) { - if (anObject(step).done) { + return new Promise(function (resolve, reject) { + var doneAndReject = function (error) { state.done = true; - return { done: true, value: undefined }; - } - return Promise.resolve(mapper(step.value)).then(function (value) { - return { done: false, value: value }; - }); + reject(error); + }; + + var ifAbruptCloseAsyncIterator = function (error) { + asyncIteratorClose(iterator, doneAndReject, error, doneAndReject); + }; + + Promise.resolve(anObject(functionCall(state.next, iterator))).then(function (step) { + try { + if (anObject(step).done) { + state.done = true; + resolve({ done: true, value: undefined }); + } else { + var value = step.value; + try { + Promise.resolve(mapper(value)).then(function (mapped) { + resolve({ done: false, value: mapped }); + }, ifAbruptCloseAsyncIterator); + } catch (error2) { ifAbruptCloseAsyncIterator(error2); } + } + } catch (error) { doneAndReject(error); } + }, doneAndReject); }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { map: function map(mapper) { - return new AsyncIteratorProxy$1({ - iterator: anObject(this), + return new AsyncIteratorProxy$1(getIteratorDirect(this), { mapper: aCallable(mapper) }); } @@ -9724,38 +10771,44 @@ var doric = (function (exports) { + var Promise$1 = getBuiltIn('Promise'); - var TypeError$d = global_1.TypeError; + var $TypeError$b = TypeError; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { reduce: function reduce(reducer /* , initialValue */) { - var iterator = anObject(this); - var next = aCallable(iterator.next); + var record = getIteratorDirect(this); + var iterator = record.iterator; + var next = record.next; var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; aCallable(reducer); return new Promise$1(function (resolve, reject) { + var ifAbruptCloseAsyncIterator = function (error) { + asyncIteratorClose(iterator, reject, error, reject); + }; + var loop = function () { try { Promise$1.resolve(anObject(functionCall(next, iterator))).then(function (step) { try { if (anObject(step).done) { - noInitial ? reject(TypeError$d('Reduce of empty iterator with no initial value')) : resolve(accumulator); + noInitial ? reject($TypeError$b('Reduce of empty iterator with no initial value')) : resolve(accumulator); } else { var value = step.value; if (noInitial) { noInitial = false; accumulator = value; loop(); - } else { + } else { try { Promise$1.resolve(reducer(accumulator, value)).then(function (result) { accumulator = result; loop(); - }, reject); - } + }, ifAbruptCloseAsyncIterator); + } catch (error3) { ifAbruptCloseAsyncIterator(error3); } } } - } catch (err) { reject(err); } + } catch (error2) { reject(error2); } }, reject); } catch (error) { reject(error); } }; @@ -9769,7 +10822,7 @@ var doric = (function (exports) { var $some = asyncIteratorIteration.some; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { some: function some(fn) { return $some(this, fn); } @@ -9783,27 +10836,37 @@ var doric = (function (exports) { - var AsyncIteratorProxy = asyncIteratorCreateProxy(function (Promise, args) { - var iterator = this.iterator; - var returnMethod, result; - if (!this.remaining--) { - result = { done: true, value: undefined }; - this.done = true; + + var AsyncIteratorProxy = asyncIteratorCreateProxy(function (Promise) { + var state = this; + var iterator = state.iterator; + var returnMethod; + + if (!state.remaining--) { + var resultDone = { done: true, value: undefined }; + state.done = true; returnMethod = iterator['return']; if (returnMethod !== undefined) { - return Promise.resolve(functionCall(returnMethod, iterator)).then(function () { - return result; + return Promise.resolve(functionCall(returnMethod, iterator, undefined)).then(function () { + return resultDone; }); } - return result; - } return functionApply(this.next, iterator, args); + return resultDone; + } return Promise.resolve(functionCall(state.next, iterator)).then(function (step) { + if (anObject(step).done) { + state.done = true; + return { done: true, value: undefined }; + } return { done: false, value: step.value }; + }).then(null, function (error) { + state.done = true; + throw error; + }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { take: function take(limit) { - return new AsyncIteratorProxy({ - iterator: anObject(this), - remaining: toPositiveInteger(limit) + return new AsyncIteratorProxy(getIteratorDirect(this), { + remaining: toPositiveInteger(notANan(+limit)) }); } }); @@ -9812,27 +10875,30 @@ var doric = (function (exports) { var $toArray = asyncIteratorIteration.toArray; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { toArray: function toArray() { return $toArray(this, undefined, []); } }); + var defineProperties = objectDefineProperties.f; + + var INCORRECT_RANGE = 'Incorrect Number.range arguments'; var NUMERIC_RANGE_ITERATOR = 'NumericRangeIterator'; - var setInternalState$7 = internalState.set; - var getInternalState$5 = internalState.getterFor(NUMERIC_RANGE_ITERATOR); + var setInternalState$8 = internalState.set; + var getInternalState$4 = internalState.getterFor(NUMERIC_RANGE_ITERATOR); - var RangeError$2 = global_1.RangeError; - var TypeError$c = global_1.TypeError; + var $RangeError$2 = RangeError; + var $TypeError$a = TypeError; var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) { if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) { - throw new TypeError$c(INCORRECT_RANGE); + throw new $TypeError$a(INCORRECT_RANGE); } if (start === Infinity || start === -Infinity) { - throw new RangeError$2(INCORRECT_RANGE); + throw new $RangeError$2(INCORRECT_RANGE); } var ifIncrease = end > start; var inclusiveEnd = false; @@ -9845,20 +10911,20 @@ var doric = (function (exports) { } else if (typeof option == type) { step = option; } else { - throw new TypeError$c(INCORRECT_RANGE); + throw new $TypeError$a(INCORRECT_RANGE); } if (step == null) { step = ifIncrease ? one : -one; } if (typeof step != type) { - throw new TypeError$c(INCORRECT_RANGE); + throw new $TypeError$a(INCORRECT_RANGE); } if (step === Infinity || step === -Infinity || (step === zero && start !== end)) { - throw new RangeError$2(INCORRECT_RANGE); + throw new $RangeError$2(INCORRECT_RANGE); } // eslint-disable-next-line no-self-compare -- NaN check var hitsEnd = start != start || end != end || step != step || (end > start) !== (step > zero); - setInternalState$7(this, { + setInternalState$8(this, { type: NUMERIC_RANGE_ITERATOR, start: start, end: end, @@ -9875,7 +10941,7 @@ var doric = (function (exports) { this.inclusive = inclusiveEnd; } }, NUMERIC_RANGE_ITERATOR, function next() { - var state = getInternalState$5(this); + var state = getInternalState$4(this); if (state.hitsEnd) { return { value: undefined, done: true }; } var start = state.start; var end = state.end; @@ -9899,32 +10965,32 @@ var doric = (function (exports) { }; if (descriptors) { - objectDefineProperties($RangeIterator.prototype, { + defineProperties($RangeIterator.prototype, { start: getter(function () { - return getInternalState$5(this).start; + return getInternalState$4(this).start; }), end: getter(function () { - return getInternalState$5(this).end; + return getInternalState$4(this).end; }), inclusive: getter(function () { - return getInternalState$5(this).inclusiveEnd; + return getInternalState$4(this).inclusiveEnd; }), step: getter(function () { - return getInternalState$5(this).step; + return getInternalState$4(this).step; }) }); } var numericRangeIterator = $RangeIterator; - /* eslint-disable es/no-bigint -- safe */ + /* eslint-disable es-x/no-bigint -- safe */ // `BigInt.range` method // https://github.com/tc39/proposal-Number.range if (typeof BigInt == 'function') { - _export({ target: 'BigInt', stat: true }, { + _export({ target: 'BigInt', stat: true, forced: true }, { range: function range(start, end, option) { return new numericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1)); } @@ -9938,10 +11004,9 @@ var doric = (function (exports) { - - var Object$2 = global_1.Object; - var TypeError$b = global_1.TypeError; - var Map$2 = getBuiltIn('Map'); + var $Object$1 = Object; + var $TypeError$9 = TypeError; + var Map$3 = getBuiltIn('Map'); var WeakMap$2 = getBuiltIn('WeakMap'); var Node = function () { @@ -9960,7 +11025,7 @@ var doric = (function (exports) { Node.prototype.next = function (i, it, IS_OBJECT) { var store = IS_OBJECT ? this.objectsByIndex[i] || (this.objectsByIndex[i] = new WeakMap$2()) - : this.primitives || (this.primitives = new Map$2()); + : this.primitives || (this.primitives = new Map$3()); var entry = store.get(it); if (!entry) { store.set(it, entry = new Node()); } return entry; @@ -9978,13 +11043,13 @@ var doric = (function (exports) { for (i = 0; i < length; i++) { if (isObject(it = arguments$1[i])) { active = active.next(i, it, true); } } - if (this === Object$2 && active === root) { throw TypeError$b('Composite keys must contain a non-primitive component'); } + if (this === $Object$1 && active === root) { throw $TypeError$9('Composite keys must contain a non-primitive component'); } for (i = 0; i < length; i++) { if (!isObject(it = arguments$1[i])) { active = active.next(i, it, false); } } return active; }; - var Object$1 = global_1.Object; + var $Object = Object; var initializer = function () { var freeze = getBuiltIn('Object', 'freeze'); @@ -9992,23 +11057,60 @@ var doric = (function (exports) { }; // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey - _export({ global: true }, { + _export({ global: true, forced: true }, { compositeKey: function compositeKey$1() { - return functionApply(compositeKey, Object$1, arguments).get('object', initializer); + return functionApply(compositeKey, $Object, arguments).get('object', initializer); } }); // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey - _export({ global: true }, { + _export({ global: true, forced: true }, { compositeSymbol: function compositeSymbol() { if (arguments.length == 1 && typeof arguments[0] == 'string') { return getBuiltIn('Symbol')['for'](arguments[0]); } return functionApply(compositeKey, null, arguments).get('symbol', getBuiltIn('Symbol')); } }); - // https://github.com/tc39/proposal-iterator-helpers - - + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + var classRegExp = /^\s*class\b/; + var exec$4 = functionUncurryThis(classRegExp.exec); + + var isClassConstructor = function (argument) { + try { + // `Function#toString` throws on some built-it function in some legacy engines + // (for example, `DOMQuad` and similar in FF41-) + if (!descriptors || !exec$4(classRegExp, inspectSource(argument))) { return false; } + } catch (error) { /* empty */ } + var prototype = getOwnPropertyDescriptor$1(argument, 'prototype'); + return !!prototype && hasOwnProperty_1(prototype, 'writable') && !prototype.writable; + }; + + // `Function.isCallable` method + // https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md + _export({ target: 'Function', stat: true, sham: true, forced: true }, { + isCallable: function isCallable$1(argument) { + return isCallable(argument) && !isClassConstructor(argument); + } + }); + + // `Function.isConstructor` method + // https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md + _export({ target: 'Function', stat: true, forced: true }, { + isConstructor: isConstructor + }); + + // `Function.prototype.unThis` method + // https://github.com/js-choi/proposal-function-un-this + _export({ target: 'Function', proto: true, forced: true }, { + unThis: function unThis() { + return functionUncurryThis(aCallable(this)); + } + }); + + // https://github.com/tc39/proposal-iterator-helpers + + @@ -10023,7 +11125,7 @@ var doric = (function (exports) { var NativeIterator = global_1.Iterator; // FF56- have non-standard global helper `Iterator` - var FORCED$2 = !isCallable(NativeIterator) + var FORCED = !isCallable(NativeIterator) || NativeIterator.prototype !== IteratorPrototype$2 // FF44- non-standard `Iterator` passes previous tests || !fails(function () { NativeIterator({}); }); @@ -10036,60 +11138,86 @@ var doric = (function (exports) { createNonEnumerableProperty(IteratorPrototype$2, TO_STRING_TAG$2, 'Iterator'); } - if (FORCED$2 || !hasOwnProperty_1(IteratorPrototype$2, 'constructor') || IteratorPrototype$2.constructor === Object) { + if (FORCED || !hasOwnProperty_1(IteratorPrototype$2, 'constructor') || IteratorPrototype$2.constructor === Object) { createNonEnumerableProperty(IteratorPrototype$2, 'constructor', IteratorConstructor); } IteratorConstructor.prototype = IteratorPrototype$2; - _export({ global: true, forced: FORCED$2 }, { + _export({ global: true, constructor: true, forced: FORCED }, { Iterator: IteratorConstructor }); var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; - var setInternalState$6 = internalState.set; - var getInternalState$4 = internalState.get; + + var ITERATOR_HELPER = 'IteratorHelper'; + var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator'; + var setInternalState$7 = internalState.set; var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); - var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) { - var IteratorProxy = function Iterator(state) { - state.next = aCallable(state.iterator.next); - state.done = false; - state.ignoreArg = !IS_ITERATOR; - setInternalState$6(this, state); - }; + var createIteratorProxyPrototype = function (IS_ITERATOR) { + var ITERATOR_PROXY = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER; - IteratorProxy.prototype = redefineAll(objectCreate(IteratorPrototype$1), { - next: function next(arg) { - var state = getInternalState$4(this); - var args = arguments.length ? [state.ignoreArg ? undefined : arg] : IS_ITERATOR ? [] : [undefined]; - state.ignoreArg = false; - var result = state.done ? undefined : functionCall(nextHandler, state, args); - return { done: state.done, value: result }; + var getInternalState = internalState.getterFor(ITERATOR_PROXY); + + var IteratorProxyPrototype = defineBuiltIns(objectCreate(IteratorPrototype$1), { + next: function next() { + var state = getInternalState(this); + // for simplification: + // for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject` + // for `%IteratorHelperPrototype%.next` - just a value + if (IS_ITERATOR) { return state.nextHandler(); } + try { + var result = state.done ? undefined : state.nextHandler(); + return { done: state.done, value: result }; + } catch (error) { + state.done = true; + throw error; + } }, - 'return': function (value) { - var state = getInternalState$4(this); + 'return': function () { + var state = getInternalState(this); var iterator = state.iterator; + var innerIterator = state.innerIterator; state.done = true; + if (innerIterator) { try { + iteratorClose(innerIterator, 'return'); + } catch (error) { + return iteratorClose(iterator, 'throw', error); + } } var $$return = getMethod(iterator, 'return'); - return { done: true, value: $$return ? anObject(functionCall($$return, iterator, value)).value : value }; - }, - 'throw': function (value) { - var state = getInternalState$4(this); - var iterator = state.iterator; - state.done = true; - var $$throw = getMethod(iterator, 'throw'); - if ($$throw) { return functionCall($$throw, iterator, value); } - throw value; + return { done: true, value: $$return ? anObject(functionCall($$return, iterator)).value : undefined }; } }); if (!IS_ITERATOR) { - createNonEnumerableProperty(IteratorProxy.prototype, TO_STRING_TAG$1, 'Generator'); + createNonEnumerableProperty(IteratorProxyPrototype, TO_STRING_TAG$1, 'Iterator Helper'); } + return IteratorProxyPrototype; + }; + + var IteratorHelperPrototype = createIteratorProxyPrototype(false); + var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true); + + var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) { + var ITERATOR_PROXY = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER; + + var IteratorProxy = function Iterator(record, state) { + if (state) { + state.iterator = record.iterator; + state.next = record.next; + } else { state = record; } + state.type = ITERATOR_PROXY; + state.nextHandler = nextHandler; + state.done = false; + setInternalState$7(this, state); + }; + + IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype; + return IteratorProxy; }; @@ -10099,19 +11227,25 @@ var doric = (function (exports) { - var IteratorProxy$6 = iteratorCreateProxy(function (args) { - var result = anObject(functionApply(this.next, this.iterator, args)); + var IteratorProxy$6 = iteratorCreateProxy(function () { + var result = anObject(functionCall(this.next, this.iterator)); var done = this.done = !!result.done; if (!done) { return [this.index++, result.value]; } }); - _export({ target: 'Iterator', proto: true, real: true }, { - asIndexedPairs: function asIndexedPairs() { - return new IteratorProxy$6({ - iterator: anObject(this), - index: 0 - }); - } + var iteratorIndexed = function indexed() { + return new IteratorProxy$6(getIteratorDirect(this), { + index: 0 + }); + }; + + // TODO: Remove from `core-js@4` + // https://github.com/tc39/proposal-iterator-helpers + + + + _export({ target: 'Iterator', name: 'indexed', proto: true, real: true, forced: true }, { + asIndexedPairs: iteratorIndexed }); // https://github.com/tc39/proposal-iterator-helpers @@ -10122,7 +11256,8 @@ var doric = (function (exports) { - var IteratorProxy$5 = iteratorCreateProxy(function (args) { + + var IteratorProxy$5 = iteratorCreateProxy(function () { var iterator = this.iterator; var next = this.next; var result, done; @@ -10132,16 +11267,15 @@ var doric = (function (exports) { done = this.done = !!result.done; if (done) { return; } } - result = anObject(functionApply(next, iterator, args)); + result = anObject(functionCall(next, iterator)); done = this.done = !!result.done; if (!done) { return result.value; } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { drop: function drop(limit) { - return new IteratorProxy$5({ - iterator: anObject(this), - remaining: toPositiveInteger(limit) + return new IteratorProxy$5(getIteratorDirect(this), { + remaining: toPositiveInteger(notANan(+limit)) }); } }); @@ -10152,13 +11286,13 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { every: function every(fn) { - anObject(this); + var record = getIteratorDirect(this); aCallable(fn); - return !iterate(this, function (value, stop) { + return !iterate(record, function (value, stop) { if (!fn(value)) { return stop(); } - }, { IS_ITERATOR: true, INTERRUPTED: true }).stopped; + }, { IS_RECORD: true, INTERRUPTED: true }).stopped; } }); @@ -10170,13 +11304,14 @@ var doric = (function (exports) { - var IteratorProxy$4 = iteratorCreateProxy(function (args) { + + var IteratorProxy$4 = iteratorCreateProxy(function () { var iterator = this.iterator; var filterer = this.filterer; var next = this.next; var result, done, value; while (true) { - result = anObject(functionApply(next, iterator, args)); + result = anObject(functionCall(next, iterator)); done = this.done = !!result.done; if (done) { return; } value = result.value; @@ -10184,10 +11319,9 @@ var doric = (function (exports) { } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { filter: function filter(filterer) { - return new IteratorProxy$4({ - iterator: anObject(this), + return new IteratorProxy$4(getIteratorDirect(this), { filterer: aCallable(filterer) }); } @@ -10199,13 +11333,13 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { find: function find(fn) { - anObject(this); + var record = getIteratorDirect(this); aCallable(fn); - return iterate(this, function (value, stop) { + return iterate(record, function (value, stop) { if (fn(value)) { return stop(value); } - }, { IS_ITERATOR: true, INTERRUPTED: true }).result; + }, { IS_RECORD: true, INTERRUPTED: true }).result; } }); @@ -10219,7 +11353,7 @@ var doric = (function (exports) { - var TypeError$a = global_1.TypeError; + var $TypeError$8 = TypeError; var IteratorProxy$3 = iteratorCreateProxy(function () { var iterator = this.iterator; @@ -10227,36 +11361,33 @@ var doric = (function (exports) { var result, mapped, iteratorMethod, innerIterator; while (true) { - try { - if (innerIterator = this.innerIterator) { - result = anObject(functionCall(this.innerNext, innerIterator)); - if (!result.done) { return result.value; } - this.innerIterator = this.innerNext = null; - } + if (innerIterator = this.innerIterator) { try { + result = anObject(functionCall(this.innerNext, innerIterator)); + if (!result.done) { return result.value; } + this.innerIterator = this.innerNext = null; + } catch (error) { iteratorClose(iterator, 'throw', error); } } - result = anObject(functionCall(this.next, iterator)); + result = anObject(functionCall(this.next, iterator)); - if (this.done = !!result.done) { return; } + if (this.done = !!result.done) { return; } + try { mapped = mapper(result.value); iteratorMethod = getIteratorMethod(mapped); if (!iteratorMethod) { - throw TypeError$a('.flatMap callback should return an iterable object'); + throw $TypeError$8('.flatMap callback should return an iterable object'); } this.innerIterator = innerIterator = anObject(functionCall(iteratorMethod, mapped)); this.innerNext = aCallable(innerIterator.next); - } catch (error) { - iteratorClose(iterator, 'throw', error); - } + } catch (error$1) { iteratorClose(iterator, 'throw', error$1); } } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { flatMap: function flatMap(mapper) { - return new IteratorProxy$3({ - iterator: anObject(this), + return new IteratorProxy$3(getIteratorDirect(this), { mapper: aCallable(mapper), innerIterator: null, innerNext: null @@ -10269,9 +11400,9 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { forEach: function forEach(fn) { - iterate(anObject(this), fn, { IS_ITERATOR: true }); + iterate(getIteratorDirect(this), fn, { IS_RECORD: true }); } }); @@ -10280,19 +11411,17 @@ var doric = (function (exports) { - var IteratorPrototype = iteratorsCore.IteratorPrototype; - var IteratorProxy$2 = iteratorCreateProxy(function (args) { - var result = anObject(functionApply(this.next, this.iterator, args)); - var done = this.done = !!result.done; - if (!done) { return result.value; } + + var IteratorProxy$2 = iteratorCreateProxy(function () { + return functionCall(this.next, this.iterator); }, true); - _export({ target: 'Iterator', stat: true }, { + _export({ target: 'Iterator', stat: true, forced: true }, { from: function from(O) { var object = toObject(O); var usingIterator = getIteratorMethod(object); @@ -10302,7 +11431,7 @@ var doric = (function (exports) { if (objectIsPrototypeOf(IteratorPrototype, iterator)) { return iterator; } } else { iterator = object; - } return new IteratorProxy$2({ iterator: iterator }); + } return new IteratorProxy$2(getIteratorDirect(iterator)); } }); @@ -10310,21 +11439,29 @@ var doric = (function (exports) { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { + indexed: iteratorIndexed + }); + + // https://github.com/tc39/proposal-iterator-helpers + + + - var IteratorProxy$1 = iteratorCreateProxy(function (args) { + + var IteratorProxy$1 = iteratorCreateProxy(function () { var iterator = this.iterator; - var result = anObject(functionApply(this.next, iterator, args)); + var result = anObject(functionCall(this.next, iterator)); var done = this.done = !!result.done; if (!done) { return callWithSafeIterationClosing(iterator, this.mapper, result.value); } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { map: function map(mapper) { - return new IteratorProxy$1({ - iterator: anObject(this), + return new IteratorProxy$1(getIteratorDirect(this), { mapper: aCallable(mapper) }); } @@ -10336,24 +11473,23 @@ var doric = (function (exports) { + var $TypeError$7 = TypeError; - var TypeError$9 = global_1.TypeError; - - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { reduce: function reduce(reducer /* , initialValue */) { - anObject(this); + var record = getIteratorDirect(this); aCallable(reducer); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; - iterate(this, function (value) { + iterate(record, function (value) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = reducer(accumulator, value); } - }, { IS_ITERATOR: true }); - if (noInitial) { throw TypeError$9('Reduce of empty iterator with no initial value'); } + }, { IS_RECORD: true }); + if (noInitial) { throw $TypeError$7('Reduce of empty iterator with no initial value'); } return accumulator; } }); @@ -10364,13 +11500,13 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { some: function some(fn) { - anObject(this); + var record = getIteratorDirect(this); aCallable(fn); - return iterate(this, function (value, stop) { + return iterate(record, function (value, stop) { if (fn(value)) { return stop(); } - }, { IS_ITERATOR: true, INTERRUPTED: true }).stopped; + }, { IS_RECORD: true, INTERRUPTED: true }).stopped; } }); @@ -10382,22 +11518,23 @@ var doric = (function (exports) { - var IteratorProxy = iteratorCreateProxy(function (args) { + + + var IteratorProxy = iteratorCreateProxy(function () { var iterator = this.iterator; if (!this.remaining--) { this.done = true; return iteratorClose(iterator, 'normal', undefined); } - var result = anObject(functionApply(this.next, iterator, args)); + var result = anObject(functionCall(this.next, iterator)); var done = this.done = !!result.done; if (!done) { return result.value; } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { take: function take(limit) { - return new IteratorProxy({ - iterator: anObject(this), - remaining: toPositiveInteger(limit) + return new IteratorProxy(getIteratorDirect(this), { + remaining: toPositiveInteger(notANan(+limit)) }); } }); @@ -10407,16 +11544,28 @@ var doric = (function (exports) { - var push$7 = [].push; + var push$9 = [].push; - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { toArray: function toArray() { var result = []; - iterate(anObject(this), push$7, { that: result, IS_ITERATOR: true }); + iterate(getIteratorDirect(this), push$9, { that: result, IS_RECORD: true }); return result; } }); + // https://github.com/tc39/proposal-iterator-helpers + + + + + + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { + toAsync: function toAsync() { + return new asyncIteratorWrap(getIteratorDirect(new asyncFromSyncIterator(this))); + } + }); + // https://github.com/tc39/collection-methods var collectionDeleteAll = function deleteAll(/* ...elements */) { var arguments$1 = arguments; @@ -10434,7 +11583,7 @@ var doric = (function (exports) { // `Map.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); @@ -10445,27 +11594,33 @@ var doric = (function (exports) { var get = aCallable(map.get); var has = aCallable(map.has); var set = aCallable(map.set); - var value = (functionCall(has, map, key) && 'update' in handler) - ? handler.update(functionCall(get, map, key), key, map) - : handler.insert(key, map); - functionCall(set, map, key, value); - return value; + var value, inserted; + if (functionCall(has, map, key)) { + value = functionCall(get, map, key); + if ('update' in handler) { + value = handler.update(value, key, map); + functionCall(set, map, key, value); + } return value; + } + inserted = handler.insert(key, map); + functionCall(set, map, key, inserted); + return inserted; }; // `Map.prototype.emplace` method // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { emplace: mapEmplace }); var getMapIterator = function (it) { - // eslint-disable-next-line es/no-map -- safe + // eslint-disable-next-line es-x/no-map -- safe return functionCall(Map.prototype.entries, it); }; // `Map.prototype.every` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { every: function every(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10478,7 +11633,7 @@ var doric = (function (exports) { // `Map.prototype.filter` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { filter: function filter(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10494,7 +11649,7 @@ var doric = (function (exports) { // `Map.prototype.find` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { find: function find(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10507,7 +11662,7 @@ var doric = (function (exports) { // `Map.prototype.findKey` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { findKey: function findKey(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10525,7 +11680,7 @@ var doric = (function (exports) { - var push$6 = [].push; + var push$8 = [].push; var collectionFrom = function from(source /* , mapFn, thisArg */) { var length = arguments.length; @@ -10540,25 +11695,25 @@ var doric = (function (exports) { n = 0; boundFunction = functionBindContext(mapFn, length > 2 ? arguments[2] : undefined); iterate(source, function (nextItem) { - functionCall(push$6, array, boundFunction(nextItem, n++)); + functionCall(push$8, array, boundFunction(nextItem, n++)); }); } else { - iterate(source, push$6, { that: array }); + iterate(source, push$8, { that: array }); } return new this(array); }; // `Map.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { from: collectionFrom }); - var push$5 = functionUncurryThis([].push); + var push$7 = functionUncurryThis([].push); // `Map.groupBy` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { groupBy: function groupBy(iterable, keyDerivative) { aCallable(keyDerivative); var iterator = getIterator(iterable); @@ -10569,7 +11724,7 @@ var doric = (function (exports) { iterate(iterator, function (element) { var derivedKey = keyDerivative(element); if (!functionCall(has, newMap, derivedKey)) { functionCall(set, newMap, derivedKey, [element]); } - else { push$5(functionCall(get, newMap, derivedKey), element); } + else { push$7(functionCall(get, newMap, derivedKey), element); } }, { IS_ITERATOR: true }); return newMap; } @@ -10584,7 +11739,7 @@ var doric = (function (exports) { // `Map.prototype.includes` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { includes: function includes(searchElement) { return iterate(getMapIterator(anObject(this)), function (key, value, stop) { if (sameValueZero(value, searchElement)) { return stop(); } @@ -10594,7 +11749,7 @@ var doric = (function (exports) { // `Map.keyBy` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { keyBy: function keyBy(iterable, keyDerivative) { var newMap = new this(); aCallable(keyDerivative); @@ -10608,7 +11763,7 @@ var doric = (function (exports) { // `Map.prototype.keyOf` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { keyOf: function keyOf(searchElement) { return iterate(getMapIterator(anObject(this)), function (key, value, stop) { if (value === searchElement) { return stop(key); } @@ -10618,7 +11773,7 @@ var doric = (function (exports) { // `Map.prototype.mapKeys` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { mapKeys: function mapKeys(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10634,7 +11789,7 @@ var doric = (function (exports) { // `Map.prototype.mapValues` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { mapValues: function mapValues(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10650,9 +11805,9 @@ var doric = (function (exports) { // `Map.prototype.merge` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, { // eslint-disable-next-line no-unused-vars -- required for `.length` - merge: function merge(iterable /* ...iterbles */) { + merge: function merge(iterable /* ...iterables */) { var arguments$1 = arguments; var map = anObject(this); @@ -10673,15 +11828,15 @@ var doric = (function (exports) { // `Map.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { of: collectionOf }); - var TypeError$8 = global_1.TypeError; + var $TypeError$6 = TypeError; // `Map.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { reduce: function reduce(callbackfn /* , initialValue */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10696,14 +11851,14 @@ var doric = (function (exports) { accumulator = callbackfn(accumulator, value, key, map); } }, { AS_ENTRIES: true, IS_ITERATOR: true }); - if (noInitial) { throw TypeError$8('Reduce of empty map with no initial value'); } + if (noInitial) { throw $TypeError$6('Reduce of empty map with no initial value'); } return accumulator; } }); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { some: function some(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -10714,11 +11869,11 @@ var doric = (function (exports) { } }); - var TypeError$7 = global_1.TypeError; + var $TypeError$5 = TypeError; // `Set.prototype.update` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { update: function update(key, callback /* , thunk */) { var map = anObject(this); var get = aCallable(map.get); @@ -10728,7 +11883,7 @@ var doric = (function (exports) { aCallable(callback); var isPresentInMap = functionCall(has, map, key); if (!isPresentInMap && length < 3) { - throw TypeError$7('Updating absent value'); + throw $TypeError$5('Updating absent value'); } var value = isPresentInMap ? functionCall(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); functionCall(set, map, key, callback(value, key, map)); @@ -10736,7 +11891,7 @@ var doric = (function (exports) { } }); - var TypeError$6 = global_1.TypeError; + var $TypeError$4 = TypeError; // `Map.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert @@ -10748,7 +11903,7 @@ var doric = (function (exports) { var insertFn = arguments.length > 2 ? arguments[2] : undefined; var value; if (!isCallable(updateFn) && !isCallable(insertFn)) { - throw TypeError$6('At least one callback required'); + throw $TypeError$4('At least one callback required'); } if (functionCall(has, map, key)) { value = functionCall(get, map, key); @@ -10766,10 +11921,9 @@ var doric = (function (exports) { - // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`) // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, name: 'upsert', forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, { updateOrInsert: mapUpsert }); @@ -10777,27 +11931,26 @@ var doric = (function (exports) { - // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`) // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { upsert: mapUpsert }); - var min = Math.min; - var max = Math.max; + var min$1 = Math.min; + var max$1 = Math.max; // `Math.clamp` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { clamp: function clamp(x, lower, upper) { - return min(upper, max(lower, x)); + return min$1(upper, max$1(lower, x)); } }); // `Math.DEG_PER_RAD` constant // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, { DEG_PER_RAD: Math.PI / 180 }); @@ -10805,7 +11958,7 @@ var doric = (function (exports) { // `Math.degrees` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { degrees: function degrees(radians) { return radians * RAD_PER_DEG; } @@ -10827,7 +11980,7 @@ var doric = (function (exports) { // `Math.fscale` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { return mathFround(mathScale(x, inLow, inHigh, outLow, outHigh)); } @@ -10836,7 +11989,7 @@ var doric = (function (exports) { // `Math.iaddh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { iaddh: function iaddh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; @@ -10848,7 +12001,7 @@ var doric = (function (exports) { // `Math.imulh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { imulh: function imulh(u, v) { var UINT16 = 0xFFFF; var $u = +u; @@ -10865,7 +12018,7 @@ var doric = (function (exports) { // `Math.isubh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { isubh: function isubh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; @@ -10876,7 +12029,7 @@ var doric = (function (exports) { // `Math.RAD_PER_DEG` constant // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true }, { RAD_PER_DEG: 180 / Math.PI }); @@ -10884,7 +12037,7 @@ var doric = (function (exports) { // `Math.radians` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { radians: function radians(degrees) { return degrees * DEG_PER_RAD; } @@ -10892,19 +12045,19 @@ var doric = (function (exports) { // `Math.scale` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { scale: mathScale }); var SEEDED_RANDOM = 'Seeded Random'; var SEEDED_RANDOM_GENERATOR = SEEDED_RANDOM + ' Generator'; var SEED_TYPE_ERROR = 'Math.seededPRNG() argument should have a "seed" field with a finite value.'; - var setInternalState$5 = internalState.set; + var setInternalState$6 = internalState.set; var getInternalState$3 = internalState.getterFor(SEEDED_RANDOM_GENERATOR); - var TypeError$5 = global_1.TypeError; + var $TypeError$3 = TypeError; var $SeededRandomGenerator = createIteratorConstructor(function SeededRandomGenerator(seed) { - setInternalState$5(this, { + setInternalState$6(this, { type: SEEDED_RANDOM_GENERATOR, seed: seed % 2147483647 }); @@ -10920,23 +12073,25 @@ var doric = (function (exports) { _export({ target: 'Math', stat: true, forced: true }, { seededPRNG: function seededPRNG(it) { var seed = anObject(it).seed; - if (!numberIsFinite(seed)) { throw TypeError$5(SEED_TYPE_ERROR); } + if (!numberIsFinite(seed)) { throw $TypeError$3(SEED_TYPE_ERROR); } return new $SeededRandomGenerator(seed); } }); // `Math.signbit` method // https://github.com/tc39/proposal-Math.signbit - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { signbit: function signbit(x) { - return (x = +x) == x && x == 0 ? 1 / x == -Infinity : x < 0; + var n = +x; + // eslint-disable-next-line no-self-compare -- NaN check + return n == n && n == 0 ? 1 / n == -Infinity : n < 0; } }); // `Math.umulh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { umulh: function umulh(u, v) { var UINT16 = 0xFFFF; var $u = +u; @@ -10952,32 +12107,32 @@ var doric = (function (exports) { var INVALID_NUMBER_REPRESENTATION = 'Invalid number representation'; var INVALID_RADIX = 'Invalid radix'; - var RangeError$1 = global_1.RangeError; - var SyntaxError = global_1.SyntaxError; - var TypeError$4 = global_1.TypeError; + var $RangeError$1 = RangeError; + var $SyntaxError = SyntaxError; + var $TypeError$2 = TypeError; var valid = /^[\da-z]+$/; - var charAt$4 = functionUncurryThis(''.charAt); - var exec$2 = functionUncurryThis(valid.exec); + var charAt$6 = functionUncurryThis(''.charAt); + var exec$3 = functionUncurryThis(valid.exec); var numberToString$1 = functionUncurryThis(1.0.toString); var stringSlice$2 = functionUncurryThis(''.slice); // `Number.fromString` method // https://github.com/tc39/proposal-number-fromstring - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, forced: true }, { fromString: function fromString(string, radix) { var sign = 1; var R, mathNum; - if (typeof string != 'string') { throw TypeError$4(INVALID_NUMBER_REPRESENTATION); } - if (!string.length) { throw SyntaxError(INVALID_NUMBER_REPRESENTATION); } - if (charAt$4(string, 0) == '-') { + if (typeof string != 'string') { throw $TypeError$2(INVALID_NUMBER_REPRESENTATION); } + if (!string.length) { throw $SyntaxError(INVALID_NUMBER_REPRESENTATION); } + if (charAt$6(string, 0) == '-') { sign = -1; string = stringSlice$2(string, 1); - if (!string.length) { throw SyntaxError(INVALID_NUMBER_REPRESENTATION); } + if (!string.length) { throw $SyntaxError(INVALID_NUMBER_REPRESENTATION); } } R = radix === undefined ? 10 : toIntegerOrInfinity(radix); - if (R < 2 || R > 36) { throw RangeError$1(INVALID_RADIX); } - if (!exec$2(valid, string) || numberToString$1(mathNum = numberParseInt(string, R), R) !== string) { - throw SyntaxError(INVALID_NUMBER_REPRESENTATION); + if (R < 2 || R > 36) { throw $RangeError$1(INVALID_RADIX); } + if (!exec$3(valid, string) || numberToString$1(mathNum = numberParseInt(string, R), R) !== string) { + throw $SyntaxError(INVALID_NUMBER_REPRESENTATION); } return sign * mathNum; } @@ -10985,23 +12140,23 @@ var doric = (function (exports) { // `Number.range` method // https://github.com/tc39/proposal-Number.range - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, forced: true }, { range: function range(start, end, option) { return new numericRangeIterator(start, end, option, 'number', 0, 1); } }); var OBJECT_ITERATOR = 'Object Iterator'; - var setInternalState$4 = internalState.set; + var setInternalState$5 = internalState.set; var getInternalState$2 = internalState.getterFor(OBJECT_ITERATOR); var objectIterator = createIteratorConstructor(function ObjectIterator(source, mode) { var object = toObject(source); - setInternalState$4(this, { + setInternalState$5(this, { type: OBJECT_ITERATOR, mode: mode, object: object, - keys: objectKeys(object), + keys: objectKeys$1(object), index: 0 }); }, 'Object', function next() { @@ -11022,34 +12177,53 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + // `Object.iterateEntries` method // https://github.com/tc39/proposal-object-iteration - _export({ target: 'Object', stat: true }, { + _export({ target: 'Object', stat: true, forced: true }, { iterateEntries: function iterateEntries(object) { return new objectIterator(object, 'entries'); } }); + // TODO: Remove from `core-js@4` + + + // `Object.iterateKeys` method // https://github.com/tc39/proposal-object-iteration - _export({ target: 'Object', stat: true }, { + _export({ target: 'Object', stat: true, forced: true }, { iterateKeys: function iterateKeys(object) { return new objectIterator(object, 'keys'); } }); + // TODO: Remove from `core-js@4` + + + // `Object.iterateValues` method // https://github.com/tc39/proposal-object-iteration - _export({ target: 'Object', stat: true }, { + _export({ target: 'Object', stat: true, forced: true }, { iterateValues: function iterateValues(object) { return new objectIterator(object, 'values'); } }); - // https://github.com/tc39/proposal-observable - + var $$OBSERVABLE$2 = wellKnownSymbol('observable'); + var NativeObservable = global_1.Observable; + var NativeObservablePrototype = NativeObservable && NativeObservable.prototype; + var observableForced = !isCallable(NativeObservable) + || !isCallable(NativeObservable.from) + || !isCallable(NativeObservable.of) + || !isCallable(NativeObservablePrototype.subscribe) + || !isCallable(NativeObservablePrototype[$$OBSERVABLE$2]); + // https://github.com/tc39/proposal-observable @@ -11058,7 +12232,6 @@ var doric = (function (exports) { - var defineProperty = objectDefineProperty.f; @@ -11068,42 +12241,51 @@ var doric = (function (exports) { - var OBSERVABLE = wellKnownSymbol('observable'); - var getInternalState$1 = internalState.get; - var setInternalState$3 = internalState.set; - var Array$1 = global_1.Array; - var cleanupSubscription = function (subscriptionState) { - var cleanup = subscriptionState.cleanup; - if (cleanup) { - subscriptionState.cleanup = undefined; - try { - cleanup(); - } catch (error) { - hostReportErrors(error); + var $$OBSERVABLE$1 = wellKnownSymbol('observable'); + var OBSERVABLE = 'Observable'; + var SUBSCRIPTION = 'Subscription'; + var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver'; + var getterFor$1 = internalState.getterFor; + var setInternalState$4 = internalState.set; + var getObservableInternalState = getterFor$1(OBSERVABLE); + var getSubscriptionInternalState = getterFor$1(SUBSCRIPTION); + var getSubscriptionObserverInternalState = getterFor$1(SUBSCRIPTION_OBSERVER); + + var SubscriptionState = function (observer) { + this.observer = anObject(observer); + this.cleanup = undefined; + this.subscriptionObserver = undefined; + }; + + SubscriptionState.prototype = { + type: SUBSCRIPTION, + clean: function () { + var cleanup = this.cleanup; + if (cleanup) { + this.cleanup = undefined; + try { + cleanup(); + } catch (error) { + hostReportErrors(error); + } } + }, + close: function () { + if (!descriptors) { + var subscription = this.facade; + var subscriptionObserver = this.subscriptionObserver; + subscription.closed = true; + if (subscriptionObserver) { subscriptionObserver.closed = true; } + } this.observer = undefined; + }, + isClosed: function () { + return this.observer === undefined; } }; - var subscriptionClosed = function (subscriptionState) { - return subscriptionState.observer === undefined; - }; - - var close = function (subscriptionState) { - var subscription = subscriptionState.facade; - if (!descriptors) { - subscription.closed = true; - var subscriptionObserver = subscriptionState.subscriptionObserver; - if (subscriptionObserver) { subscriptionObserver.closed = true; } - } subscriptionState.observer = undefined; - }; - var Subscription = function (observer, subscriber) { - var subscriptionState = setInternalState$3(this, { - cleanup: undefined, - observer: anObject(observer), - subscriptionObserver: undefined - }); + var subscriptionState = setInternalState$4(this, new SubscriptionState(observer)); var start; if (!descriptors) { this.closed = false; } try { @@ -11111,8 +12293,8 @@ var doric = (function (exports) { } catch (error) { hostReportErrors(error); } - if (subscriptionClosed(subscriptionState)) { return; } - var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(this); + if (subscriptionState.isClosed()) { return; } + var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState); try { var cleanup = subscriber(subscriptionObserver); var subscription = cleanup; @@ -11122,35 +12304,38 @@ var doric = (function (exports) { } catch (error$1) { subscriptionObserver.error(error$1); return; - } if (subscriptionClosed(subscriptionState)) { cleanupSubscription(subscriptionState); } + } if (subscriptionState.isClosed()) { subscriptionState.clean(); } }; - Subscription.prototype = redefineAll({}, { + Subscription.prototype = defineBuiltIns({}, { unsubscribe: function unsubscribe() { - var subscriptionState = getInternalState$1(this); - if (!subscriptionClosed(subscriptionState)) { - close(subscriptionState); - cleanupSubscription(subscriptionState); + var subscriptionState = getSubscriptionInternalState(this); + if (!subscriptionState.isClosed()) { + subscriptionState.close(); + subscriptionState.clean(); } } }); - if (descriptors) { defineProperty(Subscription.prototype, 'closed', { + if (descriptors) { defineBuiltInAccessor(Subscription.prototype, 'closed', { configurable: true, - get: function () { - return subscriptionClosed(getInternalState$1(this)); + get: function closed() { + return getSubscriptionInternalState(this).isClosed(); } }); } - var SubscriptionObserver = function (subscription) { - setInternalState$3(this, { subscription: subscription }); + var SubscriptionObserver = function (subscriptionState) { + setInternalState$4(this, { + type: SUBSCRIPTION_OBSERVER, + subscriptionState: subscriptionState + }); if (!descriptors) { this.closed = false; } }; - SubscriptionObserver.prototype = redefineAll({}, { + SubscriptionObserver.prototype = defineBuiltIns({}, { next: function next(value) { - var subscriptionState = getInternalState$1(getInternalState$1(this).subscription); - if (!subscriptionClosed(subscriptionState)) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; try { var nextMethod = getMethod(observer, 'next'); @@ -11161,63 +12346,78 @@ var doric = (function (exports) { } }, error: function error(value) { - var subscriptionState = getInternalState$1(getInternalState$1(this).subscription); - if (!subscriptionClosed(subscriptionState)) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; - close(subscriptionState); + subscriptionState.close(); try { var errorMethod = getMethod(observer, 'error'); if (errorMethod) { functionCall(errorMethod, observer, value); } else { hostReportErrors(value); } } catch (err) { hostReportErrors(err); - } cleanupSubscription(subscriptionState); + } subscriptionState.clean(); } }, complete: function complete() { - var subscriptionState = getInternalState$1(getInternalState$1(this).subscription); - if (!subscriptionClosed(subscriptionState)) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; - close(subscriptionState); + subscriptionState.close(); try { var completeMethod = getMethod(observer, 'complete'); if (completeMethod) { functionCall(completeMethod, observer); } } catch (error) { hostReportErrors(error); - } cleanupSubscription(subscriptionState); + } subscriptionState.clean(); } } }); - if (descriptors) { defineProperty(SubscriptionObserver.prototype, 'closed', { + if (descriptors) { defineBuiltInAccessor(SubscriptionObserver.prototype, 'closed', { configurable: true, - get: function () { - return subscriptionClosed(getInternalState$1(getInternalState$1(this).subscription)); + get: function closed() { + return getSubscriptionObserverInternalState(this).subscriptionState.isClosed(); } }); } var $Observable = function Observable(subscriber) { anInstance(this, ObservablePrototype); - setInternalState$3(this, { subscriber: aCallable(subscriber) }); + setInternalState$4(this, { + type: OBSERVABLE, + subscriber: aCallable(subscriber) + }); }; var ObservablePrototype = $Observable.prototype; - redefineAll(ObservablePrototype, { + defineBuiltIns(ObservablePrototype, { subscribe: function subscribe(observer) { var length = arguments.length; return new Subscription(isCallable(observer) ? { next: observer, error: length > 1 ? arguments[1] : undefined, complete: length > 2 ? arguments[2] : undefined - } : isObject(observer) ? observer : {}, getInternalState$1(this).subscriber); + } : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber); } }); - redefineAll($Observable, { + defineBuiltIn(ObservablePrototype, $$OBSERVABLE$1, function () { return this; }); + + _export({ global: true, constructor: true, forced: observableForced }, { + Observable: $Observable + }); + + setSpecies(OBSERVABLE); + + var $$OBSERVABLE = wellKnownSymbol('observable'); + + // `Observable.from` method + // https://github.com/tc39/proposal-observable + _export({ target: 'Observable', stat: true, forced: observableForced }, { from: function from(x) { - var C = isConstructor(this) ? this : $Observable; - var observableMethod = getMethod(anObject(x), OBSERVABLE); + var C = isConstructor(this) ? this : getBuiltIn('Observable'); + var observableMethod = getMethod(anObject(x), $$OBSERVABLE); if (observableMethod) { var observable = anObject(functionCall(observableMethod, x)); return observable.constructor === C ? observable : new C(function (observer) { @@ -11232,11 +12432,18 @@ var doric = (function (exports) { }, { IS_ITERATOR: true, INTERRUPTED: true }); observer.complete(); }); - }, + } + }); + + var Array$1 = getBuiltIn('Array'); + + // `Observable.of` method + // https://github.com/tc39/proposal-observable + _export({ target: 'Observable', stat: true, forced: observableForced }, { of: function of() { var arguments$1 = arguments; - var C = isConstructor(this) ? this : $Observable; + var C = isConstructor(this) ? this : getBuiltIn('Observable'); var length = arguments.length; var items = Array$1(length); var index = 0; @@ -11250,17 +12457,14 @@ var doric = (function (exports) { } }); - redefine(ObservablePrototype, OBSERVABLE, function () { return this; }); + // TODO: Remove from `core-js@4` + - _export({ global: true }, { - Observable: $Observable - }); - setSpecies('Observable'); // `Promise.try` method // https://github.com/tc39/proposal-promise-try - _export({ target: 'Promise', stat: true }, { + _export({ target: 'Promise', stat: true, forced: true }, { 'try': function (callbackfn) { var promiseCapability = newPromiseCapability$1.f(this); var result = perform(callbackfn); @@ -11276,9 +12480,9 @@ var doric = (function (exports) { - var Map$1 = getBuiltIn('Map'); + var Map$2 = getBuiltIn('Map'); var WeakMap$1 = getBuiltIn('WeakMap'); - var push$4 = functionUncurryThis([].push); + var push$6 = functionUncurryThis([].push); var metadata = shared('metadata'); var store$1 = metadata.store || (metadata.store = new WeakMap$1()); @@ -11287,12 +12491,12 @@ var doric = (function (exports) { var targetMetadata = store$1.get(target); if (!targetMetadata) { if (!create) { return; } - store$1.set(target, targetMetadata = new Map$1()); + store$1.set(target, targetMetadata = new Map$2()); } var keyMetadata = targetMetadata.get(targetKey); if (!keyMetadata) { if (!create) { return; } - targetMetadata.set(targetKey, keyMetadata = new Map$1()); + targetMetadata.set(targetKey, keyMetadata = new Map$2()); } return keyMetadata; }; @@ -11313,7 +12517,7 @@ var doric = (function (exports) { var ordinaryOwnMetadataKeys$2 = function (target, targetKey) { var metadataMap = getOrCreateMetadataMap$1(target, targetKey, false); var keys = []; - if (metadataMap) { metadataMap.forEach(function (_, key) { push$4(keys, key); }); } + if (metadataMap) { metadataMap.forEach(function (_, key) { push$6(keys, key); }); } return keys; }; @@ -11331,6 +12535,11 @@ var doric = (function (exports) { toKey: toMetadataKey$9 }; + // TODO: Remove from `core-js@4` + + + + var toMetadataKey$8 = reflectMetadata.toKey; var ordinaryDefineOwnMetadata$1 = reflectMetadata.set; @@ -11361,6 +12570,12 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + + var ordinaryHasOwnMetadata$2 = reflectMetadata.has; var ordinaryGetOwnMetadata$1 = reflectMetadata.get; var toMetadataKey$6 = reflectMetadata.toKey; @@ -11381,6 +12596,14 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + + + + var arrayUniqueBy$1 = functionUncurryThis(arrayUniqueBy$2); var concat = functionUncurryThis([].concat); var ordinaryOwnMetadataKeys$1 = reflectMetadata.keys; @@ -11403,6 +12626,11 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + var ordinaryGetOwnMetadata = reflectMetadata.get; var toMetadataKey$4 = reflectMetadata.toKey; @@ -11415,6 +12643,11 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + var ordinaryOwnMetadataKeys = reflectMetadata.keys; var toMetadataKey$3 = reflectMetadata.toKey; @@ -11427,6 +12660,12 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + + var ordinaryHasOwnMetadata$1 = reflectMetadata.has; var toMetadataKey$2 = reflectMetadata.toKey; @@ -11446,6 +12685,11 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + var ordinaryHasOwnMetadata = reflectMetadata.has; var toMetadataKey$1 = reflectMetadata.toKey; @@ -11485,19 +12729,19 @@ var doric = (function (exports) { // `Set.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { addAll: collectionAddAll }); // `Set.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); // `Set.prototype.difference` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { difference: function difference(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); @@ -11510,13 +12754,13 @@ var doric = (function (exports) { }); var getSetIterator = function (it) { - // eslint-disable-next-line es/no-set -- safe + // eslint-disable-next-line es-x/no-set -- safe return functionCall(Set.prototype.values, it); }; // `Set.prototype.every` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { every: function every(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -11529,7 +12773,7 @@ var doric = (function (exports) { // `Set.prototype.filter` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { filter: function filter(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -11545,7 +12789,7 @@ var doric = (function (exports) { // `Set.prototype.find` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { find: function find(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -11558,13 +12802,13 @@ var doric = (function (exports) { // `Set.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from - _export({ target: 'Set', stat: true }, { + _export({ target: 'Set', stat: true, forced: true }, { from: collectionFrom }); // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { intersection: function intersection(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); @@ -11579,7 +12823,7 @@ var doric = (function (exports) { // `Set.prototype.isDisjointFrom` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { isDisjointFrom: function isDisjointFrom(iterable) { var set = anObject(this); var hasCheck = aCallable(set.has); @@ -11591,7 +12835,7 @@ var doric = (function (exports) { // `Set.prototype.isSubsetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSubsetOf - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { isSubsetOf: function isSubsetOf(iterable) { var iterator = getIterator(this); var otherSet = anObject(iterable); @@ -11608,7 +12852,7 @@ var doric = (function (exports) { // `Set.prototype.isSupersetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { isSupersetOf: function isSupersetOf(iterable) { var set = anObject(this); var hasCheck = aCallable(set.has); @@ -11619,24 +12863,24 @@ var doric = (function (exports) { }); var arrayJoin = functionUncurryThis([].join); - var push$3 = [].push; + var push$5 = [].push; // `Set.prototype.join` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { join: function join(separator) { var set = anObject(this); var iterator = getSetIterator(set); var sep = separator === undefined ? ',' : toString_1(separator); var result = []; - iterate(iterator, push$3, { that: result, IS_ITERATOR: true }); + iterate(iterator, push$5, { that: result, IS_ITERATOR: true }); return arrayJoin(result, sep); } }); // `Set.prototype.map` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { map: function map(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -11652,15 +12896,15 @@ var doric = (function (exports) { // `Set.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of - _export({ target: 'Set', stat: true }, { + _export({ target: 'Set', stat: true, forced: true }, { of: collectionOf }); - var TypeError$3 = global_1.TypeError; + var $TypeError$1 = TypeError; // `Set.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { reduce: function reduce(callbackfn /* , initialValue */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -11675,14 +12919,14 @@ var doric = (function (exports) { accumulator = callbackfn(accumulator, value, value, set); } }, { IS_ITERATOR: true }); - if (noInitial) { throw TypeError$3('Reduce of empty set with no initial value'); } + if (noInitial) { throw $TypeError$1('Reduce of empty set with no initial value'); } return accumulator; } }); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { some: function some(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -11695,7 +12939,7 @@ var doric = (function (exports) { // `Set.prototype.symmetricDifference` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { symmetricDifference: function symmetricDifference(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); @@ -11710,7 +12954,7 @@ var doric = (function (exports) { // `Set.prototype.union` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { union: function union(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); @@ -11719,48 +12963,78 @@ var doric = (function (exports) { } }); - var charAt$3 = stringMultibyte.charAt; + // TODO: Remove from `core-js@4` + + var charAt$5 = stringMultibyte.charAt; + - var FORCED$1 = fails(function () { - return '𠮷'.at(0) !== '𠮷'; - }); // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at - _export({ target: 'String', proto: true, forced: FORCED$1 }, { - at: function at(pos) { - return charAt$3(this, pos); + _export({ target: 'String', proto: true, forced: true }, { + at: function at(index) { + var S = toString_1(requireObjectCoercible(this)); + var len = S.length; + var relativeIndex = toIntegerOrInfinity(index); + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + return (k < 0 || k >= len) ? undefined : charAt$5(S, k); } }); - var codeAt$1 = stringMultibyte.codeAt; - var charAt$2 = stringMultibyte.charAt; - var STRING_ITERATOR = 'String Iterator'; - var setInternalState$2 = internalState.set; - var getInternalState = internalState.getterFor(STRING_ITERATOR); + var $TypeError = TypeError; + var ArrayPrototype = Array.prototype; + var push$4 = functionUncurryThis(ArrayPrototype.push); + var join$3 = functionUncurryThis(ArrayPrototype.join); + + // `String.cooked` method + // https://github.com/tc39/proposal-string-cooked + _export({ target: 'String', stat: true, forced: true }, { + cooked: function cooked(template /* , ...substitutions */) { + var arguments$1 = arguments; + + var cookedTemplate = toIndexedObject(template); + var literalSegments = lengthOfArrayLike(cookedTemplate); + var argumentsLength = arguments.length; + var elements = []; + var i = 0; + while (literalSegments > i) { + var nextVal = cookedTemplate[i++]; + if (nextVal === undefined) { throw $TypeError('Incorrect template'); } + push$4(elements, toString_1(nextVal)); + if (i === literalSegments) { return join$3(elements, ''); } + if (i < argumentsLength) { push$4(elements, toString_1(arguments$1[i])); } + } + } + }); + + var codeAt$1 = stringMultibyte.codeAt; + var charAt$4 = stringMultibyte.charAt; + var STRING_ITERATOR = 'String Iterator'; + var setInternalState$3 = internalState.set; + var getInternalState$1 = internalState.getterFor(STRING_ITERATOR); // TODO: unify with String#@@iterator var $StringIterator = createIteratorConstructor(function StringIterator(string) { - setInternalState$2(this, { + setInternalState$3(this, { type: STRING_ITERATOR, string: string, index: 0 }); }, 'String', function next() { - var state = getInternalState(this); + var state = getInternalState$1(this); var string = state.string; var index = state.index; var point; if (index >= string.length) { return { value: undefined, done: true }; } - point = charAt$2(string, index); + point = charAt$4(string, index); state.index += point.length; return { value: { codePoint: codeAt$1(point, 0), position: index }, done: false }; }); // `String.prototype.codePoints` method // https://github.com/tc39/proposal-string-prototype-codepoints - _export({ target: 'String', proto: true }, { + _export({ target: 'String', proto: true, forced: true }, { codePoints: function codePoints() { return new $StringIterator(toString_1(requireObjectCoercible(this))); } @@ -11778,10 +13052,17 @@ var doric = (function (exports) { // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('matcher'); + // TODO: Remove from `core-js@4` + + // `Symbol.metadata` well-known symbol // https://github.com/tc39/proposal-decorators defineWellKnownSymbol('metadata'); + // `Symbol.metadataKey` well-known symbol + // https://github.com/tc39/proposal-decorator-metadata + defineWellKnownSymbol('metadataKey'); + // `Symbol.observable` well-known symbol // https://github.com/tc39/proposal-observable defineWellKnownSymbol('observable'); @@ -11798,6 +13079,13 @@ var doric = (function (exports) { defineWellKnownSymbol('replaceAll'); + // TODO: Remove from `core-js@4` + + + + + + var aTypedArrayConstructor = arrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod = arrayBufferViewCore.exportTypedArrayStaticMethod; @@ -11814,99 +13102,201 @@ var doric = (function (exports) { }).then(function (list) { return arrayFromConstructorAndList(aTypedArrayConstructor(C), list); }); - }, typedArrayConstructorsRequireWrappers); + }, true); // TODO: Remove from `core-js@4` var $filterReject$1 = arrayIteration.filterReject; - var aTypedArray$5 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$5 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$7 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filterOut` method // https://github.com/tc39/proposal-array-filtering - exportTypedArrayMethod$5('filterOut', function filterOut(callbackfn /* , thisArg */) { - var list = $filterReject$1(aTypedArray$5(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$7('filterOut', function filterOut(callbackfn /* , thisArg */) { + var list = $filterReject$1(aTypedArray$7(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return typedArrayFromSpeciesAndList(this, list); - }); + }, true); var $filterReject = arrayIteration.filterReject; - var aTypedArray$4 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$4 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$6 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$6 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering - exportTypedArrayMethod$4('filterReject', function filterReject(callbackfn /* , thisArg */) { - var list = $filterReject(aTypedArray$4(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$6('filterReject', function filterReject(callbackfn /* , thisArg */) { + var list = $filterReject(aTypedArray$6(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return typedArrayFromSpeciesAndList(this, list); - }); + }, true); - var $findLast = arrayIterationFromLast.findLast; + // TODO: Remove from `core-js@4` + + + + + var aTypedArray$5 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$5 = arrayBufferViewCore.exportTypedArrayMethod; + + // `%TypedArray%.prototype.groupBy` method + // https://github.com/tc39/proposal-array-grouping + exportTypedArrayMethod$5('groupBy', function groupBy(callbackfn /* , thisArg */) { + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + return arrayGroup(aTypedArray$5(this), callbackfn, thisArg, typedArraySpeciesConstructor); + }, true); + + var aTypedArray$4 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$4 = arrayBufferViewCore.exportTypedArrayMethod; + var getTypedArrayConstructor$3 = arrayBufferViewCore.getTypedArrayConstructor; + + // `%TypedArray%.prototype.toReversed` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed + exportTypedArrayMethod$4('toReversed', function toReversed() { + return arrayToReversed(aTypedArray$4(this), getTypedArrayConstructor$3(this)); + }); var aTypedArray$3 = arrayBufferViewCore.aTypedArray; + var getTypedArrayConstructor$2 = arrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod$3 = arrayBufferViewCore.exportTypedArrayMethod; + var sort = functionUncurryThis(arrayBufferViewCore.TypedArrayPrototype.sort); - // `%TypedArray%.prototype.findLast` method - // https://github.com/tc39/proposal-array-find-from-last - exportTypedArrayMethod$3('findLast', function findLast(predicate /* , thisArg */) { - return $findLast(aTypedArray$3(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + // `%TypedArray%.prototype.toSorted` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSorted + exportTypedArrayMethod$3('toSorted', function toSorted(compareFn) { + if (compareFn !== undefined) { aCallable(compareFn); } + var O = aTypedArray$3(this); + var A = arrayFromConstructorAndList(getTypedArrayConstructor$2(O), O); + return sort(A, compareFn); }); - var $findLastIndex = arrayIterationFromLast.findLastIndex; + // TODO: Remove from `core-js@4` + + + + + var aTypedArray$2 = arrayBufferViewCore.aTypedArray; + var getTypedArrayConstructor$1 = arrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod$2 = arrayBufferViewCore.exportTypedArrayMethod; + var max = Math.max; + var min = Math.min; - // `%TypedArray%.prototype.findLastIndex` method - // https://github.com/tc39/proposal-array-find-from-last - exportTypedArrayMethod$2('findLastIndex', function findLastIndex(predicate /* , thisArg */) { - return $findLastIndex(aTypedArray$2(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + // some early implementations, like WebKit, does not follow the final semantic + var PROPER_ORDER$1 = !fails(function () { + // eslint-disable-next-line es-x/no-typed-arrays -- required for testing + var array = new Int8Array([1]); + + var spliced = array.toSpliced(1, 0, { + valueOf: function () { + array[0] = 2; + return 3; + } + }); + + return spliced[0] !== 2 || spliced[1] !== 3; }); + // `%TypedArray%.prototype.toSpliced` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced + exportTypedArrayMethod$2('toSpliced', function toSpliced(start, deleteCount /* , ...items */) { + var arguments$1 = arguments; + + var O = aTypedArray$2(this); + var C = getTypedArrayConstructor$1(O); + var len = lengthOfArrayLike(O); + var actualStart = toAbsoluteIndex(start, len); + var argumentsLength = arguments.length; + var k = 0; + var insertCount, actualDeleteCount, convertedItems, newLen, A; + if (argumentsLength === 0) { + insertCount = actualDeleteCount = 0; + } else if (argumentsLength === 1) { + insertCount = 0; + actualDeleteCount = len - actualStart; + } else { + actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart); + insertCount = argumentsLength - 2; + if (insertCount) { + convertedItems = new C(insertCount); + for (var i = 2; i < argumentsLength; i++) { + convertedItems[i - 2] = arguments$1[i]; + } + } + } + newLen = len + insertCount - actualDeleteCount; + A = new C(newLen); + + for (; k < actualStart; k++) { A[k] = O[k]; } + for (; k < actualStart + insertCount; k++) { A[k] = convertedItems[k - actualStart]; } + for (; k < newLen; k++) { A[k] = O[k + actualDeleteCount - insertCount]; } + + return A; + }, !PROPER_ORDER$1); + var aTypedArray$1 = arrayBufferViewCore.aTypedArray; var exportTypedArrayMethod$1 = arrayBufferViewCore.exportTypedArrayMethod; + var arrayUniqueBy = functionUncurryThis(arrayUniqueBy$2); - // `%TypedArray%.prototype.groupBy` method - // https://github.com/tc39/proposal-array-grouping - exportTypedArrayMethod$1('groupBy', function groupBy(callbackfn /* , thisArg */) { - var thisArg = arguments.length > 1 ? arguments[1] : undefined; - return arrayGroupBy(aTypedArray$1(this), callbackfn, thisArg, typedArraySpeciesConstructor); - }); + // `%TypedArray%.prototype.uniqueBy` method + // https://github.com/tc39/proposal-array-unique + exportTypedArrayMethod$1('uniqueBy', function uniqueBy(resolver) { + return typedArrayFromSpeciesAndList(this, arrayUniqueBy(aTypedArray$1(this), resolver)); + }, true); + + var slice = functionUncurryThis(''.slice); + + var isBigIntArray = function (it) { + return slice(classof(it), 0, 3) === 'Big'; + }; var aTypedArray = arrayBufferViewCore.aTypedArray; + var getTypedArrayConstructor = arrayBufferViewCore.getTypedArrayConstructor; var exportTypedArrayMethod = arrayBufferViewCore.exportTypedArrayMethod; - var arrayUniqueBy = functionUncurryThis(arrayUniqueBy$2); - // `%TypedArray%.prototype.uniqueBy` method - // https://github.com/tc39/proposal-array-unique - exportTypedArrayMethod('uniqueBy', function uniqueBy(resolver) { - return typedArrayFromSpeciesAndList(this, arrayUniqueBy(aTypedArray(this), resolver)); - }); + var PROPER_ORDER = !!function () { + try { + // eslint-disable-next-line no-throw-literal, es-x/no-typed-arrays -- required for testing + new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } }); + } catch (error) { + // some early implementations, like WebKit, does not follow the final semantic + // https://github.com/tc39/proposal-change-array-by-copy/pull/86 + return error === 8; + } + }(); + + // `%TypedArray%.prototype.with` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with + exportTypedArrayMethod('with', { 'with': function (index, value) { + var O = aTypedArray(this); + var relativeIndex = toIntegerOrInfinity(index); + var actualValue = isBigIntArray(O) ? toBigInt(value) : +value; + return arrayWith(O, getTypedArrayConstructor(O), relativeIndex, actualValue); + } }['with'], !PROPER_ORDER); // `WeakMap.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'WeakMap', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakMap', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); // `WeakMap.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from - _export({ target: 'WeakMap', stat: true }, { + _export({ target: 'WeakMap', stat: true, forced: true }, { from: collectionFrom }); // `WeakMap.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of - _export({ target: 'WeakMap', stat: true }, { + _export({ target: 'WeakMap', stat: true, forced: true }, { of: collectionOf }); // `WeakMap.prototype.emplace` method // https://github.com/tc39/proposal-upsert - _export({ target: 'WeakMap', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakMap', proto: true, real: true, forced: true }, { emplace: mapEmplace }); @@ -11914,37 +13304,136 @@ var doric = (function (exports) { - // `WeakMap.prototype.upsert` method (replaced by `WeakMap.prototype.emplace`) // https://github.com/tc39/proposal-upsert - _export({ target: 'WeakMap', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakMap', proto: true, real: true, forced: true }, { upsert: mapUpsert }); // `WeakSet.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'WeakSet', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakSet', proto: true, real: true, forced: true }, { addAll: collectionAddAll }); // `WeakSet.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'WeakSet', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakSet', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); // `WeakSet.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from - _export({ target: 'WeakSet', stat: true }, { + _export({ target: 'WeakSet', stat: true, forced: true }, { from: collectionFrom }); // `WeakSet.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of - _export({ target: 'WeakSet', stat: true }, { + _export({ target: 'WeakSet', stat: true, forced: true }, { of: collectionOf }); + var itoc$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + var ctoi$1 = {}; + + for (var index = 0; index < 66; index++) { ctoi$1[itoc$1.charAt(index)] = index; } + + var base64Map = { + itoc: itoc$1, + ctoi: ctoi$1 + }; + + var ctoi = base64Map.ctoi; + + var disallowed = /[^\d+/a-z]/i; + var whitespaces = /[\t\n\f\r ]+/g; + var finalEq = /[=]+$/; + + var $atob = getBuiltIn('atob'); + var fromCharCode$1 = String.fromCharCode; + var charAt$3 = functionUncurryThis(''.charAt); + var replace$3 = functionUncurryThis(''.replace); + var exec$2 = functionUncurryThis(disallowed.exec); + + var NO_SPACES_IGNORE = fails(function () { + return $atob(' ') !== ''; + }); + + var NO_ENCODING_CHECK = !fails(function () { + $atob('a'); + }); + + var NO_ARG_RECEIVING_CHECK$1 = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && !fails(function () { + $atob(); + }); + + var WRONG_ARITY$1 = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && $atob.length !== 1; + + // `atob` method + // https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob + _export({ global: true, enumerable: true, forced: NO_SPACES_IGNORE || NO_ENCODING_CHECK || NO_ARG_RECEIVING_CHECK$1 || WRONG_ARITY$1 }, { + atob: function atob(data) { + validateArgumentsLength(arguments.length, 1); + if (NO_ARG_RECEIVING_CHECK$1 || WRONG_ARITY$1) { return $atob(data); } + var string = replace$3(toString_1(data), whitespaces, ''); + var output = ''; + var position = 0; + var bc = 0; + var chr, bs; + if (string.length % 4 == 0) { + string = replace$3(string, finalEq, ''); + } + if (string.length % 4 == 1 || exec$2(disallowed, string)) { + throw new (getBuiltIn('DOMException'))('The string is not correctly encoded', 'InvalidCharacterError'); + } + while (chr = charAt$3(string, position++)) { + if (hasOwnProperty_1(ctoi, chr)) { + bs = bc % 4 ? bs * 64 + ctoi[chr] : ctoi[chr]; + if (bc++ % 4) { output += fromCharCode$1(255 & bs >> (-2 * bc & 6)); } + } + } return output; + } + }); + + var itoc = base64Map.itoc; + + var $btoa = getBuiltIn('btoa'); + var charAt$2 = functionUncurryThis(''.charAt); + var charCodeAt$1 = functionUncurryThis(''.charCodeAt); + + var NO_ARG_RECEIVING_CHECK = !!$btoa && !fails(function () { + $btoa(); + }); + + var WRONG_ARG_CONVERSION = !!$btoa && fails(function () { + return $btoa(null) !== 'bnVsbA=='; + }); + + var WRONG_ARITY = !!$btoa && $btoa.length !== 1; + + // `btoa` method + // https://html.spec.whatwg.org/multipage/webappapis.html#dom-btoa + _export({ global: true, enumerable: true, forced: NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY }, { + btoa: function btoa(data) { + validateArgumentsLength(arguments.length, 1); + if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) { return $btoa(toString_1(data)); } + var string = toString_1(data); + var output = ''; + var position = 0; + var map = itoc; + var block, charCode; + while (charAt$2(string, position) || (map = '=', position % 1)) { + charCode = charCodeAt$1(string, position += 3 / 4); + if (charCode > 0xFF) { + throw new (getBuiltIn('DOMException'))('The string contains characters outside of the Latin1 range', 'InvalidCharacterError'); + } + block = block << 8 | charCode; + output += charAt$2(map, 63 & block >> 8 - position % 1 * 8); + } return output; + } + }); + // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods var domIterables = { @@ -12038,106 +13527,830 @@ var doric = (function (exports) { handlePrototype(domTokenListPrototype, 'DOMTokenList'); - var FORCED = !global_1.setImmediate || !global_1.clearImmediate; + var tryNodeRequire = function (name) { + try { + // eslint-disable-next-line no-new-func -- safe + if (engineIsNode) { return Function('return require("' + name + '")')(); } + } catch (error) { /* empty */ } + }; - // http://w3c.github.io/setImmediate/ - _export({ global: true, bind: true, enumerable: true, forced: FORCED }, { - // `setImmediate` method - // http://w3c.github.io/setImmediate/#si-setImmediate - setImmediate: task$1.set, - // `clearImmediate` method - // http://w3c.github.io/setImmediate/#si-clearImmediate - clearImmediate: task$1.clear - }); + var domExceptionConstants = { + IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, + DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, + HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, + WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, + InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, + NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, + NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, + NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, + NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, + InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, + InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, + SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, + InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, + NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, + InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, + ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, + TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, + SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, + NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, + AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, + URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, + QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, + TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, + InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, + DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 } + }; - var process$1 = global_1.process; + var defineProperty$1 = objectDefineProperty.f; - // `queueMicrotask` method - // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask - _export({ global: true, enumerable: true, noTargetGet: true }, { - queueMicrotask: function queueMicrotask(fn) { - var domain = engineIsNode && process$1.domain; - microtask(domain ? domain.bind(fn) : fn); + + + + + + + + + + + + + var DOM_EXCEPTION$2 = 'DOMException'; + var DATA_CLONE_ERR = 'DATA_CLONE_ERR'; + var Error$3 = getBuiltIn('Error'); + // NodeJS < 17.0 does not expose `DOMException` to global + var NativeDOMException$1 = getBuiltIn(DOM_EXCEPTION$2) || (function () { + try { + // NodeJS < 15.0 does not expose `MessageChannel` to global + var MessageChannel = getBuiltIn('MessageChannel') || tryNodeRequire('worker_threads').MessageChannel; + // eslint-disable-next-line es-x/no-weak-map, unicorn/require-post-message-target-origin -- safe + new MessageChannel().port1.postMessage(new WeakMap()); + } catch (error) { + if (error.name == DATA_CLONE_ERR && error.code == 25) { return error.constructor; } } - }); + })(); + var NativeDOMExceptionPrototype = NativeDOMException$1 && NativeDOMException$1.prototype; + var ErrorPrototype = Error$3.prototype; + var setInternalState$2 = internalState.set; + var getInternalState = internalState.getterFor(DOM_EXCEPTION$2); + var HAS_STACK = 'stack' in Error$3(DOM_EXCEPTION$2); - var MSIE = /MSIE .\./.test(engineUserAgent); // <- dirty ie9- check - var Function$1 = global_1.Function; + var codeFor = function (name) { + return hasOwnProperty_1(domExceptionConstants, name) && domExceptionConstants[name].m ? domExceptionConstants[name].c : 0; + }; - var wrap = function (scheduler) { - return function (handler, timeout /* , ...arguments */) { - var boundArgs = arguments.length > 2; - var args = boundArgs ? arraySlice$1(arguments, 2) : undefined; - return scheduler(boundArgs ? function () { - functionApply(isCallable(handler) ? handler : Function$1(handler), this, args); - } : handler, timeout); - }; + var $DOMException$1 = function DOMException() { + anInstance(this, DOMExceptionPrototype$1); + var argumentsLength = arguments.length; + var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); + var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); + var code = codeFor(name); + setInternalState$2(this, { + type: DOM_EXCEPTION$2, + name: name, + message: message, + code: code + }); + if (!descriptors) { + this.name = name; + this.message = message; + this.code = code; + } + if (HAS_STACK) { + var error = Error$3(message); + error.name = DOM_EXCEPTION$2; + defineProperty$1(this, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); + } }; - // ie9- setTimeout & setInterval additional parameters fix - // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers - _export({ global: true, bind: true, forced: MSIE }, { - // `setTimeout` method - // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout - setTimeout: wrap(global_1.setTimeout), - // `setInterval` method - // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval - setInterval: wrap(global_1.setInterval) - }); + var DOMExceptionPrototype$1 = $DOMException$1.prototype = objectCreate(ErrorPrototype); - var ITERATOR$1 = wellKnownSymbol('iterator'); + var createGetterDescriptor = function (get) { + return { enumerable: true, configurable: true, get: get }; + }; - var nativeUrl = !fails(function () { - var url = new URL('b?a=1&b=2&c=3', 'http://a'); - var searchParams = url.searchParams; - var result = ''; - url.pathname = 'c%20d'; - searchParams.forEach(function (value, key) { - searchParams['delete']('b'); - result += key + value; + var getterFor = function (key) { + return createGetterDescriptor(function () { + return getInternalState(this)[key]; }); - return (isPure && !url.toJSON) - || !searchParams.sort - || url.href !== 'http://a/c%20d?a=1&c=3' - || searchParams.get('c') !== '3' - || String(new URLSearchParams('?a=1')) !== 'a=1' - || !searchParams[ITERATOR$1] - // throws in Edge - || new URL('https://a@b').username !== 'a' - || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' - // not punycoded in Edge - || new URL('http://тест').host !== 'xn--e1aybc' - // not escaped in Chrome 62- - || new URL('http://a#б').hash !== '#%D0%B1' - // fails in Chrome 66- - || result !== 'a1c3' - // throws in Safari - || new URL('http://x', undefined).host !== 'x'; + }; + + if (descriptors) { + defineBuiltInAccessor(DOMExceptionPrototype$1, 'code', getterFor('code')); + defineBuiltInAccessor(DOMExceptionPrototype$1, 'message', getterFor('message')); + defineBuiltInAccessor(DOMExceptionPrototype$1, 'name', getterFor('name')); + } + + defineProperty$1(DOMExceptionPrototype$1, 'constructor', createPropertyDescriptor(1, $DOMException$1)); + + // FF36- DOMException is a function, but can't be constructed + var INCORRECT_CONSTRUCTOR = fails(function () { + return !(new NativeDOMException$1() instanceof Error$3); }); - // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js + // Safari 10.1 / Chrome 32- / IE8- DOMException.prototype.toString bugs + var INCORRECT_TO_STRING = INCORRECT_CONSTRUCTOR || fails(function () { + return ErrorPrototype.toString !== errorToString || String(new NativeDOMException$1(1, 2)) !== '2: 1'; + }); + // Deno 1.6.3- DOMException.prototype.code just missed + var INCORRECT_CODE = INCORRECT_CONSTRUCTOR || fails(function () { + return new NativeDOMException$1(1, 'DataCloneError').code !== 25; + }); + // Deno 1.6.3- DOMException constants just missed + INCORRECT_CONSTRUCTOR + || NativeDOMException$1[DATA_CLONE_ERR] !== 25 + || NativeDOMExceptionPrototype[DATA_CLONE_ERR] !== 25; - var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 - var base = 36; - var tMin = 1; - var tMax = 26; - var skew = 38; - var damp = 700; - var initialBias = 72; - var initialN = 128; // 0x80 - var delimiter = '-'; // '\x2D' - var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars - var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators - var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; - var baseMinusTMin = base - tMin; + var FORCED_CONSTRUCTOR$1 = INCORRECT_CONSTRUCTOR; - var RangeError = global_1.RangeError; - var exec$1 = functionUncurryThis(regexSeparators.exec); - var floor$1 = Math.floor; - var fromCharCode = String.fromCharCode; - var charCodeAt = functionUncurryThis(''.charCodeAt); + // `DOMException` constructor + // https://webidl.spec.whatwg.org/#idl-DOMException + _export({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR$1 }, { + DOMException: FORCED_CONSTRUCTOR$1 ? $DOMException$1 : NativeDOMException$1 + }); + + var PolyfilledDOMException$1 = getBuiltIn(DOM_EXCEPTION$2); + var PolyfilledDOMExceptionPrototype$1 = PolyfilledDOMException$1.prototype; + + if (INCORRECT_TO_STRING && (NativeDOMException$1 === PolyfilledDOMException$1)) { + defineBuiltIn(PolyfilledDOMExceptionPrototype$1, 'toString', errorToString); + } + + if (INCORRECT_CODE && descriptors && NativeDOMException$1 === PolyfilledDOMException$1) { + defineBuiltInAccessor(PolyfilledDOMExceptionPrototype$1, 'code', createGetterDescriptor(function () { + return codeFor(anObject(this).name); + })); + } + + for (var key$1 in domExceptionConstants) { if (hasOwnProperty_1(domExceptionConstants, key$1)) { + var constant$1 = domExceptionConstants[key$1]; + var constantName$1 = constant$1.s; + var descriptor$1 = createPropertyDescriptor(6, constant$1.c); + if (!hasOwnProperty_1(PolyfilledDOMException$1, constantName$1)) { + defineProperty$1(PolyfilledDOMException$1, constantName$1, descriptor$1); + } + if (!hasOwnProperty_1(PolyfilledDOMExceptionPrototype$1, constantName$1)) { + defineProperty$1(PolyfilledDOMExceptionPrototype$1, constantName$1, descriptor$1); + } + } } + + var defineProperty = objectDefineProperty.f; + + + + + + + + + + var DOM_EXCEPTION$1 = 'DOMException'; + var Error$2 = getBuiltIn('Error'); + var NativeDOMException = getBuiltIn(DOM_EXCEPTION$1); + + var $DOMException = function DOMException() { + anInstance(this, DOMExceptionPrototype); + var argumentsLength = arguments.length; + var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); + var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); + var that = new NativeDOMException(message, name); + var error = Error$2(message); + error.name = DOM_EXCEPTION$1; + defineProperty(that, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); + inheritIfRequired(that, this, $DOMException); + return that; + }; + + var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototype; + + var ERROR_HAS_STACK = 'stack' in Error$2(DOM_EXCEPTION$1); + var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2); + + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var descriptor = NativeDOMException && descriptors && Object.getOwnPropertyDescriptor(global_1, DOM_EXCEPTION$1); + + // Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it + // https://github.com/Jarred-Sumner/bun/issues/399 + var BUGGY_DESCRIPTOR = !!descriptor && !(descriptor.writable && descriptor.configurable); + + var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !BUGGY_DESCRIPTOR && !DOM_EXCEPTION_HAS_STACK; + + // `DOMException` constructor patch for `.stack` where it's required + // https://webidl.spec.whatwg.org/#es-DOMException-specialness + _export({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR }, { // TODO: fix export logic + DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException + }); + + var PolyfilledDOMException = getBuiltIn(DOM_EXCEPTION$1); + var PolyfilledDOMExceptionPrototype = PolyfilledDOMException.prototype; + + if (PolyfilledDOMExceptionPrototype.constructor !== PolyfilledDOMException) { + { + defineProperty(PolyfilledDOMExceptionPrototype, 'constructor', createPropertyDescriptor(1, PolyfilledDOMException)); + } + + for (var key in domExceptionConstants) { if (hasOwnProperty_1(domExceptionConstants, key)) { + var constant = domExceptionConstants[key]; + var constantName = constant.s; + if (!hasOwnProperty_1(PolyfilledDOMException, constantName)) { + defineProperty(PolyfilledDOMException, constantName, createPropertyDescriptor(6, constant.c)); + } + } } + } + + var DOM_EXCEPTION = 'DOMException'; + + setToStringTag(getBuiltIn(DOM_EXCEPTION), DOM_EXCEPTION); + + var clearImmediate = task$1.clear; + + // `clearImmediate` method + // http://w3c.github.io/setImmediate/#si-clearImmediate + _export({ global: true, bind: true, enumerable: true, forced: global_1.clearImmediate !== clearImmediate }, { + clearImmediate: clearImmediate + }); + + var setImmediate = task$1.set; + + // `setImmediate` method + // http://w3c.github.io/setImmediate/#si-setImmediate + _export({ global: true, bind: true, enumerable: true, forced: global_1.setImmediate !== setImmediate }, { + setImmediate: setImmediate + }); + + var process$1 = global_1.process; + + // `queueMicrotask` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask + _export({ global: true, enumerable: true, dontCallGetSet: true }, { + queueMicrotask: function queueMicrotask(fn) { + validateArgumentsLength(arguments.length, 1); + aCallable(fn); + var domain = engineIsNode && process$1.domain; + microtask(domain ? domain.bind(fn) : fn); + } + }); + + var Object$1 = global_1.Object; + var Date$1 = global_1.Date; + var Error$1 = global_1.Error; + var EvalError = global_1.EvalError; + var RangeError$1 = global_1.RangeError; + var ReferenceError = global_1.ReferenceError; + var SyntaxError$1 = global_1.SyntaxError; + var TypeError$3 = global_1.TypeError; + var URIError = global_1.URIError; + var PerformanceMark = global_1.PerformanceMark; + var WebAssembly = global_1.WebAssembly; + var CompileError = WebAssembly && WebAssembly.CompileError || Error$1; + var LinkError = WebAssembly && WebAssembly.LinkError || Error$1; + var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error$1; + var DOMException = getBuiltIn('DOMException'); + var Set$1 = getBuiltIn('Set'); + var Map$1 = getBuiltIn('Map'); + var MapPrototype = Map$1.prototype; + var mapHas = functionUncurryThis(MapPrototype.has); + var mapGet = functionUncurryThis(MapPrototype.get); + var mapSet = functionUncurryThis(MapPrototype.set); + var setAdd = functionUncurryThis(Set$1.prototype.add); + var objectKeys = getBuiltIn('Object', 'keys'); + var push$3 = functionUncurryThis([].push); + var booleanValueOf = functionUncurryThis(true.valueOf); + var numberValueOf = functionUncurryThis(1.0.valueOf); + var stringValueOf = functionUncurryThis(''.valueOf); + var getTime = functionUncurryThis(Date$1.prototype.getTime); + var PERFORMANCE_MARK = uid('structuredClone'); + var DATA_CLONE_ERROR = 'DataCloneError'; + var TRANSFERRING = 'Transferring'; + + var checkBasicSemantic = function (structuredCloneImplementation) { + return !fails(function () { + var set1 = new global_1.Set([7]); + var set2 = structuredCloneImplementation(set1); + var number = structuredCloneImplementation(Object$1(7)); + return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7; + }) && structuredCloneImplementation; + }; + + var checkErrorsCloning = function (structuredCloneImplementation, $Error) { + return !fails(function () { + var error = new $Error(); + var test = structuredCloneImplementation({ a: error, b: error }); + return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack); + }); + }; + + // https://github.com/whatwg/html/pull/5749 + var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) { + return !fails(function () { + var test = structuredCloneImplementation(new global_1.AggregateError([1], PERFORMANCE_MARK, { cause: 3 })); + return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3; + }); + }; + + // FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+ + // FF<103 and Safari implementations can't clone errors + // https://bugzilla.mozilla.org/show_bug.cgi?id=1556604 + // FF103 can clone errors, but `.stack` of clone is an empty string + // https://bugzilla.mozilla.org/show_bug.cgi?id=1778762 + // FF104+ fixed it on usual errors, but not on DOMExceptions + // https://bugzilla.mozilla.org/show_bug.cgi?id=1777321 + // Chrome <102 returns `null` if cloned object contains multiple references to one error + // https://bugs.chromium.org/p/v8/issues/detail?id=12542 + // NodeJS implementation can't clone DOMExceptions + // https://github.com/nodejs/node/issues/41038 + // only FF103+ supports new (html/5749) error cloning semantic + var nativeStructuredClone = global_1.structuredClone; + + var FORCED_REPLACEMENT = !checkErrorsCloning(nativeStructuredClone, Error$1) + || !checkErrorsCloning(nativeStructuredClone, DOMException) + || !checkNewErrorsCloningSemantic(nativeStructuredClone); + + // Chrome 82+, Safari 14.1+, Deno 1.11+ + // Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException` + // Chrome returns `null` if cloned object contains multiple references to one error + // Safari 14.1 implementation doesn't clone some `RegExp` flags, so requires a workaround + // Safari implementation can't clone errors + // Deno 1.2-1.10 implementations too naive + // NodeJS 16.0+ does not have `PerformanceMark` constructor + // NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive + // and can't clone, for example, `RegExp` or some boxed primitives + // https://github.com/nodejs/node/issues/40840 + // no one of those implementations supports new (html/5749) error cloning semantic + var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) { + return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail; + }); + + var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark; + + var throwUncloneable = function (type) { + throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR); + }; + + var throwUnpolyfillable = function (type, kind) { + throw new DOMException((kind || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR); + }; + + var structuredCloneInternal = function (value, map) { + if (isSymbol(value)) { throwUncloneable('Symbol'); } + if (!isObject(value)) { return value; } + // effectively preserves circular references + if (map) { + if (mapHas(map, value)) { return mapGet(map, value); } + } else { map = new Map$1(); } + + var type = classof(value); + var deep = false; + var C, name, cloned, dataTransfer, i, length, keys, key, source, target; + + switch (type) { + case 'Array': + cloned = []; + deep = true; + break; + case 'Object': + cloned = {}; + deep = true; + break; + case 'Map': + cloned = new Map$1(); + deep = true; + break; + case 'Set': + cloned = new Set$1(); + deep = true; + break; + case 'RegExp': + // in this block because of a Safari 14.1 bug + // old FF does not clone regexes passed to the constructor, so get the source and flags directly + cloned = new RegExp(value.source, regexpGetFlags(value)); + break; + case 'Error': + name = value.name; + switch (name) { + case 'AggregateError': + cloned = getBuiltIn('AggregateError')([]); + break; + case 'EvalError': + cloned = EvalError(); + break; + case 'RangeError': + cloned = RangeError$1(); + break; + case 'ReferenceError': + cloned = ReferenceError(); + break; + case 'SyntaxError': + cloned = SyntaxError$1(); + break; + case 'TypeError': + cloned = TypeError$3(); + break; + case 'URIError': + cloned = URIError(); + break; + case 'CompileError': + cloned = CompileError(); + break; + case 'LinkError': + cloned = LinkError(); + break; + case 'RuntimeError': + cloned = RuntimeError(); + break; + default: + cloned = Error$1(); + } + deep = true; + break; + case 'DOMException': + cloned = new DOMException(value.message, value.name); + deep = true; + break; + case 'DataView': + case 'Int8Array': + case 'Uint8Array': + case 'Uint8ClampedArray': + case 'Int16Array': + case 'Uint16Array': + case 'Int32Array': + case 'Uint32Array': + case 'Float32Array': + case 'Float64Array': + case 'BigInt64Array': + case 'BigUint64Array': + C = global_1[type]; + // in some old engines like Safari 9, typeof C is 'object' + // on Uint8ClampedArray or some other constructors + if (!isObject(C)) { throwUnpolyfillable(type); } + cloned = new C( + // this is safe, since arraybuffer cannot have circular references + structuredCloneInternal(value.buffer, map), + value.byteOffset, + type === 'DataView' ? value.byteLength : value.length + ); + break; + case 'DOMQuad': + try { + cloned = new DOMQuad( + structuredCloneInternal(value.p1, map), + structuredCloneInternal(value.p2, map), + structuredCloneInternal(value.p3, map), + structuredCloneInternal(value.p4, map) + ); + } catch (error) { + if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { throwUnpolyfillable(type); } + } + break; + case 'FileList': + C = global_1.DataTransfer; + if (isConstructor(C)) { + dataTransfer = new C(); + for (i = 0, length = lengthOfArrayLike(value); i < length; i++) { + dataTransfer.items.add(structuredCloneInternal(value[i], map)); + } + cloned = dataTransfer.files; + } else if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { throwUnpolyfillable(type); } + break; + case 'ImageData': + // Safari 9 ImageData is a constructor, but typeof ImageData is 'object' + try { + cloned = new ImageData( + structuredCloneInternal(value.data, map), + value.width, + value.height, + { colorSpace: value.colorSpace } + ); + } catch (error$1) { + if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { throwUnpolyfillable(type); } + } break; + default: + if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { switch (type) { + case 'BigInt': + // can be a 3rd party polyfill + cloned = Object$1(value.valueOf()); + break; + case 'Boolean': + cloned = Object$1(booleanValueOf(value)); + break; + case 'Number': + cloned = Object$1(numberValueOf(value)); + break; + case 'String': + cloned = Object$1(stringValueOf(value)); + break; + case 'Date': + cloned = new Date$1(getTime(value)); + break; + case 'ArrayBuffer': + C = global_1.DataView; + // `ArrayBuffer#slice` is not available in IE10 + // `ArrayBuffer#slice` and `DataView` are not available in old FF + if (!C && typeof value.slice != 'function') { throwUnpolyfillable(type); } + // detached buffers throws in `DataView` and `.slice` + try { + if (typeof value.slice == 'function') { + cloned = value.slice(0); + } else { + length = value.byteLength; + cloned = new ArrayBuffer(length); + source = new C(value); + target = new C(cloned); + for (i = 0; i < length; i++) { + target.setUint8(i, source.getUint8(i)); + } + } + } catch (error$2) { + throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR); + } break; + case 'SharedArrayBuffer': + // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original + cloned = value; + break; + case 'Blob': + try { + cloned = value.slice(0, value.size, value.type); + } catch (error$3) { + throwUnpolyfillable(type); + } break; + case 'DOMPoint': + case 'DOMPointReadOnly': + C = global_1[type]; + try { + cloned = C.fromPoint + ? C.fromPoint(value) + : new C(value.x, value.y, value.z, value.w); + } catch (error$4) { + throwUnpolyfillable(type); + } break; + case 'DOMRect': + case 'DOMRectReadOnly': + C = global_1[type]; + try { + cloned = C.fromRect + ? C.fromRect(value) + : new C(value.x, value.y, value.width, value.height); + } catch (error$5) { + throwUnpolyfillable(type); + } break; + case 'DOMMatrix': + case 'DOMMatrixReadOnly': + C = global_1[type]; + try { + cloned = C.fromMatrix + ? C.fromMatrix(value) + : new C(value); + } catch (error$6) { + throwUnpolyfillable(type); + } break; + case 'AudioData': + case 'VideoFrame': + if (!isCallable(value.clone)) { throwUnpolyfillable(type); } + try { + cloned = value.clone(); + } catch (error$7) { + throwUncloneable(type); + } break; + case 'File': + try { + cloned = new File([value], value.name, value); + } catch (error$8) { + throwUnpolyfillable(type); + } break; + case 'CryptoKey': + case 'GPUCompilationMessage': + case 'GPUCompilationInfo': + case 'ImageBitmap': + case 'RTCCertificate': + case 'WebAssembly.Module': + throwUnpolyfillable(type); + // break omitted + default: + throwUncloneable(type); + } } + } + + mapSet(map, value, cloned); + + if (deep) { switch (type) { + case 'Array': + case 'Object': + keys = objectKeys(value); + for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) { + key = keys[i]; + createProperty(cloned, key, structuredCloneInternal(value[key], map)); + } break; + case 'Map': + value.forEach(function (v, k) { + mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map)); + }); + break; + case 'Set': + value.forEach(function (v) { + setAdd(cloned, structuredCloneInternal(v, map)); + }); + break; + case 'Error': + createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map)); + if (hasOwnProperty_1(value, 'cause')) { + createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map)); + } + if (name == 'AggregateError') { + cloned.errors = structuredCloneInternal(value.errors, map); + } // break omitted + case 'DOMException': + if (errorStackInstallable) { + createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map)); + } + } } + + return cloned; + }; + + var PROPER_TRANSFER = nativeStructuredClone && !fails(function () { + // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation + // https://github.com/zloirock/core-js/issues/679 + if ((engineIsDeno && engineV8Version > 92) || (engineIsNode && engineV8Version > 94) || (engineIsBrowser && engineV8Version > 97)) { return false; } + var buffer = new ArrayBuffer(8); + var clone = nativeStructuredClone(buffer, { transfer: [buffer] }); + return buffer.byteLength != 0 || clone.byteLength != 8; + }); + + var tryToTransfer = function (rawTransfer, map) { + if (!isObject(rawTransfer)) { throw TypeError$3('Transfer option cannot be converted to a sequence'); } + + var transfer = []; + + iterate(rawTransfer, function (value) { + push$3(transfer, anObject(value)); + }); + + var i = 0; + var length = lengthOfArrayLike(transfer); + var value, type, C, transferredArray, transferred, canvas, context; + + if (PROPER_TRANSFER) { + transferredArray = nativeStructuredClone(transfer, { transfer: transfer }); + while (i < length) { mapSet(map, transfer[i], transferredArray[i++]); } + } else { while (i < length) { + value = transfer[i++]; + if (mapHas(map, value)) { throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); } + + type = classof(value); + + switch (type) { + case 'ImageBitmap': + C = global_1.OffscreenCanvas; + if (!isConstructor(C)) { throwUnpolyfillable(type, TRANSFERRING); } + try { + canvas = new C(value.width, value.height); + context = canvas.getContext('bitmaprenderer'); + context.transferFromImageBitmap(value); + transferred = canvas.transferToImageBitmap(); + } catch (error) { /* empty */ } + break; + case 'AudioData': + case 'VideoFrame': + if (!isCallable(value.clone) || !isCallable(value.close)) { throwUnpolyfillable(type, TRANSFERRING); } + try { + transferred = value.clone(); + value.close(); + } catch (error$1) { /* empty */ } + break; + case 'ArrayBuffer': + case 'MessagePort': + case 'OffscreenCanvas': + case 'ReadableStream': + case 'TransformStream': + case 'WritableStream': + throwUnpolyfillable(type, TRANSFERRING); + } + + if (transferred === undefined) { throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR); } + mapSet(map, value, transferred); + } } + }; + + _export({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLACEMENT }, { + structuredClone: function structuredClone(value /* , { transfer } */) { + var options = validateArgumentsLength(arguments.length, 1) > 1 && arguments[1] != null ? anObject(arguments[1]) : undefined; + var transfer = options ? options.transfer : undefined; + var map; + + if (transfer !== undefined) { + map = new Map$1(); + tryToTransfer(transfer, map); + } + + return structuredCloneInternal(value, map); + } + }); + + var MSIE = /MSIE .\./.test(engineUserAgent); // <- dirty ie9- check + var Function$1 = global_1.Function; + + var wrap = function (scheduler) { + return MSIE ? function (handler, timeout /* , ...arguments */) { + var boundArgs = validateArgumentsLength(arguments.length, 1) > 2; + var fn = isCallable(handler) ? handler : Function$1(handler); + var args = boundArgs ? arraySlice$1(arguments, 2) : undefined; + return scheduler(boundArgs ? function () { + functionApply(fn, this, args); + } : fn, timeout); + } : scheduler; + }; + + // ie9- setTimeout & setInterval additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers + var schedulersFix = { + // `setTimeout` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout + setTimeout: wrap(global_1.setTimeout), + // `setInterval` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + setInterval: wrap(global_1.setInterval) + }; + + var setInterval = schedulersFix.setInterval; + + // ie9- setInterval additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + _export({ global: true, bind: true, forced: global_1.setInterval !== setInterval }, { + setInterval: setInterval + }); + + var setTimeout$1 = schedulersFix.setTimeout; + + // ie9- setTimeout additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout + _export({ global: true, bind: true, forced: global_1.setTimeout !== setTimeout$1 }, { + setTimeout: setTimeout$1 + }); + + var ITERATOR$1 = wellKnownSymbol('iterator'); + + var nativeUrl = !fails(function () { + // eslint-disable-next-line unicorn/relative-url-style -- required for testing + var url = new URL('b?a=1&b=2&c=3', 'http://a'); + var searchParams = url.searchParams; + var result = ''; + url.pathname = 'c%20d'; + searchParams.forEach(function (value, key) { + searchParams['delete']('b'); + result += key + value; + }); + return (isPure && !url.toJSON) + || !searchParams.sort + || url.href !== 'http://a/c%20d?a=1&c=3' + || searchParams.get('c') !== '3' + || String(new URLSearchParams('?a=1')) !== 'a=1' + || !searchParams[ITERATOR$1] + // throws in Edge + || new URL('https://a@b').username !== 'a' + || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' + // not punycoded in Edge + || new URL('http://тест').host !== 'xn--e1aybc' + // not escaped in Chrome 62- + || new URL('http://a#б').hash !== '#%D0%B1' + // fails in Chrome 66- + || result !== 'a1c3' + // throws in Safari + || new URL('http://x', undefined).host !== 'x'; + }); + + // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js + + + var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 + var base = 36; + var tMin = 1; + var tMax = 26; + var skew = 38; + var damp = 700; + var initialBias = 72; + var initialN = 128; // 0x80 + var delimiter = '-'; // '\x2D' + var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars + var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators + var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; + var baseMinusTMin = base - tMin; + + var $RangeError = RangeError; + var exec$1 = functionUncurryThis(regexSeparators.exec); + var floor$1 = Math.floor; + var fromCharCode = String.fromCharCode; + var charCodeAt = functionUncurryThis(''.charCodeAt); var join$2 = functionUncurryThis([].join); var push$2 = functionUncurryThis([].push); var replace$2 = functionUncurryThis(''.replace); @@ -12192,8 +14405,9 @@ var doric = (function (exports) { var k = 0; delta = firstTime ? floor$1(delta / damp) : delta >> 1; delta += floor$1(delta / numPoints); - for (; delta > baseMinusTMin * tMax >> 1; k += base) { + while (delta > baseMinusTMin * tMax >> 1) { delta = floor$1(delta / baseMinusTMin); + k += base; } return floor$1(k + (baseMinusTMin + 1) * delta / (delta + skew)); }; @@ -12202,7 +14416,6 @@ var doric = (function (exports) { * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ - // eslint-disable-next-line max-statements -- TODO var encode = function (input) { var output = []; @@ -12248,7 +14461,7 @@ var doric = (function (exports) { // Increase `delta` enough to advance the decoder's state to , but guard against overflow. var handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor$1((maxInt - delta) / handledCPCountPlusOne)) { - throw RangeError(OVERFLOW_ERROR); + throw $RangeError(OVERFLOW_ERROR); } delta += (m - n) * handledCPCountPlusOne; @@ -12257,29 +14470,31 @@ var doric = (function (exports) { for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < n && ++delta > maxInt) { - throw RangeError(OVERFLOW_ERROR); + throw $RangeError(OVERFLOW_ERROR); } if (currentValue == n) { // Represent delta as a generalized variable-length integer. var q = delta; - for (var k = base; /* no condition */; k += base) { + var k = base; + while (true) { var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } var qMinusT = q - t; var baseMinusT = base - t; push$2(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor$1(qMinusT / baseMinusT); + k += base; } push$2(output, fromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; - ++handledCPCount; + handledCPCount++; } } - ++delta; - ++n; + delta++; + n++; } return join$2(output, ''); }; @@ -12321,6 +14536,7 @@ var doric = (function (exports) { + var ITERATOR = wellKnownSymbol('iterator'); @@ -12329,11 +14545,20 @@ var doric = (function (exports) { var setInternalState$1 = internalState.set; var getInternalParamsState = internalState.getterFor(URL_SEARCH_PARAMS); var getInternalIteratorState = internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR); + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + + // Avoid NodeJS experimental warning + var safeGetBuiltIn = function (name) { + if (!descriptors) { return global_1[name]; } + var descriptor = getOwnPropertyDescriptor(global_1, name); + return descriptor && descriptor.value; + }; - var n$Fetch = getBuiltIn('fetch'); - var N$Request = getBuiltIn('Request'); - var Headers = getBuiltIn('Headers'); - var RequestPrototype = N$Request && N$Request.prototype; + var nativeFetch = safeGetBuiltIn('fetch'); + var NativeRequest = safeGetBuiltIn('Request'); + var Headers = safeGetBuiltIn('Headers'); + var RequestPrototype = NativeRequest && NativeRequest.prototype; var HeadersPrototype = Headers && Headers.prototype; var RegExp$1 = global_1.RegExp; var TypeError$2 = global_1.TypeError; @@ -12395,33 +14620,6 @@ var doric = (function (exports) { return replace$1(encodeURIComponent$1(it), find, replacer); }; - var parseSearchParams = function (result, query) { - if (query) { - var attributes = split$1(query, '&'); - var index = 0; - var attribute, entry; - while (index < attributes.length) { - attribute = attributes[index++]; - if (attribute.length) { - entry = split$1(attribute, '='); - push$1(result, { - key: deserialize(shift$1(entry)), - value: deserialize(join$1(entry, '=')) - }); - } - } - } - }; - - var updateSearchParams = function (query) { - this.entries.length = 0; - parseSearchParams(this.entries, query); - }; - - var validateArgumentsLength = function (passed, required) { - if (passed < required) { throw TypeError$2('Not enough arguments'); } - }; - var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState$1(this, { type: URL_SEARCH_PARAMS_ITERATOR, @@ -12436,53 +14634,92 @@ var doric = (function (exports) { if (!step.done) { step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; } return step; - }); + }, true); - // `URLSearchParams` constructor - // https://url.spec.whatwg.org/#interface-urlsearchparams - var URLSearchParamsConstructor = function URLSearchParams(/* init */) { - anInstance(this, URLSearchParamsPrototype); - var init = arguments.length > 0 ? arguments[0] : undefined; - var that = this; - var entries = []; - var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key; - - setInternalState$1(that, { - type: URL_SEARCH_PARAMS, - entries: entries, - updateURL: function () { /* empty */ }, - updateSearchParams: updateSearchParams - }); + var URLSearchParamsState = function (init) { + this.entries = []; + this.url = null; if (init !== undefined) { - if (isObject(init)) { - iteratorMethod = getIteratorMethod(init); - if (iteratorMethod) { - iterator = getIterator(init, iteratorMethod); - next = iterator.next; - while (!(step = functionCall(next, iterator)).done) { - entryIterator = getIterator(anObject(step.value)); - entryNext = entryIterator.next; - if ( - (first = functionCall(entryNext, entryIterator)).done || - (second = functionCall(entryNext, entryIterator)).done || - !functionCall(entryNext, entryIterator).done - ) { throw TypeError$2('Expected sequence with length 2'); } - push$1(entries, { key: toString_1(first.value), value: toString_1(second.value) }); + if (isObject(init)) { this.parseObject(init); } + else { this.parseQuery(typeof init == 'string' ? charAt$1(init, 0) === '?' ? stringSlice$1(init, 1) : init : toString_1(init)); } + } + }; + + URLSearchParamsState.prototype = { + type: URL_SEARCH_PARAMS, + bindURL: function (url) { + this.url = url; + this.update(); + }, + parseObject: function (object) { + var iteratorMethod = getIteratorMethod(object); + var iterator, next, step, entryIterator, entryNext, first, second; + + if (iteratorMethod) { + iterator = getIterator(object, iteratorMethod); + next = iterator.next; + while (!(step = functionCall(next, iterator)).done) { + entryIterator = getIterator(anObject(step.value)); + entryNext = entryIterator.next; + if ( + (first = functionCall(entryNext, entryIterator)).done || + (second = functionCall(entryNext, entryIterator)).done || + !functionCall(entryNext, entryIterator).done + ) { throw TypeError$2('Expected sequence with length 2'); } + push$1(this.entries, { key: toString_1(first.value), value: toString_1(second.value) }); + } + } else { for (var key in object) { if (hasOwnProperty_1(object, key)) { + push$1(this.entries, { key: key, value: toString_1(object[key]) }); + } } } + }, + parseQuery: function (query) { + if (query) { + var attributes = split$1(query, '&'); + var index = 0; + var attribute, entry; + while (index < attributes.length) { + attribute = attributes[index++]; + if (attribute.length) { + entry = split$1(attribute, '='); + push$1(this.entries, { + key: deserialize(shift$1(entry)), + value: deserialize(join$1(entry, '=')) + }); } - } else { for (key in init) { if (hasOwnProperty_1(init, key)) { push$1(entries, { key: key, value: toString_1(init[key]) }); } } } - } else { - parseSearchParams( - entries, - typeof init == 'string' ? charAt$1(init, 0) === '?' ? stringSlice$1(init, 1) : init : toString_1(init) - ); + } } + }, + serialize: function () { + var entries = this.entries; + var result = []; + var index = 0; + var entry; + while (index < entries.length) { + entry = entries[index++]; + push$1(result, serialize(entry.key) + '=' + serialize(entry.value)); + } return join$1(result, '&'); + }, + update: function () { + this.entries.length = 0; + this.parseQuery(this.url.query); + }, + updateURL: function () { + if (this.url) { this.url.update(); } } }; + // `URLSearchParams` constructor + // https://url.spec.whatwg.org/#interface-urlsearchparams + var URLSearchParamsConstructor = function URLSearchParams(/* init */) { + anInstance(this, URLSearchParamsPrototype); + var init = arguments.length > 0 ? arguments[0] : undefined; + setInternalState$1(this, new URLSearchParamsState(init)); + }; + var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; - redefineAll(URLSearchParamsPrototype, { + defineBuiltIns(URLSearchParamsPrototype, { // `URLSearchParams.prototype.append` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { @@ -12601,24 +14838,17 @@ var doric = (function (exports) { }, { enumerable: true }); // `URLSearchParams.prototype[@@iterator]` method - redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' }); + defineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' }); // `URLSearchParams.prototype.toString` method // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior - redefine(URLSearchParamsPrototype, 'toString', function toString() { - var entries = getInternalParamsState(this).entries; - var result = []; - var index = 0; - var entry; - while (index < entries.length) { - entry = entries[index++]; - push$1(result, serialize(entry.key) + '=' + serialize(entry.value)); - } return join$1(result, '&'); + defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() { + return getInternalParamsState(this).serialize(); }, { enumerable: true }); setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS); - _export({ global: true, forced: !nativeUrl }, { + _export({ global: true, constructor: true, forced: !nativeUrl }, { URLSearchParams: URLSearchParamsConstructor }); @@ -12644,30 +14874,30 @@ var doric = (function (exports) { } return init; }; - if (isCallable(n$Fetch)) { - _export({ global: true, enumerable: true, forced: true }, { + if (isCallable(nativeFetch)) { + _export({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, { fetch: function fetch(input /* , init */) { - return n$Fetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); + return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); } }); } - if (isCallable(N$Request)) { + if (isCallable(NativeRequest)) { var RequestConstructor = function Request(input /* , init */) { anInstance(this, RequestPrototype); - return new N$Request(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); + return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); }; RequestPrototype.constructor = RequestConstructor; RequestConstructor.prototype = RequestPrototype; - _export({ global: true, forced: true }, { + _export({ global: true, constructor: true, dontCallGetSet: true, forced: true }, { Request: RequestConstructor }); } } - var web_urlSearchParams = { + var web_urlSearchParams_constructor = { URLSearchParams: URLSearchParamsConstructor, getState: getInternalParamsState }; @@ -12687,7 +14917,6 @@ var doric = (function (exports) { - var codeAt = stringMultibyte.codeAt; @@ -12695,10 +14924,11 @@ var doric = (function (exports) { + var setInternalState = internalState.set; var getInternalURLState = internalState.getterFor('URL'); - var URLSearchParams$1 = web_urlSearchParams.URLSearchParams; - var getInternalSearchParamsState = web_urlSearchParams.getState; + var URLSearchParams$1 = web_urlSearchParams_constructor.URLSearchParams; + var getInternalSearchParamsState = web_urlSearchParams_constructor.getState; var NativeURL = global_1.URL; var TypeError$1 = global_1.TypeError; @@ -12739,31 +14969,7 @@ var doric = (function (exports) { /* eslint-enable regexp/no-control-character -- safe */ var EOF; - var parseHost = function (url, input) { - var result, codePoints, index; - if (charAt(input, 0) == '[') { - if (charAt(input, input.length - 1) != ']') { return INVALID_HOST; } - result = parseIPv6(stringSlice(input, 1, -1)); - if (!result) { return INVALID_HOST; } - url.host = result; - // opaque host - } else if (!isSpecial(url)) { - if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) { return INVALID_HOST; } - result = ''; - codePoints = arrayFrom(input); - for (index = 0; index < codePoints.length; index++) { - result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); - } - url.host = result; - } else { - input = stringPunycodeToAscii(input); - if (exec(FORBIDDEN_HOST_CODE_POINT, input)) { return INVALID_HOST; } - result = parseIPv4(input); - if (result === null) { return INVALID_HOST; } - url.host = result; - } - }; - + // https://url.spec.whatwg.org/#ipv4-number-parser var parseIPv4 = function (input) { var parts = split(input, '.'); var partsLength, numbers, index, part, radix, number, ipv4; @@ -12802,6 +15008,7 @@ var doric = (function (exports) { return ipv4; }; + // https://url.spec.whatwg.org/#concept-ipv6-parser // eslint-disable-next-line max-statements -- TODO var parseIPv6 = function (input) { var address = [0, 0, 0, 0, 0, 0, 0, 0]; @@ -12905,6 +15112,7 @@ var doric = (function (exports) { return maxIndex; }; + // https://url.spec.whatwg.org/#host-serializing var serializeHost = function (host) { var result, index, compress, ignore0; // ipv4 @@ -12949,6 +15157,7 @@ var doric = (function (exports) { return code > 0x20 && code < 0x7F && !hasOwnProperty_1(set, chr) ? chr : encodeURIComponent(chr); }; + // https://url.spec.whatwg.org/#special-scheme var specialSchemes = { ftp: 21, file: null, @@ -12958,24 +15167,14 @@ var doric = (function (exports) { wss: 443 }; - var isSpecial = function (url) { - return hasOwnProperty_1(specialSchemes, url.scheme); - }; - - var includesCredentials = function (url) { - return url.username != '' || url.password != ''; - }; - - var cannotHaveUsernamePasswordPort = function (url) { - return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; - }; - + // https://url.spec.whatwg.org/#windows-drive-letter var isWindowsDriveLetter = function (string, normalized) { var second; return string.length == 2 && exec(ALPHA, charAt(string, 0)) && ((second = charAt(string, 1)) == ':' || (!normalized && second == '|')); }; + // https://url.spec.whatwg.org/#start-with-a-windows-drive-letter var startsWithWindowsDriveLetter = function (string) { var third; return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && ( @@ -12984,18 +15183,12 @@ var doric = (function (exports) { ); }; - var shortenURLsPath = function (url) { - var path = url.path; - var pathSize = path.length; - if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { - path.length--; - } - }; - + // https://url.spec.whatwg.org/#single-dot-path-segment var isSingleDot = function (segment) { return segment === '.' || toLowerCase(segment) === '%2e'; }; + // https://url.spec.whatwg.org/#double-dot-path-segment var isDoubleDot = function (segment) { segment = toLowerCase(segment); return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; @@ -13024,402 +15217,625 @@ var doric = (function (exports) { var QUERY = {}; var FRAGMENT = {}; - // eslint-disable-next-line max-statements -- TODO - var parseURL = function (url, input, stateOverride, base) { - var state = stateOverride || SCHEME_START; - var pointer = 0; - var buffer = ''; - var seenAt = false; - var seenBracket = false; - var seenPasswordToken = false; - var codePoints, chr, bufferCodePoints, failure; - - if (!stateOverride) { - url.scheme = ''; - url.username = ''; - url.password = ''; - url.host = null; - url.port = null; - url.path = []; - url.query = null; - url.fragment = null; - url.cannotBeABaseURL = false; - input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); - } - - input = replace(input, TAB_AND_NEW_LINE, ''); - - codePoints = arrayFrom(input); - - while (pointer <= codePoints.length) { - chr = codePoints[pointer]; - switch (state) { - case SCHEME_START: - if (chr && exec(ALPHA, chr)) { - buffer += toLowerCase(chr); - state = SCHEME; - } else if (!stateOverride) { - state = NO_SCHEME; - continue; - } else { return INVALID_SCHEME; } - break; + var URLState = function (url, isBase, base) { + var urlString = toString_1(url); + var baseState, failure, searchParams; + if (isBase) { + failure = this.parse(urlString); + if (failure) { throw TypeError$1(failure); } + this.searchParams = null; + } else { + if (base !== undefined) { baseState = new URLState(base, true); } + failure = this.parse(urlString, null, baseState); + if (failure) { throw TypeError$1(failure); } + searchParams = getInternalSearchParamsState(new URLSearchParams$1()); + searchParams.bindURL(this); + this.searchParams = searchParams; + } + }; - case SCHEME: - if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { - buffer += toLowerCase(chr); - } else if (chr == ':') { - if (stateOverride && ( - (isSpecial(url) != hasOwnProperty_1(specialSchemes, buffer)) || - (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || - (url.scheme == 'file' && !url.host) - )) { return; } - url.scheme = buffer; - if (stateOverride) { - if (isSpecial(url) && specialSchemes[url.scheme] == url.port) { url.port = null; } - return; - } - buffer = ''; - if (url.scheme == 'file') { - state = FILE; - } else if (isSpecial(url) && base && base.scheme == url.scheme) { - state = SPECIAL_RELATIVE_OR_AUTHORITY; - } else if (isSpecial(url)) { - state = SPECIAL_AUTHORITY_SLASHES; - } else if (codePoints[pointer + 1] == '/') { - state = PATH_OR_AUTHORITY; - pointer++; - } else { - url.cannotBeABaseURL = true; - push(url.path, ''); - state = CANNOT_BE_A_BASE_URL_PATH; - } - } else if (!stateOverride) { - buffer = ''; - state = NO_SCHEME; - pointer = 0; - continue; - } else { return INVALID_SCHEME; } - break; + URLState.prototype = { + type: 'URL', + // https://url.spec.whatwg.org/#url-parsing + // eslint-disable-next-line max-statements -- TODO + parse: function (input, stateOverride, base) { + var url = this; + var state = stateOverride || SCHEME_START; + var pointer = 0; + var buffer = ''; + var seenAt = false; + var seenBracket = false; + var seenPasswordToken = false; + var codePoints, chr, bufferCodePoints, failure; + + input = toString_1(input); + + if (!stateOverride) { + url.scheme = ''; + url.username = ''; + url.password = ''; + url.host = null; + url.port = null; + url.path = []; + url.query = null; + url.fragment = null; + url.cannotBeABaseURL = false; + input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); + } - case NO_SCHEME: - if (!base || (base.cannotBeABaseURL && chr != '#')) { return INVALID_SCHEME; } - if (base.cannotBeABaseURL && chr == '#') { - url.scheme = base.scheme; - url.path = arraySlice$1(base.path); - url.query = base.query; - url.fragment = ''; - url.cannotBeABaseURL = true; - state = FRAGMENT; - break; - } - state = base.scheme == 'file' ? FILE : RELATIVE; - continue; + input = replace(input, TAB_AND_NEW_LINE, ''); - case SPECIAL_RELATIVE_OR_AUTHORITY: - if (chr == '/' && codePoints[pointer + 1] == '/') { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - pointer++; - } else { - state = RELATIVE; - continue; - } break; + codePoints = arrayFrom(input); - case PATH_OR_AUTHORITY: - if (chr == '/') { - state = AUTHORITY; + while (pointer <= codePoints.length) { + chr = codePoints[pointer]; + switch (state) { + case SCHEME_START: + if (chr && exec(ALPHA, chr)) { + buffer += toLowerCase(chr); + state = SCHEME; + } else if (!stateOverride) { + state = NO_SCHEME; + continue; + } else { return INVALID_SCHEME; } break; - } else { - state = PATH; - continue; - } - case RELATIVE: - url.scheme = base.scheme; - if (chr == EOF) { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.query = base.query; - } else if (chr == '/' || (chr == '\\' && isSpecial(url))) { - state = RELATIVE_SLASH; - } else if (chr == '?') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.query = ''; - state = QUERY; - } else if (chr == '#') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.query = base.query; - url.fragment = ''; - state = FRAGMENT; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.path.length--; - state = PATH; - continue; - } break; + case SCHEME: + if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { + buffer += toLowerCase(chr); + } else if (chr == ':') { + if (stateOverride && ( + (url.isSpecial() != hasOwnProperty_1(specialSchemes, buffer)) || + (buffer == 'file' && (url.includesCredentials() || url.port !== null)) || + (url.scheme == 'file' && !url.host) + )) { return; } + url.scheme = buffer; + if (stateOverride) { + if (url.isSpecial() && specialSchemes[url.scheme] == url.port) { url.port = null; } + return; + } + buffer = ''; + if (url.scheme == 'file') { + state = FILE; + } else if (url.isSpecial() && base && base.scheme == url.scheme) { + state = SPECIAL_RELATIVE_OR_AUTHORITY; + } else if (url.isSpecial()) { + state = SPECIAL_AUTHORITY_SLASHES; + } else if (codePoints[pointer + 1] == '/') { + state = PATH_OR_AUTHORITY; + pointer++; + } else { + url.cannotBeABaseURL = true; + push(url.path, ''); + state = CANNOT_BE_A_BASE_URL_PATH; + } + } else if (!stateOverride) { + buffer = ''; + state = NO_SCHEME; + pointer = 0; + continue; + } else { return INVALID_SCHEME; } + break; - case RELATIVE_SLASH: - if (isSpecial(url) && (chr == '/' || chr == '\\')) { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - } else if (chr == '/') { - state = AUTHORITY; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - state = PATH; + case NO_SCHEME: + if (!base || (base.cannotBeABaseURL && chr != '#')) { return INVALID_SCHEME; } + if (base.cannotBeABaseURL && chr == '#') { + url.scheme = base.scheme; + url.path = arraySliceSimple(base.path); + url.query = base.query; + url.fragment = ''; + url.cannotBeABaseURL = true; + state = FRAGMENT; + break; + } + state = base.scheme == 'file' ? FILE : RELATIVE; continue; - } break; - case SPECIAL_AUTHORITY_SLASHES: - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - if (chr != '/' || charAt(buffer, pointer + 1) != '/') { continue; } - pointer++; - break; - - case SPECIAL_AUTHORITY_IGNORE_SLASHES: - if (chr != '/' && chr != '\\') { - state = AUTHORITY; - continue; - } break; - - case AUTHORITY: - if (chr == '@') { - if (seenAt) { buffer = '%40' + buffer; } - seenAt = true; - bufferCodePoints = arrayFrom(buffer); - for (var i = 0; i < bufferCodePoints.length; i++) { - var codePoint = bufferCodePoints[i]; - if (codePoint == ':' && !seenPasswordToken) { - seenPasswordToken = true; - continue; - } - var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); - if (seenPasswordToken) { url.password += encodedCodePoints; } - else { url.username += encodedCodePoints; } - } - buffer = ''; - } else if ( - chr == EOF || chr == '/' || chr == '?' || chr == '#' || - (chr == '\\' && isSpecial(url)) - ) { - if (seenAt && buffer == '') { return INVALID_AUTHORITY; } - pointer -= arrayFrom(buffer).length + 1; - buffer = ''; - state = HOST; - } else { buffer += chr; } - break; + case SPECIAL_RELATIVE_OR_AUTHORITY: + if (chr == '/' && codePoints[pointer + 1] == '/') { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + pointer++; + } else { + state = RELATIVE; + continue; + } break; - case HOST: - case HOSTNAME: - if (stateOverride && url.scheme == 'file') { - state = FILE_HOST; - continue; - } else if (chr == ':' && !seenBracket) { - if (buffer == '') { return INVALID_HOST; } - failure = parseHost(url, buffer); - if (failure) { return failure; } - buffer = ''; - state = PORT; - if (stateOverride == HOSTNAME) { return; } - } else if ( - chr == EOF || chr == '/' || chr == '?' || chr == '#' || - (chr == '\\' && isSpecial(url)) - ) { - if (isSpecial(url) && buffer == '') { return INVALID_HOST; } - if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) { return; } - failure = parseHost(url, buffer); - if (failure) { return failure; } - buffer = ''; - state = PATH_START; - if (stateOverride) { return; } - continue; - } else { - if (chr == '[') { seenBracket = true; } - else if (chr == ']') { seenBracket = false; } - buffer += chr; - } break; - - case PORT: - if (exec(DIGIT, chr)) { - buffer += chr; - } else if ( - chr == EOF || chr == '/' || chr == '?' || chr == '#' || - (chr == '\\' && isSpecial(url)) || - stateOverride - ) { - if (buffer != '') { - var port = parseInt$1(buffer, 10); - if (port > 0xFFFF) { return INVALID_PORT; } - url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port; - buffer = ''; + case PATH_OR_AUTHORITY: + if (chr == '/') { + state = AUTHORITY; + break; + } else { + state = PATH; + continue; } - if (stateOverride) { return; } - state = PATH_START; - continue; - } else { return INVALID_PORT; } - break; - case FILE: - url.scheme = 'file'; - if (chr == '/' || chr == '\\') { state = FILE_SLASH; } - else if (base && base.scheme == 'file') { + case RELATIVE: + url.scheme = base.scheme; if (chr == EOF) { + url.username = base.username; + url.password = base.password; url.host = base.host; - url.path = arraySlice$1(base.path); + url.port = base.port; + url.path = arraySliceSimple(base.path); url.query = base.query; + } else if (chr == '/' || (chr == '\\' && url.isSpecial())) { + state = RELATIVE_SLASH; } else if (chr == '?') { + url.username = base.username; + url.password = base.password; url.host = base.host; - url.path = arraySlice$1(base.path); + url.port = base.port; + url.path = arraySliceSimple(base.path); url.query = ''; state = QUERY; } else if (chr == '#') { + url.username = base.username; + url.password = base.password; url.host = base.host; - url.path = arraySlice$1(base.path); + url.port = base.port; + url.path = arraySliceSimple(base.path); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { - if (!startsWithWindowsDriveLetter(join(arraySlice$1(codePoints, pointer), ''))) { - url.host = base.host; - url.path = arraySlice$1(base.path); - shortenURLsPath(url); - } + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = arraySliceSimple(base.path); + url.path.length--; state = PATH; continue; - } - } else { - state = PATH; - continue; - } break; + } break; - case FILE_SLASH: - if (chr == '/' || chr == '\\') { - state = FILE_HOST; + case RELATIVE_SLASH: + if (url.isSpecial() && (chr == '/' || chr == '\\')) { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + } else if (chr == '/') { + state = AUTHORITY; + } else { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + state = PATH; + continue; + } break; + + case SPECIAL_AUTHORITY_SLASHES: + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + if (chr != '/' || charAt(buffer, pointer + 1) != '/') { continue; } + pointer++; break; - } - if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice$1(codePoints, pointer), ''))) { - if (isWindowsDriveLetter(base.path[0], true)) { push(url.path, base.path[0]); } - else { url.host = base.host; } - } - state = PATH; - continue; - case FILE_HOST: - if (chr == EOF || chr == '/' || chr == '\\' || chr == '?' || chr == '#') { - if (!stateOverride && isWindowsDriveLetter(buffer)) { - state = PATH; - } else if (buffer == '') { - url.host = ''; - if (stateOverride) { return; } + case SPECIAL_AUTHORITY_IGNORE_SLASHES: + if (chr != '/' && chr != '\\') { + state = AUTHORITY; + continue; + } break; + + case AUTHORITY: + if (chr == '@') { + if (seenAt) { buffer = '%40' + buffer; } + seenAt = true; + bufferCodePoints = arrayFrom(buffer); + for (var i = 0; i < bufferCodePoints.length; i++) { + var codePoint = bufferCodePoints[i]; + if (codePoint == ':' && !seenPasswordToken) { + seenPasswordToken = true; + continue; + } + var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); + if (seenPasswordToken) { url.password += encodedCodePoints; } + else { url.username += encodedCodePoints; } + } + buffer = ''; + } else if ( + chr == EOF || chr == '/' || chr == '?' || chr == '#' || + (chr == '\\' && url.isSpecial()) + ) { + if (seenAt && buffer == '') { return INVALID_AUTHORITY; } + pointer -= arrayFrom(buffer).length + 1; + buffer = ''; + state = HOST; + } else { buffer += chr; } + break; + + case HOST: + case HOSTNAME: + if (stateOverride && url.scheme == 'file') { + state = FILE_HOST; + continue; + } else if (chr == ':' && !seenBracket) { + if (buffer == '') { return INVALID_HOST; } + failure = url.parseHost(buffer); + if (failure) { return failure; } + buffer = ''; + state = PORT; + if (stateOverride == HOSTNAME) { return; } + } else if ( + chr == EOF || chr == '/' || chr == '?' || chr == '#' || + (chr == '\\' && url.isSpecial()) + ) { + if (url.isSpecial() && buffer == '') { return INVALID_HOST; } + if (stateOverride && buffer == '' && (url.includesCredentials() || url.port !== null)) { return; } + failure = url.parseHost(buffer); + if (failure) { return failure; } + buffer = ''; state = PATH_START; + if (stateOverride) { return; } + continue; } else { - failure = parseHost(url, buffer); - if (failure) { return failure; } - if (url.host == 'localhost') { url.host = ''; } + if (chr == '[') { seenBracket = true; } + else if (chr == ']') { seenBracket = false; } + buffer += chr; + } break; + + case PORT: + if (exec(DIGIT, chr)) { + buffer += chr; + } else if ( + chr == EOF || chr == '/' || chr == '?' || chr == '#' || + (chr == '\\' && url.isSpecial()) || + stateOverride + ) { + if (buffer != '') { + var port = parseInt$1(buffer, 10); + if (port > 0xFFFF) { return INVALID_PORT; } + url.port = (url.isSpecial() && port === specialSchemes[url.scheme]) ? null : port; + buffer = ''; + } if (stateOverride) { return; } - buffer = ''; state = PATH_START; - } continue; - } else { buffer += chr; } - break; + continue; + } else { return INVALID_PORT; } + break; - case PATH_START: - if (isSpecial(url)) { - state = PATH; - if (chr != '/' && chr != '\\') { continue; } - } else if (!stateOverride && chr == '?') { - url.query = ''; - state = QUERY; - } else if (!stateOverride && chr == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (chr != EOF) { + case FILE: + url.scheme = 'file'; + if (chr == '/' || chr == '\\') { state = FILE_SLASH; } + else if (base && base.scheme == 'file') { + if (chr == EOF) { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.query = base.query; + } else if (chr == '?') { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.query = base.query; + url.fragment = ''; + state = FRAGMENT; + } else { + if (!startsWithWindowsDriveLetter(join(arraySliceSimple(codePoints, pointer), ''))) { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.shortenPath(); + } + state = PATH; + continue; + } + } else { + state = PATH; + continue; + } break; + + case FILE_SLASH: + if (chr == '/' || chr == '\\') { + state = FILE_HOST; + break; + } + if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySliceSimple(codePoints, pointer), ''))) { + if (isWindowsDriveLetter(base.path[0], true)) { push(url.path, base.path[0]); } + else { url.host = base.host; } + } state = PATH; - if (chr != '/') { continue; } - } break; + continue; - case PATH: - if ( - chr == EOF || chr == '/' || - (chr == '\\' && isSpecial(url)) || - (!stateOverride && (chr == '?' || chr == '#')) - ) { - if (isDoubleDot(buffer)) { - shortenURLsPath(url); - if (chr != '/' && !(chr == '\\' && isSpecial(url))) { - push(url.path, ''); - } - } else if (isSingleDot(buffer)) { - if (chr != '/' && !(chr == '\\' && isSpecial(url))) { - push(url.path, ''); + case FILE_HOST: + if (chr == EOF || chr == '/' || chr == '\\' || chr == '?' || chr == '#') { + if (!stateOverride && isWindowsDriveLetter(buffer)) { + state = PATH; + } else if (buffer == '') { + url.host = ''; + if (stateOverride) { return; } + state = PATH_START; + } else { + failure = url.parseHost(buffer); + if (failure) { return failure; } + if (url.host == 'localhost') { url.host = ''; } + if (stateOverride) { return; } + buffer = ''; + state = PATH_START; + } continue; + } else { buffer += chr; } + break; + + case PATH_START: + if (url.isSpecial()) { + state = PATH; + if (chr != '/' && chr != '\\') { continue; } + } else if (!stateOverride && chr == '?') { + url.query = ''; + state = QUERY; + } else if (!stateOverride && chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + state = PATH; + if (chr != '/') { continue; } + } break; + + case PATH: + if ( + chr == EOF || chr == '/' || + (chr == '\\' && url.isSpecial()) || + (!stateOverride && (chr == '?' || chr == '#')) + ) { + if (isDoubleDot(buffer)) { + url.shortenPath(); + if (chr != '/' && !(chr == '\\' && url.isSpecial())) { + push(url.path, ''); + } + } else if (isSingleDot(buffer)) { + if (chr != '/' && !(chr == '\\' && url.isSpecial())) { + push(url.path, ''); + } + } else { + if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { + if (url.host) { url.host = ''; } + buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter + } + push(url.path, buffer); } - } else { - if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { - if (url.host) { url.host = ''; } - buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter + buffer = ''; + if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) { + while (url.path.length > 1 && url.path[0] === '') { + shift(url.path); + } } - push(url.path, buffer); - } - buffer = ''; - if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) { - while (url.path.length > 1 && url.path[0] === '') { - shift(url.path); + if (chr == '?') { + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.fragment = ''; + state = FRAGMENT; } - } + } else { + buffer += percentEncode(chr, pathPercentEncodeSet); + } break; + + case CANNOT_BE_A_BASE_URL_PATH: if (chr == '?') { url.query = ''; state = QUERY; } else if (chr == '#') { url.fragment = ''; state = FRAGMENT; - } - } else { - buffer += percentEncode(chr, pathPercentEncodeSet); - } break; - - case CANNOT_BE_A_BASE_URL_PATH: - if (chr == '?') { - url.query = ''; - state = QUERY; - } else if (chr == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (chr != EOF) { - url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet); - } break; - - case QUERY: - if (!stateOverride && chr == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (chr != EOF) { - if (chr == "'" && isSpecial(url)) { url.query += '%27'; } - else if (chr == '#') { url.query += '%23'; } - else { url.query += percentEncode(chr, C0ControlPercentEncodeSet); } - } break; - - case FRAGMENT: - if (chr != EOF) { url.fragment += percentEncode(chr, fragmentPercentEncodeSet); } - break; - } + } else if (chr != EOF) { + url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet); + } break; + + case QUERY: + if (!stateOverride && chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + if (chr == "'" && url.isSpecial()) { url.query += '%27'; } + else if (chr == '#') { url.query += '%23'; } + else { url.query += percentEncode(chr, C0ControlPercentEncodeSet); } + } break; + + case FRAGMENT: + if (chr != EOF) { url.fragment += percentEncode(chr, fragmentPercentEncodeSet); } + break; + } - pointer++; + pointer++; + } + }, + // https://url.spec.whatwg.org/#host-parsing + parseHost: function (input) { + var result, codePoints, index; + if (charAt(input, 0) == '[') { + if (charAt(input, input.length - 1) != ']') { return INVALID_HOST; } + result = parseIPv6(stringSlice(input, 1, -1)); + if (!result) { return INVALID_HOST; } + this.host = result; + // opaque host + } else if (!this.isSpecial()) { + if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) { return INVALID_HOST; } + result = ''; + codePoints = arrayFrom(input); + for (index = 0; index < codePoints.length; index++) { + result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); + } + this.host = result; + } else { + input = stringPunycodeToAscii(input); + if (exec(FORBIDDEN_HOST_CODE_POINT, input)) { return INVALID_HOST; } + result = parseIPv4(input); + if (result === null) { return INVALID_HOST; } + this.host = result; + } + }, + // https://url.spec.whatwg.org/#cannot-have-a-username-password-port + cannotHaveUsernamePasswordPort: function () { + return !this.host || this.cannotBeABaseURL || this.scheme == 'file'; + }, + // https://url.spec.whatwg.org/#include-credentials + includesCredentials: function () { + return this.username != '' || this.password != ''; + }, + // https://url.spec.whatwg.org/#is-special + isSpecial: function () { + return hasOwnProperty_1(specialSchemes, this.scheme); + }, + // https://url.spec.whatwg.org/#shorten-a-urls-path + shortenPath: function () { + var path = this.path; + var pathSize = path.length; + if (pathSize && (this.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { + path.length--; + } + }, + // https://url.spec.whatwg.org/#concept-url-serializer + serialize: function () { + var url = this; + var scheme = url.scheme; + var username = url.username; + var password = url.password; + var host = url.host; + var port = url.port; + var path = url.path; + var query = url.query; + var fragment = url.fragment; + var output = scheme + ':'; + if (host !== null) { + output += '//'; + if (url.includesCredentials()) { + output += username + (password ? ':' + password : '') + '@'; + } + output += serializeHost(host); + if (port !== null) { output += ':' + port; } + } else if (scheme == 'file') { output += '//'; } + output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; + if (query !== null) { output += '?' + query; } + if (fragment !== null) { output += '#' + fragment; } + return output; + }, + // https://url.spec.whatwg.org/#dom-url-href + setHref: function (href) { + var failure = this.parse(href); + if (failure) { throw TypeError$1(failure); } + this.searchParams.update(); + }, + // https://url.spec.whatwg.org/#dom-url-origin + getOrigin: function () { + var scheme = this.scheme; + var port = this.port; + if (scheme == 'blob') { try { + return new URLConstructor(scheme.path[0]).origin; + } catch (error) { + return 'null'; + } } + if (scheme == 'file' || !this.isSpecial()) { return 'null'; } + return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : ''); + }, + // https://url.spec.whatwg.org/#dom-url-protocol + getProtocol: function () { + return this.scheme + ':'; + }, + setProtocol: function (protocol) { + this.parse(toString_1(protocol) + ':', SCHEME_START); + }, + // https://url.spec.whatwg.org/#dom-url-username + getUsername: function () { + return this.username; + }, + setUsername: function (username) { + var codePoints = arrayFrom(toString_1(username)); + if (this.cannotHaveUsernamePasswordPort()) { return; } + this.username = ''; + for (var i = 0; i < codePoints.length; i++) { + this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }, + // https://url.spec.whatwg.org/#dom-url-password + getPassword: function () { + return this.password; + }, + setPassword: function (password) { + var codePoints = arrayFrom(toString_1(password)); + if (this.cannotHaveUsernamePasswordPort()) { return; } + this.password = ''; + for (var i = 0; i < codePoints.length; i++) { + this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }, + // https://url.spec.whatwg.org/#dom-url-host + getHost: function () { + var host = this.host; + var port = this.port; + return host === null ? '' + : port === null ? serializeHost(host) + : serializeHost(host) + ':' + port; + }, + setHost: function (host) { + if (this.cannotBeABaseURL) { return; } + this.parse(host, HOST); + }, + // https://url.spec.whatwg.org/#dom-url-hostname + getHostname: function () { + var host = this.host; + return host === null ? '' : serializeHost(host); + }, + setHostname: function (hostname) { + if (this.cannotBeABaseURL) { return; } + this.parse(hostname, HOSTNAME); + }, + // https://url.spec.whatwg.org/#dom-url-port + getPort: function () { + var port = this.port; + return port === null ? '' : toString_1(port); + }, + setPort: function (port) { + if (this.cannotHaveUsernamePasswordPort()) { return; } + port = toString_1(port); + if (port == '') { this.port = null; } + else { this.parse(port, PORT); } + }, + // https://url.spec.whatwg.org/#dom-url-pathname + getPathname: function () { + var path = this.path; + return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; + }, + setPathname: function (pathname) { + if (this.cannotBeABaseURL) { return; } + this.path = []; + this.parse(pathname, PATH_START); + }, + // https://url.spec.whatwg.org/#dom-url-search + getSearch: function () { + var query = this.query; + return query ? '?' + query : ''; + }, + setSearch: function (search) { + search = toString_1(search); + if (search == '') { + this.query = null; + } else { + if ('?' == charAt(search, 0)) { search = stringSlice(search, 1); } + this.query = ''; + this.parse(search, QUERY); + } + this.searchParams.update(); + }, + // https://url.spec.whatwg.org/#dom-url-searchparams + getSearchParams: function () { + return this.searchParams.facade; + }, + // https://url.spec.whatwg.org/#dom-url-hash + getHash: function () { + var fragment = this.fragment; + return fragment ? '#' + fragment : ''; + }, + setHash: function (hash) { + hash = toString_1(hash); + if (hash == '') { + this.fragment = null; + return; + } + if ('#' == charAt(hash, 0)) { hash = stringSlice(hash, 1); } + this.fragment = ''; + this.parse(hash, FRAGMENT); + }, + update: function () { + this.query = this.searchParams.serialize() || null; } }; @@ -13427,253 +15843,88 @@ var doric = (function (exports) { // https://url.spec.whatwg.org/#url-class var URLConstructor = function URL(url /* , base */) { var that = anInstance(this, URLPrototype); - var base = arguments.length > 1 ? arguments[1] : undefined; - var urlString = toString_1(url); - var state = setInternalState(that, { type: 'URL' }); - var baseState, failure; - if (base !== undefined) { - try { - baseState = getInternalURLState(base); - } catch (error) { - failure = parseURL(baseState = {}, toString_1(base)); - if (failure) { throw TypeError$1(failure); } - } - } - failure = parseURL(state, urlString, null, baseState); - if (failure) { throw TypeError$1(failure); } - var searchParams = state.searchParams = new URLSearchParams$1(); - var searchParamsState = getInternalSearchParamsState(searchParams); - searchParamsState.updateSearchParams(state.query); - searchParamsState.updateURL = function () { - state.query = toString_1(searchParams) || null; - }; + var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined; + var state = setInternalState(that, new URLState(url, false, base)); if (!descriptors) { - that.href = functionCall(serializeURL, that); - that.origin = functionCall(getOrigin, that); - that.protocol = functionCall(getProtocol, that); - that.username = functionCall(getUsername, that); - that.password = functionCall(getPassword, that); - that.host = functionCall(getHost, that); - that.hostname = functionCall(getHostname, that); - that.port = functionCall(getPort, that); - that.pathname = functionCall(getPathname, that); - that.search = functionCall(getSearch, that); - that.searchParams = functionCall(getSearchParams, that); - that.hash = functionCall(getHash, that); + that.href = state.serialize(); + that.origin = state.getOrigin(); + that.protocol = state.getProtocol(); + that.username = state.getUsername(); + that.password = state.getPassword(); + that.host = state.getHost(); + that.hostname = state.getHostname(); + that.port = state.getPort(); + that.pathname = state.getPathname(); + that.search = state.getSearch(); + that.searchParams = state.getSearchParams(); + that.hash = state.getHash(); } }; var URLPrototype = URLConstructor.prototype; - var serializeURL = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var username = url.username; - var password = url.password; - var host = url.host; - var port = url.port; - var path = url.path; - var query = url.query; - var fragment = url.fragment; - var output = scheme + ':'; - if (host !== null) { - output += '//'; - if (includesCredentials(url)) { - output += username + (password ? ':' + password : '') + '@'; - } - output += serializeHost(host); - if (port !== null) { output += ':' + port; } - } else if (scheme == 'file') { output += '//'; } - output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; - if (query !== null) { output += '?' + query; } - if (fragment !== null) { output += '#' + fragment; } - return output; - }; - - var getOrigin = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var port = url.port; - if (scheme == 'blob') { try { - return new URLConstructor(scheme.path[0]).origin; - } catch (error) { - return 'null'; - } } - if (scheme == 'file' || !isSpecial(url)) { return 'null'; } - return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); - }; - - var getProtocol = function () { - return getInternalURLState(this).scheme + ':'; - }; - - var getUsername = function () { - return getInternalURLState(this).username; - }; - - var getPassword = function () { - return getInternalURLState(this).password; - }; - - var getHost = function () { - var url = getInternalURLState(this); - var host = url.host; - var port = url.port; - return host === null ? '' - : port === null ? serializeHost(host) - : serializeHost(host) + ':' + port; - }; - - var getHostname = function () { - var host = getInternalURLState(this).host; - return host === null ? '' : serializeHost(host); - }; - - var getPort = function () { - var port = getInternalURLState(this).port; - return port === null ? '' : toString_1(port); - }; - - var getPathname = function () { - var url = getInternalURLState(this); - var path = url.path; - return url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; - }; - - var getSearch = function () { - var query = getInternalURLState(this).query; - return query ? '?' + query : ''; - }; - - var getSearchParams = function () { - return getInternalURLState(this).searchParams; - }; - - var getHash = function () { - var fragment = getInternalURLState(this).fragment; - return fragment ? '#' + fragment : ''; - }; - var accessorDescriptor = function (getter, setter) { - return { get: getter, set: setter, configurable: true, enumerable: true }; + return { + get: function () { + return getInternalURLState(this)[getter](); + }, + set: setter && function (value) { + return getInternalURLState(this)[setter](value); + }, + configurable: true, + enumerable: true + }; }; if (descriptors) { - objectDefineProperties(URLPrototype, { - // `URL.prototype.href` accessors pair - // https://url.spec.whatwg.org/#dom-url-href - href: accessorDescriptor(serializeURL, function (href) { - var url = getInternalURLState(this); - var urlString = toString_1(href); - var failure = parseURL(url, urlString); - if (failure) { throw TypeError$1(failure); } - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), - // `URL.prototype.origin` getter - // https://url.spec.whatwg.org/#dom-url-origin - origin: accessorDescriptor(getOrigin), - // `URL.prototype.protocol` accessors pair - // https://url.spec.whatwg.org/#dom-url-protocol - protocol: accessorDescriptor(getProtocol, function (protocol) { - var url = getInternalURLState(this); - parseURL(url, toString_1(protocol) + ':', SCHEME_START); - }), - // `URL.prototype.username` accessors pair - // https://url.spec.whatwg.org/#dom-url-username - username: accessorDescriptor(getUsername, function (username) { - var url = getInternalURLState(this); - var codePoints = arrayFrom(toString_1(username)); - if (cannotHaveUsernamePasswordPort(url)) { return; } - url.username = ''; - for (var i = 0; i < codePoints.length; i++) { - url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), - // `URL.prototype.password` accessors pair - // https://url.spec.whatwg.org/#dom-url-password - password: accessorDescriptor(getPassword, function (password) { - var url = getInternalURLState(this); - var codePoints = arrayFrom(toString_1(password)); - if (cannotHaveUsernamePasswordPort(url)) { return; } - url.password = ''; - for (var i = 0; i < codePoints.length; i++) { - url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), - // `URL.prototype.host` accessors pair - // https://url.spec.whatwg.org/#dom-url-host - host: accessorDescriptor(getHost, function (host) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) { return; } - parseURL(url, toString_1(host), HOST); - }), - // `URL.prototype.hostname` accessors pair - // https://url.spec.whatwg.org/#dom-url-hostname - hostname: accessorDescriptor(getHostname, function (hostname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) { return; } - parseURL(url, toString_1(hostname), HOSTNAME); - }), - // `URL.prototype.port` accessors pair - // https://url.spec.whatwg.org/#dom-url-port - port: accessorDescriptor(getPort, function (port) { - var url = getInternalURLState(this); - if (cannotHaveUsernamePasswordPort(url)) { return; } - port = toString_1(port); - if (port == '') { url.port = null; } - else { parseURL(url, port, PORT); } - }), - // `URL.prototype.pathname` accessors pair - // https://url.spec.whatwg.org/#dom-url-pathname - pathname: accessorDescriptor(getPathname, function (pathname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) { return; } - url.path = []; - parseURL(url, toString_1(pathname), PATH_START); - }), - // `URL.prototype.search` accessors pair - // https://url.spec.whatwg.org/#dom-url-search - search: accessorDescriptor(getSearch, function (search) { - var url = getInternalURLState(this); - search = toString_1(search); - if (search == '') { - url.query = null; - } else { - if ('?' == charAt(search, 0)) { search = stringSlice(search, 1); } - url.query = ''; - parseURL(url, search, QUERY); - } - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), - // `URL.prototype.searchParams` getter - // https://url.spec.whatwg.org/#dom-url-searchparams - searchParams: accessorDescriptor(getSearchParams), - // `URL.prototype.hash` accessors pair - // https://url.spec.whatwg.org/#dom-url-hash - hash: accessorDescriptor(getHash, function (hash) { - var url = getInternalURLState(this); - hash = toString_1(hash); - if (hash == '') { - url.fragment = null; - return; - } - if ('#' == charAt(hash, 0)) { hash = stringSlice(hash, 1); } - url.fragment = ''; - parseURL(url, hash, FRAGMENT); - }) - }); + // `URL.prototype.href` accessors pair + // https://url.spec.whatwg.org/#dom-url-href + defineBuiltInAccessor(URLPrototype, 'href', accessorDescriptor('serialize', 'setHref')); + // `URL.prototype.origin` getter + // https://url.spec.whatwg.org/#dom-url-origin + defineBuiltInAccessor(URLPrototype, 'origin', accessorDescriptor('getOrigin')); + // `URL.prototype.protocol` accessors pair + // https://url.spec.whatwg.org/#dom-url-protocol + defineBuiltInAccessor(URLPrototype, 'protocol', accessorDescriptor('getProtocol', 'setProtocol')); + // `URL.prototype.username` accessors pair + // https://url.spec.whatwg.org/#dom-url-username + defineBuiltInAccessor(URLPrototype, 'username', accessorDescriptor('getUsername', 'setUsername')); + // `URL.prototype.password` accessors pair + // https://url.spec.whatwg.org/#dom-url-password + defineBuiltInAccessor(URLPrototype, 'password', accessorDescriptor('getPassword', 'setPassword')); + // `URL.prototype.host` accessors pair + // https://url.spec.whatwg.org/#dom-url-host + defineBuiltInAccessor(URLPrototype, 'host', accessorDescriptor('getHost', 'setHost')); + // `URL.prototype.hostname` accessors pair + // https://url.spec.whatwg.org/#dom-url-hostname + defineBuiltInAccessor(URLPrototype, 'hostname', accessorDescriptor('getHostname', 'setHostname')); + // `URL.prototype.port` accessors pair + // https://url.spec.whatwg.org/#dom-url-port + defineBuiltInAccessor(URLPrototype, 'port', accessorDescriptor('getPort', 'setPort')); + // `URL.prototype.pathname` accessors pair + // https://url.spec.whatwg.org/#dom-url-pathname + defineBuiltInAccessor(URLPrototype, 'pathname', accessorDescriptor('getPathname', 'setPathname')); + // `URL.prototype.search` accessors pair + // https://url.spec.whatwg.org/#dom-url-search + defineBuiltInAccessor(URLPrototype, 'search', accessorDescriptor('getSearch', 'setSearch')); + // `URL.prototype.searchParams` getter + // https://url.spec.whatwg.org/#dom-url-searchparams + defineBuiltInAccessor(URLPrototype, 'searchParams', accessorDescriptor('getSearchParams')); + // `URL.prototype.hash` accessors pair + // https://url.spec.whatwg.org/#dom-url-hash + defineBuiltInAccessor(URLPrototype, 'hash', accessorDescriptor('getHash', 'setHash')); } // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson - redefine(URLPrototype, 'toJSON', function toJSON() { - return functionCall(serializeURL, this); + defineBuiltIn(URLPrototype, 'toJSON', function toJSON() { + return getInternalURLState(this).serialize(); }, { enumerable: true }); // `URL.prototype.toString` method // https://url.spec.whatwg.org/#URL-stringification-behavior - redefine(URLPrototype, 'toString', function toString() { - return functionCall(serializeURL, this); + defineBuiltIn(URLPrototype, 'toString', function toString() { + return getInternalURLState(this).serialize(); }, { enumerable: true }); if (NativeURL) { @@ -13681,15 +15932,15 @@ var doric = (function (exports) { var nativeRevokeObjectURL = NativeURL.revokeObjectURL; // `URL.createObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL - if (nativeCreateObjectURL) { redefine(URLConstructor, 'createObjectURL', functionBindContext(nativeCreateObjectURL, NativeURL)); } + if (nativeCreateObjectURL) { defineBuiltIn(URLConstructor, 'createObjectURL', functionBindContext(nativeCreateObjectURL, NativeURL)); } // `URL.revokeObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL - if (nativeRevokeObjectURL) { redefine(URLConstructor, 'revokeObjectURL', functionBindContext(nativeRevokeObjectURL, NativeURL)); } + if (nativeRevokeObjectURL) { defineBuiltIn(URLConstructor, 'revokeObjectURL', functionBindContext(nativeRevokeObjectURL, NativeURL)); } } setToStringTag(URLConstructor, 'URL'); - _export({ global: true, forced: !nativeUrl, sham: !descriptors }, { + _export({ global: true, constructor: true, forced: !nativeUrl, sham: !descriptors }, { URL: URLConstructor }); @@ -13718,7 +15969,7 @@ var doric = (function (exports) { */ var __uniqueId__ = 0; function uniqueId(prefix) { - return "__" + prefix + "_" + __uniqueId__++ + "__"; + return "__".concat(prefix, "_").concat(__uniqueId__++, "__"); } function toString(message) { @@ -13742,11 +15993,6 @@ var doric = (function (exports) { } function log() { var arguments$1 = arguments; - - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -13758,11 +16004,6 @@ var doric = (function (exports) { } function loge() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -13774,11 +16015,6 @@ var doric = (function (exports) { } function logw() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -14953,12 +17189,12 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } var callback = context.callbacks.get(callbackId); if (callback === undefined) { - loge("Cannot find call for context id:" + contextId + ",callback id:" + callbackId); + loge("Cannot find call for context id:".concat(contextId, ",callback id:").concat(callbackId)); return; } var argumentsList = []; @@ -14973,12 +17209,12 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } var callback = context.callbacks.get(callbackId); if (callback === undefined) { - loge("Cannot find call for context id:" + contextId + ",callback id:" + callbackId); + loge("Cannot find call for context id:".concat(contextId, ",callback id:").concat(callbackId)); return; } var argumentsList = []; @@ -15086,11 +17322,11 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } if (context.entity === undefined) { - loge("Cannot find holder for context id:" + contextId); + loge("Cannot find holder for context id:".concat(contextId)); return; } if (Reflect.has(context.entity, methodName)) { @@ -15103,7 +17339,7 @@ var doric = (function (exports) { return ret; } else { - loge("Cannot find method for context id:" + contextId + ",method name is:" + methodName); + loge("Cannot find method for context id:".concat(contextId, ",method name is:").concat(methodName)); } } function pureCallEntityMethod(contextId, methodName, args) { @@ -15111,11 +17347,11 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } if (context.entity === undefined) { - loge("Cannot find holder for context id:" + contextId); + loge("Cannot find holder for context id:".concat(contextId)); return; } if (Reflect.has(context.entity, methodName)) { @@ -15126,7 +17362,7 @@ var doric = (function (exports) { return Reflect.apply(Reflect.get(context.entity, methodName), context.entity, argumentsList); } else { - loge("Cannot find method for context id:" + contextId + ",method name is:" + methodName); + loge("Cannot find method for context id:".concat(contextId, ",method name is:").concat(methodName)); } } function jsObtainEntry(contextId) { @@ -15165,15 +17401,15 @@ var doric = (function (exports) { return exportFunc(clz); } else { - throw new Error("Cannot find class:" + className + " in context:" + srcContextId); + throw new Error("Cannot find class:".concat(className, " in context:").concat(srcContextId)); } } else { - throw new Error("Cannot find context for " + srcContextId); + throw new Error("Cannot find context for ".concat(srcContextId)); } } else { - throw new Error("Entry arguments error:" + arguments); + throw new Error("Entry arguments error:".concat(arguments)); } }; } diff --git a/doric-js/generateDts.js b/doric-js/generateDts.js new file mode 100644 index 000000000..89a3f6e53 --- /dev/null +++ b/doric-js/generateDts.js @@ -0,0 +1,18 @@ +const fs = require("fs"); + +async function work() { + const imageDts = await fs.promises.readFile("src/image.d.ts", "utf-8"); + const indexDts = await fs.promises.readFile("index.d.ts", "utf-8"); + const content = `declare module "doric" { +${indexDts + .replace(/\sdeclare\s/g, " ") + .split("\n") + .map((e) => ` ${e}`) + .join("\n")} +} +${imageDts} + `; + await fs.promises.writeFile("index.d.ts", content); +} + +work(); diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index 09d0846af..ac31d2861 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -1,1950 +1,1742 @@ -// Generated by dts-bundle v0.7.3 - -declare module 'doric' { - export * from 'doric/lib/src/runtime/global'; - export * from 'doric/lib/src/ui/index.ui'; - export * from "doric/lib/src/widget/index.widget"; - export * from 'doric/lib/src/native/index.native'; - export * from "doric/lib/src/util/index.util"; - export * from "doric/lib/src/pattern/index.pattern"; +declare module "doric" { + // Generated by dts-bundle-generator v6.12.0 + + export interface Modeling { + toModel(): Model; + } + export function obj2Model(obj: Model, convertor: (v: Function) => string): Model; + export type _M = string | number | boolean | Modeling | { + [index: string]: Model; + } | undefined; + export type Model = _M | Array<_M>; + export type Binder = (v: T) => void; + export class Mutable { + private val; + private binders; + get: () => T; + set: (v: T) => void; + private constructor(); + bind(binder: Binder): void; + static of(v: E): Mutable; + } + export type ClassType = new (...args: any) => T; + /** + * Store color as format AARRGGBB or RRGGBB + */ + export class Color implements Modeling { + static BLACK: Color; + static DKGRAY: Color; + static GRAY: Color; + static LTGRAY: Color; + static WHITE: Color; + static RED: Color; + static GREEN: Color; + static BLUE: Color; + static YELLOW: Color; + static CYAN: Color; + static MAGENTA: Color; + static TRANSPARENT: Color; + _value: number; + constructor(v: number); + static parse(str: string): Color; + static safeParse(str: string, defVal?: Color): Color; + alpha(v: number): Color; + toModel(): number; + } + export enum GradientOrientation { + /** draw the gradient from the top to the bottom */ + TOP_BOTTOM = 0, + /** draw the gradient from the top-right to the bottom-left */ + TR_BL = 1, + /** draw the gradient from the right to the left */ + RIGHT_LEFT = 2, + /** draw the gradient from the bottom-right to the top-left */ + BR_TL = 3, + /** draw the gradient from the bottom to the top */ + BOTTOM_TOP = 4, + /** draw the gradient from the bottom-left to the top-right */ + BL_TR = 5, + /** draw the gradient from the left to the right */ + LEFT_RIGHT = 6, + /** draw the gradient from the top-left to the bottom-right */ + TL_BR = 7 + } + export interface GradientColor { + start?: Color; + end?: Color; + colors?: Array; + locations?: Array; + orientation: GradientOrientation; + } + export const LEFT: number; + export const RIGHT: number; + export const TOP: number; + export const BOTTOM: number; + export const CENTER_X: number; + export const CENTER_Y: number; + export const CENTER: number; + export class Gravity implements Modeling { + val: number; + left(): Gravity; + right(): Gravity; + top(): Gravity; + bottom(): Gravity; + center(): Gravity; + centerX(): Gravity; + centerY(): Gravity; + toModel(): number; + private static origin; + static Center: Gravity; + static CenterX: Gravity; + static CenterY: Gravity; + static Left: Gravity; + static Right: Gravity; + static Top: Gravity; + static Bottom: Gravity; + } + export function gravity(): Gravity; + export enum LayoutSpec { + /** + * Depends on what's been set on width or height. + */ + JUST = 0, + /** + * Depends on it's content. + */ + FIT = 1, + /** + * Extend as much as parent let it take. + */ + MOST = 2 + } + export interface LayoutConfig { + widthSpec?: LayoutSpec; + heightSpec?: LayoutSpec; + margin?: { + left?: number; + right?: number; + top?: number; + bottom?: number; + }; + alignment?: Gravity; + weight?: number; + maxWidth?: number; + maxHeight?: number; + minWidth?: number; + minHeight?: number; + } + export class LayoutConfigImpl implements LayoutConfig, Modeling { + widthSpec?: LayoutSpec; + heightSpec?: LayoutSpec; + margin?: { + left?: number; + right?: number; + top?: number; + bottom?: number; + }; + alignment?: Gravity; + weight?: number; + maxWidth?: number; + maxHeight?: number; + minWidth?: number; + minHeight?: number; + fit(): this; + fitWidth(): this; + fitHeight(): this; + most(): this; + mostWidth(): this; + mostHeight(): this; + just(): this; + justWidth(): this; + justHeight(): this; + configWidth(w: LayoutSpec): this; + configHeight(h: LayoutSpec): this; + configMargin(m: { + left?: number; + right?: number; + top?: number; + bottom?: number; + }): this; + configAlignment(a: Gravity): this; + configWeight(w: number): this; + configMaxWidth(v: number): this; + configMaxHeight(v: number): this; + configMinWidth(v: number): this; + configMinHeight(v: number): this; + toModel(): { + widthSpec: LayoutSpec | undefined; + heightSpec: LayoutSpec | undefined; + margin: { + left?: number | undefined; + right?: number | undefined; + top?: number | undefined; + bottom?: number | undefined; + } | undefined; + alignment: number | undefined; + weight: number | undefined; + minWidth: number | undefined; + maxWidth: number | undefined; + minHeight: number | undefined; + maxHeight: number | undefined; + }; + } + export function layoutConfig(): LayoutConfigImpl; + export type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha"; + export enum RepeatMode { + RESTART = 1, + REVERSE = 2 + } + export interface IAnimation extends Modeling { + duration: number; + delay?: number; + id: string; + } + export interface Changeable { + fromValue: number; + toValue: number; + key: AnimatedKey; + repeatCount?: number; + repeatMode?: RepeatMode; + keyFrames?: { + percent: number; + value: number; + }[]; + } + export enum FillMode { + /** + * The receiver is removed from the presentation when the animation is completed. + */ + Removed = 0, + /** + * The receiver remains visible in its final state when the animation is completed. + */ + Forward = 1, + /** + * The receiver clamps values before zero to zero when the animation is completed. + */ + Backward = 2, + /** + * The receiver clamps values at both ends of the object’s time space + */ + Both = 3 + } + export enum TimingFunction { + /** + * The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations. + */ + Default = 0, + /** + * Linear pacing, which causes an animation to occur evenly over its duration. + */ + Linear = 1, + /** + * Ease-in pacing, which causes an animation to begin slowly and then speed up as it progresses. + */ + EaseIn = 2, + /** + * Ease-out pacing, which causes an animation to begin quickly and then slow as it progresses. + */ + EaseOut = 3, + /** + * Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing. + */ + EaseInEaseOut = 4 + } abstract class Animation implements IAnimation { + changeables: Map; + duration: number; + repeatCount?: number; + repeatMode?: RepeatMode; + delay?: number; + fillMode: FillMode; + timingFunction?: TimingFunction; + id: string; + toModel(): { + type: string; + delay: number | undefined; + duration: number; + changeables: { + key: AnimatedKey; + fromValue: number; + toValue: number; + keyFrames: { + percent: number; + value: number; + }[] | undefined; + }[]; + repeatCount: number | undefined; + repeatMode: RepeatMode | undefined; + fillMode: FillMode; + timingFunction: TimingFunction | undefined; + id: string; + }; + } + export class ScaleAnimation extends Animation { + private scaleXChangeable; + private scaleYChangeable; + constructor(); + set xKeyFrames(keyFrames: { + percent: number; + value: number; + }[]); + set yKeyFrames(keyFrames: { + percent: number; + value: number; + }[]); + set fromScaleX(v: number); + get fromScaleX(): number; + set toScaleX(v: number); + get toScaleX(): number; + set fromScaleY(v: number); + get fromScaleY(): number; + set toScaleY(v: number); + get toScaleY(): number; + } + export class TranslationAnimation extends Animation { + private translationXChangeable; + private translationYChangeable; + constructor(); + set xKeyFrames(keyFrames: { + percent: number; + value: number; + }[]); + set yKeyFrames(keyFrames: { + percent: number; + value: number; + }[]); + set fromTranslationX(v: number); + get fromTranslationX(): number; + set toTranslationX(v: number); + get toTranslationX(): number; + set fromTranslationY(v: number); + get fromTranslationY(): number; + set toTranslationY(v: number); + get toTranslationY(): number; + } + /** + * Rotation range is [0..2] + */ + export class RotationAnimation extends Animation { + private rotationChaneable; + constructor(); + set fromRotation(v: number); + get fromRotation(): number; + set toRotation(v: number); + get toRotation(): number; + set keyFrames(keyFrames: { + percent: number; + value: number; + }[]); + } + /** + * Rotation range is [0..2] + */ + export class RotationXAnimation extends Animation { + private rotationChaneable; + constructor(); + set fromRotation(v: number); + get fromRotation(): number; + set toRotation(v: number); + get toRotation(): number; + set keyFrames(keyFrames: { + percent: number; + value: number; + }[]); + } + /** + * Rotation range is [0..2] + */ + export class RotationYAnimation extends Animation { + private rotationChaneable; + constructor(); + set fromRotation(v: number); + get fromRotation(): number; + set toRotation(v: number); + get toRotation(): number; + set keyFrames(keyFrames: { + percent: number; + value: number; + }[]); + } + export class BackgroundColorAnimation extends Animation { + private backgroundColorChangeable; + constructor(); + set fromColor(color: Color); + get fromColor(): Color; + set toColor(v: Color); + get toColor(): Color; + set keyFrames(keyFrames: { + percent: number; + value: Color; + }[]); + } + /** + * Alpha range is [0..1] + */ + export class AlphaAnimation extends Animation { + private opacityChangeable; + constructor(); + set from(v: number); + get from(): number; + set to(v: number); + get to(): number; + set keyFrames(keyFrames: { + percent: number; + value: number; + }[]); + } + export class AnimationSet implements IAnimation { + private animations; + private _duration; + delay?: number; + id: string; + addAnimation(anim: IAnimation): void; + get duration(): number; + set duration(v: number); + toModel(): { + animations: Model; + delay: number | undefined; + id: string; + }; + } enum ValueType { + Undefined = 0, + Point = 1, + Percent = 2, + Auto = 3 + } + export class FlexTypedValue implements Modeling { + type: ValueType; + value: number; + constructor(type: ValueType); + static Auto: FlexTypedValue; + static percent(v: number): FlexTypedValue; + static point(v: number): FlexTypedValue; + toModel(): { + type: ValueType; + value: number; + }; + } + export enum FlexDirection { + COLUMN = 0, + COLUMN_REVERSE = 1, + ROW = 2, + ROW_REVERSE = 3 + } + export enum Align { + AUTO = 0, + FLEX_START = 1, + CENTER = 2, + FLEX_END = 3, + STRETCH = 4, + BASELINE = 5, + SPACE_BETWEEN = 6, + SPACE_AROUND = 7 + } + export enum Justify { + FLEX_START = 0, + CENTER = 1, + FLEX_END = 2, + SPACE_BETWEEN = 3, + SPACE_AROUND = 4, + SPACE_EVENLY = 5 + } + export enum Direction { + INHERIT = 0, + LTR = 1, + RTL = 2 + } + export enum PositionType { + RELATIVE = 0, + ABSOLUTE = 1 + } + export enum Wrap { + NO_WRAP = 0, + WRAP = 1, + WRAP_REVERSE = 2 + } + export enum OverFlow { + VISIBLE = 0, + HIDDEN = 1, + SCROLL = 2 + } + export enum Display { + FLEX = 0, + NONE = 1 + } + export type FlexValue = FlexTypedValue | number; + export interface FlexConfig { + direction?: Direction; + flexDirection?: FlexDirection; + justifyContent?: Justify; + alignContent?: Align; + alignItems?: Align; + alignSelf?: Align; + positionType?: PositionType; + flexWrap?: Wrap; + overFlow?: OverFlow; + display?: Display; + flex?: number; + flexGrow?: number; + flexShrink?: number; + flexBasis?: FlexValue; + marginLeft?: FlexValue; + marginRight?: FlexValue; + marginTop?: FlexValue; + marginBottom?: FlexValue; + marginStart?: FlexValue; + marginEnd?: FlexValue; + marginHorizontal?: FlexValue; + marginVertical?: FlexValue; + margin?: FlexValue; + paddingLeft?: FlexValue; + paddingRight?: FlexValue; + paddingTop?: FlexValue; + paddingBottom?: FlexValue; + paddingStart?: FlexValue; + paddingEnd?: FlexValue; + paddingHorizontal?: FlexValue; + paddingVertical?: FlexValue; + padding?: FlexValue; + borderLeftWidth?: number; + borderRightWidth?: number; + borderTopWidth?: number; + borderBottomWidth?: number; + borderStartWidth?: number; + borderEndWidth?: number; + borderWidth?: number; + left?: FlexValue; + right?: FlexValue; + top?: FlexValue; + bottom?: FlexValue; + start?: FlexValue; + end?: FlexValue; + width?: FlexValue; + height?: FlexValue; + minWidth?: FlexValue; + minHeight?: FlexValue; + maxWidth?: FlexValue; + maxHeight?: FlexValue; + aspectRatio?: number; + } + export function Property(target: Object, propKey: string): void; + export function InconsistProperty(target: Object, propKey: string): void; + export function ViewComponent(constructor: ClassType): void; + export type NativeViewModel = { + id: string; + type: string; + props: { + [index: string]: Model; + }; + }; + export type RefType = T extends Ref ? R : never; + export class Ref { + private view?; + set current(v: T); + get current(): T; + apply(config: Partial>): void; + } + export function createRef(): Ref; + export abstract class View implements Modeling { + width: number; + height: number; + x: number; + y: number; + backgroundColor?: Color | GradientColor; + corners?: number | { + leftTop?: number; + rightTop?: number; + leftBottom?: number; + rightBottom?: number; + }; + border?: { + width: number; + color: Color; + }; + shadow?: { + color: Color; + opacity: number; + radius: number; + offsetX: number; + offsetY: number; + }; + /** + * float [0,..1] + */ + alpha?: number; + hidden?: boolean; + viewId: string; + tag?: string; + padding?: { + left?: number; + right?: number; + top?: number; + bottom?: number; + }; + layoutConfig?: LayoutConfig; + onClick?: Function; + superview?: Superview; + callbacks: Map; + callback2Id(f: Function): string; + private id2Callback; + findViewByTag(tag: string): View | undefined; + constructor(); + /** Anchor start*/ + get left(): number; + set left(v: number); + get right(): number; + set right(v: number); + get top(): number; + set top(v: number); + get bottom(): number; + set bottom(v: number); + get centerX(): number; + get centerY(): number; + set centerX(v: number); + set centerY(v: number); + /** Anchor end*/ + private __dirty_props__; + get dirtyProps(): { + [index: string]: Model; + }; + nativeViewModel: NativeViewModel; + viewType(): any; + onPropertyChanged(propKey: string, oldV: Model, newV: Model): void; + clean(): void; + isDirty(): boolean; + responseCallback(id: string, ...args: any): any; + toModel(): NativeViewModel; + let(block: (it: this) => void): void; + also(block: (it: this) => void): this; + apply(config: Partial): this; + in(group: Group): this; + nativeChannel(context: BridgeContext, name: string): (args?: any) => Promise; + getWidth(context: BridgeContext): Promise; + getHeight(context: BridgeContext): Promise; + getX(context: BridgeContext): Promise; + getY(context: BridgeContext): Promise; + getLocationOnScreen(context: BridgeContext): Promise<{ + x: number; + y: number; + }>; + /**++++++++++transform++++++++++*/ + translationX?: number; + translationY?: number; + /** + * float [0,..1] + */ + scaleX?: number; + scaleY?: number; + pivotX?: number; + pivotY?: number; + /** + * rotation*PI + * In Z + */ + rotation?: number; + /** + * rotation*PI + * In X + */ + rotationX?: number; + /** + * rotation*PI + * In Y + */ + rotationY?: number; + /** + * Determines the distance between the z=0 plane and the user in order to give a 3D-positioned element some perspective. + * Default is 200 + */ + perspective?: number; + /**----------transform----------*/ + /** + * Only affected when its superview or itself is FlexLayout. + */ + flexConfig?: FlexConfig; + set props(props: Partial); + set parent(v: Group); + set ref(ref: Ref); + doAnimation(context: BridgeContext, animation: IAnimation): Promise; + clearAnimation(context: BridgeContext, animation: IAnimation): Promise; + cancelAnimation(context: BridgeContext, animation: IAnimation): Promise; + static isViewClass(): boolean; + } + export abstract class Superview extends View { + subviewById(id: string): View | undefined; + findViewByTag(tag: string): View | undefined; + private findViewTraversal; + abstract allSubviews(): Iterable; + isDirty(): boolean; + clean(): void; + toModel(): NativeViewModel; + } + export type ViewArray = View[]; + export type ViewFragment = View | ViewArray | undefined | null; + export abstract class Group extends Superview implements JSX.ElementChildrenAttribute { + readonly children: View[]; + allSubviews(): View[]; + addChild(view: View): void; + removeChild(view: View): void; + removeAllChildren(): void; + private addInnerElement; + set innerElement(e: View | ViewFragment | ViewFragment[] | undefined | null); + } + export class Stack extends Group { + } + export class Root extends Stack { + } class LinearLayout extends Group { + space?: number; + gravity?: Gravity; + } + export class VLayout extends LinearLayout { + } + export class HLayout extends LinearLayout { + } + export function stack(views: View[], config?: Partial): Stack; + export function hlayout(views: View[], config?: Partial): HLayout; + export function vlayout(views: View[], config?: Partial): VLayout; + export class FlexLayout extends Group { + } + export function flexlayout(views: View[], config?: Partial): FlexLayout; + export function NativeCall(target: Panel, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor; + export abstract class Panel { + private destroyed; + context: BridgeContext; + onCreate(): void; + onDestroy(): void; + onShow(): void; + onHidden(): void; + onEnvChanged(): void; + /** + * Build view of the current Panel + * This could be called any times at any time when necessary. + * @param rootView root view of this panel + */ + abstract build(rootView: Group): void; + private __data__?; + private __root__; + private headviews; + private onRenderFinishedCallback; + private __rendering__; + addHeadView(type: string, v: View): void; + allHeadViews(): IterableIterator>; + removeHeadView(type: string, v: View | string): void; + clearHeadViews(type: string): void; + getRootView(): Root; + getInitData(): object | undefined; + private __init__; + private __onCreate__; + private __onDestroy__; + private __onShow__; + private __onHidden__; + private __build__; + private __onEnvChanged__; + private __response__; + private retrospectView; + private snapshotEnabled; + private renderSnapshots; + private __renderSnapshotDepth__; + private __restoreRenderSnapshot__; + private __enableSnapshot__; + private nativeRender; + private hookBeforeNativeCall; + private hookAfterNativeCall; + onRenderFinished(): void; + addOnRenderFinishedCallback(cb: () => void): void; + } + export type BridgeContext = { + /** + * The identify of current context + */ + id: string; + /** + * In this case,It's current panel + */ + entity: any; + /** + * call native plugin + * @param namespace + * @param method + * @param args + */ + callNative(namespace: string, method: string, args?: any): Promise; + /** + * Transform function to functionId as string + * @param func + */ + function2Id(func: Function): string; + /** + * Remove transformed functions + * @param funcId + */ + removeFuncById(funcId: string): void; + }; global { + const context: BridgeContext; + const Environment: { + platform: "Android" | "iOS" | "Qt" | "web"; + platformVersion: string; + appName: string; + appVersion: string; + libVersion: string; + screenWidth: number; + screenHeight: number; + screenScale: number; + statusBarHeight: number; + hasNotch: boolean; + /** + * ex:Apple or Google + */ + deviceBrand: string; + /** + * ex: iPhone12,5 or pixel 3 + */ + deviceModel: string; + /** + * The language code for current locale + */ + localeLanguage: string; + /** + * The country/region code for current locale + */ + localeCountry: string; + [index: string]: number | string | boolean | object | undefined; + }; + function Entry(constructor: ClassType): void; + function Entry(exports: ClassType[]): (constructor: ClassType) => void; + } + export abstract class Resource implements Modeling { + type: string; + identifier: string; + resId: string; + constructor(type: string, identifier: string); + toModel(): { + resId: string; + type: string; + identifier: string; + }; + } + export class LocalResource extends Resource { + constructor(path: string); + } + export class RemoteResource extends Resource { + constructor(url: string); + } + export class Base64Resource extends Resource { + constructor(content: string); + } + /** + * Resources belong to assets dir. + */ + export class AssetsResource extends Resource { + constructor(content: string); + } + export class AndroidResource extends Resource { + } + export class iOSResource extends Resource { + } + /** + * This is for android platform + */ + export class DrawableResource extends AndroidResource { + constructor(name: string); + } + export class RawResource extends AndroidResource { + constructor(name: string); + } + export class AndroidAssetsResource extends AndroidResource { + constructor(path: string); + } + /** + * This is for iOS platform + */ + export class MainBundleResource extends iOSResource { + constructor(fileName: string); + } + export class BundleResource extends iOSResource { + constructor(bundleName: string, fileName: string); + } + export class ArrayBufferResource extends Resource { + data: ArrayBuffer; + constructor(data: ArrayBuffer); + toModel(): { + resId: string; + type: string; + identifier: string; + }; + } + export enum TruncateAt { + End = 0, + Middle = 1, + Start = 2, + Clip = 3 + } + export class Text extends View implements JSX.ElementChildrenAttribute { + text?: string; + textColor?: Color | GradientColor; + textSize?: number; + maxLines?: number; + textAlignment?: Gravity; + fontStyle?: "normal" | "bold" | "italic" | "bold_italic"; + font?: string | Resource; + maxWidth?: number; + maxHeight?: number; + lineSpacing?: number; + strikethrough?: boolean; + underline?: boolean; + htmlText?: string; + truncateAt?: TruncateAt; + set innerElement(e: string); + } + export function text(config: Partial): Text; + export enum ScaleType { + ScaleToFill = 0, + ScaleAspectFit = 1, + ScaleAspectFill = 2, + Tile = 3 + } + export class Image extends View { + /** + * Set pixels for image directly + */ + imagePixels?: { + width: number; + height: number; + pixels: ArrayBuffer; + }; + /** + * This could be loaded by customized resource loader + */ + image?: Resource; + imageUrl?: string; + /** + * Read image from local file system. + */ + imageFilePath?: string; + /** + * Read image from local path + * For android,it based on assets dir. + * For iOS,it based on main bundle dir. + */ + imagePath?: string; + /** + * Read image from resource + * For android,it will try to read from drawable. + * For iOS,it will try to read from Image.Assets. + */ + imageRes?: string; + imageBase64?: string; + scaleType?: ScaleType; + isBlur?: boolean; + /** + * Display while image is loading + * Local file name + */ + placeHolderImage?: string; + placeHolderImageBase64?: string; + /** + * Display while image is loading + * Color + * This priority is lower than placeHolderImage + */ + placeHolderColor?: Color; + /** + * Display while image is failed to load + * It can be file name in local path + */ + errorImage?: string; + errorImageBase64?: string; + /** + * Display while image is failed to load + * Color + * This priority is lower than errorImage + */ + errorColor?: Color; + loadCallback?: (image: { + width: number; + height: number; + animated: boolean; + } | undefined) => void; + /** + * Default is Environment.screenScale. + */ + imageScale?: number; + /** + * Unit in pixel + */ + stretchInset?: { + left: number; + top: number; + right: number; + bottom: number; + }; + /** + * Called if loaded image is animated and played end. + */ + onAnimationEnd?: () => void; + isAnimating(context: BridgeContext): Promise; + startAnimating(context: BridgeContext): Promise; + stopAnimating(context: BridgeContext): Promise; + getImageInfo(context: BridgeContext): Promise<{ + width: number; + height: number; + mimeType: string; + }>; + getImagePixels(context: BridgeContext): Promise; + setImagePixels(context: BridgeContext, image: { + width: number; + height: number; + pixels: ArrayBuffer; + }): Promise; + } + export function image(config: Partial): Image; + export class ListItem extends Stack { + /** + * Set to reuse native view + */ + identifier?: string; + actions?: { + title: string; + backgroundColor?: Color; + callback: () => void; + }[]; + } + export class List extends Superview { + private cachedViews; + allSubviews(): ListItem[]; + itemCount: number; + renderItem: (index: number) => ListItem; + batchCount: number; + onLoadMore?: () => void; + loadMore?: boolean; + loadMoreView?: ListItem; + onScroll?: (offset: { + x: number; + y: number; + }) => void; + onScrollEnd?: (offset: { + x: number; + y: number; + }) => void; + scrolledPosition?: number; + scrollable?: boolean; + /** + * Take effect only on iOS + */ + bounces?: boolean; + canDrag?: boolean; + beforeDragging?: (from: number) => void; + onDragging?: (from: number, to: number) => void; + onDragged?: (from: number, to: number) => void; + scrollToItem(context: BridgeContext, index: number, config?: { + animated?: boolean; + }): Promise; + /** + * @param context + * @returns Returns array of visible view's index. + */ + findVisibleItems(context: BridgeContext): Promise; + /** + * @param context + * @returns Returns array of completely visible view's index. + */ + findCompletelyVisibleItems(context: BridgeContext): Promise; + reset(): void; + private getItem; + private renderBunchedItems; + toModel(): NativeViewModel; + } + export function list(config: Partial): List; + export function listItem(item: View | View[], config?: Partial): ListItem; + export class SlideItem extends Stack { + /** + * Set to reuse native view + */ + identifier?: string; + } + export class Slider extends Superview { + private cachedViews; + allSubviews(): IterableIterator; + itemCount: number; + renderPage: (index: number) => SlideItem; + batchCount: number; + onPageSlided?: (index: number) => void; + loop?: boolean; + scrollable?: boolean; + /** + * Take effect only on iOS + */ + bounces?: boolean; + /** + * Set the effect when sliding + * ZoomOut is currently supported + */ + slideStyle?: "zoomOut" | { + type: "zoomOut"; + minScale: number; + maxScale: number; + }; + private getItem; + private renderBunchedItems; + slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise; + getSlidedPage(context: BridgeContext): Promise; + } + export function slider(config: Partial): Slider; + export function slideItem(item: View | View[], config?: Partial): SlideItem; + export function scroller(content: View, config?: Partial): Scroller; + export class Scroller extends Superview implements JSX.ElementChildrenAttribute { + content: View; + contentOffset?: { + x: number; + y: number; + }; + onScroll?: (offset: { + x: number; + y: number; + }) => void; + onScrollEnd?: (offset: { + x: number; + y: number; + }) => void; + scrollable?: boolean; + /** + * Take effect only on iOS + */ + bounces?: boolean; + allSubviews(): View[]; + toModel(): NativeViewModel; + scrollTo(context: BridgeContext, offset: { + x: number; + y: number; + }, animated?: boolean): Promise; + scrollBy(context: BridgeContext, offset: { + x: number; + y: number; + }, animated?: boolean): Promise; + set innerElement(e: View); + } + export class Refreshable extends Superview implements JSX.ElementChildrenAttribute { + content: View; + header?: View; + onRefresh?: () => void; + allSubviews(): View[]; + setRefreshable(context: BridgeContext, refreshable: boolean): Promise; + setRefreshing(context: BridgeContext, refreshing: boolean): Promise; + isRefreshable(context: BridgeContext): Promise; + isRefreshing(context: BridgeContext): Promise; + toModel(): NativeViewModel; + set innerElement(e: View | [ + View, + View + ]); + } + export function refreshable(config: Partial): Refreshable; + export interface IPullable { + startAnimation(): void; + stopAnimation(): void; + setPullingDistance(distance: number): void; + } + export function pullable(v: View, config: IPullable): View; + export class FlowLayoutItem extends Stack { + /** + * Set to reuse native view + */ + identifier?: string; + /** + * When set to true, the item will layout using all span area. + * LoadMoreView is default to true. + */ + fullSpan?: boolean; + } + export class FlowLayout extends Superview { + private cachedViews; + allSubviews(): FlowLayoutItem[]; + columnCount: number; + columnSpace?: number; + rowSpace?: number; + itemCount: number; + renderItem: (index: number) => FlowLayoutItem; + batchCount: number; + onLoadMore?: () => void; + loadMore?: boolean; + loadMoreView?: FlowLayoutItem; + onScroll?: (offset: { + x: number; + y: number; + }) => void; + onScrollEnd?: (offset: { + x: number; + y: number; + }) => void; + scrollable?: boolean; + /** + * Take effect only on iOS + */ + bounces?: boolean; + /** + * @param context + * @returns Returns array of visible view's index. + */ + findVisibleItems(context: BridgeContext): Promise; + /** + * @param context + * @returns Returns array of completely visible view's index. + */ + findCompletelyVisibleItems(context: BridgeContext): Promise; + reset(): void; + private getItem; + private renderBunchedItems; + toModel(): NativeViewModel; + } + export function flowlayout(config: Partial): FlowLayout; + export function flowItem(item: View | View[], config?: Partial): FlowLayoutItem; + export enum ReturnKeyType { + Default = 0, + Done = 1, + Search = 2, + Next = 3, + Go = 4, + Send = 5 + } + export class Input extends View { + text?: string; + textColor?: Color; + textSize?: number; + font?: string; + hintText?: string; + hintFont?: string; + inputType?: InputType; + hintTextColor?: Color; + multiline?: boolean; + textAlignment?: Gravity; + onTextChange?: (text: string) => void; + onFocusChange?: (focused: boolean) => void; + maxLength?: number; + password?: boolean; + editable?: boolean; + returnKeyType?: ReturnKeyType; + onSubmitEditing?: (text: string) => void; + enableHorizontalScrollBar?: boolean; + enableVerticalScrollBar?: boolean; + /** + * Called before text is changed + * @param editing: text already in box + * @param replacement: text which will replace part of editing + * @param start: the start index of replacing part + * @param length: the length of replacing part + * + * @returns: true means the replacement will take effect, otherwise does not + */ + beforeTextChange?: (change: { + editing: string; + start: number; + length: number; + replacement: string; + }) => boolean; + getText(context: BridgeContext): Promise; + setSelection(context: BridgeContext, start: number, end?: number): Promise; + getSelection(context: BridgeContext): Promise<{ + start: number; + end: number; + }>; + requestFocus(context: BridgeContext): Promise; + releaseFocus(context: BridgeContext): Promise; + } + export enum InputType { + Default = 0, + Number = 1, + Decimal = 2, + Alphabet = 3, + Phone = 4 + } + export function input(config: Partial): Input; + export class NestedSlider extends Group { + onPageSlided?: (index: number) => void; + scrollable?: boolean; + /** + * Take effect only on iOS + */ + bounces?: boolean; + addSlideItem(view: View): void; + slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise; + getSlidedPage(context: BridgeContext): Promise; + } + /** + * @deprecated The class should not be used, please use GestureContainer class instead + */ + export class Draggable extends Stack { + onDrag?: (x: number, y: number) => void; + } + /** + * @deprecated The function should not be used, please use gestureContainer function instead + */ + export function draggable(views: View | View[], config?: Partial): Draggable; + export class Switch extends View { + /** + * True is on ,false is off,defalut is off. + */ + state?: boolean; + /** + * Switch change callback + */ + onSwitch?: (state: boolean) => void; + offTintColor?: Color; + onTintColor?: Color; + thumbTintColor?: Color; + } + export function switchView(config: Partial): Switch; + export enum SwipeOrientation { + LEFT = 0, + RIGHT = 1, + TOP = 2, + BOTTOM = 3 + } + export class GestureContainer extends Stack { + onSingleTap?: () => void; + onDoubleTap?: () => void; + onLongPress?: () => void; + /** + * Called when the fingers in pinching on screen + * @param scale: the numeric value of scale on pinch + */ + onPinch?: (scale: number) => void; + /** + * Called when the fingers are scrolling or paning + * @param dx: the value of the change on the x-axis + * @param dy: the value of the change on the y-axis + */ + onPan?: (dx: number, dy: number) => void; + /** + * Called when the fingers are scrolling or paning + * @param dAngle: the value of the angle change from last rotate in radian + */ + onRotate?: (dAngle: number) => void; + /** + * Called when the fingers has swiped on screen + * @param orientation: the orientation of this swipe + */ + onSwipe?: (orientation: SwipeOrientation) => void; + /** + * Called when the finger touch down on the screen + * @param x: the value of event occurs on the x-axis + * @param y: the value of event occurs on the y-axis + */ + onTouchDown?: (event: { + x: number; + y: number; + }) => void; + /** + * Called when the finger moving on the screen + * @param x: the value of event occurs on the x-axis + * @param y: the value of event occurs on the y-axis + */ + onTouchMove?: (event: { + x: number; + y: number; + }) => void; + /** + * Called when the finger touch up off from the screen + * @param x: the value of event occurs on the x-axis + * @param y: the value of event occurs on the y-axis + */ + onTouchUp?: (event: { + x: number; + y: number; + }) => void; + /** + * Called when the finger leave from screen + * @param x: the value of event occurs on the x-axis + * @param y: the value of event occurs on the y-axis + */ + onTouchCancel?: (event: { + x: number; + y: number; + }) => void; + } + export function gestureContainer(views: View | View[], config?: Partial): GestureContainer; + export class BlurEffect extends Stack { + /** + * Specify the effective rectangle. + * If not set, the default is the entire area. + */ + effectiveRect?: { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Specify the radius of blur effect. + * If not set, the default value is 15. + * Suggested value is from 1 to 25. + */ + radius?: number; + } + export class AeroEffect extends Stack { + /** + * Specify the effective rectangle. + * If not set, the default is the entire area. + */ + effectiveRect?: { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Specify the area of the view is lighter or darker than the underlying view. + * If not set, the default is light. + */ + style?: "light" | "dark" | "extraLight"; + } + export function blurEffect(views: View | View[], config?: Partial): BlurEffect; + export function aeroEffect(views: View | View[], config?: Partial): AeroEffect; + export function modal(context: BridgeContext): { + toast: (msg: string, gravity?: Gravity) => void; + alert: (arg: string | { + title: string; + msg: string; + okLabel?: string; + }) => Promise; + confirm: (arg: string | { + title: string; + msg: string; + okLabel?: string; + cancelLabel?: string; + }) => Promise; + prompt: (arg: { + title?: string; + msg?: string; + okLabel?: string; + cancelLabel?: string; + text?: string; + defaultText?: string; + }) => Promise; + }; + export function navbar(context: BridgeContext): { + isHidden: () => Promise; + setHidden: (hidden: boolean) => Promise; + setTitle: (title: string) => Promise; + setBgColor: (color: Color) => Promise; + setLeft: (view: View) => Promise; + setRight: (view: View) => Promise; + setCenter: (view: View) => Promise; + }; + export function internalScheme(context: BridgeContext, panelClass: ClassType): string; + export function navigator(context: BridgeContext): { + push: (source: string | ClassType, config?: { + alias?: string; + animated?: boolean; + extra?: object; + singlePage?: boolean; + }) => Promise; + pop: (animated?: boolean) => Promise; + popSelf: (animated?: boolean) => Promise; + popToRoot: (animated?: boolean) => Promise; + openUrl: (url: string) => Promise; + }; + export interface IRequest { + url?: string; + method?: "get" | "post" | "put" | "delete"; + headers?: { + [index: string]: string; + }; + params?: { + [index: string]: string; + }; + data?: object | string; + timeout?: number; + } + export interface IResponse { + data: string; + status: number; + headers?: { + [index: string]: string; + }; + } + export function network(context: BridgeContext): { + request: (config: IRequest) => Promise; + get: (url: string, config?: IRequest) => Promise; + post: (url: string, data?: object | string, config?: IRequest) => Promise; + put: (url: string, data?: object | string, config?: IRequest) => Promise; + delete: (url: string, data?: object | string, config?: IRequest) => Promise; + }; + export function storage(context: BridgeContext): { + setItem: (key: string, value: string, zone?: string) => Promise; + getItem: (key: string, zone?: string) => Promise; + remove: (key: string, zone?: string) => Promise; + clear: (zone: string) => Promise; + }; + export function popover(context: BridgeContext): { + show: (view: View) => Promise; + dismiss: (view?: View | undefined) => Promise; + }; + /** + * Only supports x,y,width,height,corner(just for four corners),rotation,bgColor, + * @param panel @see Panel + */ + export function animate(context: BridgeContext): (args: { + animations: () => void; + duration: number; + }) => Promise; + export function notification(context: BridgeContext): { + publish: (args: { + biz?: string; + name: string; + data?: object; + androidSystem?: boolean; + permission?: string; + }) => Promise; + subscribe: (args: { + biz?: string | undefined; + name: string; + callback: (data?: any) => void; + androidSystem?: boolean | undefined; + permission?: string | undefined; + }) => Promise; + unsubscribe: (subscribeId: string) => Promise; + }; + export enum StatusBarMode { + LIGHT = 0, + DARK = 1 + } + export function statusbar(context: BridgeContext): { + setHidden: (hidden: boolean) => Promise; + setMode: (mode: StatusBarMode) => Promise; + setColor: (color: Color) => Promise; + }; + export function coordinator(context: BridgeContext): { + verticalScrolling: (argument: { + scrollable: Scroller | List | FlowLayout; + scrollRange: { + start: number; + end: number; + }; + target: View | "NavBar"; + changing: { + name: "backgroundColor" | "width" | "height" | "x" | "y" | "alpha"; + start: number | Color; + end: number | Color; + }; + }) => void; + }; + export function notch(context: BridgeContext): { + inset: () => Promise<{ + top: number; + left: number; + bottom: number; + right: number; + }>; + }; + export function keyboard(context: BridgeContext): { + subscribe: (callback: (data: { + oldBottomMargin: number; + oldHeight: number; + bottomMargin: number; + height: number; + }) => void) => Promise; + unsubscribe: (subscribeId: string) => Promise; + }; + export function resourceLoader(context: BridgeContext): { + load: (resource: Resource) => Promise; + }; + export function imageDecoder(context: BridgeContext): { + getImageInfo: (resource: Resource) => Promise<{ + width: number; + height: number; + mimeType: string; + }>; + decodeToPixels: (resource: Resource) => Promise; + }; + export function log(...args: any): void; + export function loge(...message: any): void; + export function logw(...message: any): void; + export function uniqueId(prefix: string): string; + export namespace jsx { + function createElement(constructor: ClassType, config: Partial | null, ...children: any[]): any; + class Fragment extends Group { + } + } global { + namespace JSX { + interface Element extends View { + } + interface ElementClass extends View { + } + interface ElementAttributesProperty { + props: {}; + } + interface ElementChildrenAttribute { + innerElement: any; + } + interface IntrinsicElements { + } + } + } + export function take(target: T): (block: (p: T) => void) => void; + export function takeNonNull(target?: T): (block: (p: T) => R) => R | undefined; + export function takeNull(target?: T): (block: () => R) => R | undefined; + export function takeLet(target: T): (block: (p: T) => R | undefined) => R | undefined; + export function takeAlso(target: T): (block: (p: T) => void) => T; + export function takeIf(target: T): (predicate: (t: T) => boolean) => T | undefined; + export function takeUnless(target: T): (predicate: (t: T) => boolean) => T | undefined; + export function repeat(action: (count: number) => void): (times: number) => void; + export type Observer = (v: T) => void; + export type Updater = (v: T) => T; + export interface IObservable { + addObserver(observer: Observer): void; + removeObserver(observer: Observer): void; + update(updater: Updater): void; + } + export class Observable implements IObservable { + private provider; + private clz; + private observers; + constructor(provider: IProvider, clz: { + new (...args: any[]): M; + }); + addObserver(observer: Observer): void; + removeObserver(observer: Observer): void; + update(updater: Updater): void; + } + export interface IProvider { + provide(obj: Object): void; + acquire(clz: { + new (...args: any[]): T; + }): T | undefined; + remove(clz: { + new (...args: any[]): T; + }): void; + clear(): void; + observe(clz: { + new (...args: any[]): T; + }): Observable; + } + export class Provider implements IProvider { + private provision; + private observableMap; + provide(obj: Object): void; + acquire(clz: { + new (...args: any[]): T; + }): T | undefined; + remove(clz: new (...args: any[]) => T): void; + clear(): void; + observe(clz: new (...args: any[]) => T): Observable; + } + export abstract class ViewHolder { + abstract build(root: Group): void; + } + export type Setter = (state: M) => void; + export abstract class ViewModel { + context: BridgeContext; + private state; + private viewHolder; + constructor(obj: M, v: V); + getState(): M; + getViewHolder(): V; + updateState(setter: Setter): void; + attach(view: Group): void; + abstract onAttached(state: M, vh: V): void; + abstract onBind(state: M, vh: V): void; + } + export abstract class VMPanel extends Panel { + private vm?; + private vh?; + abstract getViewModelClass(): ClassType>; + abstract getState(): M; + abstract getViewHolderClass(): ClassType; + getViewModel(): ViewModel | undefined; + build(root: Group): void; + } + export abstract class Module extends Panel { + superPanel?: ModularPanel; + __provider?: Provider; + get provider(): Provider | undefined; + set provider(provider: Provider | undefined); + private unmounted; + mount(): void; + unmount(): void; + get mounted(): boolean; + /** + * Dispatch message to other modules. + * @param message which is sent out + */ + dispatchMessage(message: any): void; + /** + * Dispatched messages can be received by override this method. + * @param message recevied message + */ + onMessage(message: any): void; + /** + * Called when this module is mounted + */ + onMounted(): void; + /** + * Called when this module is unmounted + */ + onUnmounted(): void; + } + export abstract class VMModule extends Module { + private vm?; + private vh?; + abstract getViewModelClass(): ClassType>; + abstract getState(): M; + abstract getViewHolderClass(): ClassType; + getViewModel(): ViewModel | undefined; + build(root: Group): void; + } + export abstract class ModularPanel extends Module { + private modules; + private scheduledRebuild?; + constructor(); + /** + * @returns Class list of current submodules + */ + abstract setupModules(): ClassType[]; + /** + * @param root Current module's rootview + * @returns provided for submodules as their rootview + */ + abstract setupShelf(root: Group): Group; + dispatchMessage(message: any): void; + get mountedModules(): Panel[]; + onMessage(message: any): void; + onStructureChanged(module: Module, mounted: boolean): void; + build(root: Group): void; + onCreate(): void; + onDestroy(): void; + onShow(): void; + onHidden(): void; + onRenderFinished(): void; + } global { + namespace Reflect { + function decorate(decorators: ClassDecorator[], target: Function): Function; + function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor; + function metadata(metadataKey: any, metadataValue: any): { + (target: Function): void; + (target: Object, propertyKey: string | symbol): void; + }; + function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void; + function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void; + function hasMetadata(metadataKey: any, target: Object): boolean; + function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + function hasOwnMetadata(metadataKey: any, target: Object): boolean; + function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + function getMetadata(metadataKey: any, target: Object): any; + function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any; + function getOwnMetadata(metadataKey: any, target: Object): any; + function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any; + function getMetadataKeys(target: Object): any[]; + function getMetadataKeys(target: Object, propertyKey: string | symbol): any[]; + function getOwnMetadataKeys(target: Object): any[]; + function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[]; + function deleteMetadata(metadataKey: any, target: Object): boolean; + function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + } + } + + export {}; + } - -declare module 'doric/lib/src/runtime/global' { - import { Panel } from "doric/lib/src/ui/panel"; - import { ClassType } from "doric/lib/src/util/types"; - export type BridgeContext = { - /** - * The identify of current context - */ - id: string; - /** - * In this case,It's current panel - */ - entity: any; - /** - * call native plugin - * @param namespace - * @param method - * @param args - */ - callNative(namespace: string, method: string, args?: any): Promise; - /** - * Transform function to functionId as string - * @param func - */ - function2Id(func: Function): string; - /** - * Remove transformed functions - * @param funcId - */ - removeFuncById(funcId: string): void; - }; - global { - const context: BridgeContext; - const Environment: { - platform: "Android" | "iOS" | "Qt" | "web"; - platformVersion: string; - appName: string; - appVersion: string; - libVersion: string; - screenWidth: number; - screenHeight: number; - screenScale: number; - statusBarHeight: number; - hasNotch: boolean; - /** - * ex:Apple or Google - */ - deviceBrand: string; - /** - * ex: iPhone12,5 or pixel 3 - */ - deviceModel: string; - /** - * The language code for current locale - */ - localeLanguage: string; - /** - * The country/region code for current locale - */ - localeCountry: string; - [index: string]: number | string | boolean | object | undefined; - }; - function Entry(constructor: ClassType): void; - function Entry(exports: ClassType[]): (constructor: ClassType) => void; - } - export {}; -} - -declare module 'doric/lib/src/ui/index.ui' { - export * from 'doric/lib/src/ui/view'; - export * from 'doric/lib/src/ui/panel'; - export * from 'doric/lib/src/ui/animation'; -} - -declare module 'doric/lib/src/widget/index.widget' { - export * from 'doric/lib/src/widget/layouts'; - export * from 'doric/lib/src/widget/text'; - export * from 'doric/lib/src/widget/image'; - export * from 'doric/lib/src/widget/list'; - export * from 'doric/lib/src/widget/slider'; - export * from 'doric/lib/src/widget/scroller'; - export * from 'doric/lib/src/widget/refreshable'; - export * from 'doric/lib/src/widget/flowlayout'; - export * from 'doric/lib/src/widget/input'; - export * from 'doric/lib/src/widget/nestedSlider'; - export * from 'doric/lib/src/widget/draggable'; - export * from 'doric/lib/src/widget/switch'; - export * from 'doric/lib/src/widget/gesture'; - export * from 'doric/lib/src/widget/effect'; -} - -declare module 'doric/lib/src/native/index.native' { - export * from 'doric/lib/src/native/modal'; - export * from 'doric/lib/src/native/navbar'; - export * from 'doric/lib/src/native/navigator'; - export * from 'doric/lib/src/native/network'; - export * from 'doric/lib/src/native/storage'; - export * from 'doric/lib/src/native/popover'; - export * from 'doric/lib/src/native/animate'; - export * from 'doric/lib/src/native/notification'; - export * from 'doric/lib/src/native/statusbar'; - export * from 'doric/lib/src/native/coordinator'; - export * from 'doric/lib/src/native/notch'; - export * from 'doric/lib/src/native/keyboard'; - export * from 'doric/lib/src/native/resourceLoader'; - export * from 'doric/lib/src/native/imageDecoder'; -} - -declare module 'doric/lib/src/util/index.util' { - export * from 'doric/lib/src/util/color'; - export * from 'doric/lib/src/util/gravity'; - export * from 'doric/lib/src/util/layoutconfig'; - export * from 'doric/lib/src/util/log'; - export * from 'doric/lib/src/util/types'; - export * from 'doric/lib/src/util/uniqueId'; - export * from 'doric/lib/src/util/flexbox'; - export * from 'doric/lib/src/util/jsx'; - export * from 'doric/lib/src/util/resource'; -} - -declare module 'doric/lib/src/pattern/index.pattern' { - export * from 'doric/lib/src/pattern/candies'; - export * from 'doric/lib/src/pattern/provider'; - export * from 'doric/lib/src/pattern/mvvm'; - export * from 'doric/lib/src/pattern/modular'; -} - -declare module 'doric/lib/src/ui/panel' { - import { View, Group } from "doric/lib/src/ui/view"; - import { Root } from 'doric/lib/src/widget/layouts'; - import { BridgeContext } from 'doric/lib/src/runtime/global'; - export function NativeCall(target: Panel, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor; - export abstract class Panel { - context: BridgeContext; - onCreate(): void; - onDestroy(): void; - onShow(): void; - onHidden(): void; - onEnvChanged(): void; - /** - * Build view of the current Panel - * This could be called any times at any time when necessary. - * @param rootView root view of this panel - */ - abstract build(rootView: Group): void; - addHeadView(type: string, v: View): void; - allHeadViews(): IterableIterator>; - removeHeadView(type: string, v: View | string): void; - clearHeadViews(type: string): void; - getRootView(): Root; - getInitData(): object | undefined; - onRenderFinished(): void; - addOnRenderFinishedCallback(cb: () => void): void; - } -} - -declare module 'doric/lib/src/util/types' { - export interface Modeling { - toModel(): Model; - } - export function obj2Model(obj: Model, convertor: (v: Function) => string): Model; - type _M = string | number | boolean | Modeling | { - [index: string]: Model; - } | undefined; - export type Model = _M | Array<_M>; - export type Binder = (v: T) => void; - export class Mutable { - get: () => T; - set: (v: T) => void; - bind(binder: Binder): void; - static of(v: E): Mutable; - } - export type ClassType = new (...args: any) => T; - export {}; -} - -declare module 'doric/lib/src/ui/view' { - import { Color, GradientColor } from "doric/lib/src/util/color"; - import { Modeling, Model, ClassType } from "doric/lib/src/util/types"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { LayoutConfig } from 'doric/lib/src/util/layoutconfig'; - import { IAnimation } from "doric/lib/src/ui/animation"; - import { FlexConfig } from "doric/lib/src/util/flexbox"; - export function Property(target: Object, propKey: string): void; - export function InconsistProperty(target: Object, propKey: string): void; - export function ViewComponent(constructor: ClassType): void; - export type NativeViewModel = { - id: string; - type: string; - props: { - [index: string]: Model; - }; - }; - type RefType = T extends Ref ? R : never; - export class Ref { - set current(v: T); - get current(): T; - apply(config: Partial>): void; - } - export function createRef(): Ref; - export abstract class View implements Modeling { - width: number; - height: number; - x: number; - y: number; - backgroundColor?: Color | GradientColor; - corners?: number | { - leftTop?: number; - rightTop?: number; - leftBottom?: number; - rightBottom?: number; - }; - border?: { - width: number; - color: Color; - }; - shadow?: { - color: Color; - opacity: number; - radius: number; - offsetX: number; - offsetY: number; - }; - /** - * float [0,..1] - */ - alpha?: number; - hidden?: boolean; - viewId: string; - tag?: string; - padding?: { - left?: number; - right?: number; - top?: number; - bottom?: number; - }; - layoutConfig?: LayoutConfig; - onClick?: Function; - superview?: Superview; - callbacks: Map; - callback2Id(f: Function): string; - findViewByTag(tag: string): View | undefined; - constructor(); - /** Anchor start*/ - get left(): number; - set left(v: number); - get right(): number; - set right(v: number); - get top(): number; - set top(v: number); - get bottom(): number; - set bottom(v: number); - get centerX(): number; - get centerY(): number; - set centerX(v: number); - set centerY(v: number); - get dirtyProps(): { - [index: string]: Model; - }; - nativeViewModel: NativeViewModel; - viewType(): any; - onPropertyChanged(propKey: string, oldV: Model, newV: Model): void; - clean(): void; - isDirty(): boolean; - responseCallback(id: string, ...args: any): any; - toModel(): NativeViewModel; - let(block: (it: this) => void): void; - also(block: (it: this) => void): this; - apply(config: Partial): this; - in(group: Group): this; - nativeChannel(context: BridgeContext, name: string): (args?: any) => Promise; - getWidth(context: BridgeContext): Promise; - getHeight(context: BridgeContext): Promise; - getX(context: BridgeContext): Promise; - getY(context: BridgeContext): Promise; - getLocationOnScreen(context: BridgeContext): Promise<{ - x: number; - y: number; - }>; - /**++++++++++transform++++++++++*/ - translationX?: number; - translationY?: number; - /** - * float [0,..1] - */ - scaleX?: number; - scaleY?: number; - pivotX?: number; - pivotY?: number; - /** - * rotation*PI - * In Z - */ - rotation?: number; - /** - * rotation*PI - * In X - */ - rotationX?: number; - /** - * rotation*PI - * In Y - */ - rotationY?: number; - /** - * Determines the distance between the z=0 plane and the user in order to give a 3D-positioned element some perspective. - * Default is 200 - */ - perspective?: number; - /** - * Only affected when its superview or itself is FlexLayout. - */ - flexConfig?: FlexConfig; - set props(props: Partial); - set parent(v: Group); - set ref(ref: Ref); - doAnimation(context: BridgeContext, animation: IAnimation): Promise; - clearAnimation(context: BridgeContext, animation: IAnimation): Promise; - cancelAnimation(context: BridgeContext, animation: IAnimation): Promise; - static isViewClass(): boolean; - } - export abstract class Superview extends View { - subviewById(id: string): View | undefined; - findViewByTag(tag: string): View | undefined; - abstract allSubviews(): Iterable; - isDirty(): boolean; - clean(): void; - toModel(): NativeViewModel; - } - export type ViewArray = View[]; - export type ViewFragment = View | ViewArray | undefined | null; - export abstract class Group extends Superview implements JSX.ElementChildrenAttribute { - readonly children: View[]; - allSubviews(): View[]; - addChild(view: View): void; - removeChild(view: View): void; - removeAllChildren(): void; - set innerElement(e: View | ViewFragment | ViewFragment[] | undefined | null); - } - export {}; -} - -declare module 'doric/lib/src/ui/animation' { - import { Color } from "doric/lib/src/util/color"; - import { Modeling, Model } from "doric/lib/src/util/types"; - export type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha"; - export enum RepeatMode { - RESTART = 1, - REVERSE = 2 - } - export interface IAnimation extends Modeling { - duration: number; - delay?: number; - id: string; - } - export interface Changeable { - fromValue: number; - toValue: number; - key: AnimatedKey; - repeatCount?: number; - repeatMode?: RepeatMode; - keyFrames?: { - percent: number; - value: number; - }[]; - } - export enum FillMode { - /** - * The receiver is removed from the presentation when the animation is completed. - */ - Removed = 0, - /** - * The receiver remains visible in its final state when the animation is completed. - */ - Forward = 1, - /** - * The receiver clamps values before zero to zero when the animation is completed. - */ - Backward = 2, - /** - * The receiver clamps values at both ends of the object’s time space - */ - Both = 3 - } - export enum TimingFunction { - /** - * The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations. - */ - Default = 0, - /** - * Linear pacing, which causes an animation to occur evenly over its duration. - */ - Linear = 1, - /** - * Ease-in pacing, which causes an animation to begin slowly and then speed up as it progresses. - */ - EaseIn = 2, - /** - * Ease-out pacing, which causes an animation to begin quickly and then slow as it progresses. - */ - EaseOut = 3, - /** - * Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing. - */ - EaseInEaseOut = 4 - } - abstract class Animation implements IAnimation { - changeables: Map; - duration: number; - repeatCount?: number; - repeatMode?: RepeatMode; - delay?: number; - fillMode: FillMode; - timingFunction?: TimingFunction; - id: string; - toModel(): { - type: string; - delay: number | undefined; - duration: number; - changeables: { - key: AnimatedKey; - fromValue: number; - toValue: number; - keyFrames: { - percent: number; - value: number; - }[] | undefined; - }[]; - repeatCount: number | undefined; - repeatMode: RepeatMode | undefined; - fillMode: FillMode; - timingFunction: TimingFunction | undefined; - id: string; - }; - } - export class ScaleAnimation extends Animation { - constructor(); - set xKeyFrames(keyFrames: { - percent: number; - value: number; - }[]); - set yKeyFrames(keyFrames: { - percent: number; - value: number; - }[]); - set fromScaleX(v: number); - get fromScaleX(): number; - set toScaleX(v: number); - get toScaleX(): number; - set fromScaleY(v: number); - get fromScaleY(): number; - set toScaleY(v: number); - get toScaleY(): number; - } - export class TranslationAnimation extends Animation { - constructor(); - set xKeyFrames(keyFrames: { - percent: number; - value: number; - }[]); - set yKeyFrames(keyFrames: { - percent: number; - value: number; - }[]); - set fromTranslationX(v: number); - get fromTranslationX(): number; - set toTranslationX(v: number); - get toTranslationX(): number; - set fromTranslationY(v: number); - get fromTranslationY(): number; - set toTranslationY(v: number); - get toTranslationY(): number; - } - /** - * Rotation range is [0..2] - */ - export class RotationAnimation extends Animation { - constructor(); - set fromRotation(v: number); - get fromRotation(): number; - set toRotation(v: number); - get toRotation(): number; - set keyFrames(keyFrames: { - percent: number; - value: number; - }[]); - } - /** - * Rotation range is [0..2] - */ - export class RotationXAnimation extends Animation { - constructor(); - set fromRotation(v: number); - get fromRotation(): number; - set toRotation(v: number); - get toRotation(): number; - set keyFrames(keyFrames: { - percent: number; - value: number; - }[]); - } - /** - * Rotation range is [0..2] - */ - export class RotationYAnimation extends Animation { - constructor(); - set fromRotation(v: number); - get fromRotation(): number; - set toRotation(v: number); - get toRotation(): number; - set keyFrames(keyFrames: { - percent: number; - value: number; - }[]); - } - export class BackgroundColorAnimation extends Animation { - constructor(); - set fromColor(color: Color); - get fromColor(): Color; - set toColor(v: Color); - get toColor(): Color; - set keyFrames(keyFrames: { - percent: number; - value: Color; - }[]); - } - /** - * Alpha range is [0..1] - */ - export class AlphaAnimation extends Animation { - constructor(); - set from(v: number); - get from(): number; - set to(v: number); - get to(): number; - set keyFrames(keyFrames: { - percent: number; - value: number; - }[]); - } - export class AnimationSet implements IAnimation { - delay?: number; - id: string; - addAnimation(anim: IAnimation): void; - get duration(): number; - set duration(v: number); - toModel(): { - animations: Model; - delay: number | undefined; - id: string; - }; - } - export {}; -} - -declare module 'doric/lib/src/widget/layouts' { - import { Group, View } from "doric/lib/src/ui/view"; - import { Gravity } from "doric/lib/src/util/gravity"; - export class Stack extends Group { - } - export class Root extends Stack { - } - class LinearLayout extends Group { - space?: number; - gravity?: Gravity; - } - export class VLayout extends LinearLayout { - } - export class HLayout extends LinearLayout { - } - export function stack(views: View[], config?: Partial): Stack; - export function hlayout(views: View[], config?: Partial): HLayout; - export function vlayout(views: View[], config?: Partial): VLayout; - export class FlexLayout extends Group { - } - export function flexlayout(views: View[], config?: Partial): FlexLayout; - export {}; -} - -declare module 'doric/lib/src/widget/text' { - import { View } from "doric/lib/src/ui/view"; - import { Color, GradientColor } from "doric/lib/src/util/color"; - import { Gravity } from "doric/lib/src/util/gravity"; - import { Resource } from "doric/lib/src/util/resource"; - export enum TruncateAt { - End = 0, - Middle = 1, - Start = 2, - Clip = 3 - } - export class Text extends View implements JSX.ElementChildrenAttribute { - text?: string; - textColor?: Color | GradientColor; - textSize?: number; - maxLines?: number; - textAlignment?: Gravity; - fontStyle?: "normal" | "bold" | "italic" | "bold_italic"; - font?: string | Resource; - maxWidth?: number; - maxHeight?: number; - lineSpacing?: number; - strikethrough?: boolean; - underline?: boolean; - htmlText?: string; - truncateAt?: TruncateAt; - set innerElement(e: string); - } - export function text(config: Partial): Text; -} - -declare module 'doric/lib/src/widget/image' { - import { View } from "doric/lib/src/ui/view"; - import { Color } from "doric/lib/src/util/color"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Resource } from "doric/lib/src/util/resource"; - export enum ScaleType { - ScaleToFill = 0, - ScaleAspectFit = 1, - ScaleAspectFill = 2, - Tile = 3 - } - export class Image extends View { - /** - * Set pixels for image directly - */ - imagePixels?: { - width: number; - height: number; - pixels: ArrayBuffer; - }; - /** - * This could be loaded by customized resource loader - */ - image?: Resource; - imageUrl?: string; - /** - * Read image from local file system. - */ - imageFilePath?: string; - /** - * Read image from local path - * For android,it based on assets dir. - * For iOS,it based on main bundle dir. - */ - imagePath?: string; - /** - * Read image from resource - * For android,it will try to read from drawable. - * For iOS,it will try to read from Image.Assets. - */ - imageRes?: string; - imageBase64?: string; - scaleType?: ScaleType; - isBlur?: boolean; - /** - * Display while image is loading - * Local file name - */ - placeHolderImage?: string; - placeHolderImageBase64?: string; - /** - * Display while image is loading - * Color - * This priority is lower than placeHolderImage - */ - placeHolderColor?: Color; - /** - * Display while image is failed to load - * It can be file name in local path - */ - errorImage?: string; - errorImageBase64?: string; - /** - * Display while image is failed to load - * Color - * This priority is lower than errorImage - */ - errorColor?: Color; - loadCallback?: (image: { - width: number; - height: number; - animated: boolean; - } | undefined) => void; - /** - * Default is Environment.screenScale. - */ - imageScale?: number; - /** - * Unit in pixel - */ - stretchInset?: { - left: number; - top: number; - right: number; - bottom: number; - }; - /** - * Called if loaded image is animated and played end. - */ - onAnimationEnd?: () => void; - isAnimating(context: BridgeContext): Promise; - startAnimating(context: BridgeContext): Promise; - stopAnimating(context: BridgeContext): Promise; - getImageInfo(context: BridgeContext): Promise<{ - width: number; - height: number; - mimeType: string; - }>; - getImagePixels(context: BridgeContext): Promise; - setImagePixels(context: BridgeContext, image: { - width: number; - height: number; - pixels: ArrayBuffer; - }): Promise; - } - export function image(config: Partial): Image; -} - -declare module 'doric/lib/src/widget/list' { - import { View, Superview, NativeViewModel } from "doric/lib/src/ui/view"; - import { Stack } from "doric/lib/src/widget/layouts"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Color } from "doric/lib/src/util/color"; - export class ListItem extends Stack { - /** - * Set to reuse native view - */ - identifier?: string; - actions?: { - title: string; - backgroundColor?: Color; - callback: () => void; - }[]; - } - export class List extends Superview { - allSubviews(): ListItem[]; - itemCount: number; - renderItem: (index: number) => ListItem; - batchCount: number; - onLoadMore?: () => void; - loadMore?: boolean; - loadMoreView?: ListItem; - onScroll?: (offset: { - x: number; - y: number; - }) => void; - onScrollEnd?: (offset: { - x: number; - y: number; - }) => void; - scrolledPosition?: number; - scrollable?: boolean; - /** - * Take effect only on iOS - */ - bounces?: boolean; - canDrag?: boolean; - beforeDragging?: (from: number) => void; - onDragging?: (from: number, to: number) => void; - onDragged?: (from: number, to: number) => void; - scrollToItem(context: BridgeContext, index: number, config?: { - animated?: boolean; - }): Promise; - /** - * @param context - * @returns Returns array of visible view's index. - */ - findVisibleItems(context: BridgeContext): Promise; - /** - * @param context - * @returns Returns array of completely visible view's index. - */ - findCompletelyVisibleItems(context: BridgeContext): Promise; - reset(): void; - toModel(): NativeViewModel; - } - export function list(config: Partial): List; - export function listItem(item: View | View[], config?: Partial): ListItem; -} - -declare module 'doric/lib/src/widget/slider' { - import { Superview, View } from "doric/lib/src/ui/view"; - import { Stack } from "doric/lib/src/widget/layouts"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - export class SlideItem extends Stack { - /** - * Set to reuse native view - */ - identifier?: string; - } - export class Slider extends Superview { - allSubviews(): IterableIterator; - itemCount: number; - renderPage: (index: number) => SlideItem; - batchCount: number; - onPageSlided?: (index: number) => void; - loop?: boolean; - scrollable?: boolean; - /** - * Take effect only on iOS - */ - bounces?: boolean; - /** - * Set the effect when sliding - * ZoomOut is currently supported - */ - slideStyle?: "zoomOut" | { - type: "zoomOut"; - minScale: number; - maxScale: number; - }; - slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise; - getSlidedPage(context: BridgeContext): Promise; - } - export function slider(config: Partial): Slider; - export function slideItem(item: View | View[], config?: Partial): SlideItem; -} - -declare module 'doric/lib/src/widget/scroller' { - import { Superview, View, NativeViewModel } from 'doric/lib/src/ui/view'; - import { BridgeContext } from 'doric/lib/src/runtime/global'; - export function scroller(content: View, config?: Partial): Scroller; - export class Scroller extends Superview implements JSX.ElementChildrenAttribute { - content: View; - contentOffset?: { - x: number; - y: number; - }; - onScroll?: (offset: { - x: number; - y: number; - }) => void; - onScrollEnd?: (offset: { - x: number; - y: number; - }) => void; - scrollable?: boolean; - /** - * Take effect only on iOS - */ - bounces?: boolean; - allSubviews(): View[]; - toModel(): NativeViewModel; - scrollTo(context: BridgeContext, offset: { - x: number; - y: number; - }, animated?: boolean): Promise; - scrollBy(context: BridgeContext, offset: { - x: number; - y: number; - }, animated?: boolean): Promise; - set innerElement(e: View); - } -} - -declare module 'doric/lib/src/widget/refreshable' { - import { View, Superview, NativeViewModel } from "doric/lib/src/ui/view"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - export class Refreshable extends Superview implements JSX.ElementChildrenAttribute { - content: View; - header?: View; - onRefresh?: () => void; - allSubviews(): View[]; - setRefreshable(context: BridgeContext, refreshable: boolean): Promise; - setRefreshing(context: BridgeContext, refreshing: boolean): Promise; - isRefreshable(context: BridgeContext): Promise; - isRefreshing(context: BridgeContext): Promise; - toModel(): NativeViewModel; - set innerElement(e: View | [View, View]); - } - export function refreshable(config: Partial): Refreshable; - export interface IPullable { - startAnimation(): void; - stopAnimation(): void; - setPullingDistance(distance: number): void; - } - export function pullable(v: View, config: IPullable): View; -} - -declare module 'doric/lib/src/widget/flowlayout' { - import { Stack } from 'doric/lib/src/widget/layouts'; - import { Superview, View, NativeViewModel } from 'doric/lib/src/ui/view'; - import { BridgeContext } from "doric/lib/src/runtime/global"; - export class FlowLayoutItem extends Stack { - /** - * Set to reuse native view - */ - identifier?: string; - /** - * When set to true, the item will layout using all span area. - * LoadMoreView is default to true. - */ - fullSpan?: boolean; - } - export class FlowLayout extends Superview { - allSubviews(): FlowLayoutItem[]; - columnCount: number; - columnSpace?: number; - rowSpace?: number; - itemCount: number; - renderItem: (index: number) => FlowLayoutItem; - batchCount: number; - onLoadMore?: () => void; - loadMore?: boolean; - loadMoreView?: FlowLayoutItem; - onScroll?: (offset: { - x: number; - y: number; - }) => void; - onScrollEnd?: (offset: { - x: number; - y: number; - }) => void; - scrollable?: boolean; - /** - * Take effect only on iOS - */ - bounces?: boolean; - /** - * @param context - * @returns Returns array of visible view's index. - */ - findVisibleItems(context: BridgeContext): Promise; - /** - * @param context - * @returns Returns array of completely visible view's index. - */ - findCompletelyVisibleItems(context: BridgeContext): Promise; - reset(): void; - toModel(): NativeViewModel; - } - export function flowlayout(config: Partial): FlowLayout; - export function flowItem(item: View | View[], config?: Partial): FlowLayoutItem; -} - -declare module 'doric/lib/src/widget/input' { - import { View } from "doric/lib/src/ui/view"; - import { Color } from "doric/lib/src/util/color"; - import { Gravity } from "doric/lib/src/util/gravity"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - export enum ReturnKeyType { - Default = 0, - Done = 1, - Search = 2, - Next = 3, - Go = 4, - Send = 5 - } - export class Input extends View { - text?: string; - textColor?: Color; - textSize?: number; - font?: string; - hintText?: string; - hintFont?: string; - inputType?: InputType; - hintTextColor?: Color; - multiline?: boolean; - textAlignment?: Gravity; - onTextChange?: (text: string) => void; - onFocusChange?: (focused: boolean) => void; - maxLength?: number; - password?: boolean; - editable?: boolean; - returnKeyType?: ReturnKeyType; - onSubmitEditing?: (text: string) => void; - enableHorizontalScrollBar?: boolean; - enableVerticalScrollBar?: boolean; - /** - * Called before text is changed - * @param editing: text already in box - * @param replacement: text which will replace part of editing - * @param start: the start index of replacing part - * @param length: the length of replacing part - * - * @returns: true means the replacement will take effect, otherwise does not - */ - beforeTextChange?: (change: { - editing: string; - start: number; - length: number; - replacement: string; - }) => boolean; - getText(context: BridgeContext): Promise; - setSelection(context: BridgeContext, start: number, end?: number): Promise; - getSelection(context: BridgeContext): Promise<{ - start: number; - end: number; - }>; - requestFocus(context: BridgeContext): Promise; - releaseFocus(context: BridgeContext): Promise; - } - export enum InputType { - Default = 0, - Number = 1, - Decimal = 2, - Alphabet = 3, - Phone = 4 - } - export function input(config: Partial): Input; -} - -declare module 'doric/lib/src/widget/nestedSlider' { - import { Group, View } from 'doric/lib/src/ui/view'; - import { BridgeContext } from 'doric/lib/src/runtime/global'; - export class NestedSlider extends Group { - onPageSlided?: (index: number) => void; - scrollable?: boolean; - /** - * Take effect only on iOS - */ - bounces?: boolean; - addSlideItem(view: View): void; - slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise; - getSlidedPage(context: BridgeContext): Promise; - } -} - -declare module 'doric/lib/src/widget/draggable' { - import { View } from "doric/lib/src/ui/view"; - import { Stack } from "doric/lib/src/widget/layouts"; - /** - * @deprecated The class should not be used, please use GestureContainer class instead - */ - export class Draggable extends Stack { - onDrag?: (x: number, y: number) => void; - } - /** - * @deprecated The function should not be used, please use gestureContainer function instead - */ - export function draggable(views: View | View[], config?: Partial): Draggable; -} - -declare module 'doric/lib/src/widget/switch' { - import { View } from "doric/lib/src/ui/view"; - import { Color } from "doric/lib/src/util/color"; - export class Switch extends View { - /** - * True is on ,false is off,defalut is off. - */ - state?: boolean; - /** - * Switch change callback - */ - onSwitch?: (state: boolean) => void; - offTintColor?: Color; - onTintColor?: Color; - thumbTintColor?: Color; - } - export function switchView(config: Partial): Switch; -} - -declare module 'doric/lib/src/widget/gesture' { - import { View } from "doric/lib/src/ui/view"; - import { Stack } from "doric/lib/src/widget/layouts"; - export enum SwipeOrientation { - LEFT = 0, - RIGHT = 1, - TOP = 2, - BOTTOM = 3 - } - export class GestureContainer extends Stack { - onSingleTap?: () => void; - onDoubleTap?: () => void; - onLongPress?: () => void; - /** - * Called when the fingers in pinching on screen - * @param scale: the numeric value of scale on pinch - */ - onPinch?: (scale: number) => void; - /** - * Called when the fingers are scrolling or paning - * @param dx: the value of the change on the x-axis - * @param dy: the value of the change on the y-axis - */ - onPan?: (dx: number, dy: number) => void; - /** - * Called when the fingers are scrolling or paning - * @param dAngle: the value of the angle change from last rotate in radian - */ - onRotate?: (dAngle: number) => void; - /** - * Called when the fingers has swiped on screen - * @param orientation: the orientation of this swipe - */ - onSwipe?: (orientation: SwipeOrientation) => void; - /** - * Called when the finger touch down on the screen - * @param x: the value of event occurs on the x-axis - * @param y: the value of event occurs on the y-axis - */ - onTouchDown?: (event: { - x: number; - y: number; - }) => void; - /** - * Called when the finger moving on the screen - * @param x: the value of event occurs on the x-axis - * @param y: the value of event occurs on the y-axis - */ - onTouchMove?: (event: { - x: number; - y: number; - }) => void; - /** - * Called when the finger touch up off from the screen - * @param x: the value of event occurs on the x-axis - * @param y: the value of event occurs on the y-axis - */ - onTouchUp?: (event: { - x: number; - y: number; - }) => void; - /** - * Called when the finger leave from screen - * @param x: the value of event occurs on the x-axis - * @param y: the value of event occurs on the y-axis - */ - onTouchCancel?: (event: { - x: number; - y: number; - }) => void; - } - export function gestureContainer(views: View | View[], config?: Partial): GestureContainer; -} - -declare module 'doric/lib/src/widget/effect' { - import { Stack } from "doric/lib/src/widget/layouts"; - import { View } from "doric/lib/src/ui/view"; - export class BlurEffect extends Stack { - /** - * Specify the effective rectangle. - * If not set, the default is the entire area. - */ - effectiveRect?: { - x: number; - y: number; - width: number; - height: number; - }; - /** - * Specify the radius of blur effect. - * If not set, the default value is 15. - * Suggested value is from 1 to 25. - */ - radius?: number; - } - export class AeroEffect extends Stack { - /** - * Specify the effective rectangle. - * If not set, the default is the entire area. - */ - effectiveRect?: { - x: number; - y: number; - width: number; - height: number; - }; - /** - * Specify the area of the view is lighter or darker than the underlying view. - * If not set, the default is light. - */ - style?: "light" | "dark" | "extraLight"; - } - export function blurEffect(views: View | View[], config?: Partial): BlurEffect; - export function aeroEffect(views: View | View[], config?: Partial): AeroEffect; -} - -declare module 'doric/lib/src/native/modal' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Gravity } from "doric/lib/src/util/gravity"; - export function modal(context: BridgeContext): { - toast: (msg: string, gravity?: Gravity) => void; - alert: (arg: string | { - title: string; - msg: string; - okLabel?: string; - }) => Promise; - confirm: (arg: string | { - title: string; - msg: string; - okLabel?: string; - cancelLabel?: string; - }) => Promise; - prompt: (arg: { - title?: string; - msg?: string; - okLabel?: string; - cancelLabel?: string; - text?: string; - defaultText?: string; - }) => Promise; - }; -} - -declare module 'doric/lib/src/native/navbar' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Color } from "doric/lib/src/util/color"; - import { View } from "doric/lib/src/ui/view"; - export function navbar(context: BridgeContext): { - isHidden: () => Promise; - setHidden: (hidden: boolean) => Promise; - setTitle: (title: string) => Promise; - setBgColor: (color: Color) => Promise; - setLeft: (view: View) => Promise; - setRight: (view: View) => Promise; - setCenter: (view: View) => Promise; - }; -} - -declare module 'doric/lib/src/native/navigator' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Panel } from "doric/lib/src/ui/panel"; - import { ClassType } from "doric/lib/src/util/types"; - export function internalScheme(context: BridgeContext, panelClass: ClassType): string; - export function navigator(context: BridgeContext): { - push: (source: string | ClassType, config?: { - alias?: string | undefined; - animated?: boolean | undefined; - extra?: object | undefined; - singlePage?: boolean | undefined; - } | undefined) => Promise; - pop: (animated?: boolean) => Promise; - popSelf: (animated?: boolean) => Promise; - popToRoot: (animated?: boolean) => Promise; - openUrl: (url: string) => Promise; - }; -} - -declare module 'doric/lib/src/native/network' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - export interface IRequest { - url?: string; - method?: "get" | "post" | "put" | "delete"; - headers?: { - [index: string]: string; - }; - params?: { - [index: string]: string; - }; - data?: object | string; - timeout?: number; - } - export interface IResponse { - data: string; - status: number; - headers?: { - [index: string]: string; - }; - } - export function network(context: BridgeContext): { - request: (config: IRequest) => Promise; - get: (url: string, config?: IRequest | undefined) => Promise; - post: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - put: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - delete: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - }; -} - -declare module 'doric/lib/src/native/storage' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - export function storage(context: BridgeContext): { - setItem: (key: string, value: string, zone?: string | undefined) => Promise; - getItem: (key: string, zone?: string | undefined) => Promise; - remove: (key: string, zone?: string | undefined) => Promise; - clear: (zone: string) => Promise; - }; -} - -declare module 'doric/lib/src/native/popover' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { View } from "doric/lib/src/ui/view"; - export function popover(context: BridgeContext): { - show: (view: View) => Promise; - dismiss: (view?: View | undefined) => Promise; - }; -} - -declare module 'doric/lib/src/native/animate' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - /** - * Only supports x,y,width,height,corner(just for four corners),rotation,bgColor, - * @param panel @see Panel - */ - export function animate(context: BridgeContext): (args: { - animations: () => void; - duration: number; - }) => Promise; -} - -declare module 'doric/lib/src/native/notification' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - export function notification(context: BridgeContext): { - publish: (args: { - biz?: string; - name: string; - data?: object; - androidSystem?: boolean; - permission?: string; - }) => Promise; - subscribe: (args: { - biz?: string | undefined; - name: string; - callback: (data?: any) => void; - androidSystem?: boolean | undefined; - permission?: string | undefined; - }) => Promise; - unsubscribe: (subscribeId: string) => Promise; - }; -} - -declare module 'doric/lib/src/native/statusbar' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Color } from "doric/lib/src/util/color"; - export enum StatusBarMode { - LIGHT = 0, - DARK = 1 - } - export function statusbar(context: BridgeContext): { - setHidden: (hidden: boolean) => Promise; - setMode: (mode: StatusBarMode) => Promise; - setColor: (color: Color) => Promise; - }; -} - -declare module 'doric/lib/src/native/coordinator' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { Scroller } from "doric/lib/src/widget/scroller"; - import { List } from "doric/lib/src/widget/list"; - import { FlowLayout } from "doric/lib/src/widget/flowlayout"; - import { View } from "doric/lib/src/ui/view"; - import { Color } from "doric/lib/src/util/color"; - export function coordinator(context: BridgeContext): { - verticalScrolling: (argument: { - scrollable: Scroller | List | FlowLayout; - scrollRange: { - start: number; - end: number; - }; - target: View | "NavBar"; - changing: { - name: "backgroundColor" | "width" | "height" | "x" | "y" | "alpha"; - start: number | Color; - end: number | Color; - }; - }) => void; - }; -} - -declare module 'doric/lib/src/native/notch' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - export function notch(context: BridgeContext): { - inset: () => Promise<{ - top: number; - left: number; - bottom: number; - right: number; - }>; - }; -} - -declare module 'doric/lib/src/native/keyboard' { - import { BridgeContext } from "doric/lib/src/runtime/global"; - export function keyboard(context: BridgeContext): { - subscribe: (callback: (data: { - oldBottomMargin: number; - oldHeight: number; - bottomMargin: number; - height: number; - }) => void) => Promise; - unsubscribe: (subscribeId: string) => Promise; - }; -} - -declare module 'doric/lib/src/native/resourceLoader' { - import { Resource } from "doric/lib/src/util/resource"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - export function resourceLoader(context: BridgeContext): { - load: (resource: Resource) => Promise; - }; -} - -declare module 'doric/lib/src/native/imageDecoder' { - import { Resource } from "doric/lib/src/util/resource"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - export function imageDecoder(context: BridgeContext): { - getImageInfo: (resource: Resource) => Promise<{ - width: number; - height: number; - mimeType: string; - }>; - decodeToPixels: (resource: Resource) => Promise; - }; -} - -declare module 'doric/lib/src/util/color' { - import { Modeling } from "doric/lib/src/util/types"; - /** - * Store color as format AARRGGBB or RRGGBB - */ - export class Color implements Modeling { - static BLACK: Color; - static DKGRAY: Color; - static GRAY: Color; - static LTGRAY: Color; - static WHITE: Color; - static RED: Color; - static GREEN: Color; - static BLUE: Color; - static YELLOW: Color; - static CYAN: Color; - static MAGENTA: Color; - static TRANSPARENT: Color; - _value: number; - constructor(v: number); - static parse(str: string): Color; - static safeParse(str: string, defVal?: Color): Color; - alpha(v: number): Color; - toModel(): number; - } - export enum GradientOrientation { - /** draw the gradient from the top to the bottom */ - TOP_BOTTOM = 0, - /** draw the gradient from the top-right to the bottom-left */ - TR_BL = 1, - /** draw the gradient from the right to the left */ - RIGHT_LEFT = 2, - /** draw the gradient from the bottom-right to the top-left */ - BR_TL = 3, - /** draw the gradient from the bottom to the top */ - BOTTOM_TOP = 4, - /** draw the gradient from the bottom-left to the top-right */ - BL_TR = 5, - /** draw the gradient from the left to the right */ - LEFT_RIGHT = 6, - /** draw the gradient from the top-left to the bottom-right */ - TL_BR = 7 - } - export interface GradientColor { - start?: Color; - end?: Color; - colors?: Array; - locations?: Array; - orientation: GradientOrientation; - } -} - -declare module 'doric/lib/src/util/gravity' { - import { Modeling } from "doric/lib/src/util/types"; - export const LEFT: number; - export const RIGHT: number; - export const TOP: number; - export const BOTTOM: number; - export const CENTER_X: number; - export const CENTER_Y: number; - export const CENTER: number; - export class Gravity implements Modeling { - val: number; - left(): Gravity; - right(): Gravity; - top(): Gravity; - bottom(): Gravity; - center(): Gravity; - centerX(): Gravity; - centerY(): Gravity; - toModel(): number; - static Center: Gravity; - static CenterX: Gravity; - static CenterY: Gravity; - static Left: Gravity; - static Right: Gravity; - static Top: Gravity; - static Bottom: Gravity; - } - export function gravity(): Gravity; -} - -declare module 'doric/lib/src/util/layoutconfig' { - import { Gravity } from "doric/lib/src/util/gravity"; - import { Modeling } from "doric/lib/src/util/types"; - export enum LayoutSpec { - /** - * Depends on what's been set on width or height. - */ - JUST = 0, - /** - * Depends on it's content. - */ - FIT = 1, - /** - * Extend as much as parent let it take. - */ - MOST = 2 - } - export interface LayoutConfig { - widthSpec?: LayoutSpec; - heightSpec?: LayoutSpec; - margin?: { - left?: number; - right?: number; - top?: number; - bottom?: number; - }; - alignment?: Gravity; - weight?: number; - maxWidth?: number; - maxHeight?: number; - minWidth?: number; - minHeight?: number; - } - export class LayoutConfigImpl implements LayoutConfig, Modeling { - widthSpec?: LayoutSpec; - heightSpec?: LayoutSpec; - margin?: { - left?: number; - right?: number; - top?: number; - bottom?: number; - }; - alignment?: Gravity; - weight?: number; - maxWidth?: number; - maxHeight?: number; - minWidth?: number; - minHeight?: number; - fit(): this; - fitWidth(): this; - fitHeight(): this; - most(): this; - mostWidth(): this; - mostHeight(): this; - just(): this; - justWidth(): this; - justHeight(): this; - configWidth(w: LayoutSpec): this; - configHeight(h: LayoutSpec): this; - configMargin(m: { - left?: number; - right?: number; - top?: number; - bottom?: number; - }): this; - configAlignment(a: Gravity): this; - configWeight(w: number): this; - configMaxWidth(v: number): this; - configMaxHeight(v: number): this; - configMinWidth(v: number): this; - configMinHeight(v: number): this; - toModel(): { - widthSpec: LayoutSpec | undefined; - heightSpec: LayoutSpec | undefined; - margin: { - left?: number | undefined; - right?: number | undefined; - top?: number | undefined; - bottom?: number | undefined; - } | undefined; - alignment: number | undefined; - weight: number | undefined; - minWidth: number | undefined; - maxWidth: number | undefined; - minHeight: number | undefined; - maxHeight: number | undefined; - }; - } - export function layoutConfig(): LayoutConfigImpl; -} - -declare module 'doric/lib/src/util/log' { - export function log(...args: any): void; - export function loge(...message: any): void; - export function logw(...message: any): void; -} - -declare module 'doric/lib/src/util/uniqueId' { - export function uniqueId(prefix: string): string; -} - -declare module 'doric/lib/src/util/flexbox' { - import { Modeling } from "doric/lib/src/util/types"; - enum ValueType { - Undefined = 0, - Point = 1, - Percent = 2, - Auto = 3 - } - export class FlexTypedValue implements Modeling { - type: ValueType; - value: number; - constructor(type: ValueType); - static Auto: FlexTypedValue; - static percent(v: number): FlexTypedValue; - static point(v: number): FlexTypedValue; - toModel(): { - type: ValueType; - value: number; - }; - } - export enum FlexDirection { - COLUMN = 0, - COLUMN_REVERSE = 1, - ROW = 2, - ROW_REVERSE = 3 - } - export enum Align { - AUTO = 0, - FLEX_START = 1, - CENTER = 2, - FLEX_END = 3, - STRETCH = 4, - BASELINE = 5, - SPACE_BETWEEN = 6, - SPACE_AROUND = 7 - } - export enum Justify { - FLEX_START = 0, - CENTER = 1, - FLEX_END = 2, - SPACE_BETWEEN = 3, - SPACE_AROUND = 4, - SPACE_EVENLY = 5 - } - export enum Direction { - INHERIT = 0, - LTR = 1, - RTL = 2 - } - export enum PositionType { - RELATIVE = 0, - ABSOLUTE = 1 - } - export enum Wrap { - NO_WRAP = 0, - WRAP = 1, - WRAP_REVERSE = 2 - } - export enum OverFlow { - VISIBLE = 0, - HIDDEN = 1, - SCROLL = 2 - } - export enum Display { - FLEX = 0, - NONE = 1 - } - export type FlexValue = FlexTypedValue | number; - export interface FlexConfig { - direction?: Direction; - flexDirection?: FlexDirection; - justifyContent?: Justify; - alignContent?: Align; - alignItems?: Align; - alignSelf?: Align; - positionType?: PositionType; - flexWrap?: Wrap; - overFlow?: OverFlow; - display?: Display; - flex?: number; - flexGrow?: number; - flexShrink?: number; - flexBasis?: FlexValue; - marginLeft?: FlexValue; - marginRight?: FlexValue; - marginTop?: FlexValue; - marginBottom?: FlexValue; - marginStart?: FlexValue; - marginEnd?: FlexValue; - marginHorizontal?: FlexValue; - marginVertical?: FlexValue; - margin?: FlexValue; - paddingLeft?: FlexValue; - paddingRight?: FlexValue; - paddingTop?: FlexValue; - paddingBottom?: FlexValue; - paddingStart?: FlexValue; - paddingEnd?: FlexValue; - paddingHorizontal?: FlexValue; - paddingVertical?: FlexValue; - padding?: FlexValue; - borderLeftWidth?: number; - borderRightWidth?: number; - borderTopWidth?: number; - borderBottomWidth?: number; - borderStartWidth?: number; - borderEndWidth?: number; - borderWidth?: number; - left?: FlexValue; - right?: FlexValue; - top?: FlexValue; - bottom?: FlexValue; - start?: FlexValue; - end?: FlexValue; - width?: FlexValue; - height?: FlexValue; - minWidth?: FlexValue; - minHeight?: FlexValue; - maxWidth?: FlexValue; - maxHeight?: FlexValue; - aspectRatio?: number; - } - export {}; -} - -declare module 'doric/lib/src/util/jsx' { - import { Group, View } from "doric/lib/src/ui/view"; - import { ClassType } from "doric/lib/src/util/types"; - export namespace jsx { - function createElement(constructor: ClassType, config: Partial | null, ...children: any[]): any; - class Fragment extends Group { - } - } - global { - namespace JSX { - interface Element extends View { - } - interface ElementClass extends View { - } - interface ElementAttributesProperty { - props: {}; - } - interface ElementChildrenAttribute { - innerElement: any; - } - interface IntrinsicElements { - } - } - } -} - -declare module 'doric/lib/src/util/resource' { - import { Modeling } from "doric/lib/src/util/types"; - export abstract class Resource implements Modeling { - type: string; - identifier: string; - resId: string; - constructor(type: string, identifier: string); - toModel(): { - resId: string; - type: string; - identifier: string; - }; - } - export class LocalResource extends Resource { - constructor(path: string); - } - export class RemoteResource extends Resource { - constructor(url: string); - } - export class Base64Resource extends Resource { - constructor(content: string); - } - /** - * Resources belong to assets dir. - */ - export class AssetsResource extends Resource { - constructor(content: string); - } - export class AndroidResource extends Resource { - } - export class iOSResource extends Resource { - } - /** - * This is for android platform - */ - export class DrawableResource extends AndroidResource { - constructor(name: string); - } - export class RawResource extends AndroidResource { - constructor(name: string); - } - export class AndroidAssetsResource extends AndroidResource { - constructor(path: string); - } - /** - * This is for iOS platform - */ - export class MainBundleResource extends iOSResource { - constructor(fileName: string); - } - export class BundleResource extends iOSResource { - constructor(bundleName: string, fileName: string); - } - export class ArrayBufferResource extends Resource { - data: ArrayBuffer; - constructor(data: ArrayBuffer); - toModel(): { - resId: string; - type: string; - identifier: string; - }; - } -} - -declare module 'doric/lib/src/pattern/candies' { - export function take(target: T): (block: (p: T) => void) => void; - export function takeNonNull(target?: T): (block: (p: T) => R) => R | undefined; - export function takeNull(target?: T): (block: () => R) => R | undefined; - export function takeLet(target: T): (block: (p: T) => R | undefined) => R | undefined; - export function takeAlso(target: T): (block: (p: T) => void) => T; - export function takeIf(target: T): (predicate: (t: T) => boolean) => T | undefined; - export function takeUnless(target: T): (predicate: (t: T) => boolean) => T | undefined; - export function repeat(action: (count: number) => void): (times: number) => void; -} - -declare module 'doric/lib/src/pattern/provider' { - export type Observer = (v: T) => void; - export type Updater = (v: T) => T; - export interface IObservable { - addObserver(observer: Observer): void; - removeObserver(observer: Observer): void; - update(updater: Updater): void; - } - export class Observable implements IObservable { - constructor(provider: IProvider, clz: { - new (...args: any[]): M; - }); - addObserver(observer: Observer): void; - removeObserver(observer: Observer): void; - update(updater: Updater): void; - } - export interface IProvider { - provide(obj: Object): void; - acquire(clz: { - new (...args: any[]): T; - }): T | undefined; - remove(clz: { - new (...args: any[]): T; - }): void; - clear(): void; - observe(clz: { - new (...args: any[]): T; - }): Observable; - } - export class Provider implements IProvider { - provide(obj: Object): void; - acquire(clz: { - new (...args: any[]): T; - }): T | undefined; - remove(clz: new (...args: any[]) => T): void; - clear(): void; - observe(clz: new (...args: any[]) => T): Observable; - } -} - -declare module 'doric/lib/src/pattern/mvvm' { - import { Group } from "doric/lib/src/ui/view"; - import { Panel } from "doric/lib/src/ui/panel"; - import { BridgeContext } from "doric/lib/src/runtime/global"; - import { ClassType } from "doric/lib/src/util/types"; - export abstract class ViewHolder { - abstract build(root: Group): void; - } - export type Setter = (state: M) => void; - export abstract class ViewModel { - context: BridgeContext; - constructor(obj: M, v: V); - getState(): M; - getViewHolder(): V; - updateState(setter: Setter): void; - attach(view: Group): void; - abstract onAttached(state: M, vh: V): void; - abstract onBind(state: M, vh: V): void; - } - export abstract class VMPanel extends Panel { - abstract getViewModelClass(): ClassType>; - abstract getState(): M; - abstract getViewHolderClass(): ClassType; - getViewModel(): ViewModel | undefined; - build(root: Group): void; - } -} - -declare module 'doric/lib/src/pattern/modular' { - import { Panel } from "doric/lib/src/ui/panel"; - import { Group } from "doric/lib/src/ui/view"; - import { ClassType } from "doric/lib/src/util/types"; - import { ViewHolder, ViewModel } from "doric/lib/src/pattern/mvvm"; - import { Provider } from "doric/lib/src/pattern/provider"; - export abstract class Module extends Panel { - superPanel?: ModularPanel; - __provider?: Provider; - get provider(): Provider | undefined; - set provider(provider: Provider | undefined); - mount(): void; - unmount(): void; - get mounted(): boolean; - /** - * Dispatch message to other modules. - * @param message which is sent out - */ - dispatchMessage(message: any): void; - /** - * Dispatched messages can be received by override this method. - * @param message recevied message - */ - onMessage(message: any): void; - /** - * Called when this module is mounted - */ - onMounted(): void; - /** - * Called when this module is unmounted - */ - onUnmounted(): void; - } - export abstract class VMModule extends Module { - abstract getViewModelClass(): ClassType>; - abstract getState(): M; - abstract getViewHolderClass(): ClassType; - getViewModel(): ViewModel | undefined; - build(root: Group): void; - } - export abstract class ModularPanel extends Module { - constructor(); - /** - * @returns Class list of current submodules - */ - abstract setupModules(): ClassType[]; - /** - * @param root Current module's rootview - * @returns provided for submodules as their rootview - */ - abstract setupShelf(root: Group): Group; - dispatchMessage(message: any): void; - get mountedModules(): Panel[]; - onMessage(message: any): void; - onStructureChanged(module: Module, mounted: boolean): void; - build(root: Group): void; - onCreate(): void; - onDestroy(): void; - onShow(): void; - onHidden(): void; - onRenderFinished(): void; - } -} - declare module '*.png' { const value: any; export default value; -} \ No newline at end of file +} + \ No newline at end of file diff --git a/doric-js/index.ts b/doric-js/index.ts index b7ba7daf5..0431b5ee6 100644 --- a/doric-js/index.ts +++ b/doric-js/index.ts @@ -13,6 +13,34 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +declare global { + namespace Reflect { + function decorate(decorators: ClassDecorator[], target: Function): Function; + function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor; + function metadata(metadataKey: any, metadataValue: any): { + (target: Function): void; + (target: Object, propertyKey: string | symbol): void; + }; + function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void; + function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void; + function hasMetadata(metadataKey: any, target: Object): boolean; + function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + function hasOwnMetadata(metadataKey: any, target: Object): boolean; + function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + function getMetadata(metadataKey: any, target: Object): any; + function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any; + function getOwnMetadata(metadataKey: any, target: Object): any; + function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any; + function getMetadataKeys(target: Object): any[]; + function getMetadataKeys(target: Object, propertyKey: string | symbol): any[]; + function getOwnMetadataKeys(target: Object): any[]; + function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[]; + function deleteMetadata(metadataKey: any, target: Object): boolean; + function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + } +} + export * from './src/runtime/global' export * from './src/ui/index.ui' export * from "./src/widget/index.widget" diff --git a/doric-js/lib/index.d.ts b/doric-js/lib/index.d.ts index e27a74c32..3afb9a355 100644 --- a/doric-js/lib/index.d.ts +++ b/doric-js/lib/index.d.ts @@ -1,3 +1,29 @@ +declare global { + namespace Reflect { + function decorate(decorators: ClassDecorator[], target: Function): Function; + function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor; + function metadata(metadataKey: any, metadataValue: any): { + (target: Function): void; + (target: Object, propertyKey: string | symbol): void; + }; + function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void; + function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void; + function hasMetadata(metadataKey: any, target: Object): boolean; + function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + function hasOwnMetadata(metadataKey: any, target: Object): boolean; + function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + function getMetadata(metadataKey: any, target: Object): any; + function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any; + function getOwnMetadata(metadataKey: any, target: Object): any; + function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any; + function getMetadataKeys(target: Object): any[]; + function getMetadataKeys(target: Object, propertyKey: string | symbol): any[]; + function getOwnMetadataKeys(target: Object): any[]; + function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[]; + function deleteMetadata(metadataKey: any, target: Object): boolean; + function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean; + } +} export * from './src/runtime/global'; export * from './src/ui/index.ui'; export * from "./src/widget/index.widget"; diff --git a/doric-js/lib/src/native/navigator.d.ts b/doric-js/lib/src/native/navigator.d.ts index f8bc2089b..2bf1a69b7 100644 --- a/doric-js/lib/src/native/navigator.d.ts +++ b/doric-js/lib/src/native/navigator.d.ts @@ -4,11 +4,11 @@ import { ClassType } from "../util/types"; export declare function internalScheme(context: BridgeContext, panelClass: ClassType): string; export declare function navigator(context: BridgeContext): { push: (source: string | ClassType, config?: { - alias?: string | undefined; - animated?: boolean | undefined; - extra?: object | undefined; - singlePage?: boolean | undefined; - } | undefined) => Promise; + alias?: string; + animated?: boolean; + extra?: object; + singlePage?: boolean; + }) => Promise; pop: (animated?: boolean) => Promise; popSelf: (animated?: boolean) => Promise; popToRoot: (animated?: boolean) => Promise; diff --git a/doric-js/lib/src/native/network.d.ts b/doric-js/lib/src/native/network.d.ts index cd0485a05..63dbb7f86 100644 --- a/doric-js/lib/src/native/network.d.ts +++ b/doric-js/lib/src/native/network.d.ts @@ -20,8 +20,8 @@ export interface IResponse { } export declare function network(context: BridgeContext): { request: (config: IRequest) => Promise; - get: (url: string, config?: IRequest | undefined) => Promise; - post: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - put: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - delete: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; + get: (url: string, config?: IRequest) => Promise; + post: (url: string, data?: object | string, config?: IRequest) => Promise; + put: (url: string, data?: object | string, config?: IRequest) => Promise; + delete: (url: string, data?: object | string, config?: IRequest) => Promise; }; diff --git a/doric-js/lib/src/native/storage.d.ts b/doric-js/lib/src/native/storage.d.ts index d90ebed0e..878506c0d 100644 --- a/doric-js/lib/src/native/storage.d.ts +++ b/doric-js/lib/src/native/storage.d.ts @@ -1,7 +1,7 @@ import { BridgeContext } from "../runtime/global"; export declare function storage(context: BridgeContext): { - setItem: (key: string, value: string, zone?: string | undefined) => Promise; - getItem: (key: string, zone?: string | undefined) => Promise; - remove: (key: string, zone?: string | undefined) => Promise; + setItem: (key: string, value: string, zone?: string) => Promise; + getItem: (key: string, zone?: string) => Promise; + remove: (key: string, zone?: string) => Promise; clear: (zone: string) => Promise; }; diff --git a/doric-js/package.json b/doric-js/package.json index 32f68bbc3..ca6ee047e 100644 --- a/doric-js/package.json +++ b/doric-js/package.json @@ -6,8 +6,8 @@ "types": "index.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && mv -f lib-es5/src/ui/view.es5.js lib-es5/src/ui/view.js && tsc -d -p . && rollup -c && dts-bundle --configJson dts-bundle.json && cat src/image.d.ts >> index.d.ts", - "build-win32": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && tsc -d -p . && rollup -c && dts-bundle --configJson dts-bundle.json", + "build": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && mv -f lib-es5/src/ui/view.es5.js lib-es5/src/ui/view.js && tsc -d -p . && rollup -c && dts-bundle-generator -o index.d.ts index.ts --project tsconfig.json --inline-declare-global && node generateDts.js", + "build-win32": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && tsc -d -p . && rollup -c && dts-bundle-generator -o index.d.ts index.ts --project tsconfig.json --inline-declare-global && node generateDts.js", "dev": "tsc -w -p . & rollup -c -w", "clean": "rm -rf lib && rm -rf lib-es5 && rm -rf bundle", "prepublish": "npm run build" @@ -36,7 +36,7 @@ "@types/core-js": "^2.5.5", "@types/ws": "^7.2.6", "core-js": "^3.9.1", - "dts-bundle": "^0.7.3", + "dts-bundle-generator": "^6.12.0", "proxy-polyfill": "^0.3.2", "reflect-metadata": "^0.1.13", "rollup": "^2.40.0"