babel-source 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/lib/babel.js +42478 -0
- data/lib/babel/external-helpers.js +253 -0
- data/lib/babel/polyfill.js +2454 -0
- data/lib/babel/source.rb +7 -0
- metadata +48 -0
@@ -0,0 +1,253 @@
|
|
1
|
+
(function (global) {
|
2
|
+
var babelHelpers = global.babelHelpers = {};
|
3
|
+
babelHelpers.inherits = function (subClass, superClass) {
|
4
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
5
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
6
|
+
}
|
7
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
8
|
+
constructor: {
|
9
|
+
value: subClass,
|
10
|
+
enumerable: false,
|
11
|
+
writable: true,
|
12
|
+
configurable: true
|
13
|
+
}
|
14
|
+
});
|
15
|
+
if (superClass) subClass.__proto__ = superClass;
|
16
|
+
};
|
17
|
+
|
18
|
+
babelHelpers.defaults = function (obj, defaults) {
|
19
|
+
var keys = Object.getOwnPropertyNames(defaults);
|
20
|
+
|
21
|
+
for (var i = 0; i < keys.length; i++) {
|
22
|
+
var key = keys[i];
|
23
|
+
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
24
|
+
|
25
|
+
if (value && value.configurable && obj[key] === undefined) {
|
26
|
+
Object.defineProperty(obj, key, value);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
return obj;
|
31
|
+
};
|
32
|
+
|
33
|
+
babelHelpers.prototypeProperties = function (child, staticProps, instanceProps) {
|
34
|
+
if (staticProps) Object.defineProperties(child, staticProps);
|
35
|
+
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
36
|
+
};
|
37
|
+
|
38
|
+
babelHelpers.applyConstructor = function (Constructor, args) {
|
39
|
+
var instance = Object.create(Constructor.prototype);
|
40
|
+
|
41
|
+
var result = Constructor.apply(instance, args);
|
42
|
+
|
43
|
+
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
|
44
|
+
};
|
45
|
+
|
46
|
+
babelHelpers.taggedTemplateLiteral = function (strings, raw) {
|
47
|
+
return Object.freeze(Object.defineProperties(strings, {
|
48
|
+
raw: {
|
49
|
+
value: Object.freeze(raw)
|
50
|
+
}
|
51
|
+
}));
|
52
|
+
};
|
53
|
+
|
54
|
+
babelHelpers.taggedTemplateLiteralLoose = function (strings, raw) {
|
55
|
+
strings.raw = raw;
|
56
|
+
return strings;
|
57
|
+
};
|
58
|
+
|
59
|
+
babelHelpers.interopRequire = function (obj) {
|
60
|
+
return obj && obj.__esModule ? obj.default : obj;
|
61
|
+
};
|
62
|
+
|
63
|
+
babelHelpers.toArray = function (arr) {
|
64
|
+
return Array.isArray(arr) ? arr : Array.from(arr);
|
65
|
+
};
|
66
|
+
|
67
|
+
babelHelpers.toConsumableArray = function (arr) {
|
68
|
+
if (Array.isArray(arr)) {
|
69
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
70
|
+
|
71
|
+
return arr2;
|
72
|
+
} else {
|
73
|
+
return Array.from(arr);
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
babelHelpers.slicedToArray = function (arr, i) {
|
78
|
+
if (Array.isArray(arr)) {
|
79
|
+
return arr;
|
80
|
+
} else if (Symbol.iterator in Object(arr)) {
|
81
|
+
var _arr = [];
|
82
|
+
|
83
|
+
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
84
|
+
_arr.push(_step.value);
|
85
|
+
|
86
|
+
if (i && _arr.length === i) break;
|
87
|
+
}
|
88
|
+
|
89
|
+
return _arr;
|
90
|
+
} else {
|
91
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
babelHelpers.objectWithoutProperties = function (obj, keys) {
|
96
|
+
var target = {};
|
97
|
+
|
98
|
+
for (var i in obj) {
|
99
|
+
if (keys.indexOf(i) >= 0) continue;
|
100
|
+
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
101
|
+
target[i] = obj[i];
|
102
|
+
}
|
103
|
+
|
104
|
+
return target;
|
105
|
+
};
|
106
|
+
|
107
|
+
babelHelpers.hasOwn = Object.prototype.hasOwnProperty;
|
108
|
+
babelHelpers.slice = Array.prototype.slice;
|
109
|
+
babelHelpers.bind = Function.prototype.bind;
|
110
|
+
babelHelpers.defineProperty = function (obj, key, value) {
|
111
|
+
return Object.defineProperty(obj, key, {
|
112
|
+
value: value,
|
113
|
+
enumerable: true,
|
114
|
+
configurable: true,
|
115
|
+
writable: true
|
116
|
+
});
|
117
|
+
};
|
118
|
+
|
119
|
+
babelHelpers.asyncToGenerator = function (fn) {
|
120
|
+
return function () {
|
121
|
+
var gen = fn.apply(this, arguments);
|
122
|
+
|
123
|
+
return new Promise(function (resolve, reject) {
|
124
|
+
var callNext = step.bind(null, "next");
|
125
|
+
|
126
|
+
var callThrow = step.bind(null, "throw");
|
127
|
+
|
128
|
+
function step(key, arg) {
|
129
|
+
try {
|
130
|
+
var info = gen[key](arg);
|
131
|
+
|
132
|
+
var value = info.value;
|
133
|
+
} catch (error) {
|
134
|
+
reject(error);
|
135
|
+
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
if (info.done) {
|
139
|
+
resolve(value);
|
140
|
+
} else {
|
141
|
+
Promise.resolve(value).then(callNext, callThrow);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
callNext();
|
146
|
+
});
|
147
|
+
};
|
148
|
+
};
|
149
|
+
|
150
|
+
babelHelpers.interopRequireWildcard = function (obj) {
|
151
|
+
return obj && obj.__esModule ? obj : {
|
152
|
+
default: obj
|
153
|
+
};
|
154
|
+
};
|
155
|
+
|
156
|
+
babelHelpers._typeof = function (obj) {
|
157
|
+
return obj && obj.constructor === Symbol ? "symbol" : typeof obj;
|
158
|
+
};
|
159
|
+
|
160
|
+
babelHelpers._extends = Object.assign || function (target) {
|
161
|
+
for (var i = 1; i < arguments.length; i++) {
|
162
|
+
var source = arguments[i];
|
163
|
+
for (var key in source) {
|
164
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
165
|
+
target[key] = source[key];
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
return target;
|
171
|
+
};
|
172
|
+
babelHelpers.get = function get(object, property, receiver) {
|
173
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
174
|
+
|
175
|
+
if (desc === undefined) {
|
176
|
+
var parent = Object.getPrototypeOf(object);
|
177
|
+
|
178
|
+
if (parent === null) {
|
179
|
+
return undefined;
|
180
|
+
} else {
|
181
|
+
return get(parent, property, receiver);
|
182
|
+
}
|
183
|
+
} else if ("value" in desc && desc.writable) {
|
184
|
+
return desc.value;
|
185
|
+
} else {
|
186
|
+
var getter = desc.get;
|
187
|
+
if (getter === undefined) {
|
188
|
+
return undefined;
|
189
|
+
}
|
190
|
+
return getter.call(receiver);
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
babelHelpers.set = function set(object, property, value, receiver) {
|
195
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
196
|
+
|
197
|
+
if (desc === undefined) {
|
198
|
+
var parent = Object.getPrototypeOf(object);
|
199
|
+
|
200
|
+
if (parent !== null) {
|
201
|
+
return set(parent, property, value, receiver);
|
202
|
+
}
|
203
|
+
} else if ("value" in desc && desc.writable) {
|
204
|
+
return desc.value = value;
|
205
|
+
} else {
|
206
|
+
var setter = desc.set;
|
207
|
+
if (setter !== undefined) {
|
208
|
+
return setter.call(receiver, value);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
};
|
212
|
+
|
213
|
+
babelHelpers.classCallCheck = function (instance, Constructor) {
|
214
|
+
if (!(instance instanceof Constructor)) {
|
215
|
+
throw new TypeError("Cannot call a class as a function");
|
216
|
+
}
|
217
|
+
};
|
218
|
+
|
219
|
+
babelHelpers.objectDestructuringEmpty = function (obj) {
|
220
|
+
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
221
|
+
};
|
222
|
+
|
223
|
+
babelHelpers.temporalUndefined = {};
|
224
|
+
babelHelpers.temporalAssertDefined = function (val, name, undef) {
|
225
|
+
if (val === undef) {
|
226
|
+
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
227
|
+
}
|
228
|
+
return true;
|
229
|
+
};
|
230
|
+
|
231
|
+
babelHelpers.tailCall = (function () {
|
232
|
+
function Tail(func, args, context) {
|
233
|
+
this.func = func;
|
234
|
+
this.args = args;
|
235
|
+
this.context = context;
|
236
|
+
}
|
237
|
+
|
238
|
+
Tail.prototype._isTailDescriptor = true;
|
239
|
+
var isRunning = false;
|
240
|
+
|
241
|
+
return function (func, args, context) {
|
242
|
+
var result = new Tail(func, args, context);
|
243
|
+
if (!isRunning) {
|
244
|
+
isRunning = true;
|
245
|
+
do {
|
246
|
+
result = result.func.apply(result.context, result.args);
|
247
|
+
} while (result instanceof Tail || result && result._isTailDescriptor);
|
248
|
+
isRunning = false;
|
249
|
+
}
|
250
|
+
return result;
|
251
|
+
};
|
252
|
+
})();
|
253
|
+
})(typeof global === "undefined" ? self : global);
|
@@ -0,0 +1,2454 @@
|
|
1
|
+
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
+
(function (global){
|
3
|
+
"use strict";
|
4
|
+
|
5
|
+
if (global._babelPolyfill) {
|
6
|
+
throw new Error("only one instance of babel/polyfill is allowed");
|
7
|
+
}
|
8
|
+
global._babelPolyfill = true;
|
9
|
+
|
10
|
+
require("core-js/shim");
|
11
|
+
require("regenerator-babel/runtime");
|
12
|
+
|
13
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
14
|
+
},{"core-js/shim":2,"regenerator-babel/runtime":3}],2:[function(require,module,exports){
|
15
|
+
/**
|
16
|
+
* Core.js 0.5.4
|
17
|
+
* https://github.com/zloirock/core-js
|
18
|
+
* License: http://rock.mit-license.org
|
19
|
+
* © 2015 Denis Pushkarev
|
20
|
+
*/
|
21
|
+
!function(global, framework, undefined){
|
22
|
+
'use strict';
|
23
|
+
|
24
|
+
/******************************************************************************
|
25
|
+
* Module : common *
|
26
|
+
******************************************************************************/
|
27
|
+
|
28
|
+
// Shortcuts for [[Class]] & property names
|
29
|
+
var OBJECT = 'Object'
|
30
|
+
, FUNCTION = 'Function'
|
31
|
+
, ARRAY = 'Array'
|
32
|
+
, STRING = 'String'
|
33
|
+
, NUMBER = 'Number'
|
34
|
+
, REGEXP = 'RegExp'
|
35
|
+
, DATE = 'Date'
|
36
|
+
, MAP = 'Map'
|
37
|
+
, SET = 'Set'
|
38
|
+
, WEAKMAP = 'WeakMap'
|
39
|
+
, WEAKSET = 'WeakSet'
|
40
|
+
, SYMBOL = 'Symbol'
|
41
|
+
, PROMISE = 'Promise'
|
42
|
+
, MATH = 'Math'
|
43
|
+
, ARGUMENTS = 'Arguments'
|
44
|
+
, PROTOTYPE = 'prototype'
|
45
|
+
, CONSTRUCTOR = 'constructor'
|
46
|
+
, TO_STRING = 'toString'
|
47
|
+
, TO_STRING_TAG = TO_STRING + 'Tag'
|
48
|
+
, TO_LOCALE = 'toLocaleString'
|
49
|
+
, HAS_OWN = 'hasOwnProperty'
|
50
|
+
, FOR_EACH = 'forEach'
|
51
|
+
, ITERATOR = 'iterator'
|
52
|
+
, FF_ITERATOR = '@@' + ITERATOR
|
53
|
+
, PROCESS = 'process'
|
54
|
+
, CREATE_ELEMENT = 'createElement'
|
55
|
+
// Aliases global objects and prototypes
|
56
|
+
, Function = global[FUNCTION]
|
57
|
+
, Object = global[OBJECT]
|
58
|
+
, Array = global[ARRAY]
|
59
|
+
, String = global[STRING]
|
60
|
+
, Number = global[NUMBER]
|
61
|
+
, RegExp = global[REGEXP]
|
62
|
+
, Date = global[DATE]
|
63
|
+
, Map = global[MAP]
|
64
|
+
, Set = global[SET]
|
65
|
+
, WeakMap = global[WEAKMAP]
|
66
|
+
, WeakSet = global[WEAKSET]
|
67
|
+
, Symbol = global[SYMBOL]
|
68
|
+
, Math = global[MATH]
|
69
|
+
, TypeError = global.TypeError
|
70
|
+
, RangeError = global.RangeError
|
71
|
+
, setTimeout = global.setTimeout
|
72
|
+
, setImmediate = global.setImmediate
|
73
|
+
, clearImmediate = global.clearImmediate
|
74
|
+
, parseInt = global.parseInt
|
75
|
+
, isFinite = global.isFinite
|
76
|
+
, process = global[PROCESS]
|
77
|
+
, nextTick = process && process.nextTick
|
78
|
+
, document = global.document
|
79
|
+
, html = document && document.documentElement
|
80
|
+
, navigator = global.navigator
|
81
|
+
, define = global.define
|
82
|
+
, ArrayProto = Array[PROTOTYPE]
|
83
|
+
, ObjectProto = Object[PROTOTYPE]
|
84
|
+
, FunctionProto = Function[PROTOTYPE]
|
85
|
+
, Infinity = 1 / 0
|
86
|
+
, DOT = '.'
|
87
|
+
// Methods from https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
|
88
|
+
, CONSOLE_METHODS = 'assert,clear,count,debug,dir,dirxml,error,exception,' +
|
89
|
+
'group,groupCollapsed,groupEnd,info,isIndependentlyComposed,log,' +
|
90
|
+
'markTimeline,profile,profileEnd,table,time,timeEnd,timeline,' +
|
91
|
+
'timelineEnd,timeStamp,trace,warn';
|
92
|
+
|
93
|
+
// http://jsperf.com/core-js-isobject
|
94
|
+
function isObject(it){
|
95
|
+
return it !== null && (typeof it == 'object' || typeof it == 'function');
|
96
|
+
}
|
97
|
+
function isFunction(it){
|
98
|
+
return typeof it == 'function';
|
99
|
+
}
|
100
|
+
// Native function?
|
101
|
+
var isNative = ctx(/./.test, /\[native code\]\s*\}\s*$/, 1);
|
102
|
+
|
103
|
+
// Object internal [[Class]] or toStringTag
|
104
|
+
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring
|
105
|
+
var toString = ObjectProto[TO_STRING];
|
106
|
+
function setToStringTag(it, tag, stat){
|
107
|
+
if(it && !has(it = stat ? it : it[PROTOTYPE], SYMBOL_TAG))hidden(it, SYMBOL_TAG, tag);
|
108
|
+
}
|
109
|
+
function cof(it){
|
110
|
+
return toString.call(it).slice(8, -1);
|
111
|
+
}
|
112
|
+
function classof(it){
|
113
|
+
var O, T;
|
114
|
+
return it == undefined ? it === undefined ? 'Undefined' : 'Null'
|
115
|
+
: typeof (T = (O = Object(it))[SYMBOL_TAG]) == 'string' ? T : cof(O);
|
116
|
+
}
|
117
|
+
|
118
|
+
// Function
|
119
|
+
var call = FunctionProto.call
|
120
|
+
, apply = FunctionProto.apply
|
121
|
+
, REFERENCE_GET;
|
122
|
+
// Partial apply
|
123
|
+
function part(/* ...args */){
|
124
|
+
var fn = assertFunction(this)
|
125
|
+
, length = arguments.length
|
126
|
+
, args = Array(length)
|
127
|
+
, i = 0
|
128
|
+
, _ = path._
|
129
|
+
, holder = false;
|
130
|
+
while(length > i)if((args[i] = arguments[i++]) === _)holder = true;
|
131
|
+
return function(/* ...args */){
|
132
|
+
var that = this
|
133
|
+
, _length = arguments.length
|
134
|
+
, i = 0, j = 0, _args;
|
135
|
+
if(!holder && !_length)return invoke(fn, args, that);
|
136
|
+
_args = args.slice();
|
137
|
+
if(holder)for(;length > i; i++)if(_args[i] === _)_args[i] = arguments[j++];
|
138
|
+
while(_length > j)_args.push(arguments[j++]);
|
139
|
+
return invoke(fn, _args, that);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
// Optional / simple context binding
|
143
|
+
function ctx(fn, that, length){
|
144
|
+
assertFunction(fn);
|
145
|
+
if(~length && that === undefined)return fn;
|
146
|
+
switch(length){
|
147
|
+
case 1: return function(a){
|
148
|
+
return fn.call(that, a);
|
149
|
+
}
|
150
|
+
case 2: return function(a, b){
|
151
|
+
return fn.call(that, a, b);
|
152
|
+
}
|
153
|
+
case 3: return function(a, b, c){
|
154
|
+
return fn.call(that, a, b, c);
|
155
|
+
}
|
156
|
+
} return function(/* ...args */){
|
157
|
+
return fn.apply(that, arguments);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
// Fast apply
|
161
|
+
// http://jsperf.lnkit.com/fast-apply/5
|
162
|
+
function invoke(fn, args, that){
|
163
|
+
var un = that === undefined;
|
164
|
+
switch(args.length | 0){
|
165
|
+
case 0: return un ? fn()
|
166
|
+
: fn.call(that);
|
167
|
+
case 1: return un ? fn(args[0])
|
168
|
+
: fn.call(that, args[0]);
|
169
|
+
case 2: return un ? fn(args[0], args[1])
|
170
|
+
: fn.call(that, args[0], args[1]);
|
171
|
+
case 3: return un ? fn(args[0], args[1], args[2])
|
172
|
+
: fn.call(that, args[0], args[1], args[2]);
|
173
|
+
case 4: return un ? fn(args[0], args[1], args[2], args[3])
|
174
|
+
: fn.call(that, args[0], args[1], args[2], args[3]);
|
175
|
+
case 5: return un ? fn(args[0], args[1], args[2], args[3], args[4])
|
176
|
+
: fn.call(that, args[0], args[1], args[2], args[3], args[4]);
|
177
|
+
} return fn.apply(that, args);
|
178
|
+
}
|
179
|
+
function construct(target, argumentsList /*, newTarget*/){
|
180
|
+
var proto = assertFunction(arguments.length < 3 ? target : arguments[2])[PROTOTYPE]
|
181
|
+
, instance = create(isObject(proto) ? proto : ObjectProto)
|
182
|
+
, result = apply.call(target, instance, argumentsList);
|
183
|
+
return isObject(result) ? result : instance;
|
184
|
+
}
|
185
|
+
|
186
|
+
// Object:
|
187
|
+
var create = Object.create
|
188
|
+
, getPrototypeOf = Object.getPrototypeOf
|
189
|
+
, setPrototypeOf = Object.setPrototypeOf
|
190
|
+
, defineProperty = Object.defineProperty
|
191
|
+
, defineProperties = Object.defineProperties
|
192
|
+
, getOwnDescriptor = Object.getOwnPropertyDescriptor
|
193
|
+
, getKeys = Object.keys
|
194
|
+
, getNames = Object.getOwnPropertyNames
|
195
|
+
, getSymbols = Object.getOwnPropertySymbols
|
196
|
+
, isFrozen = Object.isFrozen
|
197
|
+
, has = ctx(call, ObjectProto[HAS_OWN], 2)
|
198
|
+
// Dummy, fix for not array-like ES3 string in es5 module
|
199
|
+
, ES5Object = Object
|
200
|
+
, Dict;
|
201
|
+
function toObject(it){
|
202
|
+
return ES5Object(assertDefined(it));
|
203
|
+
}
|
204
|
+
function returnIt(it){
|
205
|
+
return it;
|
206
|
+
}
|
207
|
+
function returnThis(){
|
208
|
+
return this;
|
209
|
+
}
|
210
|
+
function get(object, key){
|
211
|
+
if(has(object, key))return object[key];
|
212
|
+
}
|
213
|
+
function ownKeys(it){
|
214
|
+
assertObject(it);
|
215
|
+
return getSymbols ? getNames(it).concat(getSymbols(it)) : getNames(it);
|
216
|
+
}
|
217
|
+
// 19.1.2.1 Object.assign(target, source, ...)
|
218
|
+
var assign = Object.assign || function(target, source){
|
219
|
+
var T = Object(assertDefined(target))
|
220
|
+
, l = arguments.length
|
221
|
+
, i = 1;
|
222
|
+
while(l > i){
|
223
|
+
var S = ES5Object(arguments[i++])
|
224
|
+
, keys = getKeys(S)
|
225
|
+
, length = keys.length
|
226
|
+
, j = 0
|
227
|
+
, key;
|
228
|
+
while(length > j)T[key = keys[j++]] = S[key];
|
229
|
+
}
|
230
|
+
return T;
|
231
|
+
}
|
232
|
+
function keyOf(object, el){
|
233
|
+
var O = toObject(object)
|
234
|
+
, keys = getKeys(O)
|
235
|
+
, length = keys.length
|
236
|
+
, index = 0
|
237
|
+
, key;
|
238
|
+
while(length > index)if(O[key = keys[index++]] === el)return key;
|
239
|
+
}
|
240
|
+
|
241
|
+
// Array
|
242
|
+
// array('str1,str2,str3') => ['str1', 'str2', 'str3']
|
243
|
+
function array(it){
|
244
|
+
return String(it).split(',');
|
245
|
+
}
|
246
|
+
var push = ArrayProto.push
|
247
|
+
, unshift = ArrayProto.unshift
|
248
|
+
, slice = ArrayProto.slice
|
249
|
+
, splice = ArrayProto.splice
|
250
|
+
, indexOf = ArrayProto.indexOf
|
251
|
+
, forEach = ArrayProto[FOR_EACH];
|
252
|
+
/*
|
253
|
+
* 0 -> forEach
|
254
|
+
* 1 -> map
|
255
|
+
* 2 -> filter
|
256
|
+
* 3 -> some
|
257
|
+
* 4 -> every
|
258
|
+
* 5 -> find
|
259
|
+
* 6 -> findIndex
|
260
|
+
*/
|
261
|
+
function createArrayMethod(type){
|
262
|
+
var isMap = type == 1
|
263
|
+
, isFilter = type == 2
|
264
|
+
, isSome = type == 3
|
265
|
+
, isEvery = type == 4
|
266
|
+
, isFindIndex = type == 6
|
267
|
+
, noholes = type == 5 || isFindIndex;
|
268
|
+
return function(callbackfn/*, that = undefined */){
|
269
|
+
var O = Object(assertDefined(this))
|
270
|
+
, that = arguments[1]
|
271
|
+
, self = ES5Object(O)
|
272
|
+
, f = ctx(callbackfn, that, 3)
|
273
|
+
, length = toLength(self.length)
|
274
|
+
, index = 0
|
275
|
+
, result = isMap ? Array(length) : isFilter ? [] : undefined
|
276
|
+
, val, res;
|
277
|
+
for(;length > index; index++)if(noholes || index in self){
|
278
|
+
val = self[index];
|
279
|
+
res = f(val, index, O);
|
280
|
+
if(type){
|
281
|
+
if(isMap)result[index] = res; // map
|
282
|
+
else if(res)switch(type){
|
283
|
+
case 3: return true; // some
|
284
|
+
case 5: return val; // find
|
285
|
+
case 6: return index; // findIndex
|
286
|
+
case 2: result.push(val); // filter
|
287
|
+
} else if(isEvery)return false; // every
|
288
|
+
}
|
289
|
+
}
|
290
|
+
return isFindIndex ? -1 : isSome || isEvery ? isEvery : result;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
function createArrayContains(isContains){
|
294
|
+
return function(el /*, fromIndex = 0 */){
|
295
|
+
var O = toObject(this)
|
296
|
+
, length = toLength(O.length)
|
297
|
+
, index = toIndex(arguments[1], length);
|
298
|
+
if(isContains && el != el){
|
299
|
+
for(;length > index; index++)if(sameNaN(O[index]))return isContains || index;
|
300
|
+
} else for(;length > index; index++)if(isContains || index in O){
|
301
|
+
if(O[index] === el)return isContains || index;
|
302
|
+
} return !isContains && -1;
|
303
|
+
}
|
304
|
+
}
|
305
|
+
function generic(A, B){
|
306
|
+
// strange IE quirks mode bug -> use typeof vs isFunction
|
307
|
+
return typeof A == 'function' ? A : B;
|
308
|
+
}
|
309
|
+
|
310
|
+
// Math
|
311
|
+
var MAX_SAFE_INTEGER = 0x1fffffffffffff // pow(2, 53) - 1 == 9007199254740991
|
312
|
+
, pow = Math.pow
|
313
|
+
, abs = Math.abs
|
314
|
+
, ceil = Math.ceil
|
315
|
+
, floor = Math.floor
|
316
|
+
, max = Math.max
|
317
|
+
, min = Math.min
|
318
|
+
, random = Math.random
|
319
|
+
, trunc = Math.trunc || function(it){
|
320
|
+
return (it > 0 ? floor : ceil)(it);
|
321
|
+
}
|
322
|
+
// 20.1.2.4 Number.isNaN(number)
|
323
|
+
function sameNaN(number){
|
324
|
+
return number != number;
|
325
|
+
}
|
326
|
+
// 7.1.4 ToInteger
|
327
|
+
function toInteger(it){
|
328
|
+
return isNaN(it) ? 0 : trunc(it);
|
329
|
+
}
|
330
|
+
// 7.1.15 ToLength
|
331
|
+
function toLength(it){
|
332
|
+
return it > 0 ? min(toInteger(it), MAX_SAFE_INTEGER) : 0;
|
333
|
+
}
|
334
|
+
function toIndex(index, length){
|
335
|
+
var index = toInteger(index);
|
336
|
+
return index < 0 ? max(index + length, 0) : min(index, length);
|
337
|
+
}
|
338
|
+
function lz(num){
|
339
|
+
return num > 9 ? num : '0' + num;
|
340
|
+
}
|
341
|
+
|
342
|
+
function createReplacer(regExp, replace, isStatic){
|
343
|
+
var replacer = isObject(replace) ? function(part){
|
344
|
+
return replace[part];
|
345
|
+
} : replace;
|
346
|
+
return function(it){
|
347
|
+
return String(isStatic ? it : this).replace(regExp, replacer);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
function createPointAt(toString){
|
351
|
+
return function(pos){
|
352
|
+
var s = String(assertDefined(this))
|
353
|
+
, i = toInteger(pos)
|
354
|
+
, l = s.length
|
355
|
+
, a, b;
|
356
|
+
if(i < 0 || i >= l)return toString ? '' : undefined;
|
357
|
+
a = s.charCodeAt(i);
|
358
|
+
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
|
359
|
+
? toString ? s.charAt(i) : a
|
360
|
+
: toString ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
|
361
|
+
}
|
362
|
+
}
|
363
|
+
|
364
|
+
// Assertion & errors
|
365
|
+
var REDUCE_ERROR = 'Reduce of empty object with no initial value';
|
366
|
+
function assert(condition, msg1, msg2){
|
367
|
+
if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1);
|
368
|
+
}
|
369
|
+
function assertDefined(it){
|
370
|
+
if(it == undefined)throw TypeError('Function called on null or undefined');
|
371
|
+
return it;
|
372
|
+
}
|
373
|
+
function assertFunction(it){
|
374
|
+
assert(isFunction(it), it, ' is not a function!');
|
375
|
+
return it;
|
376
|
+
}
|
377
|
+
function assertObject(it){
|
378
|
+
assert(isObject(it), it, ' is not an object!');
|
379
|
+
return it;
|
380
|
+
}
|
381
|
+
function assertInstance(it, Constructor, name){
|
382
|
+
assert(it instanceof Constructor, name, ": use the 'new' operator!");
|
383
|
+
}
|
384
|
+
|
385
|
+
// Property descriptors & Symbol
|
386
|
+
function descriptor(bitmap, value){
|
387
|
+
return {
|
388
|
+
enumerable : !(bitmap & 1),
|
389
|
+
configurable: !(bitmap & 2),
|
390
|
+
writable : !(bitmap & 4),
|
391
|
+
value : value
|
392
|
+
}
|
393
|
+
}
|
394
|
+
function simpleSet(object, key, value){
|
395
|
+
object[key] = value;
|
396
|
+
return object;
|
397
|
+
}
|
398
|
+
function createDefiner(bitmap){
|
399
|
+
return DESC ? function(object, key, value){
|
400
|
+
return defineProperty(object, key, descriptor(bitmap, value));
|
401
|
+
} : simpleSet;
|
402
|
+
}
|
403
|
+
function uid(key){
|
404
|
+
return SYMBOL + '(' + key + ')_' + (++sid + random())[TO_STRING](36);
|
405
|
+
}
|
406
|
+
function getWellKnownSymbol(name, setter){
|
407
|
+
return (Symbol && Symbol[name]) || (setter ? Symbol : safeSymbol)(SYMBOL + DOT + name);
|
408
|
+
}
|
409
|
+
// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.
|
410
|
+
var DESC = !!function(){
|
411
|
+
try {
|
412
|
+
return defineProperty({}, 'a', {get: function(){ return 2 }}).a == 2;
|
413
|
+
} catch(e){}
|
414
|
+
}()
|
415
|
+
, sid = 0
|
416
|
+
, hidden = createDefiner(1)
|
417
|
+
, set = Symbol ? simpleSet : hidden
|
418
|
+
, safeSymbol = Symbol || uid;
|
419
|
+
function assignHidden(target, src){
|
420
|
+
for(var key in src)hidden(target, key, src[key]);
|
421
|
+
return target;
|
422
|
+
}
|
423
|
+
|
424
|
+
var SYMBOL_UNSCOPABLES = getWellKnownSymbol('unscopables')
|
425
|
+
, ArrayUnscopables = ArrayProto[SYMBOL_UNSCOPABLES] || {}
|
426
|
+
, SYMBOL_SPECIES = getWellKnownSymbol('species');
|
427
|
+
function setSpecies(C){
|
428
|
+
if(framework || !isNative(C))defineProperty(C, SYMBOL_SPECIES, {
|
429
|
+
configurable: true,
|
430
|
+
get: returnThis
|
431
|
+
});
|
432
|
+
}
|
433
|
+
|
434
|
+
// Iterators
|
435
|
+
var SYMBOL_ITERATOR = getWellKnownSymbol(ITERATOR)
|
436
|
+
, SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG)
|
437
|
+
, SUPPORT_FF_ITER = FF_ITERATOR in ArrayProto
|
438
|
+
, ITER = safeSymbol('iter')
|
439
|
+
, KEY = 1
|
440
|
+
, VALUE = 2
|
441
|
+
, Iterators = {}
|
442
|
+
, IteratorPrototype = {}
|
443
|
+
, NATIVE_ITERATORS = SYMBOL_ITERATOR in ArrayProto
|
444
|
+
// Safari define byggy iterators w/o `next`
|
445
|
+
, BUGGY_ITERATORS = 'keys' in ArrayProto && !('next' in [].keys());
|
446
|
+
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
447
|
+
setIterator(IteratorPrototype, returnThis);
|
448
|
+
function setIterator(O, value){
|
449
|
+
hidden(O, SYMBOL_ITERATOR, value);
|
450
|
+
// Add iterator for FF iterator protocol
|
451
|
+
SUPPORT_FF_ITER && hidden(O, FF_ITERATOR, value);
|
452
|
+
}
|
453
|
+
function createIterator(Constructor, NAME, next, proto){
|
454
|
+
Constructor[PROTOTYPE] = create(proto || IteratorPrototype, {next: descriptor(1, next)});
|
455
|
+
setToStringTag(Constructor, NAME + ' Iterator');
|
456
|
+
}
|
457
|
+
function defineIterator(Constructor, NAME, value, DEFAULT){
|
458
|
+
var proto = Constructor[PROTOTYPE]
|
459
|
+
, iter = get(proto, SYMBOL_ITERATOR) || get(proto, FF_ITERATOR) || (DEFAULT && get(proto, DEFAULT)) || value;
|
460
|
+
if(framework){
|
461
|
+
// Define iterator
|
462
|
+
setIterator(proto, iter);
|
463
|
+
if(iter !== value){
|
464
|
+
var iterProto = getPrototypeOf(iter.call(new Constructor));
|
465
|
+
// Set @@toStringTag to native iterators
|
466
|
+
setToStringTag(iterProto, NAME + ' Iterator', true);
|
467
|
+
// FF fix
|
468
|
+
has(proto, FF_ITERATOR) && setIterator(iterProto, returnThis);
|
469
|
+
}
|
470
|
+
}
|
471
|
+
// Plug for library
|
472
|
+
Iterators[NAME] = iter;
|
473
|
+
// FF & v8 fix
|
474
|
+
Iterators[NAME + ' Iterator'] = returnThis;
|
475
|
+
return iter;
|
476
|
+
}
|
477
|
+
function defineStdIterators(Base, NAME, Constructor, next, DEFAULT, IS_SET){
|
478
|
+
function createIter(kind){
|
479
|
+
return function(){
|
480
|
+
return new Constructor(this, kind);
|
481
|
+
}
|
482
|
+
}
|
483
|
+
createIterator(Constructor, NAME, next);
|
484
|
+
var entries = createIter(KEY+VALUE)
|
485
|
+
, values = createIter(VALUE);
|
486
|
+
if(DEFAULT == VALUE)values = defineIterator(Base, NAME, values, 'values');
|
487
|
+
else entries = defineIterator(Base, NAME, entries, 'entries');
|
488
|
+
if(DEFAULT){
|
489
|
+
$define(PROTO + FORCED * BUGGY_ITERATORS, NAME, {
|
490
|
+
entries: entries,
|
491
|
+
keys: IS_SET ? values : createIter(KEY),
|
492
|
+
values: values
|
493
|
+
});
|
494
|
+
}
|
495
|
+
}
|
496
|
+
function iterResult(done, value){
|
497
|
+
return {value: value, done: !!done};
|
498
|
+
}
|
499
|
+
function isIterable(it){
|
500
|
+
var O = Object(it)
|
501
|
+
, Symbol = global[SYMBOL]
|
502
|
+
, hasExt = (Symbol && Symbol[ITERATOR] || FF_ITERATOR) in O;
|
503
|
+
return hasExt || SYMBOL_ITERATOR in O || has(Iterators, classof(O));
|
504
|
+
}
|
505
|
+
function getIterator(it){
|
506
|
+
var Symbol = global[SYMBOL]
|
507
|
+
, ext = it[Symbol && Symbol[ITERATOR] || FF_ITERATOR]
|
508
|
+
, getIter = ext || it[SYMBOL_ITERATOR] || Iterators[classof(it)];
|
509
|
+
return assertObject(getIter.call(it));
|
510
|
+
}
|
511
|
+
function stepCall(fn, value, entries){
|
512
|
+
return entries ? invoke(fn, value) : fn(value);
|
513
|
+
}
|
514
|
+
function forOf(iterable, entries, fn, that){
|
515
|
+
var iterator = getIterator(iterable)
|
516
|
+
, f = ctx(fn, that, entries ? 2 : 1)
|
517
|
+
, step;
|
518
|
+
while(!(step = iterator.next()).done)if(stepCall(f, step.value, entries) === false)return;
|
519
|
+
}
|
520
|
+
|
521
|
+
// core
|
522
|
+
var NODE = cof(process) == PROCESS
|
523
|
+
, core = {}
|
524
|
+
, path = framework ? global : core
|
525
|
+
, old = global.core
|
526
|
+
, exportGlobal
|
527
|
+
// type bitmap
|
528
|
+
, FORCED = 1
|
529
|
+
, GLOBAL = 2
|
530
|
+
, STATIC = 4
|
531
|
+
, PROTO = 8
|
532
|
+
, BIND = 16
|
533
|
+
, WRAP = 32
|
534
|
+
, SIMPLE = 64;
|
535
|
+
function $define(type, name, source){
|
536
|
+
var key, own, out, exp
|
537
|
+
, isGlobal = type & GLOBAL
|
538
|
+
, target = isGlobal ? global : (type & STATIC)
|
539
|
+
? global[name] : (global[name] || ObjectProto)[PROTOTYPE]
|
540
|
+
, exports = isGlobal ? core : core[name] || (core[name] = {});
|
541
|
+
if(isGlobal)source = name;
|
542
|
+
for(key in source){
|
543
|
+
// there is a similar native
|
544
|
+
own = !(type & FORCED) && target && key in target
|
545
|
+
&& (!isFunction(target[key]) || isNative(target[key]));
|
546
|
+
// export native or passed
|
547
|
+
out = (own ? target : source)[key];
|
548
|
+
// prevent global pollution for namespaces
|
549
|
+
if(!framework && isGlobal && !isFunction(target[key]))exp = source[key];
|
550
|
+
// bind timers to global for call from export context
|
551
|
+
else if(type & BIND && own)exp = ctx(out, global);
|
552
|
+
// wrap global constructors for prevent change them in library
|
553
|
+
else if(type & WRAP && !framework && target[key] == out){
|
554
|
+
exp = function(param){
|
555
|
+
return this instanceof out ? new out(param) : out(param);
|
556
|
+
}
|
557
|
+
exp[PROTOTYPE] = out[PROTOTYPE];
|
558
|
+
} else exp = type & PROTO && isFunction(out) ? ctx(call, out) : out;
|
559
|
+
// extend global
|
560
|
+
if(framework && target && !own){
|
561
|
+
if(isGlobal || type & SIMPLE)target[key] = out;
|
562
|
+
else delete target[key] && hidden(target, key, out);
|
563
|
+
}
|
564
|
+
// export
|
565
|
+
if(exports[key] != out)hidden(exports, key, exp);
|
566
|
+
}
|
567
|
+
}
|
568
|
+
// CommonJS export
|
569
|
+
if(typeof module != 'undefined' && module.exports)module.exports = core;
|
570
|
+
// RequireJS export
|
571
|
+
else if(isFunction(define) && define.amd)define(function(){return core});
|
572
|
+
// Export to global object
|
573
|
+
else exportGlobal = true;
|
574
|
+
if(exportGlobal || framework){
|
575
|
+
core.noConflict = function(){
|
576
|
+
global.core = old;
|
577
|
+
return core;
|
578
|
+
}
|
579
|
+
global.core = core;
|
580
|
+
}
|
581
|
+
|
582
|
+
/******************************************************************************
|
583
|
+
* Module : es6.symbol *
|
584
|
+
******************************************************************************/
|
585
|
+
|
586
|
+
// ECMAScript 6 symbols shim
|
587
|
+
!function(TAG, SymbolRegistry, AllSymbols, setter){
|
588
|
+
// 19.4.1.1 Symbol([description])
|
589
|
+
if(!isNative(Symbol)){
|
590
|
+
Symbol = function(description){
|
591
|
+
assert(!(this instanceof Symbol), SYMBOL + ' is not a ' + CONSTRUCTOR);
|
592
|
+
var tag = uid(description)
|
593
|
+
, sym = set(create(Symbol[PROTOTYPE]), TAG, tag);
|
594
|
+
AllSymbols[tag] = sym;
|
595
|
+
DESC && setter && defineProperty(ObjectProto, tag, {
|
596
|
+
configurable: true,
|
597
|
+
set: function(value){
|
598
|
+
hidden(this, tag, value);
|
599
|
+
}
|
600
|
+
});
|
601
|
+
return sym;
|
602
|
+
}
|
603
|
+
hidden(Symbol[PROTOTYPE], TO_STRING, function(){
|
604
|
+
return this[TAG];
|
605
|
+
});
|
606
|
+
}
|
607
|
+
$define(GLOBAL + WRAP, {Symbol: Symbol});
|
608
|
+
|
609
|
+
var symbolStatics = {
|
610
|
+
// 19.4.2.1 Symbol.for(key)
|
611
|
+
'for': function(key){
|
612
|
+
return has(SymbolRegistry, key += '')
|
613
|
+
? SymbolRegistry[key]
|
614
|
+
: SymbolRegistry[key] = Symbol(key);
|
615
|
+
},
|
616
|
+
// 19.4.2.4 Symbol.iterator
|
617
|
+
iterator: SYMBOL_ITERATOR,
|
618
|
+
// 19.4.2.5 Symbol.keyFor(sym)
|
619
|
+
keyFor: part.call(keyOf, SymbolRegistry),
|
620
|
+
// 19.4.2.10 Symbol.species
|
621
|
+
species: SYMBOL_SPECIES,
|
622
|
+
// 19.4.2.13 Symbol.toStringTag
|
623
|
+
toStringTag: SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG, true),
|
624
|
+
// 19.4.2.14 Symbol.unscopables
|
625
|
+
unscopables: SYMBOL_UNSCOPABLES,
|
626
|
+
pure: safeSymbol,
|
627
|
+
set: set,
|
628
|
+
useSetter: function(){setter = true},
|
629
|
+
useSimple: function(){setter = false}
|
630
|
+
};
|
631
|
+
// 19.4.2.2 Symbol.hasInstance
|
632
|
+
// 19.4.2.3 Symbol.isConcatSpreadable
|
633
|
+
// 19.4.2.6 Symbol.match
|
634
|
+
// 19.4.2.8 Symbol.replace
|
635
|
+
// 19.4.2.9 Symbol.search
|
636
|
+
// 19.4.2.11 Symbol.split
|
637
|
+
// 19.4.2.12 Symbol.toPrimitive
|
638
|
+
forEach.call(array('hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive'),
|
639
|
+
function(it){
|
640
|
+
symbolStatics[it] = getWellKnownSymbol(it);
|
641
|
+
}
|
642
|
+
);
|
643
|
+
$define(STATIC, SYMBOL, symbolStatics);
|
644
|
+
|
645
|
+
setToStringTag(Symbol, SYMBOL);
|
646
|
+
|
647
|
+
$define(STATIC + FORCED * !isNative(Symbol), OBJECT, {
|
648
|
+
// 19.1.2.7 Object.getOwnPropertyNames(O)
|
649
|
+
getOwnPropertyNames: function(it){
|
650
|
+
var names = getNames(toObject(it)), result = [], key, i = 0;
|
651
|
+
while(names.length > i)has(AllSymbols, key = names[i++]) || result.push(key);
|
652
|
+
return result;
|
653
|
+
},
|
654
|
+
// 19.1.2.8 Object.getOwnPropertySymbols(O)
|
655
|
+
getOwnPropertySymbols: function(it){
|
656
|
+
var names = getNames(toObject(it)), result = [], key, i = 0;
|
657
|
+
while(names.length > i)has(AllSymbols, key = names[i++]) && result.push(AllSymbols[key]);
|
658
|
+
return result;
|
659
|
+
}
|
660
|
+
});
|
661
|
+
}(safeSymbol('tag'), {}, {}, true);
|
662
|
+
|
663
|
+
/******************************************************************************
|
664
|
+
* Module : es6.object *
|
665
|
+
******************************************************************************/
|
666
|
+
|
667
|
+
!function(tmp){
|
668
|
+
var objectStatic = {
|
669
|
+
// 19.1.3.1 Object.assign(target, source)
|
670
|
+
assign: assign,
|
671
|
+
// 19.1.3.10 Object.is(value1, value2)
|
672
|
+
is: function(x, y){
|
673
|
+
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
|
674
|
+
}
|
675
|
+
};
|
676
|
+
// 19.1.3.19 Object.setPrototypeOf(O, proto)
|
677
|
+
// Works with __proto__ only. Old v8 can't works with null proto objects.
|
678
|
+
'__proto__' in ObjectProto && function(buggy, set){
|
679
|
+
try {
|
680
|
+
set = ctx(call, getOwnDescriptor(ObjectProto, '__proto__').set, 2);
|
681
|
+
set({}, ArrayProto);
|
682
|
+
} catch(e){ buggy = true }
|
683
|
+
objectStatic.setPrototypeOf = setPrototypeOf = setPrototypeOf || function(O, proto){
|
684
|
+
assertObject(O);
|
685
|
+
assert(proto === null || isObject(proto), proto, ": can't set as prototype!");
|
686
|
+
if(buggy)O.__proto__ = proto;
|
687
|
+
else set(O, proto);
|
688
|
+
return O;
|
689
|
+
}
|
690
|
+
}();
|
691
|
+
$define(STATIC, OBJECT, objectStatic);
|
692
|
+
|
693
|
+
if(framework){
|
694
|
+
// 19.1.3.6 Object.prototype.toString()
|
695
|
+
tmp[SYMBOL_TAG] = DOT;
|
696
|
+
if(cof(tmp) != DOT)hidden(ObjectProto, TO_STRING, function(){
|
697
|
+
return '[object ' + classof(this) + ']';
|
698
|
+
});
|
699
|
+
}
|
700
|
+
|
701
|
+
// 20.2.1.9 Math[@@toStringTag]
|
702
|
+
setToStringTag(Math, MATH, true);
|
703
|
+
// 24.3.3 JSON[@@toStringTag]
|
704
|
+
setToStringTag(global.JSON, 'JSON', true);
|
705
|
+
}({});
|
706
|
+
|
707
|
+
/******************************************************************************
|
708
|
+
* Module : es6.object.statics-accept-primitives *
|
709
|
+
******************************************************************************/
|
710
|
+
|
711
|
+
!function(){
|
712
|
+
// Object static methods accept primitives
|
713
|
+
function wrapObjectMethod(key, MODE){
|
714
|
+
var fn = Object[key]
|
715
|
+
, exp = core[OBJECT][key]
|
716
|
+
, f = 0
|
717
|
+
, o = {};
|
718
|
+
if(!exp || isNative(exp)){
|
719
|
+
o[key] = MODE == 1 ? function(it){
|
720
|
+
return isObject(it) ? fn(it) : it;
|
721
|
+
} : MODE == 2 ? function(it){
|
722
|
+
return isObject(it) ? fn(it) : true;
|
723
|
+
} : MODE == 3 ? function(it){
|
724
|
+
return isObject(it) ? fn(it) : false;
|
725
|
+
} : MODE == 4 ? function(it, key){
|
726
|
+
return fn(toObject(it), key);
|
727
|
+
} : function(it){
|
728
|
+
return fn(toObject(it));
|
729
|
+
};
|
730
|
+
try { fn(DOT) }
|
731
|
+
catch(e){ f = 1 }
|
732
|
+
$define(STATIC + FORCED * f, OBJECT, o);
|
733
|
+
}
|
734
|
+
}
|
735
|
+
wrapObjectMethod('freeze', 1);
|
736
|
+
wrapObjectMethod('seal', 1);
|
737
|
+
wrapObjectMethod('preventExtensions', 1);
|
738
|
+
wrapObjectMethod('isFrozen', 2);
|
739
|
+
wrapObjectMethod('isSealed', 2);
|
740
|
+
wrapObjectMethod('isExtensible', 3);
|
741
|
+
wrapObjectMethod('getOwnPropertyDescriptor', 4);
|
742
|
+
wrapObjectMethod('getPrototypeOf');
|
743
|
+
wrapObjectMethod('keys');
|
744
|
+
wrapObjectMethod('getOwnPropertyNames');
|
745
|
+
}();
|
746
|
+
|
747
|
+
/******************************************************************************
|
748
|
+
* Module : es6.function *
|
749
|
+
******************************************************************************/
|
750
|
+
|
751
|
+
!function(NAME){
|
752
|
+
// 19.2.4.2 name
|
753
|
+
NAME in FunctionProto || defineProperty(FunctionProto, NAME, {
|
754
|
+
configurable: true,
|
755
|
+
get: function(){
|
756
|
+
var match = String(this).match(/^\s*function ([^ (]*)/)
|
757
|
+
, name = match ? match[1] : '';
|
758
|
+
has(this, NAME) || defineProperty(this, NAME, descriptor(5, name));
|
759
|
+
return name;
|
760
|
+
},
|
761
|
+
set: function(value){
|
762
|
+
has(this, NAME) || defineProperty(this, NAME, descriptor(0, value));
|
763
|
+
}
|
764
|
+
});
|
765
|
+
}('name');
|
766
|
+
|
767
|
+
/******************************************************************************
|
768
|
+
* Module : es6.number.constructor *
|
769
|
+
******************************************************************************/
|
770
|
+
|
771
|
+
Number('0o1') && Number('0b1') || function(_Number, NumberProto){
|
772
|
+
function toNumber(it){
|
773
|
+
if(isObject(it))it = toPrimitive(it);
|
774
|
+
if(typeof it == 'string' && it.length > 2 && it.charCodeAt(0) == 48){
|
775
|
+
var binary = false;
|
776
|
+
switch(it.charCodeAt(1)){
|
777
|
+
case 66 : case 98 : binary = true;
|
778
|
+
case 79 : case 111 : return parseInt(it.slice(2), binary ? 2 : 8);
|
779
|
+
}
|
780
|
+
} return +it;
|
781
|
+
}
|
782
|
+
function toPrimitive(it){
|
783
|
+
var fn, val;
|
784
|
+
if(isFunction(fn = it.valueOf) && !isObject(val = fn.call(it)))return val;
|
785
|
+
if(isFunction(fn = it[TO_STRING]) && !isObject(val = fn.call(it)))return val;
|
786
|
+
throw TypeError("Can't convert object to number");
|
787
|
+
}
|
788
|
+
Number = function Number(it){
|
789
|
+
return this instanceof Number ? new _Number(toNumber(it)) : toNumber(it);
|
790
|
+
}
|
791
|
+
forEach.call(DESC ? getNames(_Number)
|
792
|
+
: array('MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY'), function(key){
|
793
|
+
key in Number || defineProperty(Number, key, getOwnDescriptor(_Number, key));
|
794
|
+
});
|
795
|
+
Number[PROTOTYPE] = NumberProto;
|
796
|
+
NumberProto[CONSTRUCTOR] = Number;
|
797
|
+
hidden(global, NUMBER, Number);
|
798
|
+
}(Number, Number[PROTOTYPE]);
|
799
|
+
|
800
|
+
/******************************************************************************
|
801
|
+
* Module : es6.number *
|
802
|
+
******************************************************************************/
|
803
|
+
|
804
|
+
!function(isInteger){
|
805
|
+
$define(STATIC, NUMBER, {
|
806
|
+
// 20.1.2.1 Number.EPSILON
|
807
|
+
EPSILON: pow(2, -52),
|
808
|
+
// 20.1.2.2 Number.isFinite(number)
|
809
|
+
isFinite: function(it){
|
810
|
+
return typeof it == 'number' && isFinite(it);
|
811
|
+
},
|
812
|
+
// 20.1.2.3 Number.isInteger(number)
|
813
|
+
isInteger: isInteger,
|
814
|
+
// 20.1.2.4 Number.isNaN(number)
|
815
|
+
isNaN: sameNaN,
|
816
|
+
// 20.1.2.5 Number.isSafeInteger(number)
|
817
|
+
isSafeInteger: function(number){
|
818
|
+
return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER;
|
819
|
+
},
|
820
|
+
// 20.1.2.6 Number.MAX_SAFE_INTEGER
|
821
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
|
822
|
+
// 20.1.2.10 Number.MIN_SAFE_INTEGER
|
823
|
+
MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER,
|
824
|
+
// 20.1.2.12 Number.parseFloat(string)
|
825
|
+
parseFloat: parseFloat,
|
826
|
+
// 20.1.2.13 Number.parseInt(string, radix)
|
827
|
+
parseInt: parseInt
|
828
|
+
});
|
829
|
+
// 20.1.2.3 Number.isInteger(number)
|
830
|
+
}(Number.isInteger || function(it){
|
831
|
+
return !isObject(it) && isFinite(it) && floor(it) === it;
|
832
|
+
});
|
833
|
+
|
834
|
+
/******************************************************************************
|
835
|
+
* Module : es6.math *
|
836
|
+
******************************************************************************/
|
837
|
+
|
838
|
+
// ECMAScript 6 shim
|
839
|
+
!function(){
|
840
|
+
// 20.2.2.28 Math.sign(x)
|
841
|
+
var E = Math.E
|
842
|
+
, exp = Math.exp
|
843
|
+
, log = Math.log
|
844
|
+
, sqrt = Math.sqrt
|
845
|
+
, sign = Math.sign || function(x){
|
846
|
+
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
|
847
|
+
};
|
848
|
+
|
849
|
+
// 20.2.2.5 Math.asinh(x)
|
850
|
+
function asinh(x){
|
851
|
+
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
|
852
|
+
}
|
853
|
+
// 20.2.2.14 Math.expm1(x)
|
854
|
+
function expm1(x){
|
855
|
+
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
|
856
|
+
}
|
857
|
+
|
858
|
+
$define(STATIC, MATH, {
|
859
|
+
// 20.2.2.3 Math.acosh(x)
|
860
|
+
acosh: function(x){
|
861
|
+
return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x;
|
862
|
+
},
|
863
|
+
// 20.2.2.5 Math.asinh(x)
|
864
|
+
asinh: asinh,
|
865
|
+
// 20.2.2.7 Math.atanh(x)
|
866
|
+
atanh: function(x){
|
867
|
+
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
|
868
|
+
},
|
869
|
+
// 20.2.2.9 Math.cbrt(x)
|
870
|
+
cbrt: function(x){
|
871
|
+
return sign(x = +x) * pow(abs(x), 1 / 3);
|
872
|
+
},
|
873
|
+
// 20.2.2.11 Math.clz32(x)
|
874
|
+
clz32: function(x){
|
875
|
+
return (x >>>= 0) ? 32 - x[TO_STRING](2).length : 32;
|
876
|
+
},
|
877
|
+
// 20.2.2.12 Math.cosh(x)
|
878
|
+
cosh: function(x){
|
879
|
+
return (exp(x = +x) + exp(-x)) / 2;
|
880
|
+
},
|
881
|
+
// 20.2.2.14 Math.expm1(x)
|
882
|
+
expm1: expm1,
|
883
|
+
// 20.2.2.16 Math.fround(x)
|
884
|
+
// TODO: fallback for IE9-
|
885
|
+
fround: function(x){
|
886
|
+
return new Float32Array([x])[0];
|
887
|
+
},
|
888
|
+
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
|
889
|
+
hypot: function(value1, value2){
|
890
|
+
var sum = 0
|
891
|
+
, len1 = arguments.length
|
892
|
+
, len2 = len1
|
893
|
+
, args = Array(len1)
|
894
|
+
, larg = -Infinity
|
895
|
+
, arg;
|
896
|
+
while(len1--){
|
897
|
+
arg = args[len1] = +arguments[len1];
|
898
|
+
if(arg == Infinity || arg == -Infinity)return Infinity;
|
899
|
+
if(arg > larg)larg = arg;
|
900
|
+
}
|
901
|
+
larg = arg || 1;
|
902
|
+
while(len2--)sum += pow(args[len2] / larg, 2);
|
903
|
+
return larg * sqrt(sum);
|
904
|
+
},
|
905
|
+
// 20.2.2.18 Math.imul(x, y)
|
906
|
+
imul: function(x, y){
|
907
|
+
var UInt16 = 0xffff
|
908
|
+
, xn = +x
|
909
|
+
, yn = +y
|
910
|
+
, xl = UInt16 & xn
|
911
|
+
, yl = UInt16 & yn;
|
912
|
+
return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0);
|
913
|
+
},
|
914
|
+
// 20.2.2.20 Math.log1p(x)
|
915
|
+
log1p: function(x){
|
916
|
+
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
|
917
|
+
},
|
918
|
+
// 20.2.2.21 Math.log10(x)
|
919
|
+
log10: function(x){
|
920
|
+
return log(x) / Math.LN10;
|
921
|
+
},
|
922
|
+
// 20.2.2.22 Math.log2(x)
|
923
|
+
log2: function(x){
|
924
|
+
return log(x) / Math.LN2;
|
925
|
+
},
|
926
|
+
// 20.2.2.28 Math.sign(x)
|
927
|
+
sign: sign,
|
928
|
+
// 20.2.2.30 Math.sinh(x)
|
929
|
+
sinh: function(x){
|
930
|
+
return (abs(x = +x) < 1) ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
|
931
|
+
},
|
932
|
+
// 20.2.2.33 Math.tanh(x)
|
933
|
+
tanh: function(x){
|
934
|
+
var a = expm1(x = +x)
|
935
|
+
, b = expm1(-x);
|
936
|
+
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
|
937
|
+
},
|
938
|
+
// 20.2.2.34 Math.trunc(x)
|
939
|
+
trunc: trunc
|
940
|
+
});
|
941
|
+
}();
|
942
|
+
|
943
|
+
/******************************************************************************
|
944
|
+
* Module : es6.string *
|
945
|
+
******************************************************************************/
|
946
|
+
|
947
|
+
!function(fromCharCode){
|
948
|
+
function assertNotRegExp(it){
|
949
|
+
if(cof(it) == REGEXP)throw TypeError();
|
950
|
+
}
|
951
|
+
|
952
|
+
$define(STATIC, STRING, {
|
953
|
+
// 21.1.2.2 String.fromCodePoint(...codePoints)
|
954
|
+
fromCodePoint: function(x){
|
955
|
+
var res = []
|
956
|
+
, len = arguments.length
|
957
|
+
, i = 0
|
958
|
+
, code
|
959
|
+
while(len > i){
|
960
|
+
code = +arguments[i++];
|
961
|
+
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
|
962
|
+
res.push(code < 0x10000
|
963
|
+
? fromCharCode(code)
|
964
|
+
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
|
965
|
+
);
|
966
|
+
} return res.join('');
|
967
|
+
},
|
968
|
+
// 21.1.2.4 String.raw(callSite, ...substitutions)
|
969
|
+
raw: function(callSite){
|
970
|
+
var raw = toObject(callSite.raw)
|
971
|
+
, len = toLength(raw.length)
|
972
|
+
, sln = arguments.length
|
973
|
+
, res = []
|
974
|
+
, i = 0;
|
975
|
+
while(len > i){
|
976
|
+
res.push(String(raw[i++]));
|
977
|
+
if(i < sln)res.push(String(arguments[i]));
|
978
|
+
} return res.join('');
|
979
|
+
}
|
980
|
+
});
|
981
|
+
|
982
|
+
$define(PROTO, STRING, {
|
983
|
+
// 21.1.3.3 String.prototype.codePointAt(pos)
|
984
|
+
codePointAt: createPointAt(false),
|
985
|
+
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
|
986
|
+
endsWith: function(searchString /*, endPosition = @length */){
|
987
|
+
assertNotRegExp(searchString);
|
988
|
+
var that = String(assertDefined(this))
|
989
|
+
, endPosition = arguments[1]
|
990
|
+
, len = toLength(that.length)
|
991
|
+
, end = endPosition === undefined ? len : min(toLength(endPosition), len);
|
992
|
+
searchString += '';
|
993
|
+
return that.slice(end - searchString.length, end) === searchString;
|
994
|
+
},
|
995
|
+
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
|
996
|
+
includes: function(searchString /*, position = 0 */){
|
997
|
+
assertNotRegExp(searchString);
|
998
|
+
return !!~String(assertDefined(this)).indexOf(searchString, arguments[1]);
|
999
|
+
},
|
1000
|
+
// 21.1.3.13 String.prototype.repeat(count)
|
1001
|
+
repeat: function(count){
|
1002
|
+
var str = String(assertDefined(this))
|
1003
|
+
, res = ''
|
1004
|
+
, n = toInteger(count);
|
1005
|
+
if(0 > n || n == Infinity)throw RangeError("Count can't be negative");
|
1006
|
+
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
|
1007
|
+
return res;
|
1008
|
+
},
|
1009
|
+
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
|
1010
|
+
startsWith: function(searchString /*, position = 0 */){
|
1011
|
+
assertNotRegExp(searchString);
|
1012
|
+
var that = String(assertDefined(this))
|
1013
|
+
, index = toLength(min(arguments[1], that.length));
|
1014
|
+
searchString += '';
|
1015
|
+
return that.slice(index, index + searchString.length) === searchString;
|
1016
|
+
}
|
1017
|
+
});
|
1018
|
+
}(String.fromCharCode);
|
1019
|
+
|
1020
|
+
/******************************************************************************
|
1021
|
+
* Module : es6.array *
|
1022
|
+
******************************************************************************/
|
1023
|
+
|
1024
|
+
!function(){
|
1025
|
+
$define(STATIC, ARRAY, {
|
1026
|
+
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
|
1027
|
+
from: function(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
|
1028
|
+
var O = Object(assertDefined(arrayLike))
|
1029
|
+
, mapfn = arguments[1]
|
1030
|
+
, mapping = mapfn !== undefined
|
1031
|
+
, f = mapping ? ctx(mapfn, arguments[2], 2) : undefined
|
1032
|
+
, index = 0
|
1033
|
+
, length, result, iter, step;
|
1034
|
+
if(isIterable(O))for(iter = getIterator(O), result = new (generic(this, Array)); !(step = iter.next()).done; index++){
|
1035
|
+
result[index] = mapping ? f(step.value, index) : step.value;
|
1036
|
+
} else for(result = new (generic(this, Array))(length = toLength(O.length)); length > index; index++){
|
1037
|
+
result[index] = mapping ? f(O[index], index) : O[index];
|
1038
|
+
}
|
1039
|
+
result.length = index;
|
1040
|
+
return result;
|
1041
|
+
},
|
1042
|
+
// 22.1.2.3 Array.of( ...items)
|
1043
|
+
of: function(/* ...args */){
|
1044
|
+
var index = 0
|
1045
|
+
, length = arguments.length
|
1046
|
+
, result = new (generic(this, Array))(length);
|
1047
|
+
while(length > index)result[index] = arguments[index++];
|
1048
|
+
result.length = length;
|
1049
|
+
return result;
|
1050
|
+
}
|
1051
|
+
});
|
1052
|
+
|
1053
|
+
$define(PROTO, ARRAY, {
|
1054
|
+
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
|
1055
|
+
copyWithin: function(target /* = 0 */, start /* = 0, end = @length */){
|
1056
|
+
var O = Object(assertDefined(this))
|
1057
|
+
, len = toLength(O.length)
|
1058
|
+
, to = toIndex(target, len)
|
1059
|
+
, from = toIndex(start, len)
|
1060
|
+
, end = arguments[2]
|
1061
|
+
, fin = end === undefined ? len : toIndex(end, len)
|
1062
|
+
, count = min(fin - from, len - to)
|
1063
|
+
, inc = 1;
|
1064
|
+
if(from < to && to < from + count){
|
1065
|
+
inc = -1;
|
1066
|
+
from = from + count - 1;
|
1067
|
+
to = to + count - 1;
|
1068
|
+
}
|
1069
|
+
while(count-- > 0){
|
1070
|
+
if(from in O)O[to] = O[from];
|
1071
|
+
else delete O[to];
|
1072
|
+
to += inc;
|
1073
|
+
from += inc;
|
1074
|
+
} return O;
|
1075
|
+
},
|
1076
|
+
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
|
1077
|
+
fill: function(value /*, start = 0, end = @length */){
|
1078
|
+
var O = Object(assertDefined(this))
|
1079
|
+
, length = toLength(O.length)
|
1080
|
+
, index = toIndex(arguments[1], length)
|
1081
|
+
, end = arguments[2]
|
1082
|
+
, endPos = end === undefined ? length : toIndex(end, length);
|
1083
|
+
while(endPos > index)O[index++] = value;
|
1084
|
+
return O;
|
1085
|
+
},
|
1086
|
+
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
|
1087
|
+
find: createArrayMethod(5),
|
1088
|
+
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
|
1089
|
+
findIndex: createArrayMethod(6)
|
1090
|
+
});
|
1091
|
+
|
1092
|
+
if(framework){
|
1093
|
+
// 22.1.3.31 Array.prototype[@@unscopables]
|
1094
|
+
forEach.call(array('find,findIndex,fill,copyWithin,entries,keys,values'), function(it){
|
1095
|
+
ArrayUnscopables[it] = true;
|
1096
|
+
});
|
1097
|
+
SYMBOL_UNSCOPABLES in ArrayProto || hidden(ArrayProto, SYMBOL_UNSCOPABLES, ArrayUnscopables);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
setSpecies(Array);
|
1101
|
+
}();
|
1102
|
+
|
1103
|
+
/******************************************************************************
|
1104
|
+
* Module : es6.iterators *
|
1105
|
+
******************************************************************************/
|
1106
|
+
|
1107
|
+
!function(at){
|
1108
|
+
// 22.1.3.4 Array.prototype.entries()
|
1109
|
+
// 22.1.3.13 Array.prototype.keys()
|
1110
|
+
// 22.1.3.29 Array.prototype.values()
|
1111
|
+
// 22.1.3.30 Array.prototype[@@iterator]()
|
1112
|
+
defineStdIterators(Array, ARRAY, function(iterated, kind){
|
1113
|
+
set(this, ITER, {o: toObject(iterated), i: 0, k: kind});
|
1114
|
+
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
|
1115
|
+
}, function(){
|
1116
|
+
var iter = this[ITER]
|
1117
|
+
, O = iter.o
|
1118
|
+
, kind = iter.k
|
1119
|
+
, index = iter.i++;
|
1120
|
+
if(!O || index >= O.length){
|
1121
|
+
iter.o = undefined;
|
1122
|
+
return iterResult(1);
|
1123
|
+
}
|
1124
|
+
if(kind == KEY) return iterResult(0, index);
|
1125
|
+
if(kind == VALUE)return iterResult(0, O[index]);
|
1126
|
+
return iterResult(0, [index, O[index]]);
|
1127
|
+
}, VALUE);
|
1128
|
+
|
1129
|
+
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
|
1130
|
+
Iterators[ARGUMENTS] = Iterators[ARRAY];
|
1131
|
+
|
1132
|
+
// 21.1.3.27 String.prototype[@@iterator]()
|
1133
|
+
defineStdIterators(String, STRING, function(iterated){
|
1134
|
+
set(this, ITER, {o: String(iterated), i: 0});
|
1135
|
+
// 21.1.5.2.1 %StringIteratorPrototype%.next()
|
1136
|
+
}, function(){
|
1137
|
+
var iter = this[ITER]
|
1138
|
+
, O = iter.o
|
1139
|
+
, index = iter.i
|
1140
|
+
, point;
|
1141
|
+
if(index >= O.length)return iterResult(1);
|
1142
|
+
point = at.call(O, index);
|
1143
|
+
iter.i += point.length;
|
1144
|
+
return iterResult(0, point);
|
1145
|
+
});
|
1146
|
+
}(createPointAt(true));
|
1147
|
+
|
1148
|
+
/******************************************************************************
|
1149
|
+
* Module : es6.regexp *
|
1150
|
+
******************************************************************************/
|
1151
|
+
|
1152
|
+
!function(RegExpProto, _RegExp){
|
1153
|
+
function assertRegExpWrapper(fn){
|
1154
|
+
return function(){
|
1155
|
+
assert(cof(this) === REGEXP);
|
1156
|
+
return fn(this);
|
1157
|
+
}
|
1158
|
+
}
|
1159
|
+
|
1160
|
+
// RegExp allows a regex with flags as the pattern
|
1161
|
+
if(DESC && !function(){try{return RegExp(/a/g, 'i') == '/a/i'}catch(e){}}()){
|
1162
|
+
RegExp = function RegExp(pattern, flags){
|
1163
|
+
return new _RegExp(cof(pattern) == REGEXP && flags !== undefined
|
1164
|
+
? pattern.source : pattern, flags);
|
1165
|
+
}
|
1166
|
+
forEach.call(getNames(_RegExp), function(key){
|
1167
|
+
key in RegExp || defineProperty(RegExp, key, {
|
1168
|
+
configurable: true,
|
1169
|
+
get: function(){ return _RegExp[key] },
|
1170
|
+
set: function(it){ _RegExp[key] = it }
|
1171
|
+
});
|
1172
|
+
});
|
1173
|
+
RegExpProto[CONSTRUCTOR] = RegExp;
|
1174
|
+
RegExp[PROTOTYPE] = RegExpProto;
|
1175
|
+
hidden(global, REGEXP, RegExp);
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
// 21.2.5.3 get RegExp.prototype.flags()
|
1179
|
+
if(/./g.flags != 'g')defineProperty(RegExpProto, 'flags', {
|
1180
|
+
configurable: true,
|
1181
|
+
get: assertRegExpWrapper(createReplacer(/^.*\/(\w*)$/, '$1', true))
|
1182
|
+
});
|
1183
|
+
|
1184
|
+
// 21.2.5.12 get RegExp.prototype.sticky()
|
1185
|
+
// 21.2.5.15 get RegExp.prototype.unicode()
|
1186
|
+
forEach.call(array('sticky,unicode'), function(key){
|
1187
|
+
key in /./ || defineProperty(RegExpProto, key, DESC ? {
|
1188
|
+
configurable: true,
|
1189
|
+
get: assertRegExpWrapper(function(){
|
1190
|
+
return false;
|
1191
|
+
})
|
1192
|
+
} : descriptor(5, false));
|
1193
|
+
});
|
1194
|
+
|
1195
|
+
setSpecies(RegExp);
|
1196
|
+
}(RegExp[PROTOTYPE], RegExp);
|
1197
|
+
|
1198
|
+
/******************************************************************************
|
1199
|
+
* Module : web.immediate *
|
1200
|
+
******************************************************************************/
|
1201
|
+
|
1202
|
+
// setImmediate shim
|
1203
|
+
// Node.js 0.9+ & IE10+ has setImmediate, else:
|
1204
|
+
isFunction(setImmediate) && isFunction(clearImmediate) || function(ONREADYSTATECHANGE){
|
1205
|
+
var postMessage = global.postMessage
|
1206
|
+
, addEventListener = global.addEventListener
|
1207
|
+
, MessageChannel = global.MessageChannel
|
1208
|
+
, counter = 0
|
1209
|
+
, queue = {}
|
1210
|
+
, defer, channel, port;
|
1211
|
+
setImmediate = function(fn){
|
1212
|
+
var args = [], i = 1;
|
1213
|
+
while(arguments.length > i)args.push(arguments[i++]);
|
1214
|
+
queue[++counter] = function(){
|
1215
|
+
invoke(isFunction(fn) ? fn : Function(fn), args);
|
1216
|
+
}
|
1217
|
+
defer(counter);
|
1218
|
+
return counter;
|
1219
|
+
}
|
1220
|
+
clearImmediate = function(id){
|
1221
|
+
delete queue[id];
|
1222
|
+
}
|
1223
|
+
function run(id){
|
1224
|
+
if(has(queue, id)){
|
1225
|
+
var fn = queue[id];
|
1226
|
+
delete queue[id];
|
1227
|
+
fn();
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
function listner(event){
|
1231
|
+
run(event.data);
|
1232
|
+
}
|
1233
|
+
// Node.js 0.8-
|
1234
|
+
if(NODE){
|
1235
|
+
defer = function(id){
|
1236
|
+
nextTick(part.call(run, id));
|
1237
|
+
}
|
1238
|
+
// Modern browsers, skip implementation for WebWorkers
|
1239
|
+
// IE8 has postMessage, but it's sync & typeof its postMessage is object
|
1240
|
+
} else if(addEventListener && isFunction(postMessage) && !global.importScripts){
|
1241
|
+
defer = function(id){
|
1242
|
+
postMessage(id, '*');
|
1243
|
+
}
|
1244
|
+
addEventListener('message', listner, false);
|
1245
|
+
// WebWorkers
|
1246
|
+
} else if(isFunction(MessageChannel)){
|
1247
|
+
channel = new MessageChannel;
|
1248
|
+
port = channel.port2;
|
1249
|
+
channel.port1.onmessage = listner;
|
1250
|
+
defer = ctx(port.postMessage, port, 1);
|
1251
|
+
// IE8-
|
1252
|
+
} else if(document && ONREADYSTATECHANGE in document[CREATE_ELEMENT]('script')){
|
1253
|
+
defer = function(id){
|
1254
|
+
html.appendChild(document[CREATE_ELEMENT]('script'))[ONREADYSTATECHANGE] = function(){
|
1255
|
+
html.removeChild(this);
|
1256
|
+
run(id);
|
1257
|
+
}
|
1258
|
+
}
|
1259
|
+
// Rest old browsers
|
1260
|
+
} else {
|
1261
|
+
defer = function(id){
|
1262
|
+
setTimeout(run, 0, id);
|
1263
|
+
}
|
1264
|
+
}
|
1265
|
+
}('onreadystatechange');
|
1266
|
+
$define(GLOBAL + BIND, {
|
1267
|
+
setImmediate: setImmediate,
|
1268
|
+
clearImmediate: clearImmediate
|
1269
|
+
});
|
1270
|
+
|
1271
|
+
/******************************************************************************
|
1272
|
+
* Module : es6.promise *
|
1273
|
+
******************************************************************************/
|
1274
|
+
|
1275
|
+
// ES6 promises shim
|
1276
|
+
// Based on https://github.com/getify/native-promise-only/
|
1277
|
+
!function(Promise, test){
|
1278
|
+
isFunction(Promise) && isFunction(Promise.resolve)
|
1279
|
+
&& Promise.resolve(test = new Promise(function(){})) == test
|
1280
|
+
|| function(asap, DEF){
|
1281
|
+
function isThenable(o){
|
1282
|
+
var then;
|
1283
|
+
if(isObject(o))then = o.then;
|
1284
|
+
return isFunction(then) ? then : false;
|
1285
|
+
}
|
1286
|
+
function notify(def){
|
1287
|
+
var chain = def.chain;
|
1288
|
+
chain.length && asap(function(){
|
1289
|
+
var msg = def.msg
|
1290
|
+
, ok = def.state == 1
|
1291
|
+
, i = 0;
|
1292
|
+
while(chain.length > i)!function(react){
|
1293
|
+
var cb = ok ? react.ok : react.fail
|
1294
|
+
, ret, then;
|
1295
|
+
try {
|
1296
|
+
if(cb){
|
1297
|
+
ret = cb === true ? msg : cb(msg);
|
1298
|
+
if(ret === react.P){
|
1299
|
+
react.rej(TypeError(PROMISE + '-chain cycle'));
|
1300
|
+
} else if(then = isThenable(ret)){
|
1301
|
+
then.call(ret, react.res, react.rej);
|
1302
|
+
} else react.res(ret);
|
1303
|
+
} else react.rej(msg);
|
1304
|
+
} catch(err){
|
1305
|
+
react.rej(err);
|
1306
|
+
}
|
1307
|
+
}(chain[i++]);
|
1308
|
+
chain.length = 0;
|
1309
|
+
});
|
1310
|
+
}
|
1311
|
+
function resolve(msg){
|
1312
|
+
var def = this
|
1313
|
+
, then, wrapper;
|
1314
|
+
if(def.done)return;
|
1315
|
+
def.done = true;
|
1316
|
+
def = def.def || def; // unwrap
|
1317
|
+
try {
|
1318
|
+
if(then = isThenable(msg)){
|
1319
|
+
wrapper = {def: def, done: false}; // wrap
|
1320
|
+
then.call(msg, ctx(resolve, wrapper, 1), ctx(reject, wrapper, 1));
|
1321
|
+
} else {
|
1322
|
+
def.msg = msg;
|
1323
|
+
def.state = 1;
|
1324
|
+
notify(def);
|
1325
|
+
}
|
1326
|
+
} catch(err){
|
1327
|
+
reject.call(wrapper || {def: def, done: false}, err); // wrap
|
1328
|
+
}
|
1329
|
+
}
|
1330
|
+
function reject(msg){
|
1331
|
+
var def = this;
|
1332
|
+
if(def.done)return;
|
1333
|
+
def.done = true;
|
1334
|
+
def = def.def || def; // unwrap
|
1335
|
+
def.msg = msg;
|
1336
|
+
def.state = 2;
|
1337
|
+
notify(def);
|
1338
|
+
}
|
1339
|
+
function getConstructor(C){
|
1340
|
+
var S = assertObject(C)[SYMBOL_SPECIES];
|
1341
|
+
return S != undefined ? S : C;
|
1342
|
+
}
|
1343
|
+
// 25.4.3.1 Promise(executor)
|
1344
|
+
Promise = function(executor){
|
1345
|
+
assertFunction(executor);
|
1346
|
+
assertInstance(this, Promise, PROMISE);
|
1347
|
+
var def = {chain: [], state: 0, done: false, msg: undefined};
|
1348
|
+
hidden(this, DEF, def);
|
1349
|
+
try {
|
1350
|
+
executor(ctx(resolve, def, 1), ctx(reject, def, 1));
|
1351
|
+
} catch(err){
|
1352
|
+
reject.call(def, err);
|
1353
|
+
}
|
1354
|
+
}
|
1355
|
+
assignHidden(Promise[PROTOTYPE], {
|
1356
|
+
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
|
1357
|
+
then: function(onFulfilled, onRejected){
|
1358
|
+
var S = assertObject(assertObject(this)[CONSTRUCTOR])[SYMBOL_SPECIES];
|
1359
|
+
var react = {
|
1360
|
+
ok: isFunction(onFulfilled) ? onFulfilled : true,
|
1361
|
+
fail: isFunction(onRejected) ? onRejected : false
|
1362
|
+
} , P = react.P = new (S != undefined ? S : Promise)(function(resolve, reject){
|
1363
|
+
react.res = assertFunction(resolve);
|
1364
|
+
react.rej = assertFunction(reject);
|
1365
|
+
}), def = this[DEF];
|
1366
|
+
def.chain.push(react);
|
1367
|
+
def.state && notify(def);
|
1368
|
+
return P;
|
1369
|
+
},
|
1370
|
+
// 25.4.5.1 Promise.prototype.catch(onRejected)
|
1371
|
+
'catch': function(onRejected){
|
1372
|
+
return this.then(undefined, onRejected);
|
1373
|
+
}
|
1374
|
+
});
|
1375
|
+
assignHidden(Promise, {
|
1376
|
+
// 25.4.4.1 Promise.all(iterable)
|
1377
|
+
all: function(iterable){
|
1378
|
+
var Promise = getConstructor(this)
|
1379
|
+
, values = [];
|
1380
|
+
return new Promise(function(resolve, reject){
|
1381
|
+
forOf(iterable, false, push, values);
|
1382
|
+
var remaining = values.length
|
1383
|
+
, results = Array(remaining);
|
1384
|
+
if(remaining)forEach.call(values, function(promise, index){
|
1385
|
+
Promise.resolve(promise).then(function(value){
|
1386
|
+
results[index] = value;
|
1387
|
+
--remaining || resolve(results);
|
1388
|
+
}, reject);
|
1389
|
+
});
|
1390
|
+
else resolve(results);
|
1391
|
+
});
|
1392
|
+
},
|
1393
|
+
// 25.4.4.4 Promise.race(iterable)
|
1394
|
+
race: function(iterable){
|
1395
|
+
var Promise = getConstructor(this);
|
1396
|
+
return new Promise(function(resolve, reject){
|
1397
|
+
forOf(iterable, false, function(promise){
|
1398
|
+
Promise.resolve(promise).then(resolve, reject);
|
1399
|
+
});
|
1400
|
+
});
|
1401
|
+
},
|
1402
|
+
// 25.4.4.5 Promise.reject(r)
|
1403
|
+
reject: function(r){
|
1404
|
+
return new (getConstructor(this))(function(resolve, reject){
|
1405
|
+
reject(r);
|
1406
|
+
});
|
1407
|
+
},
|
1408
|
+
// 25.4.4.6 Promise.resolve(x)
|
1409
|
+
resolve: function(x){
|
1410
|
+
return isObject(x) && DEF in x && getPrototypeOf(x) === this[PROTOTYPE]
|
1411
|
+
? x : new (getConstructor(this))(function(resolve, reject){
|
1412
|
+
resolve(x);
|
1413
|
+
});
|
1414
|
+
}
|
1415
|
+
});
|
1416
|
+
}(nextTick || setImmediate, safeSymbol('def'));
|
1417
|
+
setToStringTag(Promise, PROMISE);
|
1418
|
+
setSpecies(Promise);
|
1419
|
+
$define(GLOBAL + FORCED * !isNative(Promise), {Promise: Promise});
|
1420
|
+
}(global[PROMISE]);
|
1421
|
+
|
1422
|
+
/******************************************************************************
|
1423
|
+
* Module : es6.collections *
|
1424
|
+
******************************************************************************/
|
1425
|
+
|
1426
|
+
// ECMAScript 6 collections shim
|
1427
|
+
!function(){
|
1428
|
+
var UID = safeSymbol('uid')
|
1429
|
+
, O1 = safeSymbol('O1')
|
1430
|
+
, WEAK = safeSymbol('weak')
|
1431
|
+
, LEAK = safeSymbol('leak')
|
1432
|
+
, LAST = safeSymbol('last')
|
1433
|
+
, FIRST = safeSymbol('first')
|
1434
|
+
, SIZE = DESC ? safeSymbol('size') : 'size'
|
1435
|
+
, uid = 0
|
1436
|
+
, tmp = {};
|
1437
|
+
|
1438
|
+
function getCollection(C, NAME, methods, commonMethods, isMap, isWeak){
|
1439
|
+
var ADDER = isMap ? 'set' : 'add'
|
1440
|
+
, proto = C && C[PROTOTYPE]
|
1441
|
+
, O = {};
|
1442
|
+
function initFromIterable(that, iterable){
|
1443
|
+
if(iterable != undefined)forOf(iterable, isMap, that[ADDER], that);
|
1444
|
+
return that;
|
1445
|
+
}
|
1446
|
+
function fixSVZ(key, chain){
|
1447
|
+
var method = proto[key];
|
1448
|
+
if(framework)proto[key] = function(a, b){
|
1449
|
+
var result = method.call(this, a === 0 ? 0 : a, b);
|
1450
|
+
return chain ? this : result;
|
1451
|
+
};
|
1452
|
+
}
|
1453
|
+
if(!isNative(C) || !(isWeak || (!BUGGY_ITERATORS && has(proto, FOR_EACH) && has(proto, 'entries')))){
|
1454
|
+
// create collection constructor
|
1455
|
+
C = isWeak
|
1456
|
+
? function(iterable){
|
1457
|
+
assertInstance(this, C, NAME);
|
1458
|
+
set(this, UID, uid++);
|
1459
|
+
initFromIterable(this, iterable);
|
1460
|
+
}
|
1461
|
+
: function(iterable){
|
1462
|
+
var that = this;
|
1463
|
+
assertInstance(that, C, NAME);
|
1464
|
+
set(that, O1, create(null));
|
1465
|
+
set(that, SIZE, 0);
|
1466
|
+
set(that, LAST, undefined);
|
1467
|
+
set(that, FIRST, undefined);
|
1468
|
+
initFromIterable(that, iterable);
|
1469
|
+
};
|
1470
|
+
assignHidden(assignHidden(C[PROTOTYPE], methods), commonMethods);
|
1471
|
+
isWeak || defineProperty(C[PROTOTYPE], 'size', {get: function(){
|
1472
|
+
return assertDefined(this[SIZE]);
|
1473
|
+
}});
|
1474
|
+
} else {
|
1475
|
+
var Native = C
|
1476
|
+
, inst = new C
|
1477
|
+
, chain = inst[ADDER](isWeak ? {} : -0, 1)
|
1478
|
+
, buggyZero;
|
1479
|
+
// wrap to init collections from iterable
|
1480
|
+
if(!NATIVE_ITERATORS || !C.length){
|
1481
|
+
C = function(iterable){
|
1482
|
+
assertInstance(this, C, NAME);
|
1483
|
+
return initFromIterable(new Native, iterable);
|
1484
|
+
}
|
1485
|
+
C[PROTOTYPE] = proto;
|
1486
|
+
if(framework)proto[CONSTRUCTOR] = C;
|
1487
|
+
}
|
1488
|
+
isWeak || inst[FOR_EACH](function(val, key){
|
1489
|
+
buggyZero = 1 / key === -Infinity;
|
1490
|
+
});
|
1491
|
+
// fix converting -0 key to +0
|
1492
|
+
if(buggyZero){
|
1493
|
+
fixSVZ('delete');
|
1494
|
+
fixSVZ('has');
|
1495
|
+
isMap && fixSVZ('get');
|
1496
|
+
}
|
1497
|
+
// + fix .add & .set for chaining
|
1498
|
+
if(buggyZero || chain !== inst)fixSVZ(ADDER, true);
|
1499
|
+
}
|
1500
|
+
setToStringTag(C, NAME);
|
1501
|
+
setSpecies(C);
|
1502
|
+
|
1503
|
+
O[NAME] = C;
|
1504
|
+
$define(GLOBAL + WRAP + FORCED * !isNative(C), O);
|
1505
|
+
|
1506
|
+
// add .keys, .values, .entries, [@@iterator]
|
1507
|
+
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
|
1508
|
+
isWeak || defineStdIterators(C, NAME, function(iterated, kind){
|
1509
|
+
set(this, ITER, {o: iterated, k: kind});
|
1510
|
+
}, function(){
|
1511
|
+
var iter = this[ITER]
|
1512
|
+
, kind = iter.k
|
1513
|
+
, entry = iter.l;
|
1514
|
+
// revert to the last existing entry
|
1515
|
+
while(entry && entry.r)entry = entry.p;
|
1516
|
+
// get next entry
|
1517
|
+
if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){
|
1518
|
+
// or finish the iteration
|
1519
|
+
iter.o = undefined;
|
1520
|
+
return iterResult(1);
|
1521
|
+
}
|
1522
|
+
// return step by kind
|
1523
|
+
if(kind == KEY) return iterResult(0, entry.k);
|
1524
|
+
if(kind == VALUE)return iterResult(0, entry.v);
|
1525
|
+
return iterResult(0, [entry.k, entry.v]);
|
1526
|
+
}, isMap ? KEY+VALUE : VALUE, !isMap);
|
1527
|
+
|
1528
|
+
return C;
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
function fastKey(it, create){
|
1532
|
+
// return primitive with prefix
|
1533
|
+
if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
|
1534
|
+
// can't set id to frozen object
|
1535
|
+
if(isFrozen(it))return 'F';
|
1536
|
+
if(!has(it, UID)){
|
1537
|
+
// not necessary to add id
|
1538
|
+
if(!create)return 'E';
|
1539
|
+
// add missing object id
|
1540
|
+
hidden(it, UID, ++uid);
|
1541
|
+
// return object id with prefix
|
1542
|
+
} return 'O' + it[UID];
|
1543
|
+
}
|
1544
|
+
function getEntry(that, key){
|
1545
|
+
// fast case
|
1546
|
+
var index = fastKey(key), entry;
|
1547
|
+
if(index != 'F')return that[O1][index];
|
1548
|
+
// frozen object case
|
1549
|
+
for(entry = that[FIRST]; entry; entry = entry.n){
|
1550
|
+
if(entry.k == key)return entry;
|
1551
|
+
}
|
1552
|
+
}
|
1553
|
+
function def(that, key, value){
|
1554
|
+
var entry = getEntry(that, key)
|
1555
|
+
, prev, index;
|
1556
|
+
// change existing entry
|
1557
|
+
if(entry)entry.v = value;
|
1558
|
+
// create new entry
|
1559
|
+
else {
|
1560
|
+
that[LAST] = entry = {
|
1561
|
+
i: index = fastKey(key, true), // <- index
|
1562
|
+
k: key, // <- key
|
1563
|
+
v: value, // <- value
|
1564
|
+
p: prev = that[LAST], // <- previous entry
|
1565
|
+
n: undefined, // <- next entry
|
1566
|
+
r: false // <- removed
|
1567
|
+
};
|
1568
|
+
if(!that[FIRST])that[FIRST] = entry;
|
1569
|
+
if(prev)prev.n = entry;
|
1570
|
+
that[SIZE]++;
|
1571
|
+
// add to index
|
1572
|
+
if(index != 'F')that[O1][index] = entry;
|
1573
|
+
} return that;
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
var collectionMethods = {
|
1577
|
+
// 23.1.3.1 Map.prototype.clear()
|
1578
|
+
// 23.2.3.2 Set.prototype.clear()
|
1579
|
+
clear: function(){
|
1580
|
+
for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){
|
1581
|
+
entry.r = true;
|
1582
|
+
if(entry.p)entry.p = entry.p.n = undefined;
|
1583
|
+
delete data[entry.i];
|
1584
|
+
}
|
1585
|
+
that[FIRST] = that[LAST] = undefined;
|
1586
|
+
that[SIZE] = 0;
|
1587
|
+
},
|
1588
|
+
// 23.1.3.3 Map.prototype.delete(key)
|
1589
|
+
// 23.2.3.4 Set.prototype.delete(value)
|
1590
|
+
'delete': function(key){
|
1591
|
+
var that = this
|
1592
|
+
, entry = getEntry(that, key);
|
1593
|
+
if(entry){
|
1594
|
+
var next = entry.n
|
1595
|
+
, prev = entry.p;
|
1596
|
+
delete that[O1][entry.i];
|
1597
|
+
entry.r = true;
|
1598
|
+
if(prev)prev.n = next;
|
1599
|
+
if(next)next.p = prev;
|
1600
|
+
if(that[FIRST] == entry)that[FIRST] = next;
|
1601
|
+
if(that[LAST] == entry)that[LAST] = prev;
|
1602
|
+
that[SIZE]--;
|
1603
|
+
} return !!entry;
|
1604
|
+
},
|
1605
|
+
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
|
1606
|
+
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
|
1607
|
+
forEach: function(callbackfn /*, that = undefined */){
|
1608
|
+
var f = ctx(callbackfn, arguments[1], 3)
|
1609
|
+
, entry;
|
1610
|
+
while(entry = entry ? entry.n : this[FIRST]){
|
1611
|
+
f(entry.v, entry.k, this);
|
1612
|
+
// revert to the last existing entry
|
1613
|
+
while(entry && entry.r)entry = entry.p;
|
1614
|
+
}
|
1615
|
+
},
|
1616
|
+
// 23.1.3.7 Map.prototype.has(key)
|
1617
|
+
// 23.2.3.7 Set.prototype.has(value)
|
1618
|
+
has: function(key){
|
1619
|
+
return !!getEntry(this, key);
|
1620
|
+
}
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
// 23.1 Map Objects
|
1624
|
+
Map = getCollection(Map, MAP, {
|
1625
|
+
// 23.1.3.6 Map.prototype.get(key)
|
1626
|
+
get: function(key){
|
1627
|
+
var entry = getEntry(this, key);
|
1628
|
+
return entry && entry.v;
|
1629
|
+
},
|
1630
|
+
// 23.1.3.9 Map.prototype.set(key, value)
|
1631
|
+
set: function(key, value){
|
1632
|
+
return def(this, key === 0 ? 0 : key, value);
|
1633
|
+
}
|
1634
|
+
}, collectionMethods, true);
|
1635
|
+
|
1636
|
+
// 23.2 Set Objects
|
1637
|
+
Set = getCollection(Set, SET, {
|
1638
|
+
// 23.2.3.1 Set.prototype.add(value)
|
1639
|
+
add: function(value){
|
1640
|
+
return def(this, value = value === 0 ? 0 : value, value);
|
1641
|
+
}
|
1642
|
+
}, collectionMethods);
|
1643
|
+
|
1644
|
+
function defWeak(that, key, value){
|
1645
|
+
if(isFrozen(assertObject(key)))leakStore(that).set(key, value);
|
1646
|
+
else {
|
1647
|
+
has(key, WEAK) || hidden(key, WEAK, {});
|
1648
|
+
key[WEAK][that[UID]] = value;
|
1649
|
+
} return that;
|
1650
|
+
}
|
1651
|
+
function leakStore(that){
|
1652
|
+
return that[LEAK] || hidden(that, LEAK, new Map)[LEAK];
|
1653
|
+
}
|
1654
|
+
|
1655
|
+
var weakMethods = {
|
1656
|
+
// 23.3.3.2 WeakMap.prototype.delete(key)
|
1657
|
+
// 23.4.3.3 WeakSet.prototype.delete(value)
|
1658
|
+
'delete': function(key){
|
1659
|
+
if(!isObject(key))return false;
|
1660
|
+
if(isFrozen(key))return leakStore(this)['delete'](key);
|
1661
|
+
return has(key, WEAK) && has(key[WEAK], this[UID]) && delete key[WEAK][this[UID]];
|
1662
|
+
},
|
1663
|
+
// 23.3.3.4 WeakMap.prototype.has(key)
|
1664
|
+
// 23.4.3.4 WeakSet.prototype.has(value)
|
1665
|
+
has: function(key){
|
1666
|
+
if(!isObject(key))return false;
|
1667
|
+
if(isFrozen(key))return leakStore(this).has(key);
|
1668
|
+
return has(key, WEAK) && has(key[WEAK], this[UID]);
|
1669
|
+
}
|
1670
|
+
};
|
1671
|
+
|
1672
|
+
// 23.3 WeakMap Objects
|
1673
|
+
WeakMap = getCollection(WeakMap, WEAKMAP, {
|
1674
|
+
// 23.3.3.3 WeakMap.prototype.get(key)
|
1675
|
+
get: function(key){
|
1676
|
+
if(isObject(key)){
|
1677
|
+
if(isFrozen(key))return leakStore(this).get(key);
|
1678
|
+
if(has(key, WEAK))return key[WEAK][this[UID]];
|
1679
|
+
}
|
1680
|
+
},
|
1681
|
+
// 23.3.3.5 WeakMap.prototype.set(key, value)
|
1682
|
+
set: function(key, value){
|
1683
|
+
return defWeak(this, key, value);
|
1684
|
+
}
|
1685
|
+
}, weakMethods, true, true);
|
1686
|
+
|
1687
|
+
// IE11 WeakMap frozen keys fix
|
1688
|
+
if(framework && new WeakMap().set(Object.freeze(tmp), 7).get(tmp) != 7){
|
1689
|
+
forEach.call(array('delete,has,get,set'), function(key){
|
1690
|
+
var method = WeakMap[PROTOTYPE][key];
|
1691
|
+
WeakMap[PROTOTYPE][key] = function(a, b){
|
1692
|
+
// store frozen objects on leaky map
|
1693
|
+
if(isObject(a) && isFrozen(a)){
|
1694
|
+
var result = leakStore(this)[key](a, b);
|
1695
|
+
return key == 'set' ? this : result;
|
1696
|
+
// store all the rest on native weakmap
|
1697
|
+
} return method.call(this, a, b);
|
1698
|
+
};
|
1699
|
+
});
|
1700
|
+
}
|
1701
|
+
|
1702
|
+
// 23.4 WeakSet Objects
|
1703
|
+
WeakSet = getCollection(WeakSet, WEAKSET, {
|
1704
|
+
// 23.4.3.1 WeakSet.prototype.add(value)
|
1705
|
+
add: function(value){
|
1706
|
+
return defWeak(this, value, true);
|
1707
|
+
}
|
1708
|
+
}, weakMethods, false, true);
|
1709
|
+
}();
|
1710
|
+
|
1711
|
+
/******************************************************************************
|
1712
|
+
* Module : es6.reflect *
|
1713
|
+
******************************************************************************/
|
1714
|
+
|
1715
|
+
!function(){
|
1716
|
+
function Enumerate(iterated){
|
1717
|
+
var keys = [], key;
|
1718
|
+
for(key in iterated)keys.push(key);
|
1719
|
+
set(this, ITER, {o: iterated, a: keys, i: 0});
|
1720
|
+
}
|
1721
|
+
createIterator(Enumerate, OBJECT, function(){
|
1722
|
+
var iter = this[ITER]
|
1723
|
+
, keys = iter.a
|
1724
|
+
, key;
|
1725
|
+
do {
|
1726
|
+
if(iter.i >= keys.length)return iterResult(1);
|
1727
|
+
} while(!((key = keys[iter.i++]) in iter.o));
|
1728
|
+
return iterResult(0, key);
|
1729
|
+
});
|
1730
|
+
|
1731
|
+
function wrap(fn){
|
1732
|
+
return function(it){
|
1733
|
+
assertObject(it);
|
1734
|
+
try {
|
1735
|
+
return fn.apply(undefined, arguments), true;
|
1736
|
+
} catch(e){
|
1737
|
+
return false;
|
1738
|
+
}
|
1739
|
+
}
|
1740
|
+
}
|
1741
|
+
|
1742
|
+
function reflectGet(target, propertyKey/*, receiver*/){
|
1743
|
+
var receiver = arguments.length < 3 ? target : arguments[2]
|
1744
|
+
, desc = getOwnDescriptor(assertObject(target), propertyKey), proto;
|
1745
|
+
if(desc)return has(desc, 'value')
|
1746
|
+
? desc.value
|
1747
|
+
: desc.get === undefined
|
1748
|
+
? undefined
|
1749
|
+
: desc.get.call(receiver);
|
1750
|
+
return isObject(proto = getPrototypeOf(target))
|
1751
|
+
? reflectGet(proto, propertyKey, receiver)
|
1752
|
+
: undefined;
|
1753
|
+
}
|
1754
|
+
function reflectSet(target, propertyKey, V/*, receiver*/){
|
1755
|
+
var receiver = arguments.length < 4 ? target : arguments[3]
|
1756
|
+
, ownDesc = getOwnDescriptor(assertObject(target), propertyKey)
|
1757
|
+
, existingDescriptor, proto;
|
1758
|
+
if(!ownDesc){
|
1759
|
+
if(isObject(proto = getPrototypeOf(target))){
|
1760
|
+
return reflectSet(proto, propertyKey, V, receiver);
|
1761
|
+
}
|
1762
|
+
ownDesc = descriptor(0);
|
1763
|
+
}
|
1764
|
+
if(has(ownDesc, 'value')){
|
1765
|
+
if(ownDesc.writable === false || !isObject(receiver))return false;
|
1766
|
+
existingDescriptor = getOwnDescriptor(receiver, propertyKey) || descriptor(0);
|
1767
|
+
existingDescriptor.value = V;
|
1768
|
+
return defineProperty(receiver, propertyKey, existingDescriptor), true;
|
1769
|
+
}
|
1770
|
+
return ownDesc.set === undefined
|
1771
|
+
? false
|
1772
|
+
: (ownDesc.set.call(receiver, V), true);
|
1773
|
+
}
|
1774
|
+
var isExtensible = Object.isExtensible || returnIt;
|
1775
|
+
|
1776
|
+
var reflect = {
|
1777
|
+
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
|
1778
|
+
apply: ctx(call, apply, 3),
|
1779
|
+
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
|
1780
|
+
construct: construct,
|
1781
|
+
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
|
1782
|
+
defineProperty: wrap(defineProperty),
|
1783
|
+
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
|
1784
|
+
deleteProperty: function(target, propertyKey){
|
1785
|
+
var desc = getOwnDescriptor(assertObject(target), propertyKey);
|
1786
|
+
return desc && !desc.configurable ? false : delete target[propertyKey];
|
1787
|
+
},
|
1788
|
+
// 26.1.5 Reflect.enumerate(target)
|
1789
|
+
enumerate: function(target){
|
1790
|
+
return new Enumerate(assertObject(target));
|
1791
|
+
},
|
1792
|
+
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
|
1793
|
+
get: reflectGet,
|
1794
|
+
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
|
1795
|
+
getOwnPropertyDescriptor: function(target, propertyKey){
|
1796
|
+
return getOwnDescriptor(assertObject(target), propertyKey);
|
1797
|
+
},
|
1798
|
+
// 26.1.8 Reflect.getPrototypeOf(target)
|
1799
|
+
getPrototypeOf: function(target){
|
1800
|
+
return getPrototypeOf(assertObject(target));
|
1801
|
+
},
|
1802
|
+
// 26.1.9 Reflect.has(target, propertyKey)
|
1803
|
+
has: function(target, propertyKey){
|
1804
|
+
return propertyKey in target;
|
1805
|
+
},
|
1806
|
+
// 26.1.10 Reflect.isExtensible(target)
|
1807
|
+
isExtensible: function(target){
|
1808
|
+
return !!isExtensible(assertObject(target));
|
1809
|
+
},
|
1810
|
+
// 26.1.11 Reflect.ownKeys(target)
|
1811
|
+
ownKeys: ownKeys,
|
1812
|
+
// 26.1.12 Reflect.preventExtensions(target)
|
1813
|
+
preventExtensions: wrap(Object.preventExtensions || returnIt),
|
1814
|
+
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
|
1815
|
+
set: reflectSet
|
1816
|
+
}
|
1817
|
+
// 26.1.14 Reflect.setPrototypeOf(target, proto)
|
1818
|
+
if(setPrototypeOf)reflect.setPrototypeOf = function(target, proto){
|
1819
|
+
return setPrototypeOf(assertObject(target), proto), true;
|
1820
|
+
};
|
1821
|
+
|
1822
|
+
$define(GLOBAL, {Reflect: {}});
|
1823
|
+
$define(STATIC, 'Reflect', reflect);
|
1824
|
+
}();
|
1825
|
+
|
1826
|
+
/******************************************************************************
|
1827
|
+
* Module : es7.proposals *
|
1828
|
+
******************************************************************************/
|
1829
|
+
|
1830
|
+
!function(){
|
1831
|
+
$define(PROTO, ARRAY, {
|
1832
|
+
// https://github.com/domenic/Array.prototype.includes
|
1833
|
+
includes: createArrayContains(true)
|
1834
|
+
});
|
1835
|
+
$define(PROTO, STRING, {
|
1836
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
1837
|
+
at: createPointAt(true)
|
1838
|
+
});
|
1839
|
+
|
1840
|
+
function createObjectToArray(isEntries){
|
1841
|
+
return function(object){
|
1842
|
+
var O = toObject(object)
|
1843
|
+
, keys = getKeys(object)
|
1844
|
+
, length = keys.length
|
1845
|
+
, i = 0
|
1846
|
+
, result = Array(length)
|
1847
|
+
, key;
|
1848
|
+
if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]];
|
1849
|
+
else while(length > i)result[i] = O[keys[i++]];
|
1850
|
+
return result;
|
1851
|
+
}
|
1852
|
+
}
|
1853
|
+
$define(STATIC, OBJECT, {
|
1854
|
+
// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-9.md#51-objectentries-objectvalues
|
1855
|
+
values: createObjectToArray(false),
|
1856
|
+
entries: createObjectToArray(true)
|
1857
|
+
});
|
1858
|
+
$define(STATIC, REGEXP, {
|
1859
|
+
// https://gist.github.com/kangax/9698100
|
1860
|
+
escape: createReplacer(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
|
1861
|
+
});
|
1862
|
+
}();
|
1863
|
+
|
1864
|
+
/******************************************************************************
|
1865
|
+
* Module : es7.abstract-refs *
|
1866
|
+
******************************************************************************/
|
1867
|
+
|
1868
|
+
// https://github.com/zenparsing/es-abstract-refs
|
1869
|
+
!function(REFERENCE){
|
1870
|
+
REFERENCE_GET = getWellKnownSymbol(REFERENCE+'Get', true);
|
1871
|
+
var REFERENCE_SET = getWellKnownSymbol(REFERENCE+SET, true)
|
1872
|
+
, REFERENCE_DELETE = getWellKnownSymbol(REFERENCE+'Delete', true);
|
1873
|
+
|
1874
|
+
$define(STATIC, SYMBOL, {
|
1875
|
+
referenceGet: REFERENCE_GET,
|
1876
|
+
referenceSet: REFERENCE_SET,
|
1877
|
+
referenceDelete: REFERENCE_DELETE
|
1878
|
+
});
|
1879
|
+
|
1880
|
+
hidden(FunctionProto, REFERENCE_GET, returnThis);
|
1881
|
+
|
1882
|
+
function setMapMethods(Constructor){
|
1883
|
+
if(Constructor){
|
1884
|
+
var MapProto = Constructor[PROTOTYPE];
|
1885
|
+
hidden(MapProto, REFERENCE_GET, MapProto.get);
|
1886
|
+
hidden(MapProto, REFERENCE_SET, MapProto.set);
|
1887
|
+
hidden(MapProto, REFERENCE_DELETE, MapProto['delete']);
|
1888
|
+
}
|
1889
|
+
}
|
1890
|
+
setMapMethods(Map);
|
1891
|
+
setMapMethods(WeakMap);
|
1892
|
+
}('reference');
|
1893
|
+
|
1894
|
+
/******************************************************************************
|
1895
|
+
* Module : js.array.statics *
|
1896
|
+
******************************************************************************/
|
1897
|
+
|
1898
|
+
// JavaScript 1.6 / Strawman array statics shim
|
1899
|
+
!function(arrayStatics){
|
1900
|
+
function setArrayStatics(keys, length){
|
1901
|
+
forEach.call(array(keys), function(key){
|
1902
|
+
if(key in ArrayProto)arrayStatics[key] = ctx(call, ArrayProto[key], length);
|
1903
|
+
});
|
1904
|
+
}
|
1905
|
+
setArrayStatics('pop,reverse,shift,keys,values,entries', 1);
|
1906
|
+
setArrayStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
|
1907
|
+
setArrayStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
|
1908
|
+
'reduce,reduceRight,copyWithin,fill,turn');
|
1909
|
+
$define(STATIC, ARRAY, arrayStatics);
|
1910
|
+
}({});
|
1911
|
+
|
1912
|
+
/******************************************************************************
|
1913
|
+
* Module : web.dom.itarable *
|
1914
|
+
******************************************************************************/
|
1915
|
+
|
1916
|
+
!function(NodeList){
|
1917
|
+
if(framework && NodeList && !(SYMBOL_ITERATOR in NodeList[PROTOTYPE])){
|
1918
|
+
hidden(NodeList[PROTOTYPE], SYMBOL_ITERATOR, Iterators[ARRAY]);
|
1919
|
+
}
|
1920
|
+
Iterators.NodeList = Iterators[ARRAY];
|
1921
|
+
}(global.NodeList);
|
1922
|
+
}(typeof self != 'undefined' && self.Math === Math ? self : Function('return this')(), true);
|
1923
|
+
},{}],3:[function(require,module,exports){
|
1924
|
+
(function (global){
|
1925
|
+
/**
|
1926
|
+
* Copyright (c) 2014, Facebook, Inc.
|
1927
|
+
* All rights reserved.
|
1928
|
+
*
|
1929
|
+
* This source code is licensed under the BSD-style license found in the
|
1930
|
+
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
|
1931
|
+
* additional grant of patent rights can be found in the PATENTS file in
|
1932
|
+
* the same directory.
|
1933
|
+
*/
|
1934
|
+
|
1935
|
+
!(function(global) {
|
1936
|
+
"use strict";
|
1937
|
+
|
1938
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
1939
|
+
var undefined; // More compressible than void 0.
|
1940
|
+
var iteratorSymbol =
|
1941
|
+
typeof Symbol === "function" && Symbol.iterator || "@@iterator";
|
1942
|
+
|
1943
|
+
var inModule = typeof module === "object";
|
1944
|
+
var runtime = global.regeneratorRuntime;
|
1945
|
+
if (runtime) {
|
1946
|
+
if (inModule) {
|
1947
|
+
// If regeneratorRuntime is defined globally and we're in a module,
|
1948
|
+
// make the exports object identical to regeneratorRuntime.
|
1949
|
+
module.exports = runtime;
|
1950
|
+
}
|
1951
|
+
// Don't bother evaluating the rest of this file if the runtime was
|
1952
|
+
// already defined globally.
|
1953
|
+
return;
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
// Define the runtime globally (as expected by generated code) as either
|
1957
|
+
// module.exports (if we're in a module) or a new, empty object.
|
1958
|
+
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
1959
|
+
|
1960
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
1961
|
+
return new Generator(innerFn, outerFn, self || null, tryLocsList || []);
|
1962
|
+
}
|
1963
|
+
runtime.wrap = wrap;
|
1964
|
+
|
1965
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
1966
|
+
// record like context.tryEntries[i].completion. This interface could
|
1967
|
+
// have been (and was previously) designed to take a closure to be
|
1968
|
+
// invoked without arguments, but in all the cases we care about we
|
1969
|
+
// already have an existing method we want to call, so there's no need
|
1970
|
+
// to create a new function object. We can even get away with assuming
|
1971
|
+
// the method takes exactly one argument, since that happens to be true
|
1972
|
+
// in every case, so we don't have to touch the arguments object. The
|
1973
|
+
// only additional allocation required is the completion record, which
|
1974
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
1975
|
+
function tryCatch(fn, obj, arg) {
|
1976
|
+
try {
|
1977
|
+
return { type: "normal", arg: fn.call(obj, arg) };
|
1978
|
+
} catch (err) {
|
1979
|
+
return { type: "throw", arg: err };
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
var GenStateSuspendedStart = "suspendedStart";
|
1984
|
+
var GenStateSuspendedYield = "suspendedYield";
|
1985
|
+
var GenStateExecuting = "executing";
|
1986
|
+
var GenStateCompleted = "completed";
|
1987
|
+
|
1988
|
+
// Returning this object from the innerFn has the same effect as
|
1989
|
+
// breaking out of the dispatch switch statement.
|
1990
|
+
var ContinueSentinel = {};
|
1991
|
+
|
1992
|
+
// Dummy constructor functions that we use as the .constructor and
|
1993
|
+
// .constructor.prototype properties for functions that return Generator
|
1994
|
+
// objects. For full spec compliance, you may wish to configure your
|
1995
|
+
// minifier not to mangle the names of these two functions.
|
1996
|
+
function GeneratorFunction() {}
|
1997
|
+
function GeneratorFunctionPrototype() {}
|
1998
|
+
|
1999
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
|
2000
|
+
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
2001
|
+
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
2002
|
+
GeneratorFunction.displayName = "GeneratorFunction";
|
2003
|
+
|
2004
|
+
runtime.isGeneratorFunction = function(genFun) {
|
2005
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
2006
|
+
return ctor
|
2007
|
+
? ctor === GeneratorFunction ||
|
2008
|
+
// For the native GeneratorFunction constructor, the best we can
|
2009
|
+
// do is to check its .name property.
|
2010
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
2011
|
+
: false;
|
2012
|
+
};
|
2013
|
+
|
2014
|
+
runtime.mark = function(genFun) {
|
2015
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
2016
|
+
genFun.prototype = Object.create(Gp);
|
2017
|
+
return genFun;
|
2018
|
+
};
|
2019
|
+
|
2020
|
+
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
2021
|
+
return new Promise(function(resolve, reject) {
|
2022
|
+
var generator = wrap(innerFn, outerFn, self, tryLocsList);
|
2023
|
+
var callNext = step.bind(generator.next);
|
2024
|
+
var callThrow = step.bind(generator["throw"]);
|
2025
|
+
|
2026
|
+
function step(arg) {
|
2027
|
+
var record = tryCatch(this, null, arg);
|
2028
|
+
if (record.type === "throw") {
|
2029
|
+
reject(record.arg);
|
2030
|
+
return;
|
2031
|
+
}
|
2032
|
+
|
2033
|
+
var info = record.arg;
|
2034
|
+
if (info.done) {
|
2035
|
+
resolve(info.value);
|
2036
|
+
} else {
|
2037
|
+
Promise.resolve(info.value).then(callNext, callThrow);
|
2038
|
+
}
|
2039
|
+
}
|
2040
|
+
|
2041
|
+
callNext();
|
2042
|
+
});
|
2043
|
+
};
|
2044
|
+
|
2045
|
+
function Generator(innerFn, outerFn, self, tryLocsList) {
|
2046
|
+
var generator = outerFn ? Object.create(outerFn.prototype) : this;
|
2047
|
+
var context = new Context(tryLocsList);
|
2048
|
+
var state = GenStateSuspendedStart;
|
2049
|
+
|
2050
|
+
function invoke(method, arg) {
|
2051
|
+
if (state === GenStateExecuting) {
|
2052
|
+
throw new Error("Generator is already running");
|
2053
|
+
}
|
2054
|
+
|
2055
|
+
if (state === GenStateCompleted) {
|
2056
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
2057
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
2058
|
+
return doneResult();
|
2059
|
+
}
|
2060
|
+
|
2061
|
+
while (true) {
|
2062
|
+
var delegate = context.delegate;
|
2063
|
+
if (delegate) {
|
2064
|
+
var record = tryCatch(
|
2065
|
+
delegate.iterator[method],
|
2066
|
+
delegate.iterator,
|
2067
|
+
arg
|
2068
|
+
);
|
2069
|
+
|
2070
|
+
if (record.type === "throw") {
|
2071
|
+
context.delegate = null;
|
2072
|
+
|
2073
|
+
// Like returning generator.throw(uncaught), but without the
|
2074
|
+
// overhead of an extra function call.
|
2075
|
+
method = "throw";
|
2076
|
+
arg = record.arg;
|
2077
|
+
|
2078
|
+
continue;
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
// Delegate generator ran and handled its own exceptions so
|
2082
|
+
// regardless of what the method was, we continue as if it is
|
2083
|
+
// "next" with an undefined arg.
|
2084
|
+
method = "next";
|
2085
|
+
arg = undefined;
|
2086
|
+
|
2087
|
+
var info = record.arg;
|
2088
|
+
if (info.done) {
|
2089
|
+
context[delegate.resultName] = info.value;
|
2090
|
+
context.next = delegate.nextLoc;
|
2091
|
+
} else {
|
2092
|
+
state = GenStateSuspendedYield;
|
2093
|
+
return info;
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
context.delegate = null;
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
if (method === "next") {
|
2100
|
+
if (state === GenStateSuspendedStart &&
|
2101
|
+
typeof arg !== "undefined") {
|
2102
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
2103
|
+
throw new TypeError(
|
2104
|
+
"attempt to send " + JSON.stringify(arg) + " to newborn generator"
|
2105
|
+
);
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
if (state === GenStateSuspendedYield) {
|
2109
|
+
context.sent = arg;
|
2110
|
+
} else {
|
2111
|
+
delete context.sent;
|
2112
|
+
}
|
2113
|
+
|
2114
|
+
} else if (method === "throw") {
|
2115
|
+
if (state === GenStateSuspendedStart) {
|
2116
|
+
state = GenStateCompleted;
|
2117
|
+
throw arg;
|
2118
|
+
}
|
2119
|
+
|
2120
|
+
if (context.dispatchException(arg)) {
|
2121
|
+
// If the dispatched exception was caught by a catch block,
|
2122
|
+
// then let that catch block handle the exception normally.
|
2123
|
+
method = "next";
|
2124
|
+
arg = undefined;
|
2125
|
+
}
|
2126
|
+
|
2127
|
+
} else if (method === "return") {
|
2128
|
+
context.abrupt("return", arg);
|
2129
|
+
}
|
2130
|
+
|
2131
|
+
state = GenStateExecuting;
|
2132
|
+
|
2133
|
+
var record = tryCatch(innerFn, self, context);
|
2134
|
+
if (record.type === "normal") {
|
2135
|
+
// If an exception is thrown from innerFn, we leave state ===
|
2136
|
+
// GenStateExecuting and loop back for another invocation.
|
2137
|
+
state = context.done
|
2138
|
+
? GenStateCompleted
|
2139
|
+
: GenStateSuspendedYield;
|
2140
|
+
|
2141
|
+
var info = {
|
2142
|
+
value: record.arg,
|
2143
|
+
done: context.done
|
2144
|
+
};
|
2145
|
+
|
2146
|
+
if (record.arg === ContinueSentinel) {
|
2147
|
+
if (context.delegate && method === "next") {
|
2148
|
+
// Deliberately forget the last sent value so that we don't
|
2149
|
+
// accidentally pass it on to the delegate.
|
2150
|
+
arg = undefined;
|
2151
|
+
}
|
2152
|
+
} else {
|
2153
|
+
return info;
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
} else if (record.type === "throw") {
|
2157
|
+
state = GenStateCompleted;
|
2158
|
+
|
2159
|
+
if (method === "next") {
|
2160
|
+
context.dispatchException(record.arg);
|
2161
|
+
} else {
|
2162
|
+
arg = record.arg;
|
2163
|
+
}
|
2164
|
+
}
|
2165
|
+
}
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
generator.next = invoke.bind(generator, "next");
|
2169
|
+
generator["throw"] = invoke.bind(generator, "throw");
|
2170
|
+
generator["return"] = invoke.bind(generator, "return");
|
2171
|
+
|
2172
|
+
return generator;
|
2173
|
+
}
|
2174
|
+
|
2175
|
+
Gp[iteratorSymbol] = function() {
|
2176
|
+
return this;
|
2177
|
+
};
|
2178
|
+
|
2179
|
+
Gp.toString = function() {
|
2180
|
+
return "[object Generator]";
|
2181
|
+
};
|
2182
|
+
|
2183
|
+
function pushTryEntry(locs) {
|
2184
|
+
var entry = { tryLoc: locs[0] };
|
2185
|
+
|
2186
|
+
if (1 in locs) {
|
2187
|
+
entry.catchLoc = locs[1];
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
if (2 in locs) {
|
2191
|
+
entry.finallyLoc = locs[2];
|
2192
|
+
entry.afterLoc = locs[3];
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
this.tryEntries.push(entry);
|
2196
|
+
}
|
2197
|
+
|
2198
|
+
function resetTryEntry(entry) {
|
2199
|
+
var record = entry.completion || {};
|
2200
|
+
record.type = "normal";
|
2201
|
+
delete record.arg;
|
2202
|
+
entry.completion = record;
|
2203
|
+
}
|
2204
|
+
|
2205
|
+
function Context(tryLocsList) {
|
2206
|
+
// The root entry object (effectively a try statement without a catch
|
2207
|
+
// or a finally block) gives us a place to store values thrown from
|
2208
|
+
// locations where there is no enclosing try statement.
|
2209
|
+
this.tryEntries = [{ tryLoc: "root" }];
|
2210
|
+
tryLocsList.forEach(pushTryEntry, this);
|
2211
|
+
this.reset();
|
2212
|
+
}
|
2213
|
+
|
2214
|
+
runtime.keys = function(object) {
|
2215
|
+
var keys = [];
|
2216
|
+
for (var key in object) {
|
2217
|
+
keys.push(key);
|
2218
|
+
}
|
2219
|
+
keys.reverse();
|
2220
|
+
|
2221
|
+
// Rather than returning an object with a next method, we keep
|
2222
|
+
// things simple and return the next function itself.
|
2223
|
+
return function next() {
|
2224
|
+
while (keys.length) {
|
2225
|
+
var key = keys.pop();
|
2226
|
+
if (key in object) {
|
2227
|
+
next.value = key;
|
2228
|
+
next.done = false;
|
2229
|
+
return next;
|
2230
|
+
}
|
2231
|
+
}
|
2232
|
+
|
2233
|
+
// To avoid creating an additional object, we just hang the .value
|
2234
|
+
// and .done properties off the next function object itself. This
|
2235
|
+
// also ensures that the minifier will not anonymize the function.
|
2236
|
+
next.done = true;
|
2237
|
+
return next;
|
2238
|
+
};
|
2239
|
+
};
|
2240
|
+
|
2241
|
+
function values(iterable) {
|
2242
|
+
if (iterable) {
|
2243
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
2244
|
+
if (iteratorMethod) {
|
2245
|
+
return iteratorMethod.call(iterable);
|
2246
|
+
}
|
2247
|
+
|
2248
|
+
if (typeof iterable.next === "function") {
|
2249
|
+
return iterable;
|
2250
|
+
}
|
2251
|
+
|
2252
|
+
if (!isNaN(iterable.length)) {
|
2253
|
+
var i = -1, next = function next() {
|
2254
|
+
while (++i < iterable.length) {
|
2255
|
+
if (hasOwn.call(iterable, i)) {
|
2256
|
+
next.value = iterable[i];
|
2257
|
+
next.done = false;
|
2258
|
+
return next;
|
2259
|
+
}
|
2260
|
+
}
|
2261
|
+
|
2262
|
+
next.value = undefined;
|
2263
|
+
next.done = true;
|
2264
|
+
|
2265
|
+
return next;
|
2266
|
+
};
|
2267
|
+
|
2268
|
+
return next.next = next;
|
2269
|
+
}
|
2270
|
+
}
|
2271
|
+
|
2272
|
+
// Return an iterator with no values.
|
2273
|
+
return { next: doneResult };
|
2274
|
+
}
|
2275
|
+
runtime.values = values;
|
2276
|
+
|
2277
|
+
function doneResult() {
|
2278
|
+
return { value: undefined, done: true };
|
2279
|
+
}
|
2280
|
+
|
2281
|
+
Context.prototype = {
|
2282
|
+
constructor: Context,
|
2283
|
+
|
2284
|
+
reset: function() {
|
2285
|
+
this.prev = 0;
|
2286
|
+
this.next = 0;
|
2287
|
+
this.sent = undefined;
|
2288
|
+
this.done = false;
|
2289
|
+
this.delegate = null;
|
2290
|
+
|
2291
|
+
this.tryEntries.forEach(resetTryEntry);
|
2292
|
+
|
2293
|
+
// Pre-initialize at least 20 temporary variables to enable hidden
|
2294
|
+
// class optimizations for simple generators.
|
2295
|
+
for (var tempIndex = 0, tempName;
|
2296
|
+
hasOwn.call(this, tempName = "t" + tempIndex) || tempIndex < 20;
|
2297
|
+
++tempIndex) {
|
2298
|
+
this[tempName] = null;
|
2299
|
+
}
|
2300
|
+
},
|
2301
|
+
|
2302
|
+
stop: function() {
|
2303
|
+
this.done = true;
|
2304
|
+
|
2305
|
+
var rootEntry = this.tryEntries[0];
|
2306
|
+
var rootRecord = rootEntry.completion;
|
2307
|
+
if (rootRecord.type === "throw") {
|
2308
|
+
throw rootRecord.arg;
|
2309
|
+
}
|
2310
|
+
|
2311
|
+
return this.rval;
|
2312
|
+
},
|
2313
|
+
|
2314
|
+
dispatchException: function(exception) {
|
2315
|
+
if (this.done) {
|
2316
|
+
throw exception;
|
2317
|
+
}
|
2318
|
+
|
2319
|
+
var context = this;
|
2320
|
+
function handle(loc, caught) {
|
2321
|
+
record.type = "throw";
|
2322
|
+
record.arg = exception;
|
2323
|
+
context.next = loc;
|
2324
|
+
return !!caught;
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
2328
|
+
var entry = this.tryEntries[i];
|
2329
|
+
var record = entry.completion;
|
2330
|
+
|
2331
|
+
if (entry.tryLoc === "root") {
|
2332
|
+
// Exception thrown outside of any try block that could handle
|
2333
|
+
// it, so set the completion value of the entire function to
|
2334
|
+
// throw the exception.
|
2335
|
+
return handle("end");
|
2336
|
+
}
|
2337
|
+
|
2338
|
+
if (entry.tryLoc <= this.prev) {
|
2339
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
2340
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
2341
|
+
|
2342
|
+
if (hasCatch && hasFinally) {
|
2343
|
+
if (this.prev < entry.catchLoc) {
|
2344
|
+
return handle(entry.catchLoc, true);
|
2345
|
+
} else if (this.prev < entry.finallyLoc) {
|
2346
|
+
return handle(entry.finallyLoc);
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
} else if (hasCatch) {
|
2350
|
+
if (this.prev < entry.catchLoc) {
|
2351
|
+
return handle(entry.catchLoc, true);
|
2352
|
+
}
|
2353
|
+
|
2354
|
+
} else if (hasFinally) {
|
2355
|
+
if (this.prev < entry.finallyLoc) {
|
2356
|
+
return handle(entry.finallyLoc);
|
2357
|
+
}
|
2358
|
+
|
2359
|
+
} else {
|
2360
|
+
throw new Error("try statement without catch or finally");
|
2361
|
+
}
|
2362
|
+
}
|
2363
|
+
}
|
2364
|
+
},
|
2365
|
+
|
2366
|
+
_findFinallyEntry: function(finallyLoc) {
|
2367
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
2368
|
+
var entry = this.tryEntries[i];
|
2369
|
+
if (entry.tryLoc <= this.prev &&
|
2370
|
+
hasOwn.call(entry, "finallyLoc") && (
|
2371
|
+
entry.finallyLoc === finallyLoc ||
|
2372
|
+
this.prev < entry.finallyLoc)) {
|
2373
|
+
return entry;
|
2374
|
+
}
|
2375
|
+
}
|
2376
|
+
},
|
2377
|
+
|
2378
|
+
abrupt: function(type, arg) {
|
2379
|
+
var entry = this._findFinallyEntry();
|
2380
|
+
var record = entry ? entry.completion : {};
|
2381
|
+
|
2382
|
+
record.type = type;
|
2383
|
+
record.arg = arg;
|
2384
|
+
|
2385
|
+
if (entry) {
|
2386
|
+
this.next = entry.finallyLoc;
|
2387
|
+
} else {
|
2388
|
+
this.complete(record);
|
2389
|
+
}
|
2390
|
+
|
2391
|
+
return ContinueSentinel;
|
2392
|
+
},
|
2393
|
+
|
2394
|
+
complete: function(record, afterLoc) {
|
2395
|
+
if (record.type === "throw") {
|
2396
|
+
throw record.arg;
|
2397
|
+
}
|
2398
|
+
|
2399
|
+
if (record.type === "break" ||
|
2400
|
+
record.type === "continue") {
|
2401
|
+
this.next = record.arg;
|
2402
|
+
} else if (record.type === "return") {
|
2403
|
+
this.rval = record.arg;
|
2404
|
+
this.next = "end";
|
2405
|
+
} else if (record.type === "normal" && afterLoc) {
|
2406
|
+
this.next = afterLoc;
|
2407
|
+
}
|
2408
|
+
|
2409
|
+
return ContinueSentinel;
|
2410
|
+
},
|
2411
|
+
|
2412
|
+
finish: function(finallyLoc) {
|
2413
|
+
var entry = this._findFinallyEntry(finallyLoc);
|
2414
|
+
return this.complete(entry.completion, entry.afterLoc);
|
2415
|
+
},
|
2416
|
+
|
2417
|
+
"catch": function(tryLoc) {
|
2418
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
2419
|
+
var entry = this.tryEntries[i];
|
2420
|
+
if (entry.tryLoc === tryLoc) {
|
2421
|
+
var record = entry.completion;
|
2422
|
+
if (record.type === "throw") {
|
2423
|
+
var thrown = record.arg;
|
2424
|
+
resetTryEntry(entry);
|
2425
|
+
}
|
2426
|
+
return thrown;
|
2427
|
+
}
|
2428
|
+
}
|
2429
|
+
|
2430
|
+
// The context.catch method must only be called with a location
|
2431
|
+
// argument that corresponds to a known catch block.
|
2432
|
+
throw new Error("illegal catch attempt");
|
2433
|
+
},
|
2434
|
+
|
2435
|
+
delegateYield: function(iterable, resultName, nextLoc) {
|
2436
|
+
this.delegate = {
|
2437
|
+
iterator: values(iterable),
|
2438
|
+
resultName: resultName,
|
2439
|
+
nextLoc: nextLoc
|
2440
|
+
};
|
2441
|
+
|
2442
|
+
return ContinueSentinel;
|
2443
|
+
}
|
2444
|
+
};
|
2445
|
+
})(
|
2446
|
+
// Among the various tricks for obtaining a reference to the global
|
2447
|
+
// object, this seems to be the most reliable technique that does not
|
2448
|
+
// use indirect eval (which violates Content Security Policy).
|
2449
|
+
typeof global === "object" ? global :
|
2450
|
+
typeof window === "object" ? window : this
|
2451
|
+
);
|
2452
|
+
|
2453
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
2454
|
+
},{}]},{},[1]);
|