UNPKG

49.8 kBJavaScriptView Raw
1/*
2 d3plus-common v0.6.51
3 Common functions and methods used across D3plus modules.
4 Copyright (c) 2019 D3plus - https://d3plus.org
5 @license MIT
6*/
7
8(function (global, factory) {
9 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-transition'), require('d3-array'), require('d3-collection')) :
10 typeof define === 'function' && define.amd ? define('d3plus-common', ['exports', 'd3-selection', 'd3-transition', 'd3-array', 'd3-collection'], factory) :
11 (global = global || self, factory(global.d3plus = {}, global.d3Selection, global.d3Transition, global.d3Array, global.d3Collection));
12}(this, function (exports, d3Selection, d3Transition, d3Array, d3Collection) { 'use strict';
13
14 /**
15 @function accessor
16 @desc Wraps an object key in a simple accessor function.
17 @param {String} key The key to be returned from each Object passed to the function.
18 @param {*} [def] A default value to be returned if the key is not present.
19 @example <caption>this</caption>
20 accessor("id");
21 @example <caption>returns this</caption>
22 function(d) {
23 return d["id"];
24 }
25 */
26 function accessor (key, def) {
27 if (def === void 0) return function (d) {
28 return d[key];
29 };
30 return function (d) {
31 return d[key] === void 0 ? def : d[key];
32 };
33 }
34
35 function _typeof(obj) {
36 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
37 _typeof = function (obj) {
38 return typeof obj;
39 };
40 } else {
41 _typeof = function (obj) {
42 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
43 };
44 }
45
46 return _typeof(obj);
47 }
48
49 function _classCallCheck(instance, Constructor) {
50 if (!(instance instanceof Constructor)) {
51 throw new TypeError("Cannot call a class as a function");
52 }
53 }
54
55 function _defineProperties(target, props) {
56 for (var i = 0; i < props.length; i++) {
57 var descriptor = props[i];
58 descriptor.enumerable = descriptor.enumerable || false;
59 descriptor.configurable = true;
60 if ("value" in descriptor) descriptor.writable = true;
61 Object.defineProperty(target, descriptor.key, descriptor);
62 }
63 }
64
65 function _createClass(Constructor, protoProps, staticProps) {
66 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
67 if (staticProps) _defineProperties(Constructor, staticProps);
68 return Constructor;
69 }
70
71 /**
72 @function isObject
73 @desc Detects if a variable is a javascript Object.
74 @param {*} item
75 */
76 function isObject (item) {
77 return item && _typeof(item) === "object" && (typeof window === "undefined" || item !== window && item !== window.document && !(item instanceof Element)) && !Array.isArray(item) ? true : false;
78 }
79
80 /**
81 @function validObject
82 @desc Determines if the object passed is the document or window.
83 @param {Object} obj
84 @private
85 */
86
87 function validObject(obj) {
88 if (typeof window === "undefined") return true;else return obj !== window && obj !== document;
89 }
90 /**
91 @function assign
92 @desc A deeply recursive version of `Object.assign`.
93 @param {...Object} objects
94 @example <caption>this</caption>
95 assign({id: "foo", deep: {group: "A"}}, {id: "bar", deep: {value: 20}}));
96 @example <caption>returns this</caption>
97 {id: "bar", deep: {group: "A", value: 20}}
98 */
99
100
101 function assign() {
102 var _arguments = arguments;
103 var target = arguments.length <= 0 ? undefined : arguments[0];
104
105 var _loop = function _loop(i) {
106 var source = i < 0 || _arguments.length <= i ? undefined : _arguments[i];
107 Object.keys(source).forEach(function (prop) {
108 var value = source[prop];
109
110 if (isObject(value) && validObject(value)) {
111 if (target.hasOwnProperty(prop) && isObject(target[prop])) target[prop] = assign({}, target[prop], value);else target[prop] = assign({}, value);
112 } else if (Array.isArray(value)) target[prop] = value.slice();else target[prop] = value;
113 });
114 };
115
116 for (var i = 1; i < arguments.length; i++) {
117 _loop(i);
118 }
119
120 return target;
121 }
122
123 /**
124 @function attrize
125 @desc Applies each key/value in an object as an attr.
126 @param {D3selection} elem The D3 element to apply the styles to.
127 @param {Object} attrs An object of key/value attr pairs.
128 */
129 function attrize (e) {
130 var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
131
132 for (var k in a) {
133 if ({}.hasOwnProperty.call(a, k)) e.attr(k, a[k]);
134 }
135 }
136
137 /**
138 @function s
139 @desc Returns 4 random characters, used for constructing unique identifiers.
140 @private
141 */
142 function s() {
143 return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
144 }
145 /**
146 @function uuid
147 @summary Returns a unique identifier.
148 */
149
150
151 function uuid () {
152 return "".concat(s()).concat(s(), "-").concat(s(), "-").concat(s(), "-").concat(s(), "-").concat(s()).concat(s()).concat(s());
153 }
154
155 /**
156 @constant RESET
157 @desc String constant used to reset an individual config property.
158 */
159 var RESET = "D3PLUS-COMMON-RESET";
160
161 /**
162 @desc Recursive function that resets nested Object configs.
163 @param {Object} obj
164 @param {Object} defaults
165 @private
166 */
167
168 function nestedReset(obj, defaults) {
169 if (isObject(obj)) {
170 for (var nestedKey in obj) {
171 if ({}.hasOwnProperty.call(obj, nestedKey) && !nestedKey.startsWith("_")) {
172 var defaultValue = defaults && isObject(defaults) ? defaults[nestedKey] : undefined;
173
174 if (obj[nestedKey] === RESET) {
175 obj[nestedKey] = defaultValue;
176 } else if (isObject(obj[nestedKey])) {
177 nestedReset(obj[nestedKey], defaultValue);
178 }
179 }
180 }
181 }
182 }
183 /**
184 @class BaseClass
185 @summary An abstract class that contains some global methods and functionality.
186 */
187
188
189 var BaseClass =
190 /*#__PURE__*/
191 function () {
192 /**
193 @memberof BaseClass
194 @desc Invoked when creating a new class instance, and sets any default parameters.
195 @private
196 */
197 function BaseClass() {
198 _classCallCheck(this, BaseClass);
199
200 this._locale = "en-US";
201 this._on = {};
202 this._uuid = uuid();
203 }
204 /**
205 @memberof BaseClass
206 @desc If *value* is specified, sets the methods that correspond to the key/value pairs and returns this class. If *value* is not specified, returns the current configuration.
207 @param {Object} [*value*]
208 @chainable
209 */
210
211
212 _createClass(BaseClass, [{
213 key: "config",
214 value: function config(_) {
215 if (!this._configDefault) {
216 var config = {};
217
218 for (var k in this.__proto__) {
219 if (k.indexOf("_") !== 0 && !["config", "constructor", "render"].includes(k)) {
220 var v = this[k]();
221 config[k] = isObject(v) ? assign({}, v) : v;
222 }
223 }
224
225 this._configDefault = config;
226 }
227
228 if (arguments.length) {
229 for (var _k in _) {
230 if ({}.hasOwnProperty.call(_, _k) && _k in this) {
231 var _v = _[_k];
232
233 if (_v === RESET) {
234 if (_k === "on") this._on = this._configDefault[_k];else this[_k](this._configDefault[_k]);
235 } else {
236 nestedReset(_v, this._configDefault[_k]);
237
238 this[_k](_v);
239 }
240 }
241 }
242
243 return this;
244 } else {
245 var _config = {};
246
247 for (var _k2 in this.__proto__) {
248 if (_k2.indexOf("_") !== 0 && !["config", "constructor", "render"].includes(_k2)) _config[_k2] = this[_k2]();
249 }
250
251 return _config;
252 }
253 }
254 /**
255 @memberof BaseClass
256 @desc If *value* is specified, sets the locale to the specified string and returns the current class instance. This method supports the locales defined in [d3plus-format](https://github.com/d3plus/d3plus-format/blob/master/src/locale.js). In another case, you can define an Object with a custom locale.
257 @param {Object|String} [*value* = "en-US"]
258 @chainable
259 @example
260 {
261 separator: "",
262 suffixes: ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "B", "t", "q", "Q", "Z", "Y"],
263 grouping: [3],
264 delimiters: {
265 thousands: ",",
266 decimal: "."
267 },
268 currency: ["$", ""]
269 }
270 */
271
272 }, {
273 key: "locale",
274 value: function locale(_) {
275 return arguments.length ? (this._locale = _, this) : this._locale;
276 }
277 /**
278 @memberof BaseClass
279 @desc Adds or removes a *listener* to each object for the specified event *typenames*. If a *listener* is not specified, returns the currently assigned listener for the specified event *typename*. Mirrors the core [d3-selection](https://github.com/d3/d3-selection#selection_on) behavior.
280 @param {String} [*typenames*]
281 @param {Function} [*listener*]
282 @chainable
283 @example <caption>By default, listeners apply globally to all objects, however, passing a namespace with the class name gives control over specific elements:</caption>
284 new Plot
285 .on("click.Shape", function(d) {
286 console.log("data for shape clicked:", d);
287 })
288 .on("click.Legend", function(d) {
289 console.log("data for legend clicked:", d);
290 })
291 */
292
293 }, {
294 key: "on",
295 value: function on(_, f) {
296 return arguments.length === 2 ? (this._on[_] = f, this) : arguments.length ? typeof _ === "string" ? this._on[_] : (this._on = Object.assign({}, this._on, _), this) : this._on;
297 }
298 }]);
299
300 return BaseClass;
301 }();
302
303 /**
304 @function closest
305 @desc Finds the closest numeric value in an array.
306 @param {Number} n The number value to use when searching the array.
307 @param {Array} arr The array of values to test against.
308 */
309 function closest (n) {
310 var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
311 if (!arr || !(arr instanceof Array) || !arr.length) return undefined;
312 return arr.reduce(function (prev, curr) {
313 return Math.abs(curr - n) < Math.abs(prev - n) ? curr : prev;
314 });
315 }
316
317 /**
318 @function configPrep
319 @desc Preps a config object for d3plus data, and optionally bubbles up a specific nested type. When using this function, you must bind a d3plus class' `this` context.
320 @param {Object} [config = this._shapeConfig] The configuration object to parse.
321 @param {String} [type = "shape"] The event classifier to user for "on" events. For example, the default event type of "shape" will apply all events in the "on" config object with that key, like "click.shape" and "mouseleave.shape", in addition to any gloval events like "click" and "mouseleave".
322 @param {String} [nest] An optional nested key to bubble up to the parent config level.
323 */
324 function configPrep() {
325 var _this = this;
326
327 var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._shapeConfig;
328 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "shape";
329 var nest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
330 var newConfig = {
331 duration: this._duration,
332 on: {}
333 };
334
335 var wrapFunction = function wrapFunction(func) {
336 return function (d, i, s) {
337 var parent;
338
339 while (d.__d3plus__) {
340 if (parent) d.__d3plusParent__ = parent;
341 parent = d;
342 i = d.i;
343 d = d.data || d.feature;
344 }
345
346 return func.bind(_this)(d, i, s || parent);
347 };
348 };
349
350 var parseEvents = function parseEvents(newObj, on) {
351 for (var event in on) {
352 if ({}.hasOwnProperty.call(on, event) && !event.includes(".") || event.includes(".".concat(type))) {
353 newObj.on[event] = wrapFunction(on[event]);
354 }
355 }
356 };
357
358 var arrayEval = function arrayEval(arr) {
359 return arr.map(function (d) {
360 if (d instanceof Array) return arrayEval(d);else if (_typeof(d) === "object") return keyEval({}, d);else if (typeof d === "function") return wrapFunction(d);else return d;
361 });
362 };
363
364 var keyEval = function keyEval(newObj, obj) {
365 for (var key in obj) {
366 if ({}.hasOwnProperty.call(obj, key)) {
367 if (key === "on") parseEvents(newObj, obj[key]);else if (typeof obj[key] === "function") {
368 newObj[key] = wrapFunction(obj[key]);
369 } else if (obj[key] instanceof Array) {
370 newObj[key] = arrayEval(obj[key]);
371 } else if (_typeof(obj[key]) === "object") {
372 newObj[key] = {
373 on: {}
374 };
375 keyEval(newObj[key], obj[key]);
376 } else newObj[key] = obj[key];
377 }
378 }
379 };
380
381 keyEval(newConfig, config);
382 if (this._on) parseEvents(newConfig, this._on);
383
384 if (nest && config[nest]) {
385 keyEval(newConfig, config[nest]);
386 if (config[nest].on) parseEvents(newConfig, config[nest].on);
387 }
388
389 return newConfig;
390 }
391
392 /**
393 @function constant
394 @desc Wraps non-function variables in a simple return function.
395 @param {Array|Number|Object|String} value The value to be returned from the function.
396 @example <caption>this</caption>
397 constant(42);
398 @example <caption>returns this</caption>
399 function() {
400 return 42;
401 }
402 */
403 function constant (value) {
404 return function constant() {
405 return value;
406 };
407 }
408
409 /**
410 @function elem
411 @desc Manages the enter/update/exit pattern for a single DOM element.
412 @param {String} selector A D3 selector, which must include the tagname and a class and/or ID.
413 @param {Object} params Additional parameters.
414 @param {Boolean} [params.condition = true] Whether or not the element should be rendered (or removed).
415 @param {Object} [params.enter = {}] A collection of key/value pairs that map to attributes to be given on enter.
416 @param {Object} [params.exit = {}] A collection of key/value pairs that map to attributes to be given on exit.
417 @param {D3Selection} [params.parent = d3.select("body")] The parent element for this new element to be appended to.
418 @param {D3Transition} [params.transition = d3.transition().duration(0)] The transition to use when animated the different life cycle stages.
419 @param {Object} [params.update = {}] A collection of key/value pairs that map to attributes to be given on update.
420 */
421
422 function elem (selector, p) {
423 // overrides default params
424 p = Object.assign({}, {
425 condition: true,
426 enter: {},
427 exit: {},
428 parent: d3Selection.select("body"),
429 transition: d3Transition.transition().duration(0),
430 update: {}
431 }, p);
432 var className = /\.([^#]+)/g.exec(selector),
433 id = /#([^\.]+)/g.exec(selector),
434 tag = /^([^.^#]+)/g.exec(selector)[1];
435 var elem = p.parent.selectAll(selector.includes(":") ? selector.split(":")[1] : selector).data(p.condition ? [null] : []);
436 var enter = elem.enter().append(tag).call(attrize, p.enter);
437 if (id) enter.attr("id", id[1]);
438 if (className) enter.attr("class", className[1]);
439 elem.exit().transition(p.transition).call(attrize, p.exit).remove();
440 var update = enter.merge(elem);
441 update.transition(p.transition).call(attrize, p.update);
442 return update;
443 }
444
445 /**
446 @function merge
447 @desc Combines an Array of Objects together and returns a new Object.
448 @param {Array} objects The Array of objects to be merged together.
449 @param {Object} aggs An object containing specific aggregation methods (functions) for each key type. By default, numbers are summed and strings are returned as an array of unique values.
450 @example <caption>this</caption>
451 merge([
452 {id: "foo", group: "A", value: 10, links: [1, 2]},
453 {id: "bar", group: "A", value: 20, links: [1, 3]}
454 ]);
455 @example <caption>returns this</caption>
456 {id: ["bar", "foo"], group: "A", value: 30, links: [1, 2, 3]}
457 */
458
459 function objectMerge(objects) {
460 var aggs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
461 var availableKeys = new Set(d3Array.merge(objects.map(function (o) {
462 return d3Collection.keys(o);
463 }))),
464 newObject = {};
465 availableKeys.forEach(function (k) {
466 var values = objects.map(function (o) {
467 return o[k];
468 });
469 var value;
470 if (aggs[k]) value = aggs[k](values);else {
471 var types = values.map(function (v) {
472 return v || v === false ? v.constructor : v;
473 }).filter(function (v) {
474 return v !== void 0;
475 });
476 if (!types.length) value = undefined;else if (types.indexOf(Array) >= 0) {
477 value = d3Array.merge(values.map(function (v) {
478 return v instanceof Array ? v : [v];
479 }));
480 value = Array.from(new Set(value));
481 if (value.length === 1) value = value[0];
482 } else if (types.indexOf(String) >= 0) {
483 value = Array.from(new Set(values));
484 if (value.length === 1) value = value[0];
485 } else if (types.indexOf(Number) >= 0) value = d3Array.sum(values);else if (types.indexOf(Object) >= 0) value = objectMerge(values.filter(function (v) {
486 return v;
487 }));else {
488 value = Array.from(new Set(values.filter(function (v) {
489 return v !== void 0;
490 })));
491 if (value.length === 1) value = value[0];
492 }
493 }
494 newObject[k] = value;
495 });
496 return newObject;
497 }
498
499 /**
500 @function parseSides
501 @desc Converts a string of directional CSS shorthand values into an object with the values expanded.
502 @param {String|Number} sides The CSS shorthand string to expand.
503 */
504 function parseSides (sides) {
505 var values;
506 if (typeof sides === "number") values = [sides];else values = sides.split(/\s+/);
507 if (values.length === 1) values = [values[0], values[0], values[0], values[0]];else if (values.length === 2) values = values.concat(values);else if (values.length === 3) values.push(values[1]);
508 return ["top", "right", "bottom", "left"].reduce(function (acc, direction, i) {
509 var value = parseFloat(values[i]);
510 acc[direction] = value || 0;
511 return acc;
512 }, {});
513 }
514
515 /**
516 @function prefix
517 @desc Returns the appropriate CSS vendor prefix, given the current browser.
518 */
519 function prefix () {
520 if ("-webkit-transform" in document.body.style) return "-webkit-";else if ("-moz-transform" in document.body.style) return "-moz-";else if ("-ms-transform" in document.body.style) return "-ms-";else if ("-o-transform" in document.body.style) return "-o-";else return "";
521 }
522
523 /**
524 @function stylize
525 @desc Applies each key/value in an object as a style.
526 @param {D3selection} elem The D3 element to apply the styles to.
527 @param {Object} styles An object of key/value style pairs.
528 */
529 function stylize (e) {
530 var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
531
532 for (var k in s) {
533 if ({}.hasOwnProperty.call(s, k)) e.style(k, s[k]);
534 }
535 }
536
537 exports.BaseClass = BaseClass;
538 exports.RESET = RESET;
539 exports.accessor = accessor;
540 exports.assign = assign;
541 exports.attrize = attrize;
542 exports.closest = closest;
543 exports.configPrep = configPrep;
544 exports.constant = constant;
545 exports.elem = elem;
546 exports.isObject = isObject;
547 exports.merge = objectMerge;
548 exports.parseSides = parseSides;
549 exports.prefix = prefix;
550 exports.stylize = stylize;
551 exports.uuid = uuid;
552
553 Object.defineProperty(exports, '__esModule', { value: true });
554
555}));
556(function (factory) {
557 typeof define === 'function' && define.amd ? define(factory) :
558 factory();
559}(function () { 'use strict';
560
561 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
562
563 function createCommonjsModule(fn, module) {
564 return module = { exports: {} }, fn(module, module.exports), module.exports;
565 }
566
567 var O = 'object';
568 var check = function (it) {
569 return it && it.Math == Math && it;
570 };
571
572 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
573 var global_1 =
574 // eslint-disable-next-line no-undef
575 check(typeof globalThis == O && globalThis) ||
576 check(typeof window == O && window) ||
577 check(typeof self == O && self) ||
578 check(typeof commonjsGlobal == O && commonjsGlobal) ||
579 // eslint-disable-next-line no-new-func
580 Function('return this')();
581
582 var fails = function (exec) {
583 try {
584 return !!exec();
585 } catch (error) {
586 return true;
587 }
588 };
589
590 // Thank's IE8 for his funny defineProperty
591 var descriptors = !fails(function () {
592 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
593 });
594
595 var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
596 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
597
598 // Nashorn ~ JDK8 bug
599 var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
600
601 // `Object.prototype.propertyIsEnumerable` method implementation
602 // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
603 var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
604 var descriptor = getOwnPropertyDescriptor(this, V);
605 return !!descriptor && descriptor.enumerable;
606 } : nativePropertyIsEnumerable;
607
608 var objectPropertyIsEnumerable = {
609 f: f
610 };
611
612 var createPropertyDescriptor = function (bitmap, value) {
613 return {
614 enumerable: !(bitmap & 1),
615 configurable: !(bitmap & 2),
616 writable: !(bitmap & 4),
617 value: value
618 };
619 };
620
621 var toString = {}.toString;
622
623 var classofRaw = function (it) {
624 return toString.call(it).slice(8, -1);
625 };
626
627 var split = ''.split;
628
629 // fallback for non-array-like ES3 and non-enumerable old V8 strings
630 var indexedObject = fails(function () {
631 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
632 // eslint-disable-next-line no-prototype-builtins
633 return !Object('z').propertyIsEnumerable(0);
634 }) ? function (it) {
635 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
636 } : Object;
637
638 // `RequireObjectCoercible` abstract operation
639 // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
640 var requireObjectCoercible = function (it) {
641 if (it == undefined) throw TypeError("Can't call method on " + it);
642 return it;
643 };
644
645 // toObject with fallback for non-array-like ES3 strings
646
647
648
649 var toIndexedObject = function (it) {
650 return indexedObject(requireObjectCoercible(it));
651 };
652
653 var isObject = function (it) {
654 return typeof it === 'object' ? it !== null : typeof it === 'function';
655 };
656
657 // `ToPrimitive` abstract operation
658 // https://tc39.github.io/ecma262/#sec-toprimitive
659 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
660 // and the second argument - flag - preferred type is a string
661 var toPrimitive = function (input, PREFERRED_STRING) {
662 if (!isObject(input)) return input;
663 var fn, val;
664 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
665 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
666 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
667 throw TypeError("Can't convert object to primitive value");
668 };
669
670 var hasOwnProperty = {}.hasOwnProperty;
671
672 var has = function (it, key) {
673 return hasOwnProperty.call(it, key);
674 };
675
676 var document = global_1.document;
677 // typeof document.createElement is 'object' in old IE
678 var EXISTS = isObject(document) && isObject(document.createElement);
679
680 var documentCreateElement = function (it) {
681 return EXISTS ? document.createElement(it) : {};
682 };
683
684 // Thank's IE8 for his funny defineProperty
685 var ie8DomDefine = !descriptors && !fails(function () {
686 return Object.defineProperty(documentCreateElement('div'), 'a', {
687 get: function () { return 7; }
688 }).a != 7;
689 });
690
691 var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
692
693 // `Object.getOwnPropertyDescriptor` method
694 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
695 var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
696 O = toIndexedObject(O);
697 P = toPrimitive(P, true);
698 if (ie8DomDefine) try {
699 return nativeGetOwnPropertyDescriptor(O, P);
700 } catch (error) { /* empty */ }
701 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
702 };
703
704 var objectGetOwnPropertyDescriptor = {
705 f: f$1
706 };
707
708 var anObject = function (it) {
709 if (!isObject(it)) {
710 throw TypeError(String(it) + ' is not an object');
711 } return it;
712 };
713
714 var nativeDefineProperty = Object.defineProperty;
715
716 // `Object.defineProperty` method
717 // https://tc39.github.io/ecma262/#sec-object.defineproperty
718 var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
719 anObject(O);
720 P = toPrimitive(P, true);
721 anObject(Attributes);
722 if (ie8DomDefine) try {
723 return nativeDefineProperty(O, P, Attributes);
724 } catch (error) { /* empty */ }
725 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
726 if ('value' in Attributes) O[P] = Attributes.value;
727 return O;
728 };
729
730 var objectDefineProperty = {
731 f: f$2
732 };
733
734 var hide = descriptors ? function (object, key, value) {
735 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
736 } : function (object, key, value) {
737 object[key] = value;
738 return object;
739 };
740
741 var setGlobal = function (key, value) {
742 try {
743 hide(global_1, key, value);
744 } catch (error) {
745 global_1[key] = value;
746 } return value;
747 };
748
749 var shared = createCommonjsModule(function (module) {
750 var SHARED = '__core-js_shared__';
751 var store = global_1[SHARED] || setGlobal(SHARED, {});
752
753 (module.exports = function (key, value) {
754 return store[key] || (store[key] = value !== undefined ? value : {});
755 })('versions', []).push({
756 version: '3.1.3',
757 mode: 'global',
758 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
759 });
760 });
761
762 var functionToString = shared('native-function-to-string', Function.toString);
763
764 var WeakMap = global_1.WeakMap;
765
766 var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
767
768 var id = 0;
769 var postfix = Math.random();
770
771 var uid = function (key) {
772 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
773 };
774
775 var keys = shared('keys');
776
777 var sharedKey = function (key) {
778 return keys[key] || (keys[key] = uid(key));
779 };
780
781 var hiddenKeys = {};
782
783 var WeakMap$1 = global_1.WeakMap;
784 var set, get, has$1;
785
786 var enforce = function (it) {
787 return has$1(it) ? get(it) : set(it, {});
788 };
789
790 var getterFor = function (TYPE) {
791 return function (it) {
792 var state;
793 if (!isObject(it) || (state = get(it)).type !== TYPE) {
794 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
795 } return state;
796 };
797 };
798
799 if (nativeWeakMap) {
800 var store = new WeakMap$1();
801 var wmget = store.get;
802 var wmhas = store.has;
803 var wmset = store.set;
804 set = function (it, metadata) {
805 wmset.call(store, it, metadata);
806 return metadata;
807 };
808 get = function (it) {
809 return wmget.call(store, it) || {};
810 };
811 has$1 = function (it) {
812 return wmhas.call(store, it);
813 };
814 } else {
815 var STATE = sharedKey('state');
816 hiddenKeys[STATE] = true;
817 set = function (it, metadata) {
818 hide(it, STATE, metadata);
819 return metadata;
820 };
821 get = function (it) {
822 return has(it, STATE) ? it[STATE] : {};
823 };
824 has$1 = function (it) {
825 return has(it, STATE);
826 };
827 }
828
829 var internalState = {
830 set: set,
831 get: get,
832 has: has$1,
833 enforce: enforce,
834 getterFor: getterFor
835 };
836
837 var redefine = createCommonjsModule(function (module) {
838 var getInternalState = internalState.get;
839 var enforceInternalState = internalState.enforce;
840 var TEMPLATE = String(functionToString).split('toString');
841
842 shared('inspectSource', function (it) {
843 return functionToString.call(it);
844 });
845
846 (module.exports = function (O, key, value, options) {
847 var unsafe = options ? !!options.unsafe : false;
848 var simple = options ? !!options.enumerable : false;
849 var noTargetGet = options ? !!options.noTargetGet : false;
850 if (typeof value == 'function') {
851 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
852 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
853 }
854 if (O === global_1) {
855 if (simple) O[key] = value;
856 else setGlobal(key, value);
857 return;
858 } else if (!unsafe) {
859 delete O[key];
860 } else if (!noTargetGet && O[key]) {
861 simple = true;
862 }
863 if (simple) O[key] = value;
864 else hide(O, key, value);
865 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
866 })(Function.prototype, 'toString', function toString() {
867 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
868 });
869 });
870
871 var path = global_1;
872
873 var aFunction = function (variable) {
874 return typeof variable == 'function' ? variable : undefined;
875 };
876
877 var getBuiltIn = function (namespace, method) {
878 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
879 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
880 };
881
882 var ceil = Math.ceil;
883 var floor = Math.floor;
884
885 // `ToInteger` abstract operation
886 // https://tc39.github.io/ecma262/#sec-tointeger
887 var toInteger = function (argument) {
888 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
889 };
890
891 var min = Math.min;
892
893 // `ToLength` abstract operation
894 // https://tc39.github.io/ecma262/#sec-tolength
895 var toLength = function (argument) {
896 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
897 };
898
899 var max = Math.max;
900 var min$1 = Math.min;
901
902 // Helper for a popular repeating case of the spec:
903 // Let integer be ? ToInteger(index).
904 // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
905 var toAbsoluteIndex = function (index, length) {
906 var integer = toInteger(index);
907 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
908 };
909
910 // `Array.prototype.{ indexOf, includes }` methods implementation
911 var createMethod = function (IS_INCLUDES) {
912 return function ($this, el, fromIndex) {
913 var O = toIndexedObject($this);
914 var length = toLength(O.length);
915 var index = toAbsoluteIndex(fromIndex, length);
916 var value;
917 // Array#includes uses SameValueZero equality algorithm
918 // eslint-disable-next-line no-self-compare
919 if (IS_INCLUDES && el != el) while (length > index) {
920 value = O[index++];
921 // eslint-disable-next-line no-self-compare
922 if (value != value) return true;
923 // Array#indexOf ignores holes, Array#includes - not
924 } else for (;length > index; index++) {
925 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
926 } return !IS_INCLUDES && -1;
927 };
928 };
929
930 var arrayIncludes = {
931 // `Array.prototype.includes` method
932 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
933 includes: createMethod(true),
934 // `Array.prototype.indexOf` method
935 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
936 indexOf: createMethod(false)
937 };
938
939 var indexOf = arrayIncludes.indexOf;
940
941
942 var objectKeysInternal = function (object, names) {
943 var O = toIndexedObject(object);
944 var i = 0;
945 var result = [];
946 var key;
947 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
948 // Don't enum bug & hidden keys
949 while (names.length > i) if (has(O, key = names[i++])) {
950 ~indexOf(result, key) || result.push(key);
951 }
952 return result;
953 };
954
955 // IE8- don't enum bug keys
956 var enumBugKeys = [
957 'constructor',
958 'hasOwnProperty',
959 'isPrototypeOf',
960 'propertyIsEnumerable',
961 'toLocaleString',
962 'toString',
963 'valueOf'
964 ];
965
966 var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
967
968 // `Object.getOwnPropertyNames` method
969 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
970 var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
971 return objectKeysInternal(O, hiddenKeys$1);
972 };
973
974 var objectGetOwnPropertyNames = {
975 f: f$3
976 };
977
978 var f$4 = Object.getOwnPropertySymbols;
979
980 var objectGetOwnPropertySymbols = {
981 f: f$4
982 };
983
984 // all object keys, includes non-enumerable and symbols
985 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
986 var keys = objectGetOwnPropertyNames.f(anObject(it));
987 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
988 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
989 };
990
991 var copyConstructorProperties = function (target, source) {
992 var keys = ownKeys(source);
993 var defineProperty = objectDefineProperty.f;
994 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
995 for (var i = 0; i < keys.length; i++) {
996 var key = keys[i];
997 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
998 }
999 };
1000
1001 var replacement = /#|\.prototype\./;
1002
1003 var isForced = function (feature, detection) {
1004 var value = data[normalize(feature)];
1005 return value == POLYFILL ? true
1006 : value == NATIVE ? false
1007 : typeof detection == 'function' ? fails(detection)
1008 : !!detection;
1009 };
1010
1011 var normalize = isForced.normalize = function (string) {
1012 return String(string).replace(replacement, '.').toLowerCase();
1013 };
1014
1015 var data = isForced.data = {};
1016 var NATIVE = isForced.NATIVE = 'N';
1017 var POLYFILL = isForced.POLYFILL = 'P';
1018
1019 var isForced_1 = isForced;
1020
1021 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1022
1023
1024
1025
1026
1027
1028 /*
1029 options.target - name of the target object
1030 options.global - target is the global object
1031 options.stat - export as static methods of target
1032 options.proto - export as prototype methods of target
1033 options.real - real prototype method for the `pure` version
1034 options.forced - export even if the native feature is available
1035 options.bind - bind methods to the target, required for the `pure` version
1036 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1037 options.unsafe - use the simple assignment of property instead of delete + defineProperty
1038 options.sham - add a flag to not completely full polyfills
1039 options.enumerable - export as enumerable property
1040 options.noTargetGet - prevent calling a getter on target
1041 */
1042 var _export = function (options, source) {
1043 var TARGET = options.target;
1044 var GLOBAL = options.global;
1045 var STATIC = options.stat;
1046 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1047 if (GLOBAL) {
1048 target = global_1;
1049 } else if (STATIC) {
1050 target = global_1[TARGET] || setGlobal(TARGET, {});
1051 } else {
1052 target = (global_1[TARGET] || {}).prototype;
1053 }
1054 if (target) for (key in source) {
1055 sourceProperty = source[key];
1056 if (options.noTargetGet) {
1057 descriptor = getOwnPropertyDescriptor$1(target, key);
1058 targetProperty = descriptor && descriptor.value;
1059 } else targetProperty = target[key];
1060 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1061 // contained in target
1062 if (!FORCED && targetProperty !== undefined) {
1063 if (typeof sourceProperty === typeof targetProperty) continue;
1064 copyConstructorProperties(sourceProperty, targetProperty);
1065 }
1066 // add a flag to not completely full polyfills
1067 if (options.sham || (targetProperty && targetProperty.sham)) {
1068 hide(sourceProperty, 'sham', true);
1069 }
1070 // extend global
1071 redefine(target, key, sourceProperty, options);
1072 }
1073 };
1074
1075 var aFunction$1 = function (it) {
1076 if (typeof it != 'function') {
1077 throw TypeError(String(it) + ' is not a function');
1078 } return it;
1079 };
1080
1081 // optional / simple context binding
1082 var bindContext = function (fn, that, length) {
1083 aFunction$1(fn);
1084 if (that === undefined) return fn;
1085 switch (length) {
1086 case 0: return function () {
1087 return fn.call(that);
1088 };
1089 case 1: return function (a) {
1090 return fn.call(that, a);
1091 };
1092 case 2: return function (a, b) {
1093 return fn.call(that, a, b);
1094 };
1095 case 3: return function (a, b, c) {
1096 return fn.call(that, a, b, c);
1097 };
1098 }
1099 return function (/* ...args */) {
1100 return fn.apply(that, arguments);
1101 };
1102 };
1103
1104 // `ToObject` abstract operation
1105 // https://tc39.github.io/ecma262/#sec-toobject
1106 var toObject = function (argument) {
1107 return Object(requireObjectCoercible(argument));
1108 };
1109
1110 // `IsArray` abstract operation
1111 // https://tc39.github.io/ecma262/#sec-isarray
1112 var isArray = Array.isArray || function isArray(arg) {
1113 return classofRaw(arg) == 'Array';
1114 };
1115
1116 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
1117 // Chrome 38 Symbol has incorrect toString conversion
1118 // eslint-disable-next-line no-undef
1119 return !String(Symbol());
1120 });
1121
1122 var Symbol$1 = global_1.Symbol;
1123 var store$1 = shared('wks');
1124
1125 var wellKnownSymbol = function (name) {
1126 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
1127 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
1128 };
1129
1130 var SPECIES = wellKnownSymbol('species');
1131
1132 // `ArraySpeciesCreate` abstract operation
1133 // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
1134 var arraySpeciesCreate = function (originalArray, length) {
1135 var C;
1136 if (isArray(originalArray)) {
1137 C = originalArray.constructor;
1138 // cross-realm fallback
1139 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
1140 else if (isObject(C)) {
1141 C = C[SPECIES];
1142 if (C === null) C = undefined;
1143 }
1144 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
1145 };
1146
1147 var push = [].push;
1148
1149 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
1150 var createMethod$1 = function (TYPE) {
1151 var IS_MAP = TYPE == 1;
1152 var IS_FILTER = TYPE == 2;
1153 var IS_SOME = TYPE == 3;
1154 var IS_EVERY = TYPE == 4;
1155 var IS_FIND_INDEX = TYPE == 6;
1156 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
1157 return function ($this, callbackfn, that, specificCreate) {
1158 var O = toObject($this);
1159 var self = indexedObject(O);
1160 var boundFunction = bindContext(callbackfn, that, 3);
1161 var length = toLength(self.length);
1162 var index = 0;
1163 var create = specificCreate || arraySpeciesCreate;
1164 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
1165 var value, result;
1166 for (;length > index; index++) if (NO_HOLES || index in self) {
1167 value = self[index];
1168 result = boundFunction(value, index, O);
1169 if (TYPE) {
1170 if (IS_MAP) target[index] = result; // map
1171 else if (result) switch (TYPE) {
1172 case 3: return true; // some
1173 case 5: return value; // find
1174 case 6: return index; // findIndex
1175 case 2: push.call(target, value); // filter
1176 } else if (IS_EVERY) return false; // every
1177 }
1178 }
1179 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
1180 };
1181 };
1182
1183 var arrayIteration = {
1184 // `Array.prototype.forEach` method
1185 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1186 forEach: createMethod$1(0),
1187 // `Array.prototype.map` method
1188 // https://tc39.github.io/ecma262/#sec-array.prototype.map
1189 map: createMethod$1(1),
1190 // `Array.prototype.filter` method
1191 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
1192 filter: createMethod$1(2),
1193 // `Array.prototype.some` method
1194 // https://tc39.github.io/ecma262/#sec-array.prototype.some
1195 some: createMethod$1(3),
1196 // `Array.prototype.every` method
1197 // https://tc39.github.io/ecma262/#sec-array.prototype.every
1198 every: createMethod$1(4),
1199 // `Array.prototype.find` method
1200 // https://tc39.github.io/ecma262/#sec-array.prototype.find
1201 find: createMethod$1(5),
1202 // `Array.prototype.findIndex` method
1203 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
1204 findIndex: createMethod$1(6)
1205 };
1206
1207 // `Object.keys` method
1208 // https://tc39.github.io/ecma262/#sec-object.keys
1209 var objectKeys = Object.keys || function keys(O) {
1210 return objectKeysInternal(O, enumBugKeys);
1211 };
1212
1213 // `Object.defineProperties` method
1214 // https://tc39.github.io/ecma262/#sec-object.defineproperties
1215 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
1216 anObject(O);
1217 var keys = objectKeys(Properties);
1218 var length = keys.length;
1219 var index = 0;
1220 var key;
1221 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
1222 return O;
1223 };
1224
1225 var html = getBuiltIn('document', 'documentElement');
1226
1227 var IE_PROTO = sharedKey('IE_PROTO');
1228
1229 var PROTOTYPE = 'prototype';
1230 var Empty = function () { /* empty */ };
1231
1232 // Create object with fake `null` prototype: use iframe Object with cleared prototype
1233 var createDict = function () {
1234 // Thrash, waste and sodomy: IE GC bug
1235 var iframe = documentCreateElement('iframe');
1236 var length = enumBugKeys.length;
1237 var lt = '<';
1238 var script = 'script';
1239 var gt = '>';
1240 var js = 'java' + script + ':';
1241 var iframeDocument;
1242 iframe.style.display = 'none';
1243 html.appendChild(iframe);
1244 iframe.src = String(js);
1245 iframeDocument = iframe.contentWindow.document;
1246 iframeDocument.open();
1247 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
1248 iframeDocument.close();
1249 createDict = iframeDocument.F;
1250 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
1251 return createDict();
1252 };
1253
1254 // `Object.create` method
1255 // https://tc39.github.io/ecma262/#sec-object.create
1256 var objectCreate = Object.create || function create(O, Properties) {
1257 var result;
1258 if (O !== null) {
1259 Empty[PROTOTYPE] = anObject(O);
1260 result = new Empty();
1261 Empty[PROTOTYPE] = null;
1262 // add "__proto__" for Object.getPrototypeOf polyfill
1263 result[IE_PROTO] = O;
1264 } else result = createDict();
1265 return Properties === undefined ? result : objectDefineProperties(result, Properties);
1266 };
1267
1268 hiddenKeys[IE_PROTO] = true;
1269
1270 var UNSCOPABLES = wellKnownSymbol('unscopables');
1271 var ArrayPrototype = Array.prototype;
1272
1273 // Array.prototype[@@unscopables]
1274 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1275 if (ArrayPrototype[UNSCOPABLES] == undefined) {
1276 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
1277 }
1278
1279 // add a key to Array.prototype[@@unscopables]
1280 var addToUnscopables = function (key) {
1281 ArrayPrototype[UNSCOPABLES][key] = true;
1282 };
1283
1284 var $find = arrayIteration.find;
1285
1286
1287 var FIND = 'find';
1288 var SKIPS_HOLES = true;
1289
1290 // Shouldn't skip holes
1291 if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
1292
1293 // `Array.prototype.find` method
1294 // https://tc39.github.io/ecma262/#sec-array.prototype.find
1295 _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
1296 find: function find(callbackfn /* , that = undefined */) {
1297 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1298 }
1299 });
1300
1301 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1302 addToUnscopables(FIND);
1303
1304 var $includes = arrayIncludes.includes;
1305
1306
1307 // `Array.prototype.includes` method
1308 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
1309 _export({ target: 'Array', proto: true }, {
1310 includes: function includes(el /* , fromIndex = 0 */) {
1311 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1312 }
1313 });
1314
1315 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1316 addToUnscopables('includes');
1317
1318 var nativeAssign = Object.assign;
1319
1320 // `Object.assign` method
1321 // https://tc39.github.io/ecma262/#sec-object.assign
1322 // should work with symbols and should have deterministic property order (V8 bug)
1323 var objectAssign = !nativeAssign || fails(function () {
1324 var A = {};
1325 var B = {};
1326 // eslint-disable-next-line no-undef
1327 var symbol = Symbol();
1328 var alphabet = 'abcdefghijklmnopqrst';
1329 A[symbol] = 7;
1330 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1331 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
1332 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
1333 var T = toObject(target);
1334 var argumentsLength = arguments.length;
1335 var index = 1;
1336 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1337 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
1338 while (argumentsLength > index) {
1339 var S = indexedObject(arguments[index++]);
1340 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
1341 var length = keys.length;
1342 var j = 0;
1343 var key;
1344 while (length > j) {
1345 key = keys[j++];
1346 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
1347 }
1348 } return T;
1349 } : nativeAssign;
1350
1351 // `Object.assign` method
1352 // https://tc39.github.io/ecma262/#sec-object.assign
1353 _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
1354 assign: objectAssign
1355 });
1356
1357 var MATCH = wellKnownSymbol('match');
1358
1359 // `IsRegExp` abstract operation
1360 // https://tc39.github.io/ecma262/#sec-isregexp
1361 var isRegexp = function (it) {
1362 var isRegExp;
1363 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1364 };
1365
1366 var notARegexp = function (it) {
1367 if (isRegexp(it)) {
1368 throw TypeError("The method doesn't accept regular expressions");
1369 } return it;
1370 };
1371
1372 var MATCH$1 = wellKnownSymbol('match');
1373
1374 var correctIsRegexpLogic = function (METHOD_NAME) {
1375 var regexp = /./;
1376 try {
1377 '/./'[METHOD_NAME](regexp);
1378 } catch (e) {
1379 try {
1380 regexp[MATCH$1] = false;
1381 return '/./'[METHOD_NAME](regexp);
1382 } catch (f) { /* empty */ }
1383 } return false;
1384 };
1385
1386 var nativeStartsWith = ''.startsWith;
1387 var min$2 = Math.min;
1388
1389 // `String.prototype.startsWith` method
1390 // https://tc39.github.io/ecma262/#sec-string.prototype.startswith
1391 _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('startsWith') }, {
1392 startsWith: function startsWith(searchString /* , position = 0 */) {
1393 var that = String(requireObjectCoercible(this));
1394 notARegexp(searchString);
1395 var index = toLength(min$2(arguments.length > 1 ? arguments[1] : undefined, that.length));
1396 var search = String(searchString);
1397 return nativeStartsWith
1398 ? nativeStartsWith.call(that, search, index)
1399 : that.slice(index, index + search.length) === search;
1400 }
1401 });
1402
1403 if (typeof window !== "undefined") {
1404 (function () {
1405 var serializeXML = function (node, output) {
1406 var nodeType = node.nodeType;
1407 if (nodeType === 3) {
1408 output.push(node.textContent.replace(/&/, '&amp;').replace(/</, '&lt;').replace('>', '&gt;'));
1409 } else if (nodeType === 1) {
1410 output.push('<', node.tagName);
1411 if (node.hasAttributes()) {
1412 [].forEach.call(node.attributes, function(attrNode){
1413 output.push(' ', attrNode.item.name, '=\'', attrNode.item.value, '\'');
1414 });
1415 }
1416 if (node.hasChildNodes()) {
1417 output.push('>');
1418 [].forEach.call(node.childNodes, function(childNode){
1419 serializeXML(childNode, output);
1420 });
1421 output.push('</', node.tagName, '>');
1422 } else {
1423 output.push('/>');
1424 }
1425 } else if (nodeType == 8) {
1426 output.push('<!--', node.nodeValue, '-->');
1427 }
1428 };
1429
1430 Object.defineProperty(SVGElement.prototype, 'innerHTML', {
1431 get: function () {
1432 var output = [];
1433 var childNode = this.firstChild;
1434 while (childNode) {
1435 serializeXML(childNode, output);
1436 childNode = childNode.nextSibling;
1437 }
1438 return output.join('');
1439 },
1440 set: function (markupText) {
1441 while (this.firstChild) {
1442 this.removeChild(this.firstChild);
1443 }
1444
1445 try {
1446 var dXML = new DOMParser();
1447 dXML.async = false;
1448
1449 var sXML = '<svg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'>' + markupText + '</svg>';
1450 var svgDocElement = dXML.parseFromString(sXML, 'text/xml').documentElement;
1451
1452 var childNode = svgDocElement.firstChild;
1453 while (childNode) {
1454 this.appendChild(this.ownerDocument.importNode(childNode, true));
1455 childNode = childNode.nextSibling;
1456 }
1457 } catch (e) {} }
1458 });
1459
1460 Object.defineProperty(SVGElement.prototype, 'innerSVG', {
1461 get: function () {
1462 return this.innerHTML;
1463 },
1464 set: function (markup) {
1465 this.innerHTML = markup;
1466 }
1467 });
1468
1469 })();
1470 }
1471
1472}));
1473//# sourceMappingURL=d3plus-common.js.map