Created
November 26, 2015 04:20
-
-
Save timkindberg/562e0386d2e88919b97d to your computer and use it in GitHub Desktop.
ng-forward for plunkr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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(_dereq_,module,exports){ | |
(function (global){ | |
"use strict"; | |
_dereq_(180); | |
_dereq_(181); | |
if (global._babelPolyfill) { | |
throw new Error("only one instance of babel/polyfill is allowed"); | |
} | |
global._babelPolyfill = true; | |
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | |
},{"180":180,"181":181}],2:[function(_dereq_,module,exports){ | |
module.exports = function(it){ | |
if(typeof it != 'function')throw TypeError(it + ' is not a function!'); | |
return it; | |
}; | |
},{}],3:[function(_dereq_,module,exports){ | |
var isObject = _dereq_(33); | |
module.exports = function(it){ | |
if(!isObject(it))throw TypeError(it + ' is not an object!'); | |
return it; | |
}; | |
},{"33":33}],4:[function(_dereq_,module,exports){ | |
// false -> Array#indexOf | |
// true -> Array#includes | |
var toIObject = _dereq_(70) | |
, toLength = _dereq_(71) | |
, toIndex = _dereq_(68); | |
module.exports = function(IS_INCLUDES){ | |
return function($this, el, fromIndex){ | |
var O = toIObject($this) | |
, length = toLength(O.length) | |
, index = toIndex(fromIndex, length) | |
, value; | |
// Array#includes uses SameValueZero equality algorithm | |
if(IS_INCLUDES && el != el)while(length > index){ | |
value = O[index++]; | |
if(value != value)return true; | |
// Array#toIndex ignores holes, Array#includes - not | |
} else for(;length > index; index++)if(IS_INCLUDES || index in O){ | |
if(O[index] === el)return IS_INCLUDES || index; | |
} return !IS_INCLUDES && -1; | |
}; | |
}; | |
},{"68":68,"70":70,"71":71}],5:[function(_dereq_,module,exports){ | |
// 0 -> Array#forEach | |
// 1 -> Array#map | |
// 2 -> Array#filter | |
// 3 -> Array#some | |
// 4 -> Array#every | |
// 5 -> Array#find | |
// 6 -> Array#findIndex | |
var ctx = _dereq_(14) | |
, IObject = _dereq_(30) | |
, toObject = _dereq_(72) | |
, toLength = _dereq_(71); | |
module.exports = function(TYPE){ | |
var IS_MAP = TYPE == 1 | |
, IS_FILTER = TYPE == 2 | |
, IS_SOME = TYPE == 3 | |
, IS_EVERY = TYPE == 4 | |
, IS_FIND_INDEX = TYPE == 6 | |
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX; | |
return function($this, callbackfn, that){ | |
var O = toObject($this) | |
, self = IObject(O) | |
, f = ctx(callbackfn, that, 3) | |
, length = toLength(self.length) | |
, index = 0 | |
, result = IS_MAP ? Array(length) : IS_FILTER ? [] : undefined | |
, val, res; | |
for(;length > index; index++)if(NO_HOLES || index in self){ | |
val = self[index]; | |
res = f(val, index, O); | |
if(TYPE){ | |
if(IS_MAP)result[index] = res; // map | |
else if(res)switch(TYPE){ | |
case 3: return true; // some | |
case 5: return val; // find | |
case 6: return index; // findIndex | |
case 2: result.push(val); // filter | |
} else if(IS_EVERY)return false; // every | |
} | |
} | |
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; | |
}; | |
}; | |
},{"14":14,"30":30,"71":71,"72":72}],6:[function(_dereq_,module,exports){ | |
// 19.1.2.1 Object.assign(target, source, ...) | |
var toObject = _dereq_(72) | |
, IObject = _dereq_(30) | |
, enumKeys = _dereq_(18); | |
module.exports = _dereq_(20)(function(){ | |
return Symbol() in Object.assign({}); // Object.assign available and Symbol is native | |
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars | |
var T = toObject(target) | |
, l = arguments.length | |
, i = 1; | |
while(l > i){ | |
var S = IObject(arguments[i++]) | |
, keys = enumKeys(S) | |
, length = keys.length | |
, j = 0 | |
, key; | |
while(length > j)T[key = keys[j++]] = S[key]; | |
} | |
return T; | |
} : Object.assign; | |
},{"18":18,"20":20,"30":30,"72":72}],7:[function(_dereq_,module,exports){ | |
// getting tag from 19.1.3.6 Object.prototype.toString() | |
var cof = _dereq_(8) | |
, TAG = _dereq_(75)('toStringTag') | |
// ES3 wrong here | |
, ARG = cof(function(){ return arguments; }()) == 'Arguments'; | |
module.exports = function(it){ | |
var O, T, B; | |
return it === undefined ? 'Undefined' : it === null ? 'Null' | |
// @@toStringTag case | |
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T | |
// builtinTag case | |
: ARG ? cof(O) | |
// ES3 arguments fallback | |
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; | |
}; | |
},{"75":75,"8":8}],8:[function(_dereq_,module,exports){ | |
var toString = {}.toString; | |
module.exports = function(it){ | |
return toString.call(it).slice(8, -1); | |
}; | |
},{}],9:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, hide = _dereq_(27) | |
, ctx = _dereq_(14) | |
, species = _dereq_(58) | |
, strictNew = _dereq_(59) | |
, defined = _dereq_(16) | |
, forOf = _dereq_(23) | |
, step = _dereq_(38) | |
, ID = _dereq_(73)('id') | |
, $has = _dereq_(26) | |
, isObject = _dereq_(33) | |
, isExtensible = Object.isExtensible || isObject | |
, SUPPORT_DESC = _dereq_(65) | |
, SIZE = SUPPORT_DESC ? '_s' : 'size' | |
, id = 0; | |
var fastKey = function(it, create){ | |
// return primitive with prefix | |
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; | |
if(!$has(it, ID)){ | |
// can't set id to frozen object | |
if(!isExtensible(it))return 'F'; | |
// not necessary to add id | |
if(!create)return 'E'; | |
// add missing object id | |
hide(it, ID, ++id); | |
// return object id with prefix | |
} return 'O' + it[ID]; | |
}; | |
var getEntry = function(that, key){ | |
// fast case | |
var index = fastKey(key), entry; | |
if(index !== 'F')return that._i[index]; | |
// frozen object case | |
for(entry = that._f; entry; entry = entry.n){ | |
if(entry.k == key)return entry; | |
} | |
}; | |
module.exports = { | |
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ | |
var C = wrapper(function(that, iterable){ | |
strictNew(that, C, NAME); | |
that._i = $.create(null); // index | |
that._f = undefined; // first entry | |
that._l = undefined; // last entry | |
that[SIZE] = 0; // size | |
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); | |
}); | |
_dereq_(45)(C.prototype, { | |
// 23.1.3.1 Map.prototype.clear() | |
// 23.2.3.2 Set.prototype.clear() | |
clear: function clear(){ | |
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ | |
entry.r = true; | |
if(entry.p)entry.p = entry.p.n = undefined; | |
delete data[entry.i]; | |
} | |
that._f = that._l = undefined; | |
that[SIZE] = 0; | |
}, | |
// 23.1.3.3 Map.prototype.delete(key) | |
// 23.2.3.4 Set.prototype.delete(value) | |
'delete': function(key){ | |
var that = this | |
, entry = getEntry(that, key); | |
if(entry){ | |
var next = entry.n | |
, prev = entry.p; | |
delete that._i[entry.i]; | |
entry.r = true; | |
if(prev)prev.n = next; | |
if(next)next.p = prev; | |
if(that._f == entry)that._f = next; | |
if(that._l == entry)that._l = prev; | |
that[SIZE]--; | |
} return !!entry; | |
}, | |
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) | |
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) | |
forEach: function forEach(callbackfn /*, that = undefined */){ | |
var f = ctx(callbackfn, arguments[1], 3) | |
, entry; | |
while(entry = entry ? entry.n : this._f){ | |
f(entry.v, entry.k, this); | |
// revert to the last existing entry | |
while(entry && entry.r)entry = entry.p; | |
} | |
}, | |
// 23.1.3.7 Map.prototype.has(key) | |
// 23.2.3.7 Set.prototype.has(value) | |
has: function has(key){ | |
return !!getEntry(this, key); | |
} | |
}); | |
if(SUPPORT_DESC)$.setDesc(C.prototype, 'size', { | |
get: function(){ | |
return defined(this[SIZE]); | |
} | |
}); | |
return C; | |
}, | |
def: function(that, key, value){ | |
var entry = getEntry(that, key) | |
, prev, index; | |
// change existing entry | |
if(entry){ | |
entry.v = value; | |
// create new entry | |
} else { | |
that._l = entry = { | |
i: index = fastKey(key, true), // <- index | |
k: key, // <- key | |
v: value, // <- value | |
p: prev = that._l, // <- previous entry | |
n: undefined, // <- next entry | |
r: false // <- removed | |
}; | |
if(!that._f)that._f = entry; | |
if(prev)prev.n = entry; | |
that[SIZE]++; | |
// add to index | |
if(index !== 'F')that._i[index] = entry; | |
} return that; | |
}, | |
getEntry: getEntry, | |
setStrong: function(C, NAME, IS_MAP){ | |
// add .keys, .values, .entries, [@@iterator] | |
// 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 | |
_dereq_(36)(C, NAME, function(iterated, kind){ | |
this._t = iterated; // target | |
this._k = kind; // kind | |
this._l = undefined; // previous | |
}, function(){ | |
var that = this | |
, kind = that._k | |
, entry = that._l; | |
// revert to the last existing entry | |
while(entry && entry.r)entry = entry.p; | |
// get next entry | |
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ | |
// or finish the iteration | |
that._t = undefined; | |
return step(1); | |
} | |
// return step by kind | |
if(kind == 'keys' )return step(0, entry.k); | |
if(kind == 'values')return step(0, entry.v); | |
return step(0, [entry.k, entry.v]); | |
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); | |
// add [@@species], 23.1.2.2, 23.2.2.2 | |
species(C); | |
species(_dereq_(13)[NAME]); // for wrapper | |
} | |
}; | |
},{"13":13,"14":14,"16":16,"23":23,"26":26,"27":27,"33":33,"36":36,"38":38,"40":40,"45":45,"58":58,"59":59,"65":65,"73":73}],10:[function(_dereq_,module,exports){ | |
// https://github.com/DavidBruant/Map-Set.prototype.toJSON | |
var forOf = _dereq_(23) | |
, classof = _dereq_(7); | |
module.exports = function(NAME){ | |
return function toJSON(){ | |
if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic"); | |
var arr = []; | |
forOf(this, false, arr.push, arr); | |
return arr; | |
}; | |
}; | |
},{"23":23,"7":7}],11:[function(_dereq_,module,exports){ | |
'use strict'; | |
var hide = _dereq_(27) | |
, anObject = _dereq_(3) | |
, strictNew = _dereq_(59) | |
, forOf = _dereq_(23) | |
, method = _dereq_(5) | |
, WEAK = _dereq_(73)('weak') | |
, isObject = _dereq_(33) | |
, $has = _dereq_(26) | |
, isExtensible = Object.isExtensible || isObject | |
, find = method(5) | |
, findIndex = method(6) | |
, id = 0; | |
// fallback for frozen keys | |
var frozenStore = function(that){ | |
return that._l || (that._l = new FrozenStore); | |
}; | |
var FrozenStore = function(){ | |
this.a = []; | |
}; | |
var findFrozen = function(store, key){ | |
return find(store.a, function(it){ | |
return it[0] === key; | |
}); | |
}; | |
FrozenStore.prototype = { | |
get: function(key){ | |
var entry = findFrozen(this, key); | |
if(entry)return entry[1]; | |
}, | |
has: function(key){ | |
return !!findFrozen(this, key); | |
}, | |
set: function(key, value){ | |
var entry = findFrozen(this, key); | |
if(entry)entry[1] = value; | |
else this.a.push([key, value]); | |
}, | |
'delete': function(key){ | |
var index = findIndex(this.a, function(it){ | |
return it[0] === key; | |
}); | |
if(~index)this.a.splice(index, 1); | |
return !!~index; | |
} | |
}; | |
module.exports = { | |
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ | |
var C = wrapper(function(that, iterable){ | |
strictNew(that, C, NAME); | |
that._i = id++; // collection id | |
that._l = undefined; // leak store for frozen objects | |
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); | |
}); | |
_dereq_(45)(C.prototype, { | |
// 23.3.3.2 WeakMap.prototype.delete(key) | |
// 23.4.3.3 WeakSet.prototype.delete(value) | |
'delete': function(key){ | |
if(!isObject(key))return false; | |
if(!isExtensible(key))return frozenStore(this)['delete'](key); | |
return $has(key, WEAK) && $has(key[WEAK], this._i) && delete key[WEAK][this._i]; | |
}, | |
// 23.3.3.4 WeakMap.prototype.has(key) | |
// 23.4.3.4 WeakSet.prototype.has(value) | |
has: function has(key){ | |
if(!isObject(key))return false; | |
if(!isExtensible(key))return frozenStore(this).has(key); | |
return $has(key, WEAK) && $has(key[WEAK], this._i); | |
} | |
}); | |
return C; | |
}, | |
def: function(that, key, value){ | |
if(!isExtensible(anObject(key))){ | |
frozenStore(that).set(key, value); | |
} else { | |
$has(key, WEAK) || hide(key, WEAK, {}); | |
key[WEAK][that._i] = value; | |
} return that; | |
}, | |
frozenStore: frozenStore, | |
WEAK: WEAK | |
}; | |
},{"23":23,"26":26,"27":27,"3":3,"33":33,"45":45,"5":5,"59":59,"73":73}],12:[function(_dereq_,module,exports){ | |
'use strict'; | |
var global = _dereq_(25) | |
, $def = _dereq_(15) | |
, forOf = _dereq_(23) | |
, strictNew = _dereq_(59); | |
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ | |
var Base = global[NAME] | |
, C = Base | |
, ADDER = IS_MAP ? 'set' : 'add' | |
, proto = C && C.prototype | |
, O = {}; | |
var fixMethod = function(KEY){ | |
var fn = proto[KEY]; | |
_dereq_(52)(proto, KEY, | |
KEY == 'delete' ? function(a){ return fn.call(this, a === 0 ? 0 : a); } | |
: KEY == 'has' ? function has(a){ return fn.call(this, a === 0 ? 0 : a); } | |
: KEY == 'get' ? function get(a){ return fn.call(this, a === 0 ? 0 : a); } | |
: KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; } | |
: function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; } | |
); | |
}; | |
if(typeof C != 'function' || !(IS_WEAK || proto.forEach && !_dereq_(20)(function(){ | |
new C().entries().next(); | |
}))){ | |
// create collection constructor | |
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); | |
_dereq_(45)(C.prototype, methods); | |
} else { | |
var inst = new C | |
, chain = inst[ADDER](IS_WEAK ? {} : -0, 1) | |
, buggyZero; | |
// wrap for init collections from iterable | |
if(!_dereq_(37)(function(iter){ new C(iter); })){ // eslint-disable-line no-new | |
C = wrapper(function(target, iterable){ | |
strictNew(target, C, NAME); | |
var that = new Base; | |
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); | |
return that; | |
}); | |
C.prototype = proto; | |
proto.constructor = C; | |
} | |
IS_WEAK || inst.forEach(function(val, key){ | |
buggyZero = 1 / key === -Infinity; | |
}); | |
// fix converting -0 key to +0 | |
if(buggyZero){ | |
fixMethod('delete'); | |
fixMethod('has'); | |
IS_MAP && fixMethod('get'); | |
} | |
// + fix .add & .set for chaining | |
if(buggyZero || chain !== inst)fixMethod(ADDER); | |
// weak collections should not contains .clear method | |
if(IS_WEAK && proto.clear)delete proto.clear; | |
} | |
_dereq_(66)(C, NAME); | |
O[NAME] = C; | |
$def($def.G + $def.W + $def.F * (C != Base), O); | |
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); | |
return C; | |
}; | |
},{"15":15,"20":20,"23":23,"25":25,"37":37,"45":45,"52":52,"59":59,"66":66}],13:[function(_dereq_,module,exports){ | |
var core = module.exports = {}; | |
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef | |
},{}],14:[function(_dereq_,module,exports){ | |
// optional / simple context binding | |
var aFunction = _dereq_(2); | |
module.exports = function(fn, that, length){ | |
aFunction(fn); | |
if(that === undefined)return fn; | |
switch(length){ | |
case 1: return function(a){ | |
return fn.call(that, a); | |
}; | |
case 2: return function(a, b){ | |
return fn.call(that, a, b); | |
}; | |
case 3: return function(a, b, c){ | |
return fn.call(that, a, b, c); | |
}; | |
} return function(/* ...args */){ | |
return fn.apply(that, arguments); | |
}; | |
}; | |
},{"2":2}],15:[function(_dereq_,module,exports){ | |
var global = _dereq_(25) | |
, core = _dereq_(13) | |
, hide = _dereq_(27) | |
, $redef = _dereq_(52) | |
, PROTOTYPE = 'prototype'; | |
var ctx = function(fn, that){ | |
return function(){ | |
return fn.apply(that, arguments); | |
}; | |
}; | |
var $def = function(type, name, source){ | |
var key, own, out, exp | |
, isGlobal = type & $def.G | |
, isProto = type & $def.P | |
, target = isGlobal ? global : type & $def.S | |
? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] | |
, exports = isGlobal ? core : core[name] || (core[name] = {}); | |
if(isGlobal)source = name; | |
for(key in source){ | |
// contains in native | |
own = !(type & $def.F) && target && key in target; | |
// export native or passed | |
out = (own ? target : source)[key]; | |
// bind timers to global for call from export context | |
if(type & $def.B && own)exp = ctx(out, global); | |
else exp = isProto && typeof out == 'function' ? ctx(Function.call, out) : out; | |
// extend global | |
if(target && !own)$redef(target, key, out); | |
// export | |
if(exports[key] != out)hide(exports, key, exp); | |
if(isProto)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; | |
} | |
}; | |
global.core = core; | |
// type bitmap | |
$def.F = 1; // forced | |
$def.G = 2; // global | |
$def.S = 4; // static | |
$def.P = 8; // proto | |
$def.B = 16; // bind | |
$def.W = 32; // wrap | |
module.exports = $def; | |
},{"13":13,"25":25,"27":27,"52":52}],16:[function(_dereq_,module,exports){ | |
// 7.2.1 RequireObjectCoercible(argument) | |
module.exports = function(it){ | |
if(it == undefined)throw TypeError("Can't call method on " + it); | |
return it; | |
}; | |
},{}],17:[function(_dereq_,module,exports){ | |
var isObject = _dereq_(33) | |
, document = _dereq_(25).document | |
// in old IE typeof document.createElement is 'object' | |
, is = isObject(document) && isObject(document.createElement); | |
module.exports = function(it){ | |
return is ? document.createElement(it) : {}; | |
}; | |
},{"25":25,"33":33}],18:[function(_dereq_,module,exports){ | |
// all enumerable object keys, includes symbols | |
var $ = _dereq_(40); | |
module.exports = function(it){ | |
var keys = $.getKeys(it) | |
, getSymbols = $.getSymbols; | |
if(getSymbols){ | |
var symbols = getSymbols(it) | |
, isEnum = $.isEnum | |
, i = 0 | |
, key; | |
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key); | |
} | |
return keys; | |
}; | |
},{"40":40}],19:[function(_dereq_,module,exports){ | |
// 20.2.2.14 Math.expm1(x) | |
module.exports = Math.expm1 || function expm1(x){ | |
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; | |
}; | |
},{}],20:[function(_dereq_,module,exports){ | |
module.exports = function(exec){ | |
try { | |
return !!exec(); | |
} catch(e){ | |
return true; | |
} | |
}; | |
},{}],21:[function(_dereq_,module,exports){ | |
'use strict'; | |
module.exports = function(KEY, length, exec){ | |
var defined = _dereq_(16) | |
, SYMBOL = _dereq_(75)(KEY) | |
, original = ''[KEY]; | |
if(_dereq_(20)(function(){ | |
var O = {}; | |
O[SYMBOL] = function(){ return 7; }; | |
return ''[KEY](O) != 7; | |
})){ | |
_dereq_(52)(String.prototype, KEY, exec(defined, SYMBOL, original)); | |
_dereq_(27)(RegExp.prototype, SYMBOL, length == 2 | |
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) | |
// 21.2.5.11 RegExp.prototype[@@split](string, limit) | |
? function(string, arg){ return original.call(string, this, arg); } | |
// 21.2.5.6 RegExp.prototype[@@match](string) | |
// 21.2.5.9 RegExp.prototype[@@search](string) | |
: function(string){ return original.call(string, this); } | |
); | |
} | |
}; | |
},{"16":16,"20":20,"27":27,"52":52,"75":75}],22:[function(_dereq_,module,exports){ | |
'use strict'; | |
// 21.2.5.3 get RegExp.prototype.flags | |
var anObject = _dereq_(3); | |
module.exports = function(){ | |
var that = anObject(this) | |
, result = ''; | |
if(that.global)result += 'g'; | |
if(that.ignoreCase)result += 'i'; | |
if(that.multiline)result += 'm'; | |
if(that.unicode)result += 'u'; | |
if(that.sticky)result += 'y'; | |
return result; | |
}; | |
},{"3":3}],23:[function(_dereq_,module,exports){ | |
var ctx = _dereq_(14) | |
, call = _dereq_(34) | |
, isArrayIter = _dereq_(31) | |
, anObject = _dereq_(3) | |
, toLength = _dereq_(71) | |
, getIterFn = _dereq_(76); | |
module.exports = function(iterable, entries, fn, that){ | |
var iterFn = getIterFn(iterable) | |
, f = ctx(fn, that, entries ? 2 : 1) | |
, index = 0 | |
, length, step, iterator; | |
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); | |
// fast case for arrays with default iterator | |
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ | |
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); | |
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ | |
call(iterator, f, step.value, entries); | |
} | |
}; | |
},{"14":14,"3":3,"31":31,"34":34,"71":71,"76":76}],24:[function(_dereq_,module,exports){ | |
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window | |
var toString = {}.toString | |
, toIObject = _dereq_(70) | |
, getNames = _dereq_(40).getNames; | |
var windowNames = typeof window == 'object' && Object.getOwnPropertyNames | |
? Object.getOwnPropertyNames(window) : []; | |
var getWindowNames = function(it){ | |
try { | |
return getNames(it); | |
} catch(e){ | |
return windowNames.slice(); | |
} | |
}; | |
module.exports.get = function getOwnPropertyNames(it){ | |
if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); | |
return getNames(toIObject(it)); | |
}; | |
},{"40":40,"70":70}],25:[function(_dereq_,module,exports){ | |
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | |
var UNDEFINED = 'undefined'; | |
var global = module.exports = typeof window != UNDEFINED && window.Math == Math | |
? window : typeof self != UNDEFINED && self.Math == Math ? self : Function('return this')(); | |
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef | |
},{}],26:[function(_dereq_,module,exports){ | |
var hasOwnProperty = {}.hasOwnProperty; | |
module.exports = function(it, key){ | |
return hasOwnProperty.call(it, key); | |
}; | |
},{}],27:[function(_dereq_,module,exports){ | |
var $ = _dereq_(40) | |
, createDesc = _dereq_(51); | |
module.exports = _dereq_(65) ? function(object, key, value){ | |
return $.setDesc(object, key, createDesc(1, value)); | |
} : function(object, key, value){ | |
object[key] = value; | |
return object; | |
}; | |
},{"40":40,"51":51,"65":65}],28:[function(_dereq_,module,exports){ | |
module.exports = _dereq_(25).document && document.documentElement; | |
},{"25":25}],29:[function(_dereq_,module,exports){ | |
// fast apply, http://jsperf.lnkit.com/fast-apply/5 | |
module.exports = function(fn, args, that){ | |
var un = that === undefined; | |
switch(args.length){ | |
case 0: return un ? fn() | |
: fn.call(that); | |
case 1: return un ? fn(args[0]) | |
: fn.call(that, args[0]); | |
case 2: return un ? fn(args[0], args[1]) | |
: fn.call(that, args[0], args[1]); | |
case 3: return un ? fn(args[0], args[1], args[2]) | |
: fn.call(that, args[0], args[1], args[2]); | |
case 4: return un ? fn(args[0], args[1], args[2], args[3]) | |
: fn.call(that, args[0], args[1], args[2], args[3]); | |
} return fn.apply(that, args); | |
}; | |
},{}],30:[function(_dereq_,module,exports){ | |
// indexed object, fallback for non-array-like ES3 strings | |
var cof = _dereq_(8); | |
module.exports = 0 in Object('z') ? Object : function(it){ | |
return cof(it) == 'String' ? it.split('') : Object(it); | |
}; | |
},{"8":8}],31:[function(_dereq_,module,exports){ | |
// check on default Array iterator | |
var Iterators = _dereq_(39) | |
, ITERATOR = _dereq_(75)('iterator'); | |
module.exports = function(it){ | |
return (Iterators.Array || Array.prototype[ITERATOR]) === it; | |
}; | |
},{"39":39,"75":75}],32:[function(_dereq_,module,exports){ | |
// 20.1.2.3 Number.isInteger(number) | |
var isObject = _dereq_(33) | |
, floor = Math.floor; | |
module.exports = function isInteger(it){ | |
return !isObject(it) && isFinite(it) && floor(it) === it; | |
}; | |
},{"33":33}],33:[function(_dereq_,module,exports){ | |
// http://jsperf.com/core-js-isobject | |
module.exports = function(it){ | |
return it !== null && (typeof it == 'object' || typeof it == 'function'); | |
}; | |
},{}],34:[function(_dereq_,module,exports){ | |
// call something on iterator step with safe closing on error | |
var anObject = _dereq_(3); | |
module.exports = function(iterator, fn, value, entries){ | |
try { | |
return entries ? fn(anObject(value)[0], value[1]) : fn(value); | |
// 7.4.6 IteratorClose(iterator, completion) | |
} catch(e){ | |
var ret = iterator['return']; | |
if(ret !== undefined)anObject(ret.call(iterator)); | |
throw e; | |
} | |
}; | |
},{"3":3}],35:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, IteratorPrototype = {}; | |
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() | |
_dereq_(27)(IteratorPrototype, _dereq_(75)('iterator'), function(){ return this; }); | |
module.exports = function(Constructor, NAME, next){ | |
Constructor.prototype = $.create(IteratorPrototype, {next: _dereq_(51)(1,next)}); | |
_dereq_(66)(Constructor, NAME + ' Iterator'); | |
}; | |
},{"27":27,"40":40,"51":51,"66":66,"75":75}],36:[function(_dereq_,module,exports){ | |
'use strict'; | |
var LIBRARY = _dereq_(42) | |
, $def = _dereq_(15) | |
, $redef = _dereq_(52) | |
, hide = _dereq_(27) | |
, has = _dereq_(26) | |
, SYMBOL_ITERATOR = _dereq_(75)('iterator') | |
, Iterators = _dereq_(39) | |
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` | |
, FF_ITERATOR = '@@iterator' | |
, KEYS = 'keys' | |
, VALUES = 'values'; | |
var returnThis = function(){ return this; }; | |
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){ | |
_dereq_(35)(Constructor, NAME, next); | |
var createMethod = function(kind){ | |
switch(kind){ | |
case KEYS: return function keys(){ return new Constructor(this, kind); }; | |
case VALUES: return function values(){ return new Constructor(this, kind); }; | |
} return function entries(){ return new Constructor(this, kind); }; | |
}; | |
var TAG = NAME + ' Iterator' | |
, proto = Base.prototype | |
, _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] | |
, _default = _native || createMethod(DEFAULT) | |
, methods, key; | |
// Fix native | |
if(_native){ | |
var IteratorPrototype = _dereq_(40).getProto(_default.call(new Base)); | |
// Set @@toStringTag to native iterators | |
_dereq_(66)(IteratorPrototype, TAG, true); | |
// FF fix | |
if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, SYMBOL_ITERATOR, returnThis); | |
} | |
// Define iterator | |
if(!LIBRARY || FORCE)hide(proto, SYMBOL_ITERATOR, _default); | |
// Plug for library | |
Iterators[NAME] = _default; | |
Iterators[TAG] = returnThis; | |
if(DEFAULT){ | |
methods = { | |
keys: IS_SET ? _default : createMethod(KEYS), | |
values: DEFAULT == VALUES ? _default : createMethod(VALUES), | |
entries: DEFAULT != VALUES ? _default : createMethod('entries') | |
}; | |
if(FORCE)for(key in methods){ | |
if(!(key in proto))$redef(proto, key, methods[key]); | |
} else $def($def.P + $def.F * BUGGY, NAME, methods); | |
} | |
}; | |
},{"15":15,"26":26,"27":27,"35":35,"39":39,"40":40,"42":42,"52":52,"66":66,"75":75}],37:[function(_dereq_,module,exports){ | |
var SYMBOL_ITERATOR = _dereq_(75)('iterator') | |
, SAFE_CLOSING = false; | |
try { | |
var riter = [7][SYMBOL_ITERATOR](); | |
riter['return'] = function(){ SAFE_CLOSING = true; }; | |
Array.from(riter, function(){ throw 2; }); | |
} catch(e){ /* empty */ } | |
module.exports = function(exec){ | |
if(!SAFE_CLOSING)return false; | |
var safe = false; | |
try { | |
var arr = [7] | |
, iter = arr[SYMBOL_ITERATOR](); | |
iter.next = function(){ safe = true; }; | |
arr[SYMBOL_ITERATOR] = function(){ return iter; }; | |
exec(arr); | |
} catch(e){ /* empty */ } | |
return safe; | |
}; | |
},{"75":75}],38:[function(_dereq_,module,exports){ | |
module.exports = function(done, value){ | |
return {value: value, done: !!done}; | |
}; | |
},{}],39:[function(_dereq_,module,exports){ | |
module.exports = {}; | |
},{}],40:[function(_dereq_,module,exports){ | |
var $Object = Object; | |
module.exports = { | |
create: $Object.create, | |
getProto: $Object.getPrototypeOf, | |
isEnum: {}.propertyIsEnumerable, | |
getDesc: $Object.getOwnPropertyDescriptor, | |
setDesc: $Object.defineProperty, | |
setDescs: $Object.defineProperties, | |
getKeys: $Object.keys, | |
getNames: $Object.getOwnPropertyNames, | |
getSymbols: $Object.getOwnPropertySymbols, | |
each: [].forEach | |
}; | |
},{}],41:[function(_dereq_,module,exports){ | |
var $ = _dereq_(40) | |
, toIObject = _dereq_(70); | |
module.exports = function(object, el){ | |
var O = toIObject(object) | |
, keys = $.getKeys(O) | |
, length = keys.length | |
, index = 0 | |
, key; | |
while(length > index)if(O[key = keys[index++]] === el)return key; | |
}; | |
},{"40":40,"70":70}],42:[function(_dereq_,module,exports){ | |
module.exports = false; | |
},{}],43:[function(_dereq_,module,exports){ | |
// 20.2.2.20 Math.log1p(x) | |
module.exports = Math.log1p || function log1p(x){ | |
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); | |
}; | |
},{}],44:[function(_dereq_,module,exports){ | |
var global = _dereq_(25) | |
, macrotask = _dereq_(67).set | |
, Observer = global.MutationObserver || global.WebKitMutationObserver | |
, process = global.process | |
, isNode = _dereq_(8)(process) == 'process' | |
, head, last, notify; | |
var flush = function(){ | |
var parent, domain; | |
if(isNode && (parent = process.domain)){ | |
process.domain = null; | |
parent.exit(); | |
} | |
while(head){ | |
domain = head.domain; | |
if(domain)domain.enter(); | |
head.fn.call(); // <- currently we use it only for Promise - try / catch not required | |
if(domain)domain.exit(); | |
head = head.next; | |
} last = undefined; | |
if(parent)parent.enter(); | |
} | |
// Node.js | |
if(isNode){ | |
notify = function(){ | |
process.nextTick(flush); | |
}; | |
// browsers with MutationObserver | |
} else if(Observer){ | |
var toggle = 1 | |
, node = document.createTextNode(''); | |
new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new | |
notify = function(){ | |
node.data = toggle = -toggle; | |
}; | |
// for other environments - macrotask based on: | |
// - setImmediate | |
// - MessageChannel | |
// - window.postMessag | |
// - onreadystatechange | |
// - setTimeout | |
} else { | |
notify = function(){ | |
// strange IE + webpack dev server bug - use .call(global) | |
macrotask.call(global, flush); | |
}; | |
} | |
module.exports = function asap(fn){ | |
var task = {fn: fn, next: undefined, domain: isNode && process.domain}; | |
if(last)last.next = task; | |
if(!head){ | |
head = task; | |
notify(); | |
} last = task; | |
}; | |
},{"25":25,"67":67,"8":8}],45:[function(_dereq_,module,exports){ | |
var $redef = _dereq_(52); | |
module.exports = function(target, src){ | |
for(var key in src)$redef(target, key, src[key]); | |
return target; | |
}; | |
},{"52":52}],46:[function(_dereq_,module,exports){ | |
// most Object methods by ES6 should accept primitives | |
module.exports = function(KEY, exec){ | |
var $def = _dereq_(15) | |
, fn = (_dereq_(13).Object || {})[KEY] || Object[KEY] | |
, exp = {}; | |
exp[KEY] = exec(fn); | |
$def($def.S + $def.F * _dereq_(20)(function(){ fn(1); }), 'Object', exp); | |
}; | |
},{"13":13,"15":15,"20":20}],47:[function(_dereq_,module,exports){ | |
var $ = _dereq_(40) | |
, toIObject = _dereq_(70); | |
module.exports = function(isEntries){ | |
return function(it){ | |
var O = toIObject(it) | |
, keys = $.getKeys(O) | |
, length = keys.length | |
, i = 0 | |
, result = Array(length) | |
, key; | |
if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]]; | |
else while(length > i)result[i] = O[keys[i++]]; | |
return result; | |
}; | |
}; | |
},{"40":40,"70":70}],48:[function(_dereq_,module,exports){ | |
// all object keys, includes non-enumerable and symbols | |
var $ = _dereq_(40) | |
, anObject = _dereq_(3) | |
, Reflect = _dereq_(25).Reflect; | |
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ | |
var keys = $.getNames(anObject(it)) | |
, getSymbols = $.getSymbols; | |
return getSymbols ? keys.concat(getSymbols(it)) : keys; | |
}; | |
},{"25":25,"3":3,"40":40}],49:[function(_dereq_,module,exports){ | |
'use strict'; | |
var path = _dereq_(50) | |
, invoke = _dereq_(29) | |
, aFunction = _dereq_(2); | |
module.exports = function(/* ...pargs */){ | |
var fn = aFunction(this) | |
, length = arguments.length | |
, pargs = Array(length) | |
, i = 0 | |
, _ = path._ | |
, holder = false; | |
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true; | |
return function(/* ...args */){ | |
var that = this | |
, _length = arguments.length | |
, j = 0, k = 0, args; | |
if(!holder && !_length)return invoke(fn, pargs, that); | |
args = pargs.slice(); | |
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++]; | |
while(_length > k)args.push(arguments[k++]); | |
return invoke(fn, args, that); | |
}; | |
}; | |
},{"2":2,"29":29,"50":50}],50:[function(_dereq_,module,exports){ | |
module.exports = _dereq_(25); | |
},{"25":25}],51:[function(_dereq_,module,exports){ | |
module.exports = function(bitmap, value){ | |
return { | |
enumerable : !(bitmap & 1), | |
configurable: !(bitmap & 2), | |
writable : !(bitmap & 4), | |
value : value | |
}; | |
}; | |
},{}],52:[function(_dereq_,module,exports){ | |
// add fake Function#toString | |
// for correct work wrapped methods / constructors with methods like LoDash isNative | |
var global = _dereq_(25) | |
, hide = _dereq_(27) | |
, SRC = _dereq_(73)('src') | |
, TO_STRING = 'toString' | |
, $toString = Function[TO_STRING] | |
, TPL = ('' + $toString).split(TO_STRING); | |
_dereq_(13).inspectSource = function(it){ | |
return $toString.call(it); | |
}; | |
(module.exports = function(O, key, val, safe){ | |
if(typeof val == 'function'){ | |
hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); | |
if(!('name' in val))val.name = key; | |
} | |
if(O === global){ | |
O[key] = val; | |
} else { | |
if(!safe)delete O[key]; | |
hide(O, key, val); | |
} | |
})(Function.prototype, TO_STRING, function toString(){ | |
return typeof this == 'function' && this[SRC] || $toString.call(this); | |
}); | |
},{"13":13,"25":25,"27":27,"73":73}],53:[function(_dereq_,module,exports){ | |
module.exports = function(regExp, replace){ | |
var replacer = replace === Object(replace) ? function(part){ | |
return replace[part]; | |
} : replace; | |
return function(it){ | |
return String(it).replace(regExp, replacer); | |
}; | |
}; | |
},{}],54:[function(_dereq_,module,exports){ | |
module.exports = Object.is || function is(x, y){ | |
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; | |
}; | |
},{}],55:[function(_dereq_,module,exports){ | |
// Works with __proto__ only. Old v8 can't work with null proto objects. | |
/* eslint-disable no-proto */ | |
var getDesc = _dereq_(40).getDesc | |
, isObject = _dereq_(33) | |
, anObject = _dereq_(3); | |
var check = function(O, proto){ | |
anObject(O); | |
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); | |
}; | |
module.exports = { | |
set: Object.setPrototypeOf || ('__proto__' in {} // eslint-disable-line | |
? function(buggy, set){ | |
try { | |
set = _dereq_(14)(Function.call, getDesc(Object.prototype, '__proto__').set, 2); | |
set({}, []); | |
} catch(e){ buggy = true; } | |
return function setPrototypeOf(O, proto){ | |
check(O, proto); | |
if(buggy)O.__proto__ = proto; | |
else set(O, proto); | |
return O; | |
}; | |
}() | |
: undefined), | |
check: check | |
}; | |
},{"14":14,"3":3,"33":33,"40":40}],56:[function(_dereq_,module,exports){ | |
var global = _dereq_(25) | |
, SHARED = '__core-js_shared__' | |
, store = global[SHARED] || (global[SHARED] = {}); | |
module.exports = function(key){ | |
return store[key] || (store[key] = {}); | |
}; | |
},{"25":25}],57:[function(_dereq_,module,exports){ | |
// 20.2.2.28 Math.sign(x) | |
module.exports = Math.sign || function sign(x){ | |
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; | |
}; | |
},{}],58:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, SPECIES = _dereq_(75)('species'); | |
module.exports = function(C){ | |
if(_dereq_(65) && !(SPECIES in C))$.setDesc(C, SPECIES, { | |
configurable: true, | |
get: function(){ return this; } | |
}); | |
}; | |
},{"40":40,"65":65,"75":75}],59:[function(_dereq_,module,exports){ | |
module.exports = function(it, Constructor, name){ | |
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!"); | |
return it; | |
}; | |
},{}],60:[function(_dereq_,module,exports){ | |
// true -> String#at | |
// false -> String#codePointAt | |
var toInteger = _dereq_(69) | |
, defined = _dereq_(16); | |
module.exports = function(TO_STRING){ | |
return function(that, pos){ | |
var s = String(defined(that)) | |
, i = toInteger(pos) | |
, l = s.length | |
, a, b; | |
if(i < 0 || i >= l)return TO_STRING ? '' : undefined; | |
a = s.charCodeAt(i); | |
return a < 0xd800 || a > 0xdbff || i + 1 === l | |
|| (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff | |
? TO_STRING ? s.charAt(i) : a | |
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; | |
}; | |
}; | |
},{"16":16,"69":69}],61:[function(_dereq_,module,exports){ | |
// helper for String#{startsWith, endsWith, includes} | |
var defined = _dereq_(16) | |
, cof = _dereq_(8); | |
module.exports = function(that, searchString, NAME){ | |
if(cof(searchString) == 'RegExp')throw TypeError('String#' + NAME + " doesn't accept regex!"); | |
return String(defined(that)); | |
}; | |
},{"16":16,"8":8}],62:[function(_dereq_,module,exports){ | |
// https://github.com/ljharb/proposal-string-pad-left-right | |
var toLength = _dereq_(71) | |
, repeat = _dereq_(63) | |
, defined = _dereq_(16); | |
module.exports = function(that, maxLength, fillString, left){ | |
var S = String(defined(that)) | |
, stringLength = S.length | |
, fillStr = fillString === undefined ? ' ' : String(fillString) | |
, intMaxLength = toLength(maxLength); | |
if(intMaxLength <= stringLength)return S; | |
if(fillStr == '')fillStr = ' '; | |
var fillLen = intMaxLength - stringLength | |
, stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); | |
if(stringFiller.length > fillLen)stringFiller = left | |
? stringFiller.slice(stringFiller.length - fillLen) | |
: stringFiller.slice(0, fillLen); | |
return left ? stringFiller + S : S + stringFiller; | |
}; | |
},{"16":16,"63":63,"71":71}],63:[function(_dereq_,module,exports){ | |
'use strict'; | |
var toInteger = _dereq_(69) | |
, defined = _dereq_(16); | |
module.exports = function repeat(count){ | |
var str = String(defined(this)) | |
, res = '' | |
, n = toInteger(count); | |
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative"); | |
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; | |
return res; | |
}; | |
},{"16":16,"69":69}],64:[function(_dereq_,module,exports){ | |
// 1 -> String#trimLeft | |
// 2 -> String#trimRight | |
// 3 -> String#trim | |
var trim = function(string, TYPE){ | |
string = String(defined(string)); | |
if(TYPE & 1)string = string.replace(ltrim, ''); | |
if(TYPE & 2)string = string.replace(rtrim, ''); | |
return string; | |
}; | |
var $def = _dereq_(15) | |
, defined = _dereq_(16) | |
, spaces = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + | |
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF' | |
, space = '[' + spaces + ']' | |
, non = '\u200b\u0085' | |
, ltrim = RegExp('^' + space + space + '*') | |
, rtrim = RegExp(space + space + '*$'); | |
module.exports = function(KEY, exec){ | |
var exp = {}; | |
exp[KEY] = exec(trim); | |
$def($def.P + $def.F * _dereq_(20)(function(){ | |
return !!spaces[KEY]() || non[KEY]() != non; | |
}), 'String', exp); | |
}; | |
},{"15":15,"16":16,"20":20}],65:[function(_dereq_,module,exports){ | |
// Thank's IE8 for his funny defineProperty | |
module.exports = !_dereq_(20)(function(){ | |
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; | |
}); | |
},{"20":20}],66:[function(_dereq_,module,exports){ | |
var has = _dereq_(26) | |
, hide = _dereq_(27) | |
, TAG = _dereq_(75)('toStringTag'); | |
module.exports = function(it, tag, stat){ | |
if(it && !has(it = stat ? it : it.prototype, TAG))hide(it, TAG, tag); | |
}; | |
},{"26":26,"27":27,"75":75}],67:[function(_dereq_,module,exports){ | |
'use strict'; | |
var ctx = _dereq_(14) | |
, invoke = _dereq_(29) | |
, html = _dereq_(28) | |
, cel = _dereq_(17) | |
, global = _dereq_(25) | |
, process = global.process | |
, setTask = global.setImmediate | |
, clearTask = global.clearImmediate | |
, MessageChannel = global.MessageChannel | |
, counter = 0 | |
, queue = {} | |
, ONREADYSTATECHANGE = 'onreadystatechange' | |
, defer, channel, port; | |
var run = function(){ | |
var id = +this; | |
if(queue.hasOwnProperty(id)){ | |
var fn = queue[id]; | |
delete queue[id]; | |
fn(); | |
} | |
}; | |
var listner = function(event){ | |
run.call(event.data); | |
}; | |
// Node.js 0.9+ & IE10+ has setImmediate, otherwise: | |
if(!setTask || !clearTask){ | |
setTask = function setImmediate(fn){ | |
var args = [], i = 1; | |
while(arguments.length > i)args.push(arguments[i++]); | |
queue[++counter] = function(){ | |
invoke(typeof fn == 'function' ? fn : Function(fn), args); | |
}; | |
defer(counter); | |
return counter; | |
}; | |
clearTask = function clearImmediate(id){ | |
delete queue[id]; | |
}; | |
// Node.js 0.8- | |
if(_dereq_(8)(process) == 'process'){ | |
defer = function(id){ | |
process.nextTick(ctx(run, id, 1)); | |
}; | |
// Browsers with MessageChannel, includes WebWorkers | |
} else if(MessageChannel){ | |
channel = new MessageChannel; | |
port = channel.port2; | |
channel.port1.onmessage = listner; | |
defer = ctx(port.postMessage, port, 1); | |
// Browsers with postMessage, skip WebWorkers | |
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object' | |
} else if(global.addEventListener && typeof postMessage == 'function' && !global.importScript){ | |
defer = function(id){ | |
global.postMessage(id + '', '*'); | |
}; | |
global.addEventListener('message', listner, false); | |
// IE8- | |
} else if(ONREADYSTATECHANGE in cel('script')){ | |
defer = function(id){ | |
html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ | |
html.removeChild(this); | |
run.call(id); | |
}; | |
}; | |
// Rest old browsers | |
} else { | |
defer = function(id){ | |
setTimeout(ctx(run, id, 1), 0); | |
}; | |
} | |
} | |
module.exports = { | |
set: setTask, | |
clear: clearTask | |
}; | |
},{"14":14,"17":17,"25":25,"28":28,"29":29,"8":8}],68:[function(_dereq_,module,exports){ | |
var toInteger = _dereq_(69) | |
, max = Math.max | |
, min = Math.min; | |
module.exports = function(index, length){ | |
index = toInteger(index); | |
return index < 0 ? max(index + length, 0) : min(index, length); | |
}; | |
},{"69":69}],69:[function(_dereq_,module,exports){ | |
// 7.1.4 ToInteger | |
var ceil = Math.ceil | |
, floor = Math.floor; | |
module.exports = function(it){ | |
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); | |
}; | |
},{}],70:[function(_dereq_,module,exports){ | |
// to indexed object, toObject with fallback for non-array-like ES3 strings | |
var IObject = _dereq_(30) | |
, defined = _dereq_(16); | |
module.exports = function(it){ | |
return IObject(defined(it)); | |
}; | |
},{"16":16,"30":30}],71:[function(_dereq_,module,exports){ | |
// 7.1.15 ToLength | |
var toInteger = _dereq_(69) | |
, min = Math.min; | |
module.exports = function(it){ | |
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 | |
}; | |
},{"69":69}],72:[function(_dereq_,module,exports){ | |
// 7.1.13 ToObject(argument) | |
var defined = _dereq_(16); | |
module.exports = function(it){ | |
return Object(defined(it)); | |
}; | |
},{"16":16}],73:[function(_dereq_,module,exports){ | |
var id = 0 | |
, px = Math.random(); | |
module.exports = function(key){ | |
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); | |
}; | |
},{}],74:[function(_dereq_,module,exports){ | |
// 22.1.3.31 Array.prototype[@@unscopables] | |
var UNSCOPABLES = _dereq_(75)('unscopables'); | |
if(!(UNSCOPABLES in []))_dereq_(27)(Array.prototype, UNSCOPABLES, {}); | |
module.exports = function(key){ | |
[][UNSCOPABLES][key] = true; | |
}; | |
},{"27":27,"75":75}],75:[function(_dereq_,module,exports){ | |
var store = _dereq_(56)('wks') | |
, Symbol = _dereq_(25).Symbol; | |
module.exports = function(name){ | |
return store[name] || (store[name] = | |
Symbol && Symbol[name] || (Symbol || _dereq_(73))('Symbol.' + name)); | |
}; | |
},{"25":25,"56":56,"73":73}],76:[function(_dereq_,module,exports){ | |
var classof = _dereq_(7) | |
, ITERATOR = _dereq_(75)('iterator') | |
, Iterators = _dereq_(39); | |
module.exports = _dereq_(13).getIteratorMethod = function(it){ | |
if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; | |
}; | |
},{"13":13,"39":39,"7":7,"75":75}],77:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, SUPPORT_DESC = _dereq_(65) | |
, createDesc = _dereq_(51) | |
, html = _dereq_(28) | |
, cel = _dereq_(17) | |
, has = _dereq_(26) | |
, cof = _dereq_(8) | |
, $def = _dereq_(15) | |
, invoke = _dereq_(29) | |
, arrayMethod = _dereq_(5) | |
, IE_PROTO = _dereq_(73)('__proto__') | |
, isObject = _dereq_(33) | |
, anObject = _dereq_(3) | |
, aFunction = _dereq_(2) | |
, toObject = _dereq_(72) | |
, toIObject = _dereq_(70) | |
, toInteger = _dereq_(69) | |
, toIndex = _dereq_(68) | |
, toLength = _dereq_(71) | |
, IObject = _dereq_(30) | |
, fails = _dereq_(20) | |
, ObjectProto = Object.prototype | |
, A = [] | |
, _slice = A.slice | |
, _join = A.join | |
, defineProperty = $.setDesc | |
, getOwnDescriptor = $.getDesc | |
, defineProperties = $.setDescs | |
, $indexOf = _dereq_(4)(false) | |
, factories = {} | |
, IE8_DOM_DEFINE; | |
if(!SUPPORT_DESC){ | |
IE8_DOM_DEFINE = !fails(function(){ | |
return defineProperty(cel('div'), 'a', {get: function(){ return 7; }}).a != 7; | |
}); | |
$.setDesc = function(O, P, Attributes){ | |
if(IE8_DOM_DEFINE)try { | |
return defineProperty(O, P, Attributes); | |
} catch(e){ /* empty */ } | |
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); | |
if('value' in Attributes)anObject(O)[P] = Attributes.value; | |
return O; | |
}; | |
$.getDesc = function(O, P){ | |
if(IE8_DOM_DEFINE)try { | |
return getOwnDescriptor(O, P); | |
} catch(e){ /* empty */ } | |
if(has(O, P))return createDesc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]); | |
}; | |
$.setDescs = defineProperties = function(O, Properties){ | |
anObject(O); | |
var keys = $.getKeys(Properties) | |
, length = keys.length | |
, i = 0 | |
, P; | |
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]); | |
return O; | |
}; | |
} | |
$def($def.S + $def.F * !SUPPORT_DESC, 'Object', { | |
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P) | |
getOwnPropertyDescriptor: $.getDesc, | |
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) | |
defineProperty: $.setDesc, | |
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) | |
defineProperties: defineProperties | |
}); | |
// IE 8- don't enum bug keys | |
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' + | |
'toLocaleString,toString,valueOf').split(',') | |
// Additional keys for getOwnPropertyNames | |
, keys2 = keys1.concat('length', 'prototype') | |
, keysLen1 = keys1.length; | |
// Create object with `null` prototype: use iframe Object with cleared prototype | |
var createDict = function(){ | |
// Thrash, waste and sodomy: IE GC bug | |
var iframe = cel('iframe') | |
, i = keysLen1 | |
, gt = '>' | |
, iframeDocument; | |
iframe.style.display = 'none'; | |
html.appendChild(iframe); | |
iframe.src = 'javascript:'; // eslint-disable-line no-script-url | |
// createDict = iframe.contentWindow.Object; | |
// html.removeChild(iframe); | |
iframeDocument = iframe.contentWindow.document; | |
iframeDocument.open(); | |
iframeDocument.write('<script>document.F=Object</script' + gt); | |
iframeDocument.close(); | |
createDict = iframeDocument.F; | |
while(i--)delete createDict.prototype[keys1[i]]; | |
return createDict(); | |
}; | |
var createGetKeys = function(names, length){ | |
return function(object){ | |
var O = toIObject(object) | |
, i = 0 | |
, result = [] | |
, key; | |
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); | |
// Don't enum bug & hidden keys | |
while(length > i)if(has(O, key = names[i++])){ | |
~$indexOf(result, key) || result.push(key); | |
} | |
return result; | |
}; | |
}; | |
var Empty = function(){}; | |
$def($def.S, 'Object', { | |
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) | |
getPrototypeOf: $.getProto = $.getProto || function(O){ | |
O = toObject(O); | |
if(has(O, IE_PROTO))return O[IE_PROTO]; | |
if(typeof O.constructor == 'function' && O instanceof O.constructor){ | |
return O.constructor.prototype; | |
} return O instanceof Object ? ObjectProto : null; | |
}, | |
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) | |
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true), | |
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) | |
create: $.create = $.create || function(O, /*?*/Properties){ | |
var result; | |
if(O !== null){ | |
Empty.prototype = anObject(O); | |
result = new Empty(); | |
Empty.prototype = null; | |
// add "__proto__" for Object.getPrototypeOf shim | |
result[IE_PROTO] = O; | |
} else result = createDict(); | |
return Properties === undefined ? result : defineProperties(result, Properties); | |
}, | |
// 19.1.2.14 / 15.2.3.14 Object.keys(O) | |
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false) | |
}); | |
var construct = function(F, len, args){ | |
if(!(len in factories)){ | |
for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']'; | |
factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); | |
} | |
return factories[len](F, args); | |
}; | |
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) | |
$def($def.P, 'Function', { | |
bind: function bind(that /*, args... */){ | |
var fn = aFunction(this) | |
, partArgs = _slice.call(arguments, 1); | |
var bound = function(/* args... */){ | |
var args = partArgs.concat(_slice.call(arguments)); | |
return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); | |
}; | |
if(isObject(fn.prototype))bound.prototype = fn.prototype; | |
return bound; | |
} | |
}); | |
// fallback for not array-like ES3 strings and DOM objects | |
var buggySlice = fails(function(){ | |
if(html)_slice.call(html); | |
}); | |
$def($def.P + $def.F * buggySlice, 'Array', { | |
slice: function(begin, end){ | |
var len = toLength(this.length) | |
, klass = cof(this); | |
end = end === undefined ? len : end; | |
if(klass == 'Array')return _slice.call(this, begin, end); | |
var start = toIndex(begin, len) | |
, upTo = toIndex(end, len) | |
, size = toLength(upTo - start) | |
, cloned = Array(size) | |
, i = 0; | |
for(; i < size; i++)cloned[i] = klass == 'String' | |
? this.charAt(start + i) | |
: this[start + i]; | |
return cloned; | |
} | |
}); | |
$def($def.P + $def.F * (IObject != Object), 'Array', { | |
join: function(){ | |
return _join.apply(IObject(this), arguments); | |
} | |
}); | |
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg) | |
$def($def.S, 'Array', {isArray: function(arg){ return cof(arg) == 'Array'; }}); | |
var createArrayReduce = function(isRight){ | |
return function(callbackfn, memo){ | |
aFunction(callbackfn); | |
var O = IObject(this) | |
, length = toLength(O.length) | |
, index = isRight ? length - 1 : 0 | |
, i = isRight ? -1 : 1; | |
if(arguments.length < 2)for(;;){ | |
if(index in O){ | |
memo = O[index]; | |
index += i; | |
break; | |
} | |
index += i; | |
if(isRight ? index < 0 : length <= index){ | |
throw TypeError('Reduce of empty array with no initial value'); | |
} | |
} | |
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){ | |
memo = callbackfn(memo, O[index], index, this); | |
} | |
return memo; | |
}; | |
}; | |
var methodize = function($fn){ | |
return function(arg1/*, arg2 = undefined */){ | |
return $fn(this, arg1, arguments[1]); | |
}; | |
}; | |
$def($def.P, 'Array', { | |
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) | |
forEach: $.each = $.each || methodize(arrayMethod(0)), | |
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) | |
map: methodize(arrayMethod(1)), | |
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) | |
filter: methodize(arrayMethod(2)), | |
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) | |
some: methodize(arrayMethod(3)), | |
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) | |
every: methodize(arrayMethod(4)), | |
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) | |
reduce: createArrayReduce(false), | |
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) | |
reduceRight: createArrayReduce(true), | |
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) | |
indexOf: methodize($indexOf), | |
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) | |
lastIndexOf: function(el, fromIndex /* = @[*-1] */){ | |
var O = toIObject(this) | |
, length = toLength(O.length) | |
, index = length - 1; | |
if(arguments.length > 1)index = Math.min(index, toInteger(fromIndex)); | |
if(index < 0)index = toLength(length + index); | |
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index; | |
return -1; | |
} | |
}); | |
// 20.3.3.1 / 15.9.4.4 Date.now() | |
$def($def.S, 'Date', {now: function(){ return +new Date; }}); | |
var lz = function(num){ | |
return num > 9 ? num : '0' + num; | |
}; | |
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() | |
// PhantomJS and old webkit had a broken Date implementation. | |
var date = new Date(-5e13 - 1) | |
, brokenDate = !(date.toISOString && date.toISOString() == '0385-07-25T07:06:39.999Z' | |
&& fails(function(){ new Date(NaN).toISOString(); })); | |
$def($def.P + $def.F * brokenDate, 'Date', { | |
toISOString: function toISOString(){ | |
if(!isFinite(this))throw RangeError('Invalid time value'); | |
var d = this | |
, y = d.getUTCFullYear() | |
, m = d.getUTCMilliseconds() | |
, s = y < 0 ? '-' : y > 9999 ? '+' : ''; | |
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + | |
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + | |
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + | |
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; | |
} | |
}); | |
},{"15":15,"17":17,"2":2,"20":20,"26":26,"28":28,"29":29,"3":3,"30":30,"33":33,"4":4,"40":40,"5":5,"51":51,"65":65,"68":68,"69":69,"70":70,"71":71,"72":72,"73":73,"8":8}],78:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, toObject = _dereq_(72) | |
, toIndex = _dereq_(68) | |
, toLength = _dereq_(71); | |
$def($def.P, 'Array', { | |
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) | |
copyWithin: function copyWithin(target/* = 0 */, start /* = 0, end = @length */){ | |
var O = toObject(this) | |
, len = toLength(O.length) | |
, to = toIndex(target, len) | |
, from = toIndex(start, len) | |
, end = arguments[2] | |
, fin = end === undefined ? len : toIndex(end, len) | |
, count = Math.min(fin - from, len - to) | |
, inc = 1; | |
if(from < to && to < from + count){ | |
inc = -1; | |
from = from + count - 1; | |
to = to + count - 1; | |
} | |
while(count-- > 0){ | |
if(from in O)O[to] = O[from]; | |
else delete O[to]; | |
to += inc; | |
from += inc; | |
} return O; | |
} | |
}); | |
_dereq_(74)('copyWithin'); | |
},{"15":15,"68":68,"71":71,"72":72,"74":74}],79:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, toObject = _dereq_(72) | |
, toIndex = _dereq_(68) | |
, toLength = _dereq_(71); | |
$def($def.P, 'Array', { | |
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) | |
fill: function fill(value /*, start = 0, end = @length */){ | |
var O = toObject(this, true) | |
, length = toLength(O.length) | |
, index = toIndex(arguments[1], length) | |
, end = arguments[2] | |
, endPos = end === undefined ? length : toIndex(end, length); | |
while(endPos > index)O[index++] = value; | |
return O; | |
} | |
}); | |
_dereq_(74)('fill'); | |
},{"15":15,"68":68,"71":71,"72":72,"74":74}],80:[function(_dereq_,module,exports){ | |
'use strict'; | |
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) | |
var KEY = 'findIndex' | |
, $def = _dereq_(15) | |
, forced = true | |
, $find = _dereq_(5)(6); | |
// Shouldn't skip holes | |
if(KEY in [])Array(1)[KEY](function(){ forced = false; }); | |
$def($def.P + $def.F * forced, 'Array', { | |
findIndex: function findIndex(callbackfn/*, that = undefined */){ | |
return $find(this, callbackfn, arguments[1]); | |
} | |
}); | |
_dereq_(74)(KEY); | |
},{"15":15,"5":5,"74":74}],81:[function(_dereq_,module,exports){ | |
'use strict'; | |
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) | |
var KEY = 'find' | |
, $def = _dereq_(15) | |
, forced = true | |
, $find = _dereq_(5)(5); | |
// Shouldn't skip holes | |
if(KEY in [])Array(1)[KEY](function(){ forced = false; }); | |
$def($def.P + $def.F * forced, 'Array', { | |
find: function find(callbackfn/*, that = undefined */){ | |
return $find(this, callbackfn, arguments[1]); | |
} | |
}); | |
_dereq_(74)(KEY); | |
},{"15":15,"5":5,"74":74}],82:[function(_dereq_,module,exports){ | |
'use strict'; | |
var ctx = _dereq_(14) | |
, $def = _dereq_(15) | |
, toObject = _dereq_(72) | |
, call = _dereq_(34) | |
, isArrayIter = _dereq_(31) | |
, toLength = _dereq_(71) | |
, getIterFn = _dereq_(76); | |
$def($def.S + $def.F * !_dereq_(37)(function(iter){ Array.from(iter); }), 'Array', { | |
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) | |
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ | |
var O = toObject(arrayLike) | |
, C = typeof this == 'function' ? this : Array | |
, mapfn = arguments[1] | |
, mapping = mapfn !== undefined | |
, index = 0 | |
, iterFn = getIterFn(O) | |
, length, result, step, iterator; | |
if(mapping)mapfn = ctx(mapfn, arguments[2], 2); | |
// if object isn't iterable or it's array with default iterator - use simple case | |
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ | |
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ | |
result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value; | |
} | |
} else { | |
for(result = new C(length = toLength(O.length)); length > index; index++){ | |
result[index] = mapping ? mapfn(O[index], index) : O[index]; | |
} | |
} | |
result.length = index; | |
return result; | |
} | |
}); | |
},{"14":14,"15":15,"31":31,"34":34,"37":37,"71":71,"72":72,"76":76}],83:[function(_dereq_,module,exports){ | |
'use strict'; | |
var setUnscope = _dereq_(74) | |
, step = _dereq_(38) | |
, Iterators = _dereq_(39) | |
, toIObject = _dereq_(70); | |
// 22.1.3.4 Array.prototype.entries() | |
// 22.1.3.13 Array.prototype.keys() | |
// 22.1.3.29 Array.prototype.values() | |
// 22.1.3.30 Array.prototype[@@iterator]() | |
_dereq_(36)(Array, 'Array', function(iterated, kind){ | |
this._t = toIObject(iterated); // target | |
this._i = 0; // next index | |
this._k = kind; // kind | |
// 22.1.5.2.1 %ArrayIteratorPrototype%.next() | |
}, function(){ | |
var O = this._t | |
, kind = this._k | |
, index = this._i++; | |
if(!O || index >= O.length){ | |
this._t = undefined; | |
return step(1); | |
} | |
if(kind == 'keys' )return step(0, index); | |
if(kind == 'values')return step(0, O[index]); | |
return step(0, [index, O[index]]); | |
}, 'values'); | |
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) | |
Iterators.Arguments = Iterators.Array; | |
setUnscope('keys'); | |
setUnscope('values'); | |
setUnscope('entries'); | |
},{"36":36,"38":38,"39":39,"70":70,"74":74}],84:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15); | |
// WebKit Array.of isn't generic | |
$def($def.S + $def.F * _dereq_(20)(function(){ | |
function F(){} | |
return !(Array.of.call(F) instanceof F); | |
}), 'Array', { | |
// 22.1.2.3 Array.of( ...items) | |
of: function of(/* ...args */){ | |
var index = 0 | |
, length = arguments.length | |
, result = new (typeof this == 'function' ? this : Array)(length); | |
while(length > index)result[index] = arguments[index++]; | |
result.length = length; | |
return result; | |
} | |
}); | |
},{"15":15,"20":20}],85:[function(_dereq_,module,exports){ | |
_dereq_(58)(Array); | |
},{"58":58}],86:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, isObject = _dereq_(33) | |
, HAS_INSTANCE = _dereq_(75)('hasInstance') | |
, FunctionProto = Function.prototype; | |
// 19.2.3.6 Function.prototype[@@hasInstance](V) | |
if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){ | |
if(typeof this != 'function' || !isObject(O))return false; | |
if(!isObject(this.prototype))return O instanceof this; | |
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: | |
while(O = $.getProto(O))if(this.prototype === O)return true; | |
return false; | |
}}); | |
},{"33":33,"40":40,"75":75}],87:[function(_dereq_,module,exports){ | |
var setDesc = _dereq_(40).setDesc | |
, createDesc = _dereq_(51) | |
, has = _dereq_(26) | |
, FProto = Function.prototype | |
, nameRE = /^\s*function ([^ (]*)/ | |
, NAME = 'name'; | |
// 19.2.4.2 name | |
NAME in FProto || _dereq_(65) && setDesc(FProto, NAME, { | |
configurable: true, | |
get: function(){ | |
var match = ('' + this).match(nameRE) | |
, name = match ? match[1] : ''; | |
has(this, NAME) || setDesc(this, NAME, createDesc(5, name)); | |
return name; | |
} | |
}); | |
},{"26":26,"40":40,"51":51,"65":65}],88:[function(_dereq_,module,exports){ | |
'use strict'; | |
var strong = _dereq_(9); | |
// 23.1 Map Objects | |
_dereq_(12)('Map', function(get){ | |
return function Map(){ return get(this, arguments[0]); }; | |
}, { | |
// 23.1.3.6 Map.prototype.get(key) | |
get: function get(key){ | |
var entry = strong.getEntry(this, key); | |
return entry && entry.v; | |
}, | |
// 23.1.3.9 Map.prototype.set(key, value) | |
set: function set(key, value){ | |
return strong.def(this, key === 0 ? 0 : key, value); | |
} | |
}, strong, true); | |
},{"12":12,"9":9}],89:[function(_dereq_,module,exports){ | |
// 20.2.2.3 Math.acosh(x) | |
var $def = _dereq_(15) | |
, log1p = _dereq_(43) | |
, sqrt = Math.sqrt | |
, $acosh = Math.acosh; | |
// V8 bug https://code.google.com/p/v8/issues/detail?id=3509 | |
$def($def.S + $def.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', { | |
acosh: function acosh(x){ | |
return (x = +x) < 1 ? NaN : x > 94906265.62425156 | |
? Math.log(x) + Math.LN2 | |
: log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); | |
} | |
}); | |
},{"15":15,"43":43}],90:[function(_dereq_,module,exports){ | |
// 20.2.2.5 Math.asinh(x) | |
var $def = _dereq_(15); | |
function asinh(x){ | |
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); | |
} | |
$def($def.S, 'Math', {asinh: asinh}); | |
},{"15":15}],91:[function(_dereq_,module,exports){ | |
// 20.2.2.7 Math.atanh(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', { | |
atanh: function atanh(x){ | |
return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; | |
} | |
}); | |
},{"15":15}],92:[function(_dereq_,module,exports){ | |
// 20.2.2.9 Math.cbrt(x) | |
var $def = _dereq_(15) | |
, sign = _dereq_(57); | |
$def($def.S, 'Math', { | |
cbrt: function cbrt(x){ | |
return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); | |
} | |
}); | |
},{"15":15,"57":57}],93:[function(_dereq_,module,exports){ | |
// 20.2.2.11 Math.clz32(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', { | |
clz32: function clz32(x){ | |
return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; | |
} | |
}); | |
},{"15":15}],94:[function(_dereq_,module,exports){ | |
// 20.2.2.12 Math.cosh(x) | |
var $def = _dereq_(15) | |
, exp = Math.exp; | |
$def($def.S, 'Math', { | |
cosh: function cosh(x){ | |
return (exp(x = +x) + exp(-x)) / 2; | |
} | |
}); | |
},{"15":15}],95:[function(_dereq_,module,exports){ | |
// 20.2.2.14 Math.expm1(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', {expm1: _dereq_(19)}); | |
},{"15":15,"19":19}],96:[function(_dereq_,module,exports){ | |
// 20.2.2.16 Math.fround(x) | |
var $def = _dereq_(15) | |
, sign = _dereq_(57) | |
, pow = Math.pow | |
, EPSILON = pow(2, -52) | |
, EPSILON32 = pow(2, -23) | |
, MAX32 = pow(2, 127) * (2 - EPSILON32) | |
, MIN32 = pow(2, -126); | |
var roundTiesToEven = function(n){ | |
return n + 1 / EPSILON - 1 / EPSILON; | |
}; | |
$def($def.S, 'Math', { | |
fround: function fround(x){ | |
var $abs = Math.abs(x) | |
, $sign = sign(x) | |
, a, result; | |
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; | |
a = (1 + EPSILON32 / EPSILON) * $abs; | |
result = a - (a - $abs); | |
if(result > MAX32 || result != result)return $sign * Infinity; | |
return $sign * result; | |
} | |
}); | |
},{"15":15,"57":57}],97:[function(_dereq_,module,exports){ | |
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) | |
var $def = _dereq_(15) | |
, abs = Math.abs; | |
$def($def.S, 'Math', { | |
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars | |
var sum = 0 | |
, i = 0 | |
, len = arguments.length | |
, larg = 0 | |
, arg, div; | |
while(i < len){ | |
arg = abs(arguments[i++]); | |
if(larg < arg){ | |
div = larg / arg; | |
sum = sum * div * div + 1; | |
larg = arg; | |
} else if(arg > 0){ | |
div = arg / larg; | |
sum += div * div; | |
} else sum += arg; | |
} | |
return larg === Infinity ? Infinity : larg * Math.sqrt(sum); | |
} | |
}); | |
},{"15":15}],98:[function(_dereq_,module,exports){ | |
// 20.2.2.18 Math.imul(x, y) | |
var $def = _dereq_(15); | |
// WebKit fails with big numbers | |
$def($def.S + $def.F * _dereq_(20)(function(){ | |
return Math.imul(0xffffffff, 5) != -5; | |
}), 'Math', { | |
imul: function imul(x, y){ | |
var UINT16 = 0xffff | |
, xn = +x | |
, yn = +y | |
, xl = UINT16 & xn | |
, yl = UINT16 & yn; | |
return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); | |
} | |
}); | |
},{"15":15,"20":20}],99:[function(_dereq_,module,exports){ | |
// 20.2.2.21 Math.log10(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', { | |
log10: function log10(x){ | |
return Math.log(x) / Math.LN10; | |
} | |
}); | |
},{"15":15}],100:[function(_dereq_,module,exports){ | |
// 20.2.2.20 Math.log1p(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', {log1p: _dereq_(43)}); | |
},{"15":15,"43":43}],101:[function(_dereq_,module,exports){ | |
// 20.2.2.22 Math.log2(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', { | |
log2: function log2(x){ | |
return Math.log(x) / Math.LN2; | |
} | |
}); | |
},{"15":15}],102:[function(_dereq_,module,exports){ | |
// 20.2.2.28 Math.sign(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', {sign: _dereq_(57)}); | |
},{"15":15,"57":57}],103:[function(_dereq_,module,exports){ | |
// 20.2.2.30 Math.sinh(x) | |
var $def = _dereq_(15) | |
, expm1 = _dereq_(19) | |
, exp = Math.exp; | |
$def($def.S, 'Math', { | |
sinh: function sinh(x){ | |
return Math.abs(x = +x) < 1 | |
? (expm1(x) - expm1(-x)) / 2 | |
: (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); | |
} | |
}); | |
},{"15":15,"19":19}],104:[function(_dereq_,module,exports){ | |
// 20.2.2.33 Math.tanh(x) | |
var $def = _dereq_(15) | |
, expm1 = _dereq_(19) | |
, exp = Math.exp; | |
$def($def.S, 'Math', { | |
tanh: function tanh(x){ | |
var a = expm1(x = +x) | |
, b = expm1(-x); | |
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); | |
} | |
}); | |
},{"15":15,"19":19}],105:[function(_dereq_,module,exports){ | |
// 20.2.2.34 Math.trunc(x) | |
var $def = _dereq_(15); | |
$def($def.S, 'Math', { | |
trunc: function trunc(it){ | |
return (it > 0 ? Math.floor : Math.ceil)(it); | |
} | |
}); | |
},{"15":15}],106:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, global = _dereq_(25) | |
, has = _dereq_(26) | |
, cof = _dereq_(8) | |
, isObject = _dereq_(33) | |
, fails = _dereq_(20) | |
, NUMBER = 'Number' | |
, $Number = global[NUMBER] | |
, Base = $Number | |
, proto = $Number.prototype | |
// Opera ~12 has broken Object#toString | |
, BROKEN_COF = cof($.create(proto)) == NUMBER; | |
var toPrimitive = function(it){ | |
var fn, val; | |
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; | |
if(typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | |
throw TypeError("Can't convert object to number"); | |
}; | |
var toNumber = function(it){ | |
if(isObject(it))it = toPrimitive(it); | |
if(typeof it == 'string' && it.length > 2 && it.charCodeAt(0) == 48){ | |
var binary = false; | |
switch(it.charCodeAt(1)){ | |
case 66 : case 98 : binary = true; | |
case 79 : case 111 : return parseInt(it.slice(2), binary ? 2 : 8); | |
} | |
} return +it; | |
}; | |
if(!($Number('0o1') && $Number('0b1'))){ | |
$Number = function Number(it){ | |
var that = this; | |
return that instanceof $Number | |
// check on 1..constructor(foo) case | |
&& (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER) | |
? new Base(toNumber(it)) : toNumber(it); | |
}; | |
$.each.call(_dereq_(65) ? $.getNames(Base) : ( | |
// ES3: | |
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + | |
// ES6 (in case, if modules with ES6 Number statics required before): | |
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + | |
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' | |
).split(','), function(key){ | |
if(has(Base, key) && !has($Number, key)){ | |
$.setDesc($Number, key, $.getDesc(Base, key)); | |
} | |
} | |
); | |
$Number.prototype = proto; | |
proto.constructor = $Number; | |
_dereq_(52)(global, NUMBER, $Number); | |
} | |
},{"20":20,"25":25,"26":26,"33":33,"40":40,"52":52,"65":65,"8":8}],107:[function(_dereq_,module,exports){ | |
// 20.1.2.1 Number.EPSILON | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', {EPSILON: Math.pow(2, -52)}); | |
},{"15":15}],108:[function(_dereq_,module,exports){ | |
// 20.1.2.2 Number.isFinite(number) | |
var $def = _dereq_(15) | |
, _isFinite = _dereq_(25).isFinite; | |
$def($def.S, 'Number', { | |
isFinite: function isFinite(it){ | |
return typeof it == 'number' && _isFinite(it); | |
} | |
}); | |
},{"15":15,"25":25}],109:[function(_dereq_,module,exports){ | |
// 20.1.2.3 Number.isInteger(number) | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', {isInteger: _dereq_(32)}); | |
},{"15":15,"32":32}],110:[function(_dereq_,module,exports){ | |
// 20.1.2.4 Number.isNaN(number) | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', { | |
isNaN: function isNaN(number){ | |
return number != number; | |
} | |
}); | |
},{"15":15}],111:[function(_dereq_,module,exports){ | |
// 20.1.2.5 Number.isSafeInteger(number) | |
var $def = _dereq_(15) | |
, isInteger = _dereq_(32) | |
, abs = Math.abs; | |
$def($def.S, 'Number', { | |
isSafeInteger: function isSafeInteger(number){ | |
return isInteger(number) && abs(number) <= 0x1fffffffffffff; | |
} | |
}); | |
},{"15":15,"32":32}],112:[function(_dereq_,module,exports){ | |
// 20.1.2.6 Number.MAX_SAFE_INTEGER | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); | |
},{"15":15}],113:[function(_dereq_,module,exports){ | |
// 20.1.2.10 Number.MIN_SAFE_INTEGER | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); | |
},{"15":15}],114:[function(_dereq_,module,exports){ | |
// 20.1.2.12 Number.parseFloat(string) | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', {parseFloat: parseFloat}); | |
},{"15":15}],115:[function(_dereq_,module,exports){ | |
// 20.1.2.13 Number.parseInt(string, radix) | |
var $def = _dereq_(15); | |
$def($def.S, 'Number', {parseInt: parseInt}); | |
},{"15":15}],116:[function(_dereq_,module,exports){ | |
// 19.1.3.1 Object.assign(target, source) | |
var $def = _dereq_(15); | |
$def($def.S + $def.F, 'Object', {assign: _dereq_(6)}); | |
},{"15":15,"6":6}],117:[function(_dereq_,module,exports){ | |
// 19.1.2.5 Object.freeze(O) | |
var isObject = _dereq_(33); | |
_dereq_(46)('freeze', function($freeze){ | |
return function freeze(it){ | |
return $freeze && isObject(it) ? $freeze(it) : it; | |
}; | |
}); | |
},{"33":33,"46":46}],118:[function(_dereq_,module,exports){ | |
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) | |
var toIObject = _dereq_(70); | |
_dereq_(46)('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){ | |
return function getOwnPropertyDescriptor(it, key){ | |
return $getOwnPropertyDescriptor(toIObject(it), key); | |
}; | |
}); | |
},{"46":46,"70":70}],119:[function(_dereq_,module,exports){ | |
// 19.1.2.7 Object.getOwnPropertyNames(O) | |
_dereq_(46)('getOwnPropertyNames', function(){ | |
return _dereq_(24).get; | |
}); | |
},{"24":24,"46":46}],120:[function(_dereq_,module,exports){ | |
// 19.1.2.9 Object.getPrototypeOf(O) | |
var toObject = _dereq_(72); | |
_dereq_(46)('getPrototypeOf', function($getPrototypeOf){ | |
return function getPrototypeOf(it){ | |
return $getPrototypeOf(toObject(it)); | |
}; | |
}); | |
},{"46":46,"72":72}],121:[function(_dereq_,module,exports){ | |
// 19.1.2.11 Object.isExtensible(O) | |
var isObject = _dereq_(33); | |
_dereq_(46)('isExtensible', function($isExtensible){ | |
return function isExtensible(it){ | |
return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; | |
}; | |
}); | |
},{"33":33,"46":46}],122:[function(_dereq_,module,exports){ | |
// 19.1.2.12 Object.isFrozen(O) | |
var isObject = _dereq_(33); | |
_dereq_(46)('isFrozen', function($isFrozen){ | |
return function isFrozen(it){ | |
return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; | |
}; | |
}); | |
},{"33":33,"46":46}],123:[function(_dereq_,module,exports){ | |
// 19.1.2.13 Object.isSealed(O) | |
var isObject = _dereq_(33); | |
_dereq_(46)('isSealed', function($isSealed){ | |
return function isSealed(it){ | |
return isObject(it) ? $isSealed ? $isSealed(it) : false : true; | |
}; | |
}); | |
},{"33":33,"46":46}],124:[function(_dereq_,module,exports){ | |
// 19.1.3.10 Object.is(value1, value2) | |
var $def = _dereq_(15); | |
$def($def.S, 'Object', { | |
is: _dereq_(54) | |
}); | |
},{"15":15,"54":54}],125:[function(_dereq_,module,exports){ | |
// 19.1.2.14 Object.keys(O) | |
var toObject = _dereq_(72); | |
_dereq_(46)('keys', function($keys){ | |
return function keys(it){ | |
return $keys(toObject(it)); | |
}; | |
}); | |
},{"46":46,"72":72}],126:[function(_dereq_,module,exports){ | |
// 19.1.2.15 Object.preventExtensions(O) | |
var isObject = _dereq_(33); | |
_dereq_(46)('preventExtensions', function($preventExtensions){ | |
return function preventExtensions(it){ | |
return $preventExtensions && isObject(it) ? $preventExtensions(it) : it; | |
}; | |
}); | |
},{"33":33,"46":46}],127:[function(_dereq_,module,exports){ | |
// 19.1.2.17 Object.seal(O) | |
var isObject = _dereq_(33); | |
_dereq_(46)('seal', function($seal){ | |
return function seal(it){ | |
return $seal && isObject(it) ? $seal(it) : it; | |
}; | |
}); | |
},{"33":33,"46":46}],128:[function(_dereq_,module,exports){ | |
// 19.1.3.19 Object.setPrototypeOf(O, proto) | |
var $def = _dereq_(15); | |
$def($def.S, 'Object', {setPrototypeOf: _dereq_(55).set}); | |
},{"15":15,"55":55}],129:[function(_dereq_,module,exports){ | |
'use strict'; | |
// 19.1.3.6 Object.prototype.toString() | |
var classof = _dereq_(7) | |
, test = {}; | |
test[_dereq_(75)('toStringTag')] = 'z'; | |
if(test + '' != '[object z]'){ | |
_dereq_(52)(Object.prototype, 'toString', function toString(){ | |
return '[object ' + classof(this) + ']'; | |
}, true); | |
} | |
},{"52":52,"7":7,"75":75}],130:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, LIBRARY = _dereq_(42) | |
, global = _dereq_(25) | |
, ctx = _dereq_(14) | |
, classof = _dereq_(7) | |
, $def = _dereq_(15) | |
, isObject = _dereq_(33) | |
, anObject = _dereq_(3) | |
, aFunction = _dereq_(2) | |
, strictNew = _dereq_(59) | |
, forOf = _dereq_(23) | |
, setProto = _dereq_(55).set | |
, same = _dereq_(54) | |
, species = _dereq_(58) | |
, SPECIES = _dereq_(75)('species') | |
, RECORD = _dereq_(73)('record') | |
, asap = _dereq_(44) | |
, PROMISE = 'Promise' | |
, process = global.process | |
, isNode = classof(process) == 'process' | |
, P = global[PROMISE] | |
, Wrapper; | |
var testResolve = function(sub){ | |
var test = new P(function(){}); | |
if(sub)test.constructor = Object; | |
return P.resolve(test) === test; | |
}; | |
var useNative = function(){ | |
var works = false; | |
function P2(x){ | |
var self = new P(x); | |
setProto(self, P2.prototype); | |
return self; | |
} | |
try { | |
works = P && P.resolve && testResolve(); | |
setProto(P2, P); | |
P2.prototype = $.create(P.prototype, {constructor: {value: P2}}); | |
// actual Firefox has broken subclass support, test that | |
if(!(P2.resolve(5).then(function(){}) instanceof P2)){ | |
works = false; | |
} | |
// actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162 | |
if(works && _dereq_(65)){ | |
var thenableThenGotten = false; | |
P.resolve($.setDesc({}, 'then', { | |
get: function(){ thenableThenGotten = true; } | |
})); | |
works = thenableThenGotten; | |
} | |
} catch(e){ works = false; } | |
return works; | |
}(); | |
// helpers | |
var isPromise = function(it){ | |
return isObject(it) && (useNative ? classof(it) == 'Promise' : RECORD in it); | |
}; | |
var sameConstructor = function(a, b){ | |
// library wrapper special case | |
if(LIBRARY && a === P && b === Wrapper)return true; | |
return same(a, b); | |
}; | |
var getConstructor = function(C){ | |
var S = anObject(C)[SPECIES]; | |
return S != undefined ? S : C; | |
}; | |
var isThenable = function(it){ | |
var then; | |
return isObject(it) && typeof (then = it.then) == 'function' ? then : false; | |
}; | |
var notify = function(record, isReject){ | |
if(record.n)return; | |
record.n = true; | |
var chain = record.c; | |
asap(function(){ | |
var value = record.v | |
, ok = record.s == 1 | |
, i = 0; | |
var run = function(react){ | |
var cb = ok ? react.ok : react.fail | |
, ret, then; | |
try { | |
if(cb){ | |
if(!ok)record.h = true; | |
ret = cb === true ? value : cb(value); | |
if(ret === react.P){ | |
react.rej(TypeError('Promise-chain cycle')); | |
} else if(then = isThenable(ret)){ | |
then.call(ret, react.res, react.rej); | |
} else react.res(ret); | |
} else react.rej(value); | |
} catch(err){ | |
react.rej(err); | |
} | |
}; | |
while(chain.length > i)run(chain[i++]); // variable length - can't use forEach | |
chain.length = 0; | |
record.n = false; | |
if(isReject)setTimeout(function(){ | |
if(isUnhandled(record.p)){ | |
if(isNode){ | |
process.emit('unhandledRejection', value, record.p); | |
} else if(global.console && console.error){ | |
console.error('Unhandled promise rejection', value); | |
} | |
} record.a = undefined; | |
}, 1); | |
}); | |
}; | |
var isUnhandled = function(promise){ | |
var record = promise[RECORD] | |
, chain = record.a || record.c | |
, i = 0 | |
, react; | |
if(record.h)return false; | |
while(chain.length > i){ | |
react = chain[i++]; | |
if(react.fail || !isUnhandled(react.P))return false; | |
} return true; | |
}; | |
var $reject = function(value){ | |
var record = this; | |
if(record.d)return; | |
record.d = true; | |
record = record.r || record; // unwrap | |
record.v = value; | |
record.s = 2; | |
record.a = record.c.slice(); | |
notify(record, true); | |
}; | |
var $resolve = function(value){ | |
var record = this | |
, then; | |
if(record.d)return; | |
record.d = true; | |
record = record.r || record; // unwrap | |
try { | |
if(then = isThenable(value)){ | |
asap(function(){ | |
var wrapper = {r: record, d: false}; // wrap | |
try { | |
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); | |
} catch(e){ | |
$reject.call(wrapper, e); | |
} | |
}); | |
} else { | |
record.v = value; | |
record.s = 1; | |
notify(record, false); | |
} | |
} catch(e){ | |
$reject.call({r: record, d: false}, e); // wrap | |
} | |
}; | |
// constructor polyfill | |
if(!useNative){ | |
// 25.4.3.1 Promise(executor) | |
P = function Promise(executor){ | |
aFunction(executor); | |
var record = { | |
p: strictNew(this, P, PROMISE), // <- promise | |
c: [], // <- awaiting reactions | |
a: undefined, // <- checked in isUnhandled reactions | |
s: 0, // <- state | |
d: false, // <- done | |
v: undefined, // <- value | |
h: false, // <- handled rejection | |
n: false // <- notify | |
}; | |
this[RECORD] = record; | |
try { | |
executor(ctx($resolve, record, 1), ctx($reject, record, 1)); | |
} catch(err){ | |
$reject.call(record, err); | |
} | |
}; | |
_dereq_(45)(P.prototype, { | |
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) | |
then: function then(onFulfilled, onRejected){ | |
var S = anObject(anObject(this).constructor)[SPECIES]; | |
var react = { | |
ok: typeof onFulfilled == 'function' ? onFulfilled : true, | |
fail: typeof onRejected == 'function' ? onRejected : false | |
}; | |
var promise = react.P = new (S != undefined ? S : P)(function(res, rej){ | |
react.res = aFunction(res); | |
react.rej = aFunction(rej); | |
}); | |
var record = this[RECORD]; | |
record.c.push(react); | |
if(record.a)record.a.push(react); | |
if(record.s)notify(record, false); | |
return promise; | |
}, | |
// 25.4.5.1 Promise.prototype.catch(onRejected) | |
'catch': function(onRejected){ | |
return this.then(undefined, onRejected); | |
} | |
}); | |
} | |
// export | |
$def($def.G + $def.W + $def.F * !useNative, {Promise: P}); | |
_dereq_(66)(P, PROMISE); | |
species(P); | |
species(Wrapper = _dereq_(13)[PROMISE]); | |
// statics | |
$def($def.S + $def.F * !useNative, PROMISE, { | |
// 25.4.4.5 Promise.reject(r) | |
reject: function reject(r){ | |
return new this(function(res, rej){ rej(r); }); | |
} | |
}); | |
$def($def.S + $def.F * (!useNative || testResolve(true)), PROMISE, { | |
// 25.4.4.6 Promise.resolve(x) | |
resolve: function resolve(x){ | |
return isPromise(x) && sameConstructor(x.constructor, this) | |
? x : new this(function(res){ res(x); }); | |
} | |
}); | |
$def($def.S + $def.F * !(useNative && _dereq_(37)(function(iter){ | |
P.all(iter)['catch'](function(){}); | |
})), PROMISE, { | |
// 25.4.4.1 Promise.all(iterable) | |
all: function all(iterable){ | |
var C = getConstructor(this) | |
, values = []; | |
return new C(function(res, rej){ | |
forOf(iterable, false, values.push, values); | |
var remaining = values.length | |
, results = Array(remaining); | |
if(remaining)$.each.call(values, function(promise, index){ | |
C.resolve(promise).then(function(value){ | |
results[index] = value; | |
--remaining || res(results); | |
}, rej); | |
}); | |
else res(results); | |
}); | |
}, | |
// 25.4.4.4 Promise.race(iterable) | |
race: function race(iterable){ | |
var C = getConstructor(this); | |
return new C(function(res, rej){ | |
forOf(iterable, false, function(promise){ | |
C.resolve(promise).then(res, rej); | |
}); | |
}); | |
} | |
}); | |
},{"13":13,"14":14,"15":15,"2":2,"23":23,"25":25,"3":3,"33":33,"37":37,"40":40,"42":42,"44":44,"45":45,"54":54,"55":55,"58":58,"59":59,"65":65,"66":66,"7":7,"73":73,"75":75}],131:[function(_dereq_,module,exports){ | |
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList) | |
var $def = _dereq_(15) | |
, _apply = Function.apply; | |
$def($def.S, 'Reflect', { | |
apply: function apply(target, thisArgument, argumentsList){ | |
return _apply.call(target, thisArgument, argumentsList); | |
} | |
}); | |
},{"15":15}],132:[function(_dereq_,module,exports){ | |
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) | |
var $ = _dereq_(40) | |
, $def = _dereq_(15) | |
, aFunction = _dereq_(2) | |
, anObject = _dereq_(3) | |
, isObject = _dereq_(33) | |
, bind = Function.bind || _dereq_(13).Function.prototype.bind; | |
// MS Edge supports only 2 arguments | |
// FF Nightly sets third argument as `new.target`, but does not create `this` from it | |
$def($def.S + $def.F * _dereq_(20)(function(){ | |
function F(){} | |
return !(Reflect.construct(function(){}, [], F) instanceof F); | |
}), 'Reflect', { | |
construct: function construct(Target, args /*, newTarget*/){ | |
aFunction(Target); | |
var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); | |
if(Target == newTarget){ | |
// w/o altered newTarget, optimization for 0-4 arguments | |
if(args != undefined)switch(anObject(args).length){ | |
case 0: return new Target; | |
case 1: return new Target(args[0]); | |
case 2: return new Target(args[0], args[1]); | |
case 3: return new Target(args[0], args[1], args[2]); | |
case 4: return new Target(args[0], args[1], args[2], args[3]); | |
} | |
// w/o altered newTarget, lot of arguments case | |
var $args = [null]; | |
$args.push.apply($args, args); | |
return new (bind.apply(Target, $args)); | |
} | |
// with altered newTarget, not support built-in constructors | |
var proto = newTarget.prototype | |
, instance = $.create(isObject(proto) ? proto : Object.prototype) | |
, result = Function.apply.call(Target, instance, args); | |
return isObject(result) ? result : instance; | |
} | |
}); | |
},{"13":13,"15":15,"2":2,"20":20,"3":3,"33":33,"40":40}],133:[function(_dereq_,module,exports){ | |
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) | |
var $ = _dereq_(40) | |
, $def = _dereq_(15) | |
, anObject = _dereq_(3); | |
// MS Edge has broken Reflect.defineProperty - throwing instead of returning false | |
$def($def.S + $def.F * _dereq_(20)(function(){ | |
Reflect.defineProperty($.setDesc({}, 1, {value: 1}), 1, {value: 2}); | |
}), 'Reflect', { | |
defineProperty: function defineProperty(target, propertyKey, attributes){ | |
anObject(target); | |
try { | |
$.setDesc(target, propertyKey, attributes); | |
return true; | |
} catch(e){ | |
return false; | |
} | |
} | |
}); | |
},{"15":15,"20":20,"3":3,"40":40}],134:[function(_dereq_,module,exports){ | |
// 26.1.4 Reflect.deleteProperty(target, propertyKey) | |
var $def = _dereq_(15) | |
, getDesc = _dereq_(40).getDesc | |
, anObject = _dereq_(3); | |
$def($def.S, 'Reflect', { | |
deleteProperty: function deleteProperty(target, propertyKey){ | |
var desc = getDesc(anObject(target), propertyKey); | |
return desc && !desc.configurable ? false : delete target[propertyKey]; | |
} | |
}); | |
},{"15":15,"3":3,"40":40}],135:[function(_dereq_,module,exports){ | |
'use strict'; | |
// 26.1.5 Reflect.enumerate(target) | |
var $def = _dereq_(15) | |
, anObject = _dereq_(3); | |
var Enumerate = function(iterated){ | |
this._t = anObject(iterated); // target | |
this._i = 0; // next index | |
var keys = this._k = [] // keys | |
, key; | |
for(key in iterated)keys.push(key); | |
}; | |
_dereq_(35)(Enumerate, 'Object', function(){ | |
var that = this | |
, keys = that._k | |
, key; | |
do { | |
if(that._i >= keys.length)return {value: undefined, done: true}; | |
} while(!((key = keys[that._i++]) in that._t)); | |
return {value: key, done: false}; | |
}); | |
$def($def.S, 'Reflect', { | |
enumerate: function enumerate(target){ | |
return new Enumerate(target); | |
} | |
}); | |
},{"15":15,"3":3,"35":35}],136:[function(_dereq_,module,exports){ | |
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) | |
var $ = _dereq_(40) | |
, $def = _dereq_(15) | |
, anObject = _dereq_(3); | |
$def($def.S, 'Reflect', { | |
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){ | |
return $.getDesc(anObject(target), propertyKey); | |
} | |
}); | |
},{"15":15,"3":3,"40":40}],137:[function(_dereq_,module,exports){ | |
// 26.1.8 Reflect.getPrototypeOf(target) | |
var $def = _dereq_(15) | |
, getProto = _dereq_(40).getProto | |
, anObject = _dereq_(3); | |
$def($def.S, 'Reflect', { | |
getPrototypeOf: function getPrototypeOf(target){ | |
return getProto(anObject(target)); | |
} | |
}); | |
},{"15":15,"3":3,"40":40}],138:[function(_dereq_,module,exports){ | |
// 26.1.6 Reflect.get(target, propertyKey [, receiver]) | |
var $ = _dereq_(40) | |
, has = _dereq_(26) | |
, $def = _dereq_(15) | |
, isObject = _dereq_(33) | |
, anObject = _dereq_(3); | |
function get(target, propertyKey/*, receiver*/){ | |
var receiver = arguments.length < 3 ? target : arguments[2] | |
, desc, proto; | |
if(anObject(target) === receiver)return target[propertyKey]; | |
if(desc = $.getDesc(target, propertyKey))return has(desc, 'value') | |
? desc.value | |
: desc.get !== undefined | |
? desc.get.call(receiver) | |
: undefined; | |
if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver); | |
} | |
$def($def.S, 'Reflect', {get: get}); | |
},{"15":15,"26":26,"3":3,"33":33,"40":40}],139:[function(_dereq_,module,exports){ | |
// 26.1.9 Reflect.has(target, propertyKey) | |
var $def = _dereq_(15); | |
$def($def.S, 'Reflect', { | |
has: function has(target, propertyKey){ | |
return propertyKey in target; | |
} | |
}); | |
},{"15":15}],140:[function(_dereq_,module,exports){ | |
// 26.1.10 Reflect.isExtensible(target) | |
var $def = _dereq_(15) | |
, anObject = _dereq_(3) | |
, $isExtensible = Object.isExtensible; | |
$def($def.S, 'Reflect', { | |
isExtensible: function isExtensible(target){ | |
anObject(target); | |
return $isExtensible ? $isExtensible(target) : true; | |
} | |
}); | |
},{"15":15,"3":3}],141:[function(_dereq_,module,exports){ | |
// 26.1.11 Reflect.ownKeys(target) | |
var $def = _dereq_(15); | |
$def($def.S, 'Reflect', {ownKeys: _dereq_(48)}); | |
},{"15":15,"48":48}],142:[function(_dereq_,module,exports){ | |
// 26.1.12 Reflect.preventExtensions(target) | |
var $def = _dereq_(15) | |
, anObject = _dereq_(3) | |
, $preventExtensions = Object.preventExtensions; | |
$def($def.S, 'Reflect', { | |
preventExtensions: function preventExtensions(target){ | |
anObject(target); | |
try { | |
if($preventExtensions)$preventExtensions(target); | |
return true; | |
} catch(e){ | |
return false; | |
} | |
} | |
}); | |
},{"15":15,"3":3}],143:[function(_dereq_,module,exports){ | |
// 26.1.14 Reflect.setPrototypeOf(target, proto) | |
var $def = _dereq_(15) | |
, setProto = _dereq_(55); | |
if(setProto)$def($def.S, 'Reflect', { | |
setPrototypeOf: function setPrototypeOf(target, proto){ | |
setProto.check(target, proto); | |
try { | |
setProto.set(target, proto); | |
return true; | |
} catch(e){ | |
return false; | |
} | |
} | |
}); | |
},{"15":15,"55":55}],144:[function(_dereq_,module,exports){ | |
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) | |
var $ = _dereq_(40) | |
, has = _dereq_(26) | |
, $def = _dereq_(15) | |
, createDesc = _dereq_(51) | |
, anObject = _dereq_(3) | |
, isObject = _dereq_(33); | |
function set(target, propertyKey, V/*, receiver*/){ | |
var receiver = arguments.length < 4 ? target : arguments[3] | |
, ownDesc = $.getDesc(anObject(target), propertyKey) | |
, existingDescriptor, proto; | |
if(!ownDesc){ | |
if(isObject(proto = $.getProto(target))){ | |
return set(proto, propertyKey, V, receiver); | |
} | |
ownDesc = createDesc(0); | |
} | |
if(has(ownDesc, 'value')){ | |
if(ownDesc.writable === false || !isObject(receiver))return false; | |
existingDescriptor = $.getDesc(receiver, propertyKey) || createDesc(0); | |
existingDescriptor.value = V; | |
$.setDesc(receiver, propertyKey, existingDescriptor); | |
return true; | |
} | |
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); | |
} | |
$def($def.S, 'Reflect', {set: set}); | |
},{"15":15,"26":26,"3":3,"33":33,"40":40,"51":51}],145:[function(_dereq_,module,exports){ | |
var $ = _dereq_(40) | |
, global = _dereq_(25) | |
, cof = _dereq_(8) | |
, $flags = _dereq_(22) | |
, $RegExp = global.RegExp | |
, Base = $RegExp | |
, proto = $RegExp.prototype | |
, re = /a/g | |
// "new" creates a new object | |
, CORRECT_NEW = new $RegExp(re) !== re | |
// RegExp allows a regex with flags as the pattern | |
, ALLOWS_RE_WITH_FLAGS = function(){ | |
try { | |
return $RegExp(re, 'i') == '/a/i'; | |
} catch(e){ /* empty */ } | |
}(); | |
if(_dereq_(65)){ | |
if(!CORRECT_NEW || !ALLOWS_RE_WITH_FLAGS){ | |
$RegExp = function RegExp(pattern, flags){ | |
var patternIsRegExp = cof(pattern) == 'RegExp' | |
, flagsIsUndefined = flags === undefined; | |
if(!(this instanceof $RegExp) && patternIsRegExp && flagsIsUndefined)return pattern; | |
return CORRECT_NEW | |
? new Base(patternIsRegExp && !flagsIsUndefined ? pattern.source : pattern, flags) | |
: new Base(patternIsRegExp ? pattern.source : pattern | |
, patternIsRegExp && flagsIsUndefined ? $flags.call(pattern) : flags); | |
}; | |
$.each.call($.getNames(Base), function(key){ | |
key in $RegExp || $.setDesc($RegExp, key, { | |
configurable: true, | |
get: function(){ return Base[key]; }, | |
set: function(it){ Base[key] = it; } | |
}); | |
}); | |
proto.constructor = $RegExp; | |
$RegExp.prototype = proto; | |
_dereq_(52)(global, 'RegExp', $RegExp); | |
} | |
} | |
_dereq_(58)($RegExp); | |
},{"22":22,"25":25,"40":40,"52":52,"58":58,"65":65,"8":8}],146:[function(_dereq_,module,exports){ | |
// 21.2.5.3 get RegExp.prototype.flags() | |
var $ = _dereq_(40); | |
if(_dereq_(65) && /./g.flags != 'g')$.setDesc(RegExp.prototype, 'flags', { | |
configurable: true, | |
get: _dereq_(22) | |
}); | |
},{"22":22,"40":40,"65":65}],147:[function(_dereq_,module,exports){ | |
// @@match logic | |
_dereq_(21)('match', 1, function(defined, MATCH){ | |
// 21.1.3.11 String.prototype.match(regexp) | |
return function match(regexp){ | |
'use strict'; | |
var O = defined(this) | |
, fn = regexp == undefined ? undefined : regexp[MATCH]; | |
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); | |
}; | |
}); | |
},{"21":21}],148:[function(_dereq_,module,exports){ | |
// @@replace logic | |
_dereq_(21)('replace', 2, function(defined, REPLACE, $replace){ | |
// 21.1.3.14 String.prototype.replace(searchValue, replaceValue) | |
return function replace(searchValue, replaceValue){ | |
'use strict'; | |
var O = defined(this) | |
, fn = searchValue == undefined ? undefined : searchValue[REPLACE]; | |
return fn !== undefined | |
? fn.call(searchValue, O, replaceValue) | |
: $replace.call(String(O), searchValue, replaceValue); | |
}; | |
}); | |
},{"21":21}],149:[function(_dereq_,module,exports){ | |
// @@search logic | |
_dereq_(21)('search', 1, function(defined, SEARCH){ | |
// 21.1.3.15 String.prototype.search(regexp) | |
return function search(regexp){ | |
'use strict'; | |
var O = defined(this) | |
, fn = regexp == undefined ? undefined : regexp[SEARCH]; | |
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); | |
}; | |
}); | |
},{"21":21}],150:[function(_dereq_,module,exports){ | |
// @@split logic | |
_dereq_(21)('split', 2, function(defined, SPLIT, $split){ | |
// 21.1.3.17 String.prototype.split(separator, limit) | |
return function split(separator, limit){ | |
'use strict'; | |
var O = defined(this) | |
, fn = separator == undefined ? undefined : separator[SPLIT]; | |
return fn !== undefined | |
? fn.call(separator, O, limit) | |
: $split.call(String(O), separator, limit); | |
}; | |
}); | |
},{"21":21}],151:[function(_dereq_,module,exports){ | |
'use strict'; | |
var strong = _dereq_(9); | |
// 23.2 Set Objects | |
_dereq_(12)('Set', function(get){ | |
return function Set(){ return get(this, arguments[0]); }; | |
}, { | |
// 23.2.3.1 Set.prototype.add(value) | |
add: function add(value){ | |
return strong.def(this, value = value === 0 ? 0 : value, value); | |
} | |
}, strong); | |
},{"12":12,"9":9}],152:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, $at = _dereq_(60)(false); | |
$def($def.P, 'String', { | |
// 21.1.3.3 String.prototype.codePointAt(pos) | |
codePointAt: function codePointAt(pos){ | |
return $at(this, pos); | |
} | |
}); | |
},{"15":15,"60":60}],153:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, toLength = _dereq_(71) | |
, context = _dereq_(61); | |
// should throw error on regex | |
$def($def.P + $def.F * !_dereq_(20)(function(){ 'q'.endsWith(/./); }), 'String', { | |
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) | |
endsWith: function endsWith(searchString /*, endPosition = @length */){ | |
var that = context(this, searchString, 'endsWith') | |
, endPosition = arguments[1] | |
, len = toLength(that.length) | |
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) | |
, search = String(searchString); | |
return that.slice(end - search.length, end) === search; | |
} | |
}); | |
},{"15":15,"20":20,"61":61,"71":71}],154:[function(_dereq_,module,exports){ | |
var $def = _dereq_(15) | |
, toIndex = _dereq_(68) | |
, fromCharCode = String.fromCharCode | |
, $fromCodePoint = String.fromCodePoint; | |
// length should be 1, old FF problem | |
$def($def.S + $def.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { | |
// 21.1.2.2 String.fromCodePoint(...codePoints) | |
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars | |
var res = [] | |
, len = arguments.length | |
, i = 0 | |
, code; | |
while(len > i){ | |
code = +arguments[i++]; | |
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); | |
res.push(code < 0x10000 | |
? fromCharCode(code) | |
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) | |
); | |
} return res.join(''); | |
} | |
}); | |
},{"15":15,"68":68}],155:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, context = _dereq_(61); | |
$def($def.P, 'String', { | |
// 21.1.3.7 String.prototype.includes(searchString, position = 0) | |
includes: function includes(searchString /*, position = 0 */){ | |
return !!~context(this, searchString, 'includes').indexOf(searchString, arguments[1]); | |
} | |
}); | |
},{"15":15,"61":61}],156:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $at = _dereq_(60)(true); | |
// 21.1.3.27 String.prototype[@@iterator]() | |
_dereq_(36)(String, 'String', function(iterated){ | |
this._t = String(iterated); // target | |
this._i = 0; // next index | |
// 21.1.5.2.1 %StringIteratorPrototype%.next() | |
}, function(){ | |
var O = this._t | |
, index = this._i | |
, point; | |
if(index >= O.length)return {value: undefined, done: true}; | |
point = $at(O, index); | |
this._i += point.length; | |
return {value: point, done: false}; | |
}); | |
},{"36":36,"60":60}],157:[function(_dereq_,module,exports){ | |
var $def = _dereq_(15) | |
, toIObject = _dereq_(70) | |
, toLength = _dereq_(71); | |
$def($def.S, 'String', { | |
// 21.1.2.4 String.raw(callSite, ...substitutions) | |
raw: function raw(callSite){ | |
var tpl = toIObject(callSite.raw) | |
, len = toLength(tpl.length) | |
, sln = arguments.length | |
, res = [] | |
, i = 0; | |
while(len > i){ | |
res.push(String(tpl[i++])); | |
if(i < sln)res.push(String(arguments[i])); | |
} return res.join(''); | |
} | |
}); | |
},{"15":15,"70":70,"71":71}],158:[function(_dereq_,module,exports){ | |
var $def = _dereq_(15); | |
$def($def.P, 'String', { | |
// 21.1.3.13 String.prototype.repeat(count) | |
repeat: _dereq_(63) | |
}); | |
},{"15":15,"63":63}],159:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, toLength = _dereq_(71) | |
, context = _dereq_(61); | |
// should throw error on regex | |
$def($def.P + $def.F * !_dereq_(20)(function(){ 'q'.startsWith(/./); }), 'String', { | |
// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) | |
startsWith: function startsWith(searchString /*, position = 0 */){ | |
var that = context(this, searchString, 'startsWith') | |
, index = toLength(Math.min(arguments[1], that.length)) | |
, search = String(searchString); | |
return that.slice(index, index + search.length) === search; | |
} | |
}); | |
},{"15":15,"20":20,"61":61,"71":71}],160:[function(_dereq_,module,exports){ | |
'use strict'; | |
// 21.1.3.25 String.prototype.trim() | |
_dereq_(64)('trim', function($trim){ | |
return function trim(){ | |
return $trim(this, 3); | |
}; | |
}); | |
},{"64":64}],161:[function(_dereq_,module,exports){ | |
'use strict'; | |
// ECMAScript 6 symbols shim | |
var $ = _dereq_(40) | |
, global = _dereq_(25) | |
, has = _dereq_(26) | |
, SUPPORT_DESC = _dereq_(65) | |
, $def = _dereq_(15) | |
, $redef = _dereq_(52) | |
, shared = _dereq_(56) | |
, setTag = _dereq_(66) | |
, uid = _dereq_(73) | |
, wks = _dereq_(75) | |
, keyOf = _dereq_(41) | |
, $names = _dereq_(24) | |
, enumKeys = _dereq_(18) | |
, isObject = _dereq_(33) | |
, anObject = _dereq_(3) | |
, toIObject = _dereq_(70) | |
, createDesc = _dereq_(51) | |
, getDesc = $.getDesc | |
, setDesc = $.setDesc | |
, _create = $.create | |
, getNames = $names.get | |
, $Symbol = global.Symbol | |
, setter = false | |
, HIDDEN = wks('_hidden') | |
, isEnum = $.isEnum | |
, SymbolRegistry = shared('symbol-registry') | |
, AllSymbols = shared('symbols') | |
, useNative = typeof $Symbol == 'function' | |
, ObjectProto = Object.prototype; | |
var setSymbolDesc = SUPPORT_DESC ? function(){ // fallback for old Android | |
try { | |
return _create(setDesc({}, HIDDEN, { | |
get: function(){ | |
return setDesc(this, HIDDEN, {value: false})[HIDDEN]; | |
} | |
}))[HIDDEN] || setDesc; | |
} catch(e){ | |
return function(it, key, D){ | |
var protoDesc = getDesc(ObjectProto, key); | |
if(protoDesc)delete ObjectProto[key]; | |
setDesc(it, key, D); | |
if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc); | |
}; | |
} | |
}() : setDesc; | |
var wrap = function(tag){ | |
var sym = AllSymbols[tag] = _create($Symbol.prototype); | |
sym._k = tag; | |
SUPPORT_DESC && setter && setSymbolDesc(ObjectProto, tag, { | |
configurable: true, | |
set: function(value){ | |
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; | |
setSymbolDesc(this, tag, createDesc(1, value)); | |
} | |
}); | |
return sym; | |
}; | |
var $defineProperty = function defineProperty(it, key, D){ | |
if(D && has(AllSymbols, key)){ | |
if(!D.enumerable){ | |
if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {})); | |
it[HIDDEN][key] = true; | |
} else { | |
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; | |
D = _create(D, {enumerable: createDesc(0, false)}); | |
} return setSymbolDesc(it, key, D); | |
} return setDesc(it, key, D); | |
}; | |
var $defineProperties = function defineProperties(it, P){ | |
anObject(it); | |
var keys = enumKeys(P = toIObject(P)) | |
, i = 0 | |
, l = keys.length | |
, key; | |
while(l > i)$defineProperty(it, key = keys[i++], P[key]); | |
return it; | |
}; | |
var $create = function create(it, P){ | |
return P === undefined ? _create(it) : $defineProperties(_create(it), P); | |
}; | |
var $propertyIsEnumerable = function propertyIsEnumerable(key){ | |
var E = isEnum.call(this, key); | |
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] | |
? E : true; | |
}; | |
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ | |
var D = getDesc(it = toIObject(it), key); | |
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; | |
return D; | |
}; | |
var $getOwnPropertyNames = function getOwnPropertyNames(it){ | |
var names = getNames(toIObject(it)) | |
, result = [] | |
, i = 0 | |
, key; | |
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key); | |
return result; | |
}; | |
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ | |
var names = getNames(toIObject(it)) | |
, result = [] | |
, i = 0 | |
, key; | |
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]); | |
return result; | |
}; | |
// 19.4.1.1 Symbol([description]) | |
if(!useNative){ | |
$Symbol = function Symbol(){ | |
if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor'); | |
return wrap(uid(arguments[0])); | |
}; | |
$redef($Symbol.prototype, 'toString', function toString(){ | |
return this._k; | |
}); | |
$.create = $create; | |
$.isEnum = $propertyIsEnumerable; | |
$.getDesc = $getOwnPropertyDescriptor; | |
$.setDesc = $defineProperty; | |
$.setDescs = $defineProperties; | |
$.getNames = $names.get = $getOwnPropertyNames; | |
$.getSymbols = $getOwnPropertySymbols; | |
if(SUPPORT_DESC && !_dereq_(42)){ | |
$redef(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); | |
} | |
} | |
// MS Edge converts symbol values to JSON as {} | |
// WebKit converts symbol values in objects to JSON as null | |
if(!useNative || _dereq_(20)(function(){ | |
return JSON.stringify([{a: $Symbol()}, [$Symbol()]]) != '[{},[null]]'; | |
}))$redef($Symbol.prototype, 'toJSON', function toJSON(){ | |
if(useNative && isObject(this))return this; | |
}); | |
var symbolStatics = { | |
// 19.4.2.1 Symbol.for(key) | |
'for': function(key){ | |
return has(SymbolRegistry, key += '') | |
? SymbolRegistry[key] | |
: SymbolRegistry[key] = $Symbol(key); | |
}, | |
// 19.4.2.5 Symbol.keyFor(sym) | |
keyFor: function keyFor(key){ | |
return keyOf(SymbolRegistry, key); | |
}, | |
useSetter: function(){ setter = true; }, | |
useSimple: function(){ setter = false; } | |
}; | |
// 19.4.2.2 Symbol.hasInstance | |
// 19.4.2.3 Symbol.isConcatSpreadable | |
// 19.4.2.4 Symbol.iterator | |
// 19.4.2.6 Symbol.match | |
// 19.4.2.8 Symbol.replace | |
// 19.4.2.9 Symbol.search | |
// 19.4.2.10 Symbol.species | |
// 19.4.2.11 Symbol.split | |
// 19.4.2.12 Symbol.toPrimitive | |
// 19.4.2.13 Symbol.toStringTag | |
// 19.4.2.14 Symbol.unscopables | |
$.each.call(( | |
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' + | |
'species,split,toPrimitive,toStringTag,unscopables' | |
).split(','), function(it){ | |
var sym = wks(it); | |
symbolStatics[it] = useNative ? sym : wrap(sym); | |
} | |
); | |
setter = true; | |
$def($def.G + $def.W, {Symbol: $Symbol}); | |
$def($def.S, 'Symbol', symbolStatics); | |
$def($def.S + $def.F * !useNative, 'Object', { | |
// 19.1.2.2 Object.create(O [, Properties]) | |
create: $create, | |
// 19.1.2.4 Object.defineProperty(O, P, Attributes) | |
defineProperty: $defineProperty, | |
// 19.1.2.3 Object.defineProperties(O, Properties) | |
defineProperties: $defineProperties, | |
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) | |
getOwnPropertyDescriptor: $getOwnPropertyDescriptor, | |
// 19.1.2.7 Object.getOwnPropertyNames(O) | |
getOwnPropertyNames: $getOwnPropertyNames, | |
// 19.1.2.8 Object.getOwnPropertySymbols(O) | |
getOwnPropertySymbols: $getOwnPropertySymbols | |
}); | |
// 19.4.3.5 Symbol.prototype[@@toStringTag] | |
setTag($Symbol, 'Symbol'); | |
// 20.2.1.9 Math[@@toStringTag] | |
setTag(Math, 'Math', true); | |
// 24.3.3 JSON[@@toStringTag] | |
setTag(global.JSON, 'JSON', true); | |
},{"15":15,"18":18,"20":20,"24":24,"25":25,"26":26,"3":3,"33":33,"40":40,"41":41,"42":42,"51":51,"52":52,"56":56,"65":65,"66":66,"70":70,"73":73,"75":75}],162:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $ = _dereq_(40) | |
, weak = _dereq_(11) | |
, isObject = _dereq_(33) | |
, has = _dereq_(26) | |
, frozenStore = weak.frozenStore | |
, WEAK = weak.WEAK | |
, isExtensible = Object.isExtensible || isObject | |
, tmp = {}; | |
// 23.3 WeakMap Objects | |
var $WeakMap = _dereq_(12)('WeakMap', function(get){ | |
return function WeakMap(){ return get(this, arguments[0]); }; | |
}, { | |
// 23.3.3.3 WeakMap.prototype.get(key) | |
get: function get(key){ | |
if(isObject(key)){ | |
if(!isExtensible(key))return frozenStore(this).get(key); | |
if(has(key, WEAK))return key[WEAK][this._i]; | |
} | |
}, | |
// 23.3.3.5 WeakMap.prototype.set(key, value) | |
set: function set(key, value){ | |
return weak.def(this, key, value); | |
} | |
}, weak, true, true); | |
// IE11 WeakMap frozen keys fix | |
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ | |
$.each.call(['delete', 'has', 'get', 'set'], function(key){ | |
var proto = $WeakMap.prototype | |
, method = proto[key]; | |
_dereq_(52)(proto, key, function(a, b){ | |
// store frozen objects on leaky map | |
if(isObject(a) && !isExtensible(a)){ | |
var result = frozenStore(this)[key](a, b); | |
return key == 'set' ? this : result; | |
// store all the rest on native weakmap | |
} return method.call(this, a, b); | |
}); | |
}); | |
} | |
},{"11":11,"12":12,"26":26,"33":33,"40":40,"52":52}],163:[function(_dereq_,module,exports){ | |
'use strict'; | |
var weak = _dereq_(11); | |
// 23.4 WeakSet Objects | |
_dereq_(12)('WeakSet', function(get){ | |
return function WeakSet(){ return get(this, arguments[0]); }; | |
}, { | |
// 23.4.3.1 WeakSet.prototype.add(value) | |
add: function add(value){ | |
return weak.def(this, value, true); | |
} | |
}, weak, false, true); | |
},{"11":11,"12":12}],164:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, $includes = _dereq_(4)(true); | |
$def($def.P, 'Array', { | |
// https://github.com/domenic/Array.prototype.includes | |
includes: function includes(el /*, fromIndex = 0 */){ | |
return $includes(this, el, arguments[1]); | |
} | |
}); | |
_dereq_(74)('includes'); | |
},{"15":15,"4":4,"74":74}],165:[function(_dereq_,module,exports){ | |
// https://github.com/DavidBruant/Map-Set.prototype.toJSON | |
var $def = _dereq_(15); | |
$def($def.P, 'Map', {toJSON: _dereq_(10)('Map')}); | |
},{"10":10,"15":15}],166:[function(_dereq_,module,exports){ | |
// http://goo.gl/XkBrjD | |
var $def = _dereq_(15) | |
, $entries = _dereq_(47)(true); | |
$def($def.S, 'Object', { | |
entries: function entries(it){ | |
return $entries(it); | |
} | |
}); | |
},{"15":15,"47":47}],167:[function(_dereq_,module,exports){ | |
// https://gist.github.com/WebReflection/9353781 | |
var $ = _dereq_(40) | |
, $def = _dereq_(15) | |
, ownKeys = _dereq_(48) | |
, toIObject = _dereq_(70) | |
, createDesc = _dereq_(51); | |
$def($def.S, 'Object', { | |
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ | |
var O = toIObject(object) | |
, setDesc = $.setDesc | |
, getDesc = $.getDesc | |
, keys = ownKeys(O) | |
, result = {} | |
, i = 0 | |
, key, D; | |
while(keys.length > i){ | |
D = getDesc(O, key = keys[i++]); | |
if(key in result)setDesc(result, key, createDesc(0, D)); | |
else result[key] = D; | |
} return result; | |
} | |
}); | |
},{"15":15,"40":40,"48":48,"51":51,"70":70}],168:[function(_dereq_,module,exports){ | |
// http://goo.gl/XkBrjD | |
var $def = _dereq_(15) | |
, $values = _dereq_(47)(false); | |
$def($def.S, 'Object', { | |
values: function values(it){ | |
return $values(it); | |
} | |
}); | |
},{"15":15,"47":47}],169:[function(_dereq_,module,exports){ | |
// https://github.com/benjamingr/RexExp.escape | |
var $def = _dereq_(15) | |
, $re = _dereq_(53)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); | |
$def($def.S, 'RegExp', {escape: function escape(it){ return $re(it); }}); | |
},{"15":15,"53":53}],170:[function(_dereq_,module,exports){ | |
// https://github.com/DavidBruant/Map-Set.prototype.toJSON | |
var $def = _dereq_(15); | |
$def($def.P, 'Set', {toJSON: _dereq_(10)('Set')}); | |
},{"10":10,"15":15}],171:[function(_dereq_,module,exports){ | |
// https://github.com/mathiasbynens/String.prototype.at | |
'use strict'; | |
var $def = _dereq_(15) | |
, $at = _dereq_(60)(true); | |
$def($def.P, 'String', { | |
at: function at(pos){ | |
return $at(this, pos); | |
} | |
}); | |
},{"15":15,"60":60}],172:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, $pad = _dereq_(62); | |
$def($def.P, 'String', { | |
padLeft: function padLeft(maxLength /*, fillString = ' ' */){ | |
return $pad(this, maxLength, arguments[1], true); | |
} | |
}); | |
},{"15":15,"62":62}],173:[function(_dereq_,module,exports){ | |
'use strict'; | |
var $def = _dereq_(15) | |
, $pad = _dereq_(62); | |
$def($def.P, 'String', { | |
padRight: function padRight(maxLength /*, fillString = ' ' */){ | |
return $pad(this, maxLength, arguments[1], false); | |
} | |
}); | |
},{"15":15,"62":62}],174:[function(_dereq_,module,exports){ | |
'use strict'; | |
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim | |
_dereq_(64)('trimLeft', function($trim){ | |
return function trimLeft(){ | |
return $trim(this, 1); | |
}; | |
}); | |
},{"64":64}],175:[function(_dereq_,module,exports){ | |
'use strict'; | |
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim | |
_dereq_(64)('trimRight', function($trim){ | |
return function trimRight(){ | |
return $trim(this, 2); | |
}; | |
}); | |
},{"64":64}],176:[function(_dereq_,module,exports){ | |
// JavaScript 1.6 / Strawman array statics shim | |
var $ = _dereq_(40) | |
, $def = _dereq_(15) | |
, $Array = _dereq_(13).Array || Array | |
, statics = {}; | |
var setStatics = function(keys, length){ | |
$.each.call(keys.split(','), function(key){ | |
if(length == undefined && key in $Array)statics[key] = $Array[key]; | |
else if(key in [])statics[key] = _dereq_(14)(Function.call, [][key], length); | |
}); | |
}; | |
setStatics('pop,reverse,shift,keys,values,entries', 1); | |
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3); | |
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' + | |
'reduce,reduceRight,copyWithin,fill'); | |
$def($def.S, 'Array', statics); | |
},{"13":13,"14":14,"15":15,"40":40}],177:[function(_dereq_,module,exports){ | |
_dereq_(83); | |
var global = _dereq_(25) | |
, hide = _dereq_(27) | |
, Iterators = _dereq_(39) | |
, ITERATOR = _dereq_(75)('iterator') | |
, NL = global.NodeList | |
, HTC = global.HTMLCollection | |
, NLProto = NL && NL.prototype | |
, HTCProto = HTC && HTC.prototype | |
, ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; | |
if(NL && !(ITERATOR in NLProto))hide(NLProto, ITERATOR, ArrayValues); | |
if(HTC && !(ITERATOR in HTCProto))hide(HTCProto, ITERATOR, ArrayValues); | |
},{"25":25,"27":27,"39":39,"75":75,"83":83}],178:[function(_dereq_,module,exports){ | |
var $def = _dereq_(15) | |
, $task = _dereq_(67); | |
$def($def.G + $def.B, { | |
setImmediate: $task.set, | |
clearImmediate: $task.clear | |
}); | |
},{"15":15,"67":67}],179:[function(_dereq_,module,exports){ | |
// ie9- setTimeout & setInterval additional parameters fix | |
var global = _dereq_(25) | |
, $def = _dereq_(15) | |
, invoke = _dereq_(29) | |
, partial = _dereq_(49) | |
, navigator = global.navigator | |
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check | |
var wrap = function(set){ | |
return MSIE ? function(fn, time /*, ...args */){ | |
return set(invoke( | |
partial, | |
[].slice.call(arguments, 2), | |
typeof fn == 'function' ? fn : Function(fn) | |
), time); | |
} : set; | |
}; | |
$def($def.G + $def.B + $def.F * MSIE, { | |
setTimeout: wrap(global.setTimeout), | |
setInterval: wrap(global.setInterval) | |
}); | |
},{"15":15,"25":25,"29":29,"49":49}],180:[function(_dereq_,module,exports){ | |
_dereq_(77); | |
_dereq_(161); | |
_dereq_(116); | |
_dereq_(124); | |
_dereq_(128); | |
_dereq_(129); | |
_dereq_(117); | |
_dereq_(127); | |
_dereq_(126); | |
_dereq_(122); | |
_dereq_(123); | |
_dereq_(121); | |
_dereq_(118); | |
_dereq_(120); | |
_dereq_(125); | |
_dereq_(119); | |
_dereq_(87); | |
_dereq_(86); | |
_dereq_(106); | |
_dereq_(107); | |
_dereq_(108); | |
_dereq_(109); | |
_dereq_(110); | |
_dereq_(111); | |
_dereq_(112); | |
_dereq_(113); | |
_dereq_(114); | |
_dereq_(115); | |
_dereq_(89); | |
_dereq_(90); | |
_dereq_(91); | |
_dereq_(92); | |
_dereq_(93); | |
_dereq_(94); | |
_dereq_(95); | |
_dereq_(96); | |
_dereq_(97); | |
_dereq_(98); | |
_dereq_(99); | |
_dereq_(100); | |
_dereq_(101); | |
_dereq_(102); | |
_dereq_(103); | |
_dereq_(104); | |
_dereq_(105); | |
_dereq_(154); | |
_dereq_(157); | |
_dereq_(160); | |
_dereq_(156); | |
_dereq_(152); | |
_dereq_(153); | |
_dereq_(155); | |
_dereq_(158); | |
_dereq_(159); | |
_dereq_(82); | |
_dereq_(84); | |
_dereq_(83); | |
_dereq_(85); | |
_dereq_(78); | |
_dereq_(79); | |
_dereq_(81); | |
_dereq_(80); | |
_dereq_(145); | |
_dereq_(146); | |
_dereq_(147); | |
_dereq_(148); | |
_dereq_(149); | |
_dereq_(150); | |
_dereq_(130); | |
_dereq_(88); | |
_dereq_(151); | |
_dereq_(162); | |
_dereq_(163); | |
_dereq_(131); | |
_dereq_(132); | |
_dereq_(133); | |
_dereq_(134); | |
_dereq_(135); | |
_dereq_(138); | |
_dereq_(136); | |
_dereq_(137); | |
_dereq_(139); | |
_dereq_(140); | |
_dereq_(141); | |
_dereq_(142); | |
_dereq_(144); | |
_dereq_(143); | |
_dereq_(164); | |
_dereq_(171); | |
_dereq_(172); | |
_dereq_(173); | |
_dereq_(174); | |
_dereq_(175); | |
_dereq_(169); | |
_dereq_(167); | |
_dereq_(168); | |
_dereq_(166); | |
_dereq_(165); | |
_dereq_(170); | |
_dereq_(176); | |
_dereq_(179); | |
_dereq_(178); | |
_dereq_(177); | |
module.exports = _dereq_(13); | |
},{"100":100,"101":101,"102":102,"103":103,"104":104,"105":105,"106":106,"107":107,"108":108,"109":109,"110":110,"111":111,"112":112,"113":113,"114":114,"115":115,"116":116,"117":117,"118":118,"119":119,"120":120,"121":121,"122":122,"123":123,"124":124,"125":125,"126":126,"127":127,"128":128,"129":129,"13":13,"130":130,"131":131,"132":132,"133":133,"134":134,"135":135,"136":136,"137":137,"138":138,"139":139,"140":140,"141":141,"142":142,"143":143,"144":144,"145":145,"146":146,"147":147,"148":148,"149":149,"150":150,"151":151,"152":152,"153":153,"154":154,"155":155,"156":156,"157":157,"158":158,"159":159,"160":160,"161":161,"162":162,"163":163,"164":164,"165":165,"166":166,"167":167,"168":168,"169":169,"170":170,"171":171,"172":172,"173":173,"174":174,"175":175,"176":176,"177":177,"178":178,"179":179,"77":77,"78":78,"79":79,"80":80,"81":81,"82":82,"83":83,"84":84,"85":85,"86":86,"87":87,"88":88,"89":89,"90":90,"91":91,"92":92,"93":93,"94":94,"95":95,"96":96,"97":97,"98":98,"99":99}],181:[function(_dereq_,module,exports){ | |
(function (global){ | |
/** | |
* Copyright (c) 2014, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An | |
* additional grant of patent rights can be found in the PATENTS file in | |
* the same directory. | |
*/ | |
!(function(global) { | |
"use strict"; | |
var hasOwn = Object.prototype.hasOwnProperty; | |
var undefined; // More compressible than void 0. | |
var iteratorSymbol = | |
typeof Symbol === "function" && Symbol.iterator || "@@iterator"; | |
var inModule = typeof module === "object"; | |
var runtime = global.regeneratorRuntime; | |
if (runtime) { | |
if (inModule) { | |
// If regeneratorRuntime is defined globally and we're in a module, | |
// make the exports object identical to regeneratorRuntime. | |
module.exports = runtime; | |
} | |
// Don't bother evaluating the rest of this file if the runtime was | |
// already defined globally. | |
return; | |
} | |
// Define the runtime globally (as expected by generated code) as either | |
// module.exports (if we're in a module) or a new, empty object. | |
runtime = global.regeneratorRuntime = inModule ? module.exports : {}; | |
function wrap(innerFn, outerFn, self, tryLocsList) { | |
// If outerFn provided, then outerFn.prototype instanceof Generator. | |
var generator = Object.create((outerFn || Generator).prototype); | |
var context = new Context(tryLocsList || []); | |
// The ._invoke method unifies the implementations of the .next, | |
// .throw, and .return methods. | |
generator._invoke = makeInvokeMethod(innerFn, self, context); | |
return generator; | |
} | |
runtime.wrap = wrap; | |
// Try/catch helper to minimize deoptimizations. Returns a completion | |
// record like context.tryEntries[i].completion. This interface could | |
// have been (and was previously) designed to take a closure to be | |
// invoked without arguments, but in all the cases we care about we | |
// already have an existing method we want to call, so there's no need | |
// to create a new function object. We can even get away with assuming | |
// the method takes exactly one argument, since that happens to be true | |
// in every case, so we don't have to touch the arguments object. The | |
// only additional allocation required is the completion record, which | |
// has a stable shape and so hopefully should be cheap to allocate. | |
function tryCatch(fn, obj, arg) { | |
try { | |
return { type: "normal", arg: fn.call(obj, arg) }; | |
} catch (err) { | |
return { type: "throw", arg: err }; | |
} | |
} | |
var GenStateSuspendedStart = "suspendedStart"; | |
var GenStateSuspendedYield = "suspendedYield"; | |
var GenStateExecuting = "executing"; | |
var GenStateCompleted = "completed"; | |
// Returning this object from the innerFn has the same effect as | |
// breaking out of the dispatch switch statement. | |
var ContinueSentinel = {}; | |
// Dummy constructor functions that we use as the .constructor and | |
// .constructor.prototype properties for functions that return Generator | |
// objects. For full spec compliance, you may wish to configure your | |
// minifier not to mangle the names of these two functions. | |
function Generator() {} | |
function GeneratorFunction() {} | |
function GeneratorFunctionPrototype() {} | |
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype; | |
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | |
GeneratorFunctionPrototype.constructor = GeneratorFunction; | |
GeneratorFunction.displayName = "GeneratorFunction"; | |
// Helper for defining the .next, .throw, and .return methods of the | |
// Iterator interface in terms of a single ._invoke method. | |
function defineIteratorMethods(prototype) { | |
["next", "throw", "return"].forEach(function(method) { | |
prototype[method] = function(arg) { | |
return this._invoke(method, arg); | |
}; | |
}); | |
} | |
runtime.isGeneratorFunction = function(genFun) { | |
var ctor = typeof genFun === "function" && genFun.constructor; | |
return ctor | |
? ctor === GeneratorFunction || | |
// For the native GeneratorFunction constructor, the best we can | |
// do is to check its .name property. | |
(ctor.displayName || ctor.name) === "GeneratorFunction" | |
: false; | |
}; | |
runtime.mark = function(genFun) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | |
} else { | |
genFun.__proto__ = GeneratorFunctionPrototype; | |
} | |
genFun.prototype = Object.create(Gp); | |
return genFun; | |
}; | |
// Within the body of any async function, `await x` is transformed to | |
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | |
// `value instanceof AwaitArgument` to determine if the yielded value is | |
// meant to be awaited. Some may consider the name of this method too | |
// cutesy, but they are curmudgeons. | |
runtime.awrap = function(arg) { | |
return new AwaitArgument(arg); | |
}; | |
function AwaitArgument(arg) { | |
this.arg = arg; | |
} | |
function AsyncIterator(generator) { | |
// This invoke function is written in a style that assumes some | |
// calling function (or Promise) will handle exceptions. | |
function invoke(method, arg) { | |
var result = generator[method](arg); | |
var value = result.value; | |
return value instanceof AwaitArgument | |
? Promise.resolve(value.arg).then(invokeNext, invokeThrow) | |
: Promise.resolve(value).then(function(unwrapped) { | |
// When a yielded Promise is resolved, its final value becomes | |
// the .value of the Promise<{value,done}> result for the | |
// current iteration. If the Promise is rejected, however, the | |
// result for this iteration will be rejected with the same | |
// reason. Note that rejections of yielded Promises are not | |
// thrown back into the generator function, as is the case | |
// when an awaited Promise is rejected. This difference in | |
// behavior between yield and await is important, because it | |
// allows the consumer to decide what to do with the yielded | |
// rejection (swallow it and continue, manually .throw it back | |
// into the generator, abandon iteration, whatever). With | |
// await, by contrast, there is no opportunity to examine the | |
// rejection reason outside the generator function, so the | |
// only option is to throw it from the await expression, and | |
// let the generator function handle the exception. | |
result.value = unwrapped; | |
return result; | |
}); | |
} | |
if (typeof process === "object" && process.domain) { | |
invoke = process.domain.bind(invoke); | |
} | |
var invokeNext = invoke.bind(generator, "next"); | |
var invokeThrow = invoke.bind(generator, "throw"); | |
var invokeReturn = invoke.bind(generator, "return"); | |
var previousPromise; | |
function enqueue(method, arg) { | |
function callInvokeWithMethodAndArg() { | |
return invoke(method, arg); | |
} | |
return previousPromise = | |
// If enqueue has been called before, then we want to wait until | |
// all previous Promises have been resolved before calling invoke, | |
// so that results are always delivered in the correct order. If | |
// enqueue has not been called before, then it is important to | |
// call invoke immediately, without waiting on a callback to fire, | |
// so that the async generator function has the opportunity to do | |
// any necessary setup in a predictable way. This predictability | |
// is why the Promise constructor synchronously invokes its | |
// executor callback, and why async functions synchronously | |
// execute code before the first await. Since we implement simple | |
// async functions in terms of async generators, it is especially | |
// important to get this right, even though it requires care. | |
previousPromise ? previousPromise.then( | |
callInvokeWithMethodAndArg, | |
// Avoid propagating failures to Promises returned by later | |
// invocations of the iterator. | |
callInvokeWithMethodAndArg | |
) : new Promise(function (resolve) { | |
resolve(callInvokeWithMethodAndArg()); | |
}); | |
} | |
// Define the unified helper method that is used to implement .next, | |
// .throw, and .return (see defineIteratorMethods). | |
this._invoke = enqueue; | |
} | |
defineIteratorMethods(AsyncIterator.prototype); | |
// Note that simple async functions are implemented on top of | |
// AsyncIterator objects; they just return a Promise for the value of | |
// the final result produced by the iterator. | |
runtime.async = function(innerFn, outerFn, self, tryLocsList) { | |
var iter = new AsyncIterator( | |
wrap(innerFn, outerFn, self, tryLocsList) | |
); | |
return runtime.isGeneratorFunction(outerFn) | |
? iter // If outerFn is a generator, return the full iterator. | |
: iter.next().then(function(result) { | |
return result.done ? result.value : iter.next(); | |
}); | |
}; | |
function makeInvokeMethod(innerFn, self, context) { | |
var state = GenStateSuspendedStart; | |
return function invoke(method, arg) { | |
if (state === GenStateExecuting) { | |
throw new Error("Generator is already running"); | |
} | |
if (state === GenStateCompleted) { | |
if (method === "throw") { | |
throw arg; | |
} | |
// Be forgiving, per 25.3.3.3.3 of the spec: | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | |
return doneResult(); | |
} | |
while (true) { | |
var delegate = context.delegate; | |
if (delegate) { | |
if (method === "return" || | |
(method === "throw" && delegate.iterator[method] === undefined)) { | |
// A return or throw (when the delegate iterator has no throw | |
// method) always terminates the yield* loop. | |
context.delegate = null; | |
// If the delegate iterator has a return method, give it a | |
// chance to clean up. | |
var returnMethod = delegate.iterator["return"]; | |
if (returnMethod) { | |
var record = tryCatch(returnMethod, delegate.iterator, arg); | |
if (record.type === "throw") { | |
// If the return method threw an exception, let that | |
// exception prevail over the original return or throw. | |
method = "throw"; | |
arg = record.arg; | |
continue; | |
} | |
} | |
if (method === "return") { | |
// Continue with the outer return, now that the delegate | |
// iterator has been terminated. | |
continue; | |
} | |
} | |
var record = tryCatch( | |
delegate.iterator[method], | |
delegate.iterator, | |
arg | |
); | |
if (record.type === "throw") { | |
context.delegate = null; | |
// Like returning generator.throw(uncaught), but without the | |
// overhead of an extra function call. | |
method = "throw"; | |
arg = record.arg; | |
continue; | |
} | |
// Delegate generator ran and handled its own exceptions so | |
// regardless of what the method was, we continue as if it is | |
// "next" with an undefined arg. | |
method = "next"; | |
arg = undefined; | |
var info = record.arg; | |
if (info.done) { | |
context[delegate.resultName] = info.value; | |
context.next = delegate.nextLoc; | |
} else { | |
state = GenStateSuspendedYield; | |
return info; | |
} | |
context.delegate = null; | |
} | |
if (method === "next") { | |
if (state === GenStateSuspendedYield) { | |
context.sent = arg; | |
} else { | |
context.sent = undefined; | |
} | |
} else if (method === "throw") { | |
if (state === GenStateSuspendedStart) { | |
state = GenStateCompleted; | |
throw arg; | |
} | |
if (context.dispatchException(arg)) { | |
// If the dispatched exception was caught by a catch block, | |
// then let that catch block handle the exception normally. | |
method = "next"; | |
arg = undefined; | |
} | |
} else if (method === "return") { | |
context.abrupt("return", arg); | |
} | |
state = GenStateExecuting; | |
var record = tryCatch(innerFn, self, context); | |
if (record.type === "normal") { | |
// If an exception is thrown from innerFn, we leave state === | |
// GenStateExecuting and loop back for another invocation. | |
state = context.done | |
? GenStateCompleted | |
: GenStateSuspendedYield; | |
var info = { | |
value: record.arg, | |
done: context.done | |
}; | |
if (record.arg === ContinueSentinel) { | |
if (context.delegate && method === "next") { | |
// Deliberately forget the last sent value so that we don't | |
// accidentally pass it on to the delegate. | |
arg = undefined; | |
} | |
} else { | |
return info; | |
} | |
} else if (record.type === "throw") { | |
state = GenStateCompleted; | |
// Dispatch the exception by looping back around to the | |
// context.dispatchException(arg) call above. | |
method = "throw"; | |
arg = record.arg; | |
} | |
} | |
}; | |
} | |
// Define Generator.prototype.{next,throw,return} in terms of the | |
// unified ._invoke helper method. | |
defineIteratorMethods(Gp); | |
Gp[iteratorSymbol] = function() { | |
return this; | |
}; | |
Gp.toString = function() { | |
return "[object Generator]"; | |
}; | |
function pushTryEntry(locs) { | |
var entry = { tryLoc: locs[0] }; | |
if (1 in locs) { | |
entry.catchLoc = locs[1]; | |
} | |
if (2 in locs) { | |
entry.finallyLoc = locs[2]; | |
entry.afterLoc = locs[3]; | |
} | |
this.tryEntries.push(entry); | |
} | |
function resetTryEntry(entry) { | |
var record = entry.completion || {}; | |
record.type = "normal"; | |
delete record.arg; | |
entry.completion = record; | |
} | |
function Context(tryLocsList) { | |
// The root entry object (effectively a try statement without a catch | |
// or a finally block) gives us a place to store values thrown from | |
// locations where there is no enclosing try statement. | |
this.tryEntries = [{ tryLoc: "root" }]; | |
tryLocsList.forEach(pushTryEntry, this); | |
this.reset(true); | |
} | |
runtime.keys = function(object) { | |
var keys = []; | |
for (var key in object) { | |
keys.push(key); | |
} | |
keys.reverse(); | |
// Rather than returning an object with a next method, we keep | |
// things simple and return the next function itself. | |
return function next() { | |
while (keys.length) { | |
var key = keys.pop(); | |
if (key in object) { | |
next.value = key; | |
next.done = false; | |
return next; | |
} | |
} | |
// To avoid creating an additional object, we just hang the .value | |
// and .done properties off the next function object itself. This | |
// also ensures that the minifier will not anonymize the function. | |
next.done = true; | |
return next; | |
}; | |
}; | |
function values(iterable) { | |
if (iterable) { | |
var iteratorMethod = iterable[iteratorSymbol]; | |
if (iteratorMethod) { | |
return iteratorMethod.call(iterable); | |
} | |
if (typeof iterable.next === "function") { | |
return iterable; | |
} | |
if (!isNaN(iterable.length)) { | |
var i = -1, next = function next() { | |
while (++i < iterable.length) { | |
if (hasOwn.call(iterable, i)) { | |
next.value = iterable[i]; | |
next.done = false; | |
return next; | |
} | |
} | |
next.value = undefined; | |
next.done = true; | |
return next; | |
}; | |
return next.next = next; | |
} | |
} | |
// Return an iterator with no values. | |
return { next: doneResult }; | |
} | |
runtime.values = values; | |
function doneResult() { | |
return { value: undefined, done: true }; | |
} | |
Context.prototype = { | |
constructor: Context, | |
reset: function(skipTempReset) { | |
this.prev = 0; | |
this.next = 0; | |
this.sent = undefined; | |
this.done = false; | |
this.delegate = null; | |
this.tryEntries.forEach(resetTryEntry); | |
if (!skipTempReset) { | |
for (var name in this) { | |
// Not sure about the optimal order of these conditions: | |
if (name.charAt(0) === "t" && | |
hasOwn.call(this, name) && | |
!isNaN(+name.slice(1))) { | |
this[name] = undefined; | |
} | |
} | |
} | |
}, | |
stop: function() { | |
this.done = true; | |
var rootEntry = this.tryEntries[0]; | |
var rootRecord = rootEntry.completion; | |
if (rootRecord.type === "throw") { | |
throw rootRecord.arg; | |
} | |
return this.rval; | |
}, | |
dispatchException: function(exception) { | |
if (this.done) { | |
throw exception; | |
} | |
var context = this; | |
function handle(loc, caught) { | |
record.type = "throw"; | |
record.arg = exception; | |
context.next = loc; | |
return !!caught; | |
} | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
var record = entry.completion; | |
if (entry.tryLoc === "root") { | |
// Exception thrown outside of any try block that could handle | |
// it, so set the completion value of the entire function to | |
// throw the exception. | |
return handle("end"); | |
} | |
if (entry.tryLoc <= this.prev) { | |
var hasCatch = hasOwn.call(entry, "catchLoc"); | |
var hasFinally = hasOwn.call(entry, "finallyLoc"); | |
if (hasCatch && hasFinally) { | |
if (this.prev < entry.catchLoc) { | |
return handle(entry.catchLoc, true); | |
} else if (this.prev < entry.finallyLoc) { | |
return handle(entry.finallyLoc); | |
} | |
} else if (hasCatch) { | |
if (this.prev < entry.catchLoc) { | |
return handle(entry.catchLoc, true); | |
} | |
} else if (hasFinally) { | |
if (this.prev < entry.finallyLoc) { | |
return handle(entry.finallyLoc); | |
} | |
} else { | |
throw new Error("try statement without catch or finally"); | |
} | |
} | |
} | |
}, | |
abrupt: function(type, arg) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.tryLoc <= this.prev && | |
hasOwn.call(entry, "finallyLoc") && | |
this.prev < entry.finallyLoc) { | |
var finallyEntry = entry; | |
break; | |
} | |
} | |
if (finallyEntry && | |
(type === "break" || | |
type === "continue") && | |
finallyEntry.tryLoc <= arg && | |
arg <= finallyEntry.finallyLoc) { | |
// Ignore the finally entry if control is not jumping to a | |
// location outside the try/catch block. | |
finallyEntry = null; | |
} | |
var record = finallyEntry ? finallyEntry.completion : {}; | |
record.type = type; | |
record.arg = arg; | |
if (finallyEntry) { | |
this.next = finallyEntry.finallyLoc; | |
} else { | |
this.complete(record); | |
} | |
return ContinueSentinel; | |
}, | |
complete: function(record, afterLoc) { | |
if (record.type === "throw") { | |
throw record.arg; | |
} | |
if (record.type === "break" || | |
record.type === "continue") { | |
this.next = record.arg; | |
} else if (record.type === "return") { | |
this.rval = record.arg; | |
this.next = "end"; | |
} else if (record.type === "normal" && afterLoc) { | |
this.next = afterLoc; | |
} | |
}, | |
finish: function(finallyLoc) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.finallyLoc === finallyLoc) { | |
this.complete(entry.completion, entry.afterLoc); | |
resetTryEntry(entry); | |
return ContinueSentinel; | |
} | |
} | |
}, | |
"catch": function(tryLoc) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.tryLoc === tryLoc) { | |
var record = entry.completion; | |
if (record.type === "throw") { | |
var thrown = record.arg; | |
resetTryEntry(entry); | |
} | |
return thrown; | |
} | |
} | |
// The context.catch method must only be called with a location | |
// argument that corresponds to a known catch block. | |
throw new Error("illegal catch attempt"); | |
}, | |
delegateYield: function(iterable, resultName, nextLoc) { | |
this.delegate = { | |
iterator: values(iterable), | |
resultName: resultName, | |
nextLoc: nextLoc | |
}; | |
return ContinueSentinel; | |
} | |
}; | |
})( | |
// Among the various tricks for obtaining a reference to the global | |
// object, this seems to be the most reliable technique that does not | |
// use indirect eval (which violates Content Security Policy). | |
typeof global === "object" ? global : | |
typeof window === "object" ? window : | |
typeof self === "object" ? self : this | |
); | |
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | |
},{}]},{},[1]); | |
/*! ***************************************************************************** | |
Copyright (C) Microsoft. All rights reserved. | |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | |
this file except in compliance with the License. You may obtain a copy of the | |
License at http://www.apache.org/licenses/LICENSE-2.0 | |
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | |
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | |
MERCHANTABLITY OR NON-INFRINGEMENT. | |
See the Apache Version 2.0 License for specific language governing permissions | |
and limitations under the License. | |
***************************************************************************** */ | |
"use strict"; | |
var Reflect; | |
(function (Reflect) { | |
// Load global or shim versions of Map, Set, and WeakMap | |
var functionPrototype = Object.getPrototypeOf(Function); | |
var _Map = typeof Map === "function" ? Map : CreateMapPolyfill(); | |
var _Set = typeof Set === "function" ? Set : CreateSetPolyfill(); | |
var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); | |
// [[Metadata]] internal slot | |
var __Metadata__ = new _WeakMap(); | |
/** | |
* Applies a set of decorators to a property of a target object. | |
* @param decorators An array of decorators. | |
* @param target The target object. | |
* @param targetKey (Optional) The property key to decorate. | |
* @param targetDescriptor (Optional) The property descriptor for the target key | |
* @remarks Decorators are applied in reverse order. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* C = Reflect.decorate(decoratorsArray, C); | |
* | |
* // property (on constructor) | |
* Reflect.decorate(decoratorsArray, C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* Reflect.decorate(decoratorsArray, C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* Object.defineProperty(C, "staticMethod", | |
* Reflect.decorate(decoratorsArray, C, "staticMethod", | |
* Object.getOwnPropertyDescriptor(C, "staticMethod"))); | |
* | |
* // method (on prototype) | |
* Object.defineProperty(C.prototype, "method", | |
* Reflect.decorate(decoratorsArray, C.prototype, "method", | |
* Object.getOwnPropertyDescriptor(C.prototype, "method"))); | |
* | |
*/ | |
function decorate(decorators, target, targetKey, targetDescriptor) { | |
if (!IsUndefined(targetDescriptor)) { | |
if (!IsArray(decorators)) { | |
throw new TypeError(); | |
} | |
else if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (IsUndefined(targetKey)) { | |
throw new TypeError(); | |
} | |
else if (!IsObject(targetDescriptor)) { | |
throw new TypeError(); | |
} | |
targetKey = ToPropertyKey(targetKey); | |
return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor); | |
} | |
else if (!IsUndefined(targetKey)) { | |
if (!IsArray(decorators)) { | |
throw new TypeError(); | |
} | |
else if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
targetKey = ToPropertyKey(targetKey); | |
return DecoratePropertyWithoutDescriptor(decorators, target, targetKey); | |
} | |
else { | |
if (!IsArray(decorators)) { | |
throw new TypeError(); | |
} | |
else if (!IsConstructor(target)) { | |
throw new TypeError(); | |
} | |
return DecorateConstructor(decorators, target); | |
} | |
} | |
Reflect.decorate = decorate; | |
/** | |
* A default metadata decorator factory that can be used on a class, class member, or parameter. | |
* @param metadataKey The key for the metadata entry. | |
* @param metadataValue The value for the metadata entry. | |
* @returns A decorator function. | |
* @remarks | |
* If `metadataKey` is already defined for the target and target key, the | |
* metadataValue for that key will be overwritten. | |
* @example | |
* | |
* // constructor | |
* @Reflect.metadata(key, value) | |
* class C { | |
* } | |
* | |
* // property (on constructor, TypeScript only) | |
* class C { | |
* @Reflect.metadata(key, value) | |
* static staticProperty; | |
* } | |
* | |
* // property (on prototype, TypeScript only) | |
* class C { | |
* @Reflect.metadata(key, value) | |
* property; | |
* } | |
* | |
* // method (on constructor) | |
* class C { | |
* @Reflect.metadata(key, value) | |
* static staticMethod() { } | |
* } | |
* | |
* // method (on prototype) | |
* class C { | |
* @Reflect.metadata(key, value) | |
* method() { } | |
* } | |
* | |
*/ | |
function metadata(metadataKey, metadataValue) { | |
function decorator(target, targetKey) { | |
if (!IsUndefined(targetKey)) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
targetKey = ToPropertyKey(targetKey); | |
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); | |
} | |
else { | |
if (!IsConstructor(target)) { | |
throw new TypeError(); | |
} | |
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined); | |
} | |
} | |
return decorator; | |
} | |
Reflect.metadata = metadata; | |
/** | |
* Define a unique metadata entry on the target. | |
* @param metadataKey A key used to store and retrieve metadata. | |
* @param metadataValue A value that contains attached metadata. | |
* @param target The target object on which to define metadata. | |
* @param targetKey (Optional) The property key for the target. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* Reflect.defineMetadata("custom:annotation", options, C); | |
* | |
* // property (on constructor) | |
* Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); | |
* | |
* // decorator factory as metadata-producing annotation. | |
* function MyAnnotation(options): Decorator { | |
* return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); | |
* } | |
* | |
*/ | |
function defineMetadata(metadataKey, metadataValue, target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); | |
} | |
Reflect.defineMetadata = defineMetadata; | |
/** | |
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. | |
* @param metadataKey A key used to store and retrieve metadata. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.hasMetadata("custom:annotation", C); | |
* | |
* // property (on constructor) | |
* result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); | |
* | |
*/ | |
function hasMetadata(metadataKey, target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryHasMetadata(metadataKey, target, targetKey); | |
} | |
Reflect.hasMetadata = hasMetadata; | |
/** | |
* Gets a value indicating whether the target object has the provided metadata key defined. | |
* @param metadataKey A key used to store and retrieve metadata. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns `true` if the metadata key was defined on the target object; otherwise, `false`. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.hasOwnMetadata("custom:annotation", C); | |
* | |
* // property (on constructor) | |
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); | |
* | |
*/ | |
function hasOwnMetadata(metadataKey, target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); | |
} | |
Reflect.hasOwnMetadata = hasOwnMetadata; | |
/** | |
* Gets the metadata value for the provided metadata key on the target object or its prototype chain. | |
* @param metadataKey A key used to store and retrieve metadata. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns The metadata value for the metadata key if found; otherwise, `undefined`. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.getMetadata("custom:annotation", C); | |
* | |
* // property (on constructor) | |
* result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); | |
* | |
*/ | |
function getMetadata(metadataKey, target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryGetMetadata(metadataKey, target, targetKey); | |
} | |
Reflect.getMetadata = getMetadata; | |
/** | |
* Gets the metadata value for the provided metadata key on the target object. | |
* @param metadataKey A key used to store and retrieve metadata. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns The metadata value for the metadata key if found; otherwise, `undefined`. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.getOwnMetadata("custom:annotation", C); | |
* | |
* // property (on constructor) | |
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); | |
* | |
*/ | |
function getOwnMetadata(metadataKey, target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); | |
} | |
Reflect.getOwnMetadata = getOwnMetadata; | |
/** | |
* Gets the metadata keys defined on the target object or its prototype chain. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns An array of unique metadata keys. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.getMetadataKeys(C); | |
* | |
* // property (on constructor) | |
* result = Reflect.getMetadataKeys(C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.getMetadataKeys(C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.getMetadataKeys(C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.getMetadataKeys(C.prototype, "method"); | |
* | |
*/ | |
function getMetadataKeys(target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryMetadataKeys(target, targetKey); | |
} | |
Reflect.getMetadataKeys = getMetadataKeys; | |
/** | |
* Gets the unique metadata keys defined on the target object. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns An array of unique metadata keys. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.getOwnMetadataKeys(C); | |
* | |
* // property (on constructor) | |
* result = Reflect.getOwnMetadataKeys(C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.getOwnMetadataKeys(C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.getOwnMetadataKeys(C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.getOwnMetadataKeys(C.prototype, "method"); | |
* | |
*/ | |
function getOwnMetadataKeys(target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
return OrdinaryOwnMetadataKeys(target, targetKey); | |
} | |
Reflect.getOwnMetadataKeys = getOwnMetadataKeys; | |
/** | |
* Deletes the metadata entry from the target object with the provided key. | |
* @param metadataKey A key used to store and retrieve metadata. | |
* @param target The target object on which the metadata is defined. | |
* @param targetKey (Optional) The property key for the target. | |
* @returns `true` if the metadata entry was found and deleted; otherwise, false. | |
* @example | |
* | |
* class C { | |
* // property declarations are not part of ES6, though they are valid in TypeScript: | |
* // static staticProperty; | |
* // property; | |
* | |
* constructor(p) { } | |
* static staticMethod(p) { } | |
* method(p) { } | |
* } | |
* | |
* // constructor | |
* result = Reflect.deleteMetadata("custom:annotation", C); | |
* | |
* // property (on constructor) | |
* result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); | |
* | |
* // property (on prototype) | |
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); | |
* | |
* // method (on constructor) | |
* result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); | |
* | |
* // method (on prototype) | |
* result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); | |
* | |
*/ | |
function deleteMetadata(metadataKey, target, targetKey) { | |
if (!IsObject(target)) { | |
throw new TypeError(); | |
} | |
else if (!IsUndefined(targetKey)) { | |
targetKey = ToPropertyKey(targetKey); | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- | |
var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); | |
if (IsUndefined(metadataMap)) { | |
return false; | |
} | |
if (!metadataMap.delete(metadataKey)) { | |
return false; | |
} | |
if (metadataMap.size > 0) { | |
return true; | |
} | |
var targetMetadata = __Metadata__.get(target); | |
targetMetadata.delete(targetKey); | |
if (targetMetadata.size > 0) { | |
return true; | |
} | |
__Metadata__.delete(target); | |
return true; | |
} | |
Reflect.deleteMetadata = deleteMetadata; | |
function DecorateConstructor(decorators, target) { | |
for (var i = decorators.length - 1; i >= 0; --i) { | |
var decorator = decorators[i]; | |
var decorated = decorator(target); | |
if (!IsUndefined(decorated)) { | |
if (!IsConstructor(decorated)) { | |
throw new TypeError(); | |
} | |
target = decorated; | |
} | |
} | |
return target; | |
} | |
function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { | |
for (var i = decorators.length - 1; i >= 0; --i) { | |
var decorator = decorators[i]; | |
var decorated = decorator(target, propertyKey, descriptor); | |
if (!IsUndefined(decorated)) { | |
if (!IsObject(decorated)) { | |
throw new TypeError(); | |
} | |
descriptor = decorated; | |
} | |
} | |
return descriptor; | |
} | |
function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { | |
for (var i = decorators.length - 1; i >= 0; --i) { | |
var decorator = decorators[i]; | |
decorator(target, propertyKey); | |
} | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- | |
function GetOrCreateMetadataMap(target, targetKey, create) { | |
var targetMetadata = __Metadata__.get(target); | |
if (!targetMetadata) { | |
if (!create) { | |
return undefined; | |
} | |
targetMetadata = new _Map(); | |
__Metadata__.set(target, targetMetadata); | |
} | |
var keyMetadata = targetMetadata.get(targetKey); | |
if (!keyMetadata) { | |
if (!create) { | |
return undefined; | |
} | |
keyMetadata = new _Map(); | |
targetMetadata.set(targetKey, keyMetadata); | |
} | |
return keyMetadata; | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- | |
function OrdinaryHasMetadata(MetadataKey, O, P) { | |
var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); | |
if (hasOwn) { | |
return true; | |
} | |
var parent = GetPrototypeOf(O); | |
if (parent !== null) { | |
return OrdinaryHasMetadata(MetadataKey, parent, P); | |
} | |
return false; | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- | |
function OrdinaryHasOwnMetadata(MetadataKey, O, P) { | |
var metadataMap = GetOrCreateMetadataMap(O, P, false); | |
if (metadataMap === undefined) { | |
return false; | |
} | |
return Boolean(metadataMap.has(MetadataKey)); | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- | |
function OrdinaryGetMetadata(MetadataKey, O, P) { | |
var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); | |
if (hasOwn) { | |
return OrdinaryGetOwnMetadata(MetadataKey, O, P); | |
} | |
var parent = GetPrototypeOf(O); | |
if (parent !== null) { | |
return OrdinaryGetMetadata(MetadataKey, parent, P); | |
} | |
return undefined; | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- | |
function OrdinaryGetOwnMetadata(MetadataKey, O, P) { | |
var metadataMap = GetOrCreateMetadataMap(O, P, false); | |
if (metadataMap === undefined) { | |
return undefined; | |
} | |
return metadataMap.get(MetadataKey); | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- | |
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { | |
var metadataMap = GetOrCreateMetadataMap(O, P, true); | |
metadataMap.set(MetadataKey, MetadataValue); | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- | |
function OrdinaryMetadataKeys(O, P) { | |
var ownKeys = OrdinaryOwnMetadataKeys(O, P); | |
var parent = GetPrototypeOf(O); | |
if (parent === null) { | |
return ownKeys; | |
} | |
var parentKeys = OrdinaryMetadataKeys(parent, P); | |
if (parentKeys.length <= 0) { | |
return ownKeys; | |
} | |
if (ownKeys.length <= 0) { | |
return parentKeys; | |
} | |
var set = new _Set(); | |
var keys = []; | |
for (var _i = 0; _i < ownKeys.length; _i++) { | |
var key = ownKeys[_i]; | |
var hasKey = set.has(key); | |
if (!hasKey) { | |
set.add(key); | |
keys.push(key); | |
} | |
} | |
for (var _a = 0; _a < parentKeys.length; _a++) { | |
var key = parentKeys[_a]; | |
var hasKey = set.has(key); | |
if (!hasKey) { | |
set.add(key); | |
keys.push(key); | |
} | |
} | |
return keys; | |
} | |
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- | |
function OrdinaryOwnMetadataKeys(target, targetKey) { | |
var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); | |
var keys = []; | |
if (metadataMap) { | |
metadataMap.forEach(function (_, key) { return keys.push(key); }); | |
} | |
return keys; | |
} | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type | |
function IsUndefined(x) { | |
return x === undefined; | |
} | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray | |
function IsArray(x) { | |
return Array.isArray(x); | |
} | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type | |
function IsObject(x) { | |
return typeof x === "object" ? x !== null : typeof x === "function"; | |
} | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor | |
function IsConstructor(x) { | |
return typeof x === "function"; | |
} | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type | |
function IsSymbol(x) { | |
return typeof x === "symbol"; | |
} | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey | |
function ToPropertyKey(value) { | |
if (IsSymbol(value)) { | |
return value; | |
} | |
return String(value); | |
} | |
function GetPrototypeOf(O) { | |
var proto = Object.getPrototypeOf(O); | |
if (typeof O !== "function" || O === functionPrototype) { | |
return proto; | |
} | |
// TypeScript doesn't set __proto__ in ES5, as it's non-standard. | |
// Try to determine the superclass constructor. Compatible implementations | |
// must either set __proto__ on a subclass constructor to the superclass constructor, | |
// or ensure each class has a valid `constructor` property on its prototype that | |
// points back to the constructor. | |
// If this is not the same as Function.[[Prototype]], then this is definately inherited. | |
// This is the case when in ES6 or when using __proto__ in a compatible browser. | |
if (proto !== functionPrototype) { | |
return proto; | |
} | |
// If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. | |
var prototype = O.prototype; | |
var prototypeProto = Object.getPrototypeOf(prototype); | |
if (prototypeProto == null || prototypeProto === Object.prototype) { | |
return proto; | |
} | |
// if the constructor was not a function, then we cannot determine the heritage. | |
var constructor = prototypeProto.constructor; | |
if (typeof constructor !== "function") { | |
return proto; | |
} | |
// if we have some kind of self-reference, then we cannot determine the heritage. | |
if (constructor === O) { | |
return proto; | |
} | |
// we have a pretty good guess at the heritage. | |
return constructor; | |
} | |
// naive Map shim | |
function CreateMapPolyfill() { | |
var cacheSentinel = {}; | |
function Map() { | |
this._keys = []; | |
this._values = []; | |
this._cache = cacheSentinel; | |
} | |
Map.prototype = { | |
get size() { | |
return this._keys.length; | |
}, | |
has: function (key) { | |
if (key === this._cache) { | |
return true; | |
} | |
if (this._find(key) >= 0) { | |
this._cache = key; | |
return true; | |
} | |
return false; | |
}, | |
get: function (key) { | |
var index = this._find(key); | |
if (index >= 0) { | |
this._cache = key; | |
return this._values[index]; | |
} | |
return undefined; | |
}, | |
set: function (key, value) { | |
this.delete(key); | |
this._keys.push(key); | |
this._values.push(value); | |
this._cache = key; | |
return this; | |
}, | |
delete: function (key) { | |
var index = this._find(key); | |
if (index >= 0) { | |
this._keys.splice(index, 1); | |
this._values.splice(index, 1); | |
this._cache = cacheSentinel; | |
return true; | |
} | |
return false; | |
}, | |
clear: function () { | |
this._keys.length = 0; | |
this._values.length = 0; | |
this._cache = cacheSentinel; | |
}, | |
forEach: function (callback, thisArg) { | |
var size = this.size; | |
for (var i = 0; i < size; ++i) { | |
var key = this._keys[i]; | |
var value = this._values[i]; | |
this._cache = key; | |
callback.call(this, value, key, this); | |
} | |
}, | |
_find: function (key) { | |
var keys = this._keys; | |
var size = keys.length; | |
for (var i = 0; i < size; ++i) { | |
if (keys[i] === key) { | |
return i; | |
} | |
} | |
return -1; | |
} | |
}; | |
return Map; | |
} | |
// naive Set shim | |
function CreateSetPolyfill() { | |
var cacheSentinel = {}; | |
function Set() { | |
this._map = new _Map(); | |
} | |
Set.prototype = { | |
get size() { | |
return this._map.length; | |
}, | |
has: function (value) { | |
return this._map.has(value); | |
}, | |
add: function (value) { | |
this._map.set(value, value); | |
return this; | |
}, | |
delete: function (value) { | |
return this._map.delete(value); | |
}, | |
clear: function () { | |
this._map.clear(); | |
}, | |
forEach: function (callback, thisArg) { | |
this._map.forEach(callback, thisArg); | |
} | |
}; | |
return Set; | |
} | |
// naive WeakMap shim | |
function CreateWeakMapPolyfill() { | |
var UUID_SIZE = 16; | |
var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; | |
var nodeCrypto = isNode && require("crypto"); | |
var hasOwn = Object.prototype.hasOwnProperty; | |
var keys = {}; | |
var rootKey = CreateUniqueKey(); | |
function WeakMap() { | |
this._key = CreateUniqueKey(); | |
} | |
WeakMap.prototype = { | |
has: function (target) { | |
var table = GetOrCreateWeakMapTable(target, false); | |
if (table) { | |
return this._key in table; | |
} | |
return false; | |
}, | |
get: function (target) { | |
var table = GetOrCreateWeakMapTable(target, false); | |
if (table) { | |
return table[this._key]; | |
} | |
return undefined; | |
}, | |
set: function (target, value) { | |
var table = GetOrCreateWeakMapTable(target, true); | |
table[this._key] = value; | |
return this; | |
}, | |
delete: function (target) { | |
var table = GetOrCreateWeakMapTable(target, false); | |
if (table && this._key in table) { | |
return delete table[this._key]; | |
} | |
return false; | |
}, | |
clear: function () { | |
// NOTE: not a real clear, just makes the previous data unreachable | |
this._key = CreateUniqueKey(); | |
} | |
}; | |
function FillRandomBytes(buffer, size) { | |
for (var i = 0; i < size; ++i) { | |
buffer[i] = Math.random() * 255 | 0; | |
} | |
} | |
function GenRandomBytes(size) { | |
if (nodeCrypto) { | |
var data = nodeCrypto.randomBytes(size); | |
return data; | |
} | |
else if (typeof Uint8Array === "function") { | |
var data = new Uint8Array(size); | |
if (typeof crypto !== "undefined") { | |
crypto.getRandomValues(data); | |
} | |
else if (typeof msCrypto !== "undefined") { | |
msCrypto.getRandomValues(data); | |
} | |
else { | |
FillRandomBytes(data, size); | |
} | |
return data; | |
} | |
else { | |
var data = new Array(size); | |
FillRandomBytes(data, size); | |
return data; | |
} | |
} | |
function CreateUUID() { | |
var data = GenRandomBytes(UUID_SIZE); | |
// mark as random - RFC 4122 § 4.4 | |
data[6] = data[6] & 0x4f | 0x40; | |
data[8] = data[8] & 0xbf | 0x80; | |
var result = ""; | |
for (var offset = 0; offset < UUID_SIZE; ++offset) { | |
var byte = data[offset]; | |
if (offset === 4 || offset === 6 || offset === 8) { | |
result += "-"; | |
} | |
if (byte < 16) { | |
result += "0"; | |
} | |
result += byte.toString(16).toLowerCase(); | |
} | |
return result; | |
} | |
function CreateUniqueKey() { | |
var key; | |
do { | |
key = "@@WeakMap@@" + CreateUUID(); | |
} while (hasOwn.call(keys, key)); | |
keys[key] = true; | |
return key; | |
} | |
function GetOrCreateWeakMapTable(target, create) { | |
if (!hasOwn.call(target, rootKey)) { | |
if (!create) { | |
return undefined; | |
} | |
Object.defineProperty(target, rootKey, { value: Object.create(null) }); | |
} | |
return target[rootKey]; | |
} | |
return WeakMap; | |
} | |
// hook global Reflect | |
(function (__global) { | |
if (typeof __global.Reflect !== "undefined") { | |
if (__global.Reflect !== Reflect) { | |
for (var p in Reflect) { | |
__global.Reflect[p] = Reflect[p]; | |
} | |
} | |
} | |
else { | |
__global.Reflect = Reflect; | |
} | |
})(typeof window !== "undefined" ? window : | |
typeof WorkerGlobalScope !== "undefined" ? self : | |
typeof global !== "undefined" ? global : | |
Function("return this;")()); | |
})(Reflect || (Reflect = {})); | |
//# sourceMappingURL=Reflect.js.map | |
(function (global, factory) { | |
if (typeof define === "function" && define.amd) { | |
define(["exports"], factory); | |
} else if (typeof exports !== "undefined") { | |
factory(exports); | |
} else { | |
var mod = { | |
exports: {} | |
}; | |
factory(mod.exports); | |
global.ngForward = mod.exports; | |
} | |
})(this, function (exports) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var babelHelpers_inherits = function babelHelpers_inherits(subClass, superClass) { | |
if (typeof superClass !== "function" && superClass !== null) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor: { | |
value: subClass, | |
enumerable: false, | |
writable: true, | |
configurable: true | |
} | |
}); | |
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | |
}; | |
var babelHelpers_createClass = (function () { | |
function defineProperties(target, props) { | |
for (var i = 0; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
descriptor.configurable = true; | |
if ("value" in descriptor) descriptor.writable = true; | |
Object.defineProperty(target, descriptor.key, descriptor); | |
} | |
} | |
return function (Constructor, protoProps, staticProps) { | |
if (protoProps) defineProperties(Constructor.prototype, protoProps); | |
if (staticProps) defineProperties(Constructor, staticProps); | |
return Constructor; | |
}; | |
})(); | |
var babelHelpers_toConsumableArray = function babelHelpers_toConsumableArray(arr) { | |
if (Array.isArray(arr)) { | |
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | |
return arr2; | |
} else { | |
return Array.from(arr); | |
} | |
}; | |
var babelHelpers_slicedToArray = (function () { | |
function sliceIterator(arr, i) { | |
var _arr = []; | |
var _n = true; | |
var _d = false; | |
var _e = undefined; | |
try { | |
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | |
_arr.push(_s.value); | |
if (i && _arr.length === i) break; | |
} | |
} catch (err) { | |
_d = true; | |
_e = err; | |
} finally { | |
try { | |
if (!_n && _i["return"]) _i["return"](); | |
} finally { | |
if (_d) throw _e; | |
} | |
} | |
return _arr; | |
} | |
return function (arr, i) { | |
if (Array.isArray(arr)) { | |
return arr; | |
} else if (Symbol.iterator in Object(arr)) { | |
return sliceIterator(arr, i); | |
} else { | |
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | |
} | |
}; | |
})(); | |
var babelHelpers_bind = Function.prototype.bind; | |
var babelHelpers_defineProperty = function babelHelpers_defineProperty(obj, key, value) { | |
if (key in obj) { | |
Object.defineProperty(obj, key, { | |
value: value, | |
enumerable: true, | |
configurable: true, | |
writable: true | |
}); | |
} else { | |
obj[key] = value; | |
} | |
return obj; | |
}; | |
var babelHelpers_get = function get(_x, _x3, _x4) { | |
var _again2 = true; | |
_function2: while (_again2) { | |
var object = _x, | |
property = _x3, | |
receiver = _x4; | |
_again2 = false; | |
if (object === null) object = Function.prototype; | |
var desc = Object.getOwnPropertyDescriptor(object, property); | |
if (desc === undefined) { | |
var parent = Object.getPrototypeOf(object); | |
if (parent === null) { | |
return undefined; | |
} else { | |
_x = parent; | |
_x3 = property; | |
_x4 = receiver; | |
_again2 = true; | |
desc = parent = undefined; | |
continue _function2; | |
} | |
} else if ("value" in desc) { | |
return desc.value; | |
} else { | |
var getter = desc.get; | |
if (getter === undefined) { | |
return undefined; | |
} | |
return getter.call(receiver); | |
} | |
} | |
}; | |
var babelHelpers_classCallCheck = function babelHelpers_classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
}; | |
var Metastore = (function () { | |
function Metastore(namespace) { | |
babelHelpers_classCallCheck(this, Metastore); | |
this.namespace = namespace; | |
} | |
babelHelpers_createClass(Metastore, [{ | |
key: '_map', | |
value: function _map(obj, key) { | |
if (!Reflect.hasOwnMetadata(this.namespace, obj, key)) { | |
Reflect.defineMetadata(this.namespace, new Map(), obj, key); | |
} | |
return Reflect.getOwnMetadata(this.namespace, obj, key); | |
} | |
}, { | |
key: 'get', | |
value: function get(key, obj, prop) { | |
return this._map(obj, prop).get(key); | |
} | |
}, { | |
key: 'set', | |
value: function set(key, value, obj, prop) { | |
this._map(obj, prop).set(key, value); | |
} | |
}, { | |
key: 'has', | |
value: function has(key, obj, prop) { | |
return this._map(obj, prop).has(key); | |
} | |
}, { | |
key: 'push', | |
value: function push(key, value, obj, prop) { | |
if (!this.has(key, obj, prop)) { | |
this.set(key, [], obj, prop); | |
} | |
var store = this.get(key, obj, prop); | |
if (!Array.isArray(store)) { | |
throw new Error('Metastores can only push metadata to array values'); | |
} | |
store.push(value); | |
} | |
}, { | |
key: 'forEach', | |
value: function forEach(callbackFn, obj, prop) { | |
this._map(obj, prop).forEach(callbackFn); | |
} | |
}]); | |
return Metastore; | |
})(); | |
var componentStore = new Metastore('$component'); | |
var providerStore = new Metastore('$provider'); | |
var bundleStore = new Metastore('$bundle'); | |
var randomInt = function randomInt() { | |
return Math.floor(Math.random() * 100); | |
}; | |
function decoratorFactory(type) { | |
var strategyType = arguments.length <= 1 || arguments[1] === undefined ? 'provider' : arguments[1]; | |
var names = new Set(); | |
function createUniqueName(_x2) { | |
var _again = true; | |
_function: while (_again) { | |
var name = _x2; | |
_again = false; | |
if (names.has(name)) { | |
_x2 = '' + name + randomInt(); | |
_again = true; | |
continue _function; | |
} else { | |
return name; | |
} | |
} | |
} | |
; | |
var NAME_TAKEN_ERROR = function NAME_TAKEN_ERROR(name) { | |
return new Error('A provider with type ' + type + ' and name ' + name + ' has already been registered'); | |
}; | |
return (function () { | |
var d = function d(maybeT) { | |
var writeWithUniqueName = function writeWithUniqueName(t) { | |
var name = createUniqueName(t.name); | |
providerStore.set('type', type, t); | |
providerStore.set('name', name, t); | |
names.add(name); | |
}; | |
if (typeof maybeT === 'string') { | |
if (names.has(maybeT)) { | |
throw NAME_TAKEN_ERROR(maybeT); | |
} | |
return function (t) { | |
providerStore.set('type', type, t); | |
providerStore.set('name', maybeT, t); | |
names.add(maybeT); | |
}; | |
} else if (maybeT === undefined) { | |
return function (t) { | |
return writeWithUniqueName(t); | |
}; | |
} | |
writeWithUniqueName(maybeT); | |
}; | |
d.clearNameCache = function () { | |
return names.clear(); | |
}; | |
return d; | |
})(); | |
} | |
; | |
var _parsers = {}; | |
var DecoratedModule = (function () { | |
function DecoratedModule(name) { | |
var modules = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; | |
babelHelpers_classCallCheck(this, DecoratedModule); | |
this.name = name; | |
if (modules) { | |
this.moduleList(modules); | |
this._module = angular.module(name, this._dependencies); | |
} else { | |
this._module = angular.module(name); | |
} | |
} | |
babelHelpers_createClass(DecoratedModule, [{ | |
key: 'add', | |
value: function add() { | |
var _iteratorNormalCompletion = true; | |
var _didIteratorError = false; | |
var _iteratorError = undefined; | |
try { | |
for (var _len = arguments.length, providers = Array(_len), _key = 0; _key < _len; _key++) { | |
providers[_key] = arguments[_key]; | |
} | |
for (var _iterator = providers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | |
var provider = _step.value; | |
if (!providerStore.has('type', provider)) { | |
throw new Error('Cannot read provider metadata. Are you adding a class that hasn\'t been decorated yet?'); | |
} | |
var type = providerStore.get('type', provider); | |
var _name = providerStore.get('name', provider); | |
var inject = bundleStore.get('$inject', provider) || []; | |
if (_parsers[type]) { | |
_parsers[type](provider, _name, inject, this._module); | |
} else { | |
throw new Error('No parser registered for type \'' + type + '\''); | |
} | |
} | |
} catch (err) { | |
_didIteratorError = true; | |
_iteratorError = err; | |
} finally { | |
try { | |
if (!_iteratorNormalCompletion && _iterator['return']) { | |
_iterator['return'](); | |
} | |
} finally { | |
if (_didIteratorError) { | |
throw _iteratorError; | |
} | |
} | |
} | |
return this; | |
} | |
}, { | |
key: 'publish', | |
value: function publish() { | |
return this._module; | |
} | |
}, { | |
key: 'moduleList', | |
value: function moduleList(modules) { | |
this._dependencies = []; | |
if (modules && modules.length !== 0) { | |
for (var i = 0; i < modules.length; i++) { | |
if (typeof modules[i] === 'string') { | |
this._dependencies.push(modules[i]); | |
} else if (modules[i] && modules[i].name) { | |
this._dependencies.push(modules[i].name); | |
} else { | |
throw new Error('Cannot read module: Unknown module in ' + this.name); | |
} | |
} | |
} | |
} | |
}, { | |
key: 'config', | |
value: function config(configFunc) { | |
this._module.config(configFunc); | |
return this; | |
} | |
}, { | |
key: 'run', | |
value: function run(runFunc) { | |
this._module.run(runFunc); | |
return this; | |
} | |
}, { | |
key: 'value', | |
value: function value(name, _value) { | |
this._module.value(name, _value); | |
return this; | |
} | |
}, { | |
key: 'constant', | |
value: function constant(name, value) { | |
this._module.constant(name, value); | |
return this; | |
} | |
}]); | |
return DecoratedModule; | |
})(); | |
var Module = function Module(name, modules) { | |
return new DecoratedModule(name, modules); | |
}; | |
Module.addProvider = function (providerType, parser) { | |
_parsers[providerType] = parser; | |
}; | |
Module.getParser = function (providerType) { | |
return _parsers[providerType]; | |
}; | |
var INJECTABLE = 'injectable'; | |
var Injectable = decoratorFactory(INJECTABLE); | |
Module.addProvider(INJECTABLE, function (provider, name, injects, ngModule) { | |
ngModule.service(name, [].concat(babelHelpers_toConsumableArray(injects), [provider])); | |
}); | |
var OpaqueToken = (function () { | |
function OpaqueToken(_desc) { | |
babelHelpers_classCallCheck(this, OpaqueToken); | |
this._desc = _desc; | |
} | |
babelHelpers_createClass(OpaqueToken, [{ | |
key: "toString", | |
value: function toString() { | |
return "Token " + this._desc; | |
} | |
}]); | |
return OpaqueToken; | |
})(); | |
var getInjectableName = function getInjectableName(injectable) { | |
if (typeof injectable === 'string' || injectable instanceof OpaqueToken) { | |
return injectable.toString(); | |
} else if (providerStore.has('type', injectable)) { | |
return providerStore.get('name', injectable); | |
} | |
}; | |
var getInjectableNameWithJitCreation = function getInjectableNameWithJitCreation(injectable) { | |
var name = getInjectableName(injectable); | |
if (name) { | |
return name; | |
} | |
if (typeof injectable === 'function') { | |
Injectable(injectable); | |
return providerStore.get('name', injectable); | |
} | |
}; | |
function parseSelector(selector) { | |
var selectorArray = undefined; | |
var type = undefined; | |
if (selector.match(/\[(.*?)\]/) !== null) { | |
selectorArray = selector.slice(1, selector.length - 1).split('-'); | |
type = 'A'; | |
} else if (selector[0] === '.') { | |
selectorArray = selector.slice(1, selector.length).split('-'); | |
type = 'C'; | |
} else { | |
selectorArray = selector.split('-'); | |
type = 'E'; | |
} | |
var first = selectorArray.shift(); | |
var name = undefined; | |
if (selectorArray.length > 0) { | |
for (var i = 0; i < selectorArray.length; i++) { | |
var s = selectorArray[i]; | |
s = s.slice(0, 1).toUpperCase() + s.slice(1, s.length); | |
selectorArray[i] = s; | |
} | |
name = [first].concat(babelHelpers_toConsumableArray(selectorArray)).join(''); | |
} else { | |
name = first; | |
} | |
return { name: name, type: type }; | |
} | |
var SNAKE_CASE_REGEXP = /[A-Z]/g; | |
function ucFirst(word) { | |
return '' + word.charAt(0).toUpperCase() + word.substring(1); | |
} | |
function dashToCamel(dash) { | |
var words = dash.split('-'); | |
return '' + words.shift() + words.map(ucFirst).join(''); | |
} | |
function dasherize(name) { | |
var separator = arguments.length <= 1 || arguments[1] === undefined ? '-' : arguments[1]; | |
return name.replace(SNAKE_CASE_REGEXP, function (letter, pos) { | |
return '' + (pos ? separator : '') + letter.toLowerCase(); | |
}); | |
} | |
function flatten(items) { | |
var resolved = []; | |
var _iteratorNormalCompletion = true; | |
var _didIteratorError = false; | |
var _iteratorError = undefined; | |
try { | |
for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | |
var item = _step.value; | |
if (Array.isArray(item)) { | |
resolved.push.apply(resolved, babelHelpers_toConsumableArray(flatten(item))); | |
} else { | |
resolved.push(item); | |
} | |
} | |
} catch (err) { | |
_didIteratorError = true; | |
_iteratorError = err; | |
} finally { | |
try { | |
if (!_iteratorNormalCompletion && _iterator['return']) { | |
_iterator['return'](); | |
} | |
} finally { | |
if (_didIteratorError) { | |
throw _iteratorError; | |
} | |
} | |
} | |
return resolved; | |
} | |
function Inject() { | |
for (var _len = arguments.length, injects = Array(_len), _key = 0; _key < _len; _key++) { | |
injects[_key] = arguments[_key]; | |
} | |
return function (t) { | |
var notStringBased = function notStringBased(inj) { | |
return typeof inj !== 'string' && !(inj instanceof OpaqueToken); | |
}; | |
var ensureInjectable = function ensureInjectable(inj) { | |
if (!providerStore.get('name', inj) || !providerStore.get('type', inj)) { | |
throw new Error('Processing "' + t.name + '" @Inject parameter: "' + (inj.name || inj.toString()) + '" is not a valid injectable.\n\t\t\t\tPlease ensure ' + (inj.name || inj.toString()) + ' is injectable. Valid examples can be:\n\t\t\t\t- a string representing an ng1 provider, e.g. \'$q\'\n\t\t\t\t- an @Injectable ng-forward class\n\t\t\t\t- a Provider, e.g. provide(SOME_CONFIG, {asValue: 100})'); | |
} | |
return inj; | |
}; | |
var providers = injects.filter(notStringBased).map(ensureInjectable); | |
Providers.apply(undefined, babelHelpers_toConsumableArray(providers))(t); | |
var dependencies = injects.map(getInjectableName).filter(function (n) { | |
return n !== undefined; | |
}); | |
if (bundleStore.has('$inject', t)) { | |
var parentInjects = bundleStore.get('$inject', t); | |
bundleStore.set('$inject', [].concat(babelHelpers_toConsumableArray(dependencies), babelHelpers_toConsumableArray(parentInjects)), t); | |
} else { | |
bundleStore.set('$inject', dependencies, t); | |
} | |
}; | |
} | |
var TYPE = 'provider'; | |
var Provider = (function () { | |
function Provider(token, _ref) { | |
var useClass = _ref.useClass; | |
var useValue = _ref.useValue; | |
var useConstant = _ref.useConstant; | |
var useFactory = _ref.useFactory; | |
var deps = _ref.deps; | |
babelHelpers_classCallCheck(this, Provider); | |
this._dependencies = []; | |
try { | |
this.token = getInjectableNameWithJitCreation(token); | |
} catch (e) { | |
throw new Error('new Provider() Error: Invalid token ' + token); | |
} | |
Object.assign(this, { useClass: useClass, useValue: useValue, useConstant: useConstant, useFactory: useFactory }); | |
if (!useClass && !useValue && !useConstant && !useFactory) { | |
throw new Error('new Provider(' + token + ') Error: No usage provided (i.e. useClass, useValue, useConstant, useFactory)'); | |
} | |
if (deps) { | |
Inject.apply(undefined, babelHelpers_toConsumableArray(deps))(this.useFactory); | |
Providers.apply(undefined, babelHelpers_toConsumableArray(deps.filter(function (d) { | |
return typeof d !== 'string'; | |
})))(this.useFactory); | |
this._dependencies = bundleStore.get('$inject', this.useFactory); | |
} | |
providerStore.set('name', this.token, this); | |
providerStore.set('type', TYPE, this); | |
} | |
babelHelpers_createClass(Provider, [{ | |
key: 'type', | |
get: function get() { | |
var _this = this; | |
if (this._type) return this._type; | |
this._type = Object.keys(this).find(function (k) { | |
return k.startsWith('use') && _this[k] !== undefined; | |
}); | |
return this._type; | |
} | |
}, { | |
key: 'dependencies', | |
get: function get() { | |
return this._dependencies; | |
} | |
}]); | |
return Provider; | |
})(); | |
Module.addProvider(TYPE, function (provider, name, injects, ngModule) { | |
switch (provider.type) { | |
case 'useValue': | |
ngModule.value(provider.token, provider.useValue); | |
break; | |
case 'useConstant': | |
ngModule.constant(provider.token, provider.useConstant); | |
break; | |
case 'useClass': | |
injects = bundleStore.get('$inject', provider.useClass) || []; | |
Module.getParser(INJECTABLE)(provider.useClass, provider.token, injects, ngModule); | |
break; | |
case 'useFactory': | |
ngModule.factory(provider.token, [].concat(babelHelpers_toConsumableArray(provider.dependencies), [provider.useFactory])); | |
break; | |
default: | |
break; | |
} | |
}); | |
var provide = function provide(token, _ref2) { | |
var useClass = _ref2.useClass; | |
var useValue = _ref2.useValue; | |
var useConstant = _ref2.useConstant; | |
var useFactory = _ref2.useFactory; | |
var deps = _ref2.deps; | |
return new Provider(token, { useClass: useClass, useValue: useValue, useConstant: useConstant, useFactory: useFactory, deps: deps }); | |
}; | |
var STRING_TEST = function STRING_TEST(a) { | |
return typeof a === 'string'; | |
}; | |
var PROVIDER_TEST = function PROVIDER_TEST(a) { | |
return (typeof a === 'function' || a instanceof Provider) && providerStore.has('name', a); | |
}; | |
function groupModulesAndProviders(modulesAndProviders) { | |
modulesAndProviders = flatten(modulesAndProviders); | |
var modules = modulesAndProviders.filter(STRING_TEST); | |
var providers = modulesAndProviders.filter(PROVIDER_TEST); | |
if (modulesAndProviders.length !== modules.length + providers.length) { | |
throw new Error('One or more of your providers was not valid. Please make sure all providers are either: ' + 'decorated class, Provider instance, or module string'); | |
} | |
return { modules: modules, providers: providers }; | |
} | |
function Providers() { | |
for (var _len = arguments.length, modulesAndProviders = Array(_len), _key = 0; _key < _len; _key++) { | |
modulesAndProviders[_key] = arguments[_key]; | |
} | |
return function (t) { | |
var _groupIntoModulesAndProviders = groupModulesAndProviders(modulesAndProviders); | |
var modules = _groupIntoModulesAndProviders.modules; | |
var providers = _groupIntoModulesAndProviders.providers; | |
var parentModules = bundleStore.get('modules', t) || []; | |
bundleStore.set('modules', [].concat(babelHelpers_toConsumableArray(modules), babelHelpers_toConsumableArray(parentModules)), t); | |
var parentProviders = bundleStore.get('providers', t) || []; | |
bundleStore.set('providers', [].concat(babelHelpers_toConsumableArray(providers), babelHelpers_toConsumableArray(parentProviders)), t); | |
}; | |
} | |
var BIND_STRING = '_bind_string_'; | |
var BIND_ONEWAY = '_bind_oneway_'; | |
var BIND_TWOWAY = '_bind_twoway_'; | |
function isDefined(value) { | |
return typeof value !== 'undefined'; | |
} | |
function inputsMap(inputs) { | |
var definition = {}; | |
for (var key in inputs) { | |
var lowercaseInput = inputs[key]; | |
definition['@' + key] = '@' + lowercaseInput; | |
definition['[' + inputs[key] + ']'] = '=?'; | |
definition['[(' + inputs[key] + ')]'] = '=?'; | |
} | |
return definition; | |
} | |
function inputsBuilder(controller, localKey, publicKey) { | |
var _Object$defineProperties; | |
// We are going to be installing a lot of properties on the controller to handle the magic | |
// of our input bindings. Here we are marking them as hidden but writeable, that way | |
// we don't leak our abstraction | |
var stringKey = '@' + localKey; | |
var oneWayKey = '[' + publicKey + ']'; | |
var twoWayKey = '[(' + publicKey + ')]'; | |
var __stringKey = Symbol(); | |
var __oneWayKey = Symbol(); | |
var __twoWayKey = Symbol(); | |
var __using_binding = Symbol(); | |
Object.defineProperties(controller, (_Object$defineProperties = {}, babelHelpers_defineProperty(_Object$defineProperties, stringKey, { | |
enumerable: false, configurable: false, | |
set: createHiddenPropSetter(BIND_STRING, __stringKey), | |
get: function get() { | |
return this[__stringKey]; | |
} | |
}), babelHelpers_defineProperty(_Object$defineProperties, oneWayKey, { | |
enumerable: false, configurable: false, | |
set: createHiddenPropSetter(BIND_ONEWAY, __oneWayKey), | |
get: function get() { | |
return this[__oneWayKey]; | |
} | |
}), babelHelpers_defineProperty(_Object$defineProperties, twoWayKey, { | |
enumerable: false, configurable: false, | |
set: createHiddenPropSetter(BIND_TWOWAY, __twoWayKey), | |
get: function get() { | |
return this[localKey]; | |
} | |
}), babelHelpers_defineProperty(_Object$defineProperties, __using_binding, { | |
enumerable: false, configurable: false, writable: true, | |
value: controller.__using_binding || {} | |
}), _Object$defineProperties)); | |
function createHiddenPropSetter(BIND_TYPE, __privateKey) { | |
return function (val) { | |
this[__privateKey] = val; | |
if (isDefined(val)) { | |
setBindingUsed(BIND_TYPE, localKey); | |
} | |
if (controller[__using_binding][localKey] === BIND_TYPE) { | |
this[localKey] = val; | |
} | |
}; | |
} | |
function setBindingUsed(using, key) { | |
if (controller[__using_binding][key] && controller[__using_binding][key] !== using) { | |
throw new Error('Can not use more than one type of attribute binding simultaneously: ' + key + ', [' + key + '], [(' + key + ')]. Choose one.'); | |
} | |
controller[__using_binding][key] = using; | |
} | |
} | |
var Subscription = (function () { | |
function Subscription(_unsubscribe) { | |
babelHelpers_classCallCheck(this, Subscription); | |
this.isUnsubscribed = false; | |
if (_unsubscribe) { | |
this._unsubscribe = _unsubscribe; | |
} | |
} | |
babelHelpers_createClass(Subscription, [{ | |
key: "_unsubscribe", | |
value: function _unsubscribe() {} | |
}, { | |
key: "unsubscribe", | |
value: function unsubscribe() { | |
if (this.isUnsubscribed) { | |
return; | |
} | |
this.isUnsubscribed = true; | |
var unsubscribe = this._unsubscribe; | |
var subscriptions = this._subscriptions; | |
this._subscriptions = void 0; | |
if (unsubscribe) { | |
unsubscribe.call(this); | |
} | |
if (subscriptions != null) { | |
var index = -1; | |
var len = subscriptions.length; | |
while (++index < len) { | |
subscriptions[index].unsubscribe(); | |
} | |
} | |
} | |
}, { | |
key: "add", | |
value: function add(subscription) { | |
// return early if: | |
// 1. the subscription is null | |
// 2. we're attempting to add our this | |
// 3. we're attempting to add the static `empty` Subscription | |
if (!subscription || subscription === this || subscription === Subscription.EMPTY) { | |
return; | |
} | |
var sub = subscription; | |
switch (typeof subscription) { | |
case "function": | |
sub = new Subscription(subscription); | |
case "object": | |
if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { | |
break; | |
} else if (this.isUnsubscribed) { | |
sub.unsubscribe(); | |
} else { | |
var subscriptions = this._subscriptions || (this._subscriptions = []); | |
subscriptions.push(sub); | |
} | |
break; | |
default: | |
throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); | |
} | |
} | |
}, { | |
key: "remove", | |
value: function remove(subscription) { | |
// return early if: | |
// 1. the subscription is null | |
// 2. we're attempting to remove ourthis | |
// 3. we're attempting to remove the static `empty` Subscription | |
if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { | |
return; | |
} | |
var subscriptions = this._subscriptions; | |
if (subscriptions) { | |
var subscriptionIndex = subscriptions.indexOf(subscription); | |
if (subscriptionIndex !== -1) { | |
subscriptions.splice(subscriptionIndex, 1); | |
} | |
} | |
} | |
}]); | |
return Subscription; | |
})(); | |
Subscription.EMPTY = (function (empty) { | |
empty.isUnsubscribed = true; | |
return empty; | |
})(new Subscription()); | |
function noop() {} | |
function throwError(e) { | |
throw e; | |
} | |
function tryOrOnError(target) { | |
function tryCatcher() { | |
try { | |
tryCatcher.target.apply(this, arguments); | |
} catch (e) { | |
this.error(e); | |
} | |
} | |
tryCatcher.target = target; | |
return tryCatcher; | |
} | |
var Subscriber = (function (_Subscription) { | |
babelHelpers_inherits(Subscriber, _Subscription); | |
function Subscriber(destination) { | |
babelHelpers_classCallCheck(this, Subscriber); | |
babelHelpers_get(Object.getPrototypeOf(Subscriber.prototype), 'constructor', this).call(this); | |
this.destination = destination; | |
this._isUnsubscribed = false; | |
if (!this.destination) { | |
return; | |
} | |
var subscription = destination._subscription; | |
if (subscription) { | |
this._subscription = subscription; | |
} else if (destination instanceof Subscriber) { | |
this._subscription = destination; | |
} | |
} | |
babelHelpers_createClass(Subscriber, [{ | |
key: 'add', | |
value: function add(sub) { | |
// route add to the shared Subscription if it exists | |
var _subscription = this._subscription; | |
if (_subscription) { | |
_subscription.add(sub); | |
} else { | |
babelHelpers_get(Object.getPrototypeOf(Subscriber.prototype), 'add', this).call(this, sub); | |
} | |
} | |
}, { | |
key: 'remove', | |
value: function remove(sub) { | |
// route remove to the shared Subscription if it exists | |
if (this._subscription) { | |
this._subscription.remove(sub); | |
} else { | |
babelHelpers_get(Object.getPrototypeOf(Subscriber.prototype), 'remove', this).call(this, sub); | |
} | |
} | |
}, { | |
key: 'unsubscribe', | |
value: function unsubscribe() { | |
if (this._isUnsubscribed) { | |
return; | |
} else if (this._subscription) { | |
this._isUnsubscribed = true; | |
} else { | |
babelHelpers_get(Object.getPrototypeOf(Subscriber.prototype), 'unsubscribe', this).call(this); | |
} | |
} | |
}, { | |
key: '_next', | |
value: function _next(value) { | |
this.destination.next(value); | |
} | |
}, { | |
key: '_error', | |
value: function _error(err) { | |
this.destination.error(err); | |
} | |
}, { | |
key: '_complete', | |
value: function _complete() { | |
this.destination.complete(); | |
} | |
}, { | |
key: 'next', | |
value: function next(value) { | |
if (!this.isUnsubscribed) { | |
this._next(value); | |
} | |
} | |
}, { | |
key: 'error', | |
value: function error(_error2) { | |
if (!this.isUnsubscribed) { | |
this._error(_error2); | |
this.unsubscribe(); | |
} | |
} | |
}, { | |
key: 'complete', | |
value: function complete() { | |
if (!this.isUnsubscribed) { | |
this._complete(); | |
this.unsubscribe(); | |
} | |
} | |
}, { | |
key: 'isUnsubscribed', | |
get: function get() { | |
var subscription = this._subscription; | |
if (subscription) { | |
// route to the shared Subscription if it exists | |
return this._isUnsubscribed || subscription.isUnsubscribed; | |
} else { | |
return this._isUnsubscribed; | |
} | |
}, | |
set: function set(value) { | |
var subscription = this._subscription; | |
if (subscription) { | |
// route to the shared Subscription if it exists | |
subscription.isUnsubscribed = Boolean(value); | |
} else { | |
this._isUnsubscribed = Boolean(value); | |
} | |
} | |
}], [{ | |
key: 'create', | |
value: function create(next, error, complete) { | |
var subscriber = new Subscriber(); | |
subscriber._next = typeof next === "function" && tryOrOnError(next) || noop; | |
subscriber._error = typeof error === "function" && error || throwError; | |
subscriber._complete = typeof complete === "function" && complete || noop; | |
return subscriber; | |
} | |
}]); | |
return Subscriber; | |
})(Subscription); | |
var objectTypes = { | |
'boolean': false, | |
'function': true, | |
'object': true, | |
'number': false, | |
'string': false, | |
'undefined': false | |
}; | |
var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; | |
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; | |
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; | |
var freeGlobal = objectTypes[typeof global] && global; | |
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { | |
root = freeGlobal; | |
} | |
if (!root.Symbol) { | |
root.Symbol = {}; | |
} | |
if (!root.Symbol.observable) { | |
if (typeof root.Symbol['for'] === 'function') { | |
root.Symbol.observable = root.Symbol['for']('observable'); | |
} else { | |
root.Symbol.observable = '@@observable'; | |
} | |
} | |
var $$observable = root.Symbol.observable; | |
/** | |
* A representation of any set of values over any amount of time. This the most basic building block | |
* of RxJS. | |
* | |
* @class Observable<T> | |
*/ | |
var Observable = (function () { | |
/** | |
* @constructor | |
* @param {Function} subscribe the function that is | |
* called when the Observable is initially subscribed to. This function is given a Subscriber, to which new values | |
* can be `next`ed, or an `error` method can be called to raise an error, or `complete` can be called to notify | |
* of a successful completion. | |
*/ | |
function Observable(subscribe) { | |
babelHelpers_classCallCheck(this, Observable); | |
this._isScalar = false; | |
if (subscribe) { | |
this._subscribe = subscribe; | |
} | |
} | |
// HACK: Since TypeScript inherits static properties too, we have to | |
// fight against TypeScript here so Subject can have a different static create signature | |
/** | |
* @static | |
* @method create | |
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor | |
* @returns {Observable} a new cold observable | |
* @description creates a new cold Observable by calling the Observable constructor | |
*/ | |
/** | |
* @method lift | |
* @param {Operator} operator the operator defining the operation to take on the observable | |
* @returns {Observable} a new observable with the Operator applied | |
* @description creates a new Observable, with this Observable as the source, and the passed | |
* operator defined as the new observable's operator. | |
*/ | |
babelHelpers_createClass(Observable, [{ | |
key: 'lift', | |
value: function lift(operator) { | |
var observable = new Observable(); | |
observable.source = this; | |
observable.operator = operator; | |
return observable; | |
} | |
/** | |
* @method Symbol.observable | |
* @returns {Observable} this instance of the observable | |
* @description an interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable | |
*/ | |
}, { | |
key: $$observable, | |
value: function value() { | |
return this; | |
} | |
/** | |
* @method subscribe | |
* @param {Observer|Function} observerOrNext (optional) either an observer defining all functions to be called, | |
* or the first of three possible handlers, which is the handler for each value emitted from the observable. | |
* @param {Function} error (optional) a handler for a terminal event resulting from an error. If no error handler is provided, | |
* the error will be thrown as unhandled | |
* @param {Function} complete (optional) a handler for a terminal event resulting from successful completion. | |
* @returns {Subscription} a subscription reference to the registered handlers | |
* @description registers handlers for handling emitted values, error and completions from the observable, and | |
* executes the observable's subscriber function, which will take action to set up the underlying data stream | |
*/ | |
}, { | |
key: 'subscribe', | |
value: function subscribe(observerOrNext, error, complete) { | |
var subscriber = undefined; | |
if (observerOrNext && typeof observerOrNext === "object") { | |
if (observerOrNext instanceof Subscriber) { | |
subscriber = observerOrNext; | |
} else { | |
subscriber = new Subscriber(observerOrNext); | |
} | |
} else { | |
var next = observerOrNext; | |
subscriber = Subscriber.create(next, error, complete); | |
} | |
subscriber.add(this._subscribe(subscriber)); | |
return subscriber; | |
} | |
/** | |
* @method forEach | |
* @param {Function} next a handler for each value emitted by the observable | |
* @param {PromiseConstructor} PromiseCtor? a constructor function used to instantiate the Promise | |
* @returns {Promise} a promise that either resolves on observable completion or | |
* rejects with the handled error | |
*/ | |
}, { | |
key: 'forEach', | |
value: function forEach(next, PromiseCtor) { | |
var _this = this; | |
if (!PromiseCtor) { | |
if (root.Rx && root.Rx.config && root.Rx.config.Promise) { | |
PromiseCtor = root.Rx.config.Promise; | |
} else if (root.Promise) { | |
PromiseCtor = root.Promise; | |
} | |
} | |
if (!PromiseCtor) { | |
throw new Error('no Promise impl found'); | |
} | |
return new PromiseCtor(function (resolve, reject) { | |
_this.subscribe(next, reject, resolve); | |
}); | |
} | |
}, { | |
key: '_subscribe', | |
value: function _subscribe(subscriber) { | |
return this.source._subscribe(this.operator.call(subscriber)); | |
} | |
}]); | |
return Observable; | |
})(); | |
Observable.create = function (subscribe) { | |
return new Observable(subscribe); | |
}; | |
var SubjectSubscription = (function (_Subscription) { | |
babelHelpers_inherits(SubjectSubscription, _Subscription); | |
function SubjectSubscription(subject, observer) { | |
babelHelpers_classCallCheck(this, SubjectSubscription); | |
babelHelpers_get(Object.getPrototypeOf(SubjectSubscription.prototype), 'constructor', this).call(this); | |
this.subject = subject; | |
this.observer = observer; | |
this.isUnsubscribed = false; | |
} | |
babelHelpers_createClass(SubjectSubscription, [{ | |
key: 'unsubscribe', | |
value: function unsubscribe() { | |
if (this.isUnsubscribed) { | |
return; | |
} | |
this.isUnsubscribed = true; | |
var subject = this.subject; | |
var observers = subject.observers; | |
this.subject = void 0; | |
if (!observers || observers.length === 0 || subject.isUnsubscribed) { | |
return; | |
} | |
if (this.observer instanceof Subscriber) { | |
this.observer.unsubscribe(); | |
} | |
var subscriberIndex = observers.indexOf(this.observer); | |
if (subscriberIndex !== -1) { | |
observers.splice(subscriberIndex, 1); | |
} | |
} | |
}]); | |
return SubjectSubscription; | |
})(Subscription); | |
var subscriptionAdd = Subscription.prototype.add; | |
var subscriptionRemove = Subscription.prototype.remove; | |
var subscriptionUnsubscribe = Subscription.prototype.unsubscribe; | |
var subscriberNext = Subscriber.prototype.next; | |
var subscriberError = Subscriber.prototype.error; | |
var subscriberComplete = Subscriber.prototype.complete; | |
var _subscriberNext = Subscriber.prototype._next; | |
var _subscriberError = Subscriber.prototype._error; | |
var _subscriberComplete = Subscriber.prototype._complete; | |
var Subject = (function (_Observable) { | |
babelHelpers_inherits(Subject, _Observable); | |
function Subject() { | |
babelHelpers_classCallCheck(this, Subject); | |
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
babelHelpers_get(Object.getPrototypeOf(Subject.prototype), 'constructor', this).apply(this, args); | |
this.observers = []; | |
this.isUnsubscribed = false; | |
this.dispatching = false; | |
this.errorSignal = false; | |
this.completeSignal = false; | |
} | |
babelHelpers_createClass(Subject, [{ | |
key: 'lift', | |
value: function lift(operator) { | |
var subject = new BidirectionalSubject(this, this.destination || this); | |
subject.operator = operator; | |
return subject; | |
} | |
}, { | |
key: '_subscribe', | |
value: function _subscribe(subscriber) { | |
if (subscriber.isUnsubscribed) { | |
return; | |
} else if (this.errorSignal) { | |
subscriber.error(this.errorInstance); | |
return; | |
} else if (this.completeSignal) { | |
subscriber.complete(); | |
return; | |
} else if (this.isUnsubscribed) { | |
throw new Error("Cannot subscribe to a disposed Subject."); | |
} | |
this.observers.push(subscriber); | |
return new SubjectSubscription(this, subscriber); | |
} | |
}, { | |
key: 'add', | |
value: function add(subscription) { | |
subscriptionAdd.call(this, subscription); | |
} | |
}, { | |
key: 'remove', | |
value: function remove(subscription) { | |
subscriptionRemove.call(this, subscription); | |
} | |
}, { | |
key: 'unsubscribe', | |
value: function unsubscribe() { | |
this.observers = void 0; | |
subscriptionUnsubscribe.call(this); | |
} | |
}, { | |
key: 'next', | |
value: function next(value) { | |
if (this.isUnsubscribed) { | |
return; | |
} | |
this.dispatching = true; | |
this._next(value); | |
this.dispatching = false; | |
if (this.errorSignal) { | |
this.error(this.errorInstance); | |
} else if (this.completeSignal) { | |
this.complete(); | |
} | |
} | |
}, { | |
key: 'error', | |
value: function error(_error) { | |
if (this.isUnsubscribed || this.completeSignal) { | |
return; | |
} | |
this.errorSignal = true; | |
this.errorInstance = _error; | |
if (this.dispatching) { | |
return; | |
} | |
this._error(_error); | |
this.unsubscribe(); | |
} | |
}, { | |
key: 'complete', | |
value: function complete() { | |
if (this.isUnsubscribed || this.errorSignal) { | |
return; | |
} | |
this.completeSignal = true; | |
if (this.dispatching) { | |
return; | |
} | |
this._complete(); | |
this.unsubscribe(); | |
} | |
}, { | |
key: '_next', | |
value: function _next(value) { | |
var index = -1; | |
var observers = this.observers.slice(0); | |
var len = observers.length; | |
while (++index < len) { | |
observers[index].next(value); | |
} | |
} | |
}, { | |
key: '_error', | |
value: function _error(error) { | |
var index = -1; | |
var observers = this.observers; | |
var len = observers.length; | |
// optimization -- block next, complete, and unsubscribe while dispatching | |
this.observers = void 0; | |
this.isUnsubscribed = true; | |
while (++index < len) { | |
observers[index].error(error); | |
} | |
this.isUnsubscribed = false; | |
} | |
}, { | |
key: '_complete', | |
value: function _complete() { | |
var index = -1; | |
var observers = this.observers; | |
var len = observers.length; | |
// optimization -- block next, complete, and unsubscribe while dispatching | |
this.observers = void 0; // optimization | |
this.isUnsubscribed = true; | |
while (++index < len) { | |
observers[index].complete(); | |
} | |
this.isUnsubscribed = false; | |
} | |
}], [{ | |
key: 'create', | |
value: function create(source, destination) { | |
return new BidirectionalSubject(source, destination); | |
} | |
}]); | |
return Subject; | |
})(Observable); | |
var BidirectionalSubject = (function (_Subject) { | |
babelHelpers_inherits(BidirectionalSubject, _Subject); | |
function BidirectionalSubject(source, destination) { | |
babelHelpers_classCallCheck(this, BidirectionalSubject); | |
babelHelpers_get(Object.getPrototypeOf(BidirectionalSubject.prototype), 'constructor', this).call(this); | |
this.source = source; | |
this.destination = destination; | |
} | |
babelHelpers_createClass(BidirectionalSubject, [{ | |
key: '_subscribe', | |
value: function _subscribe(subscriber) { | |
var operator = this.operator; | |
return this.source._subscribe.call(this.source, operator ? operator.call(subscriber) : subscriber); | |
} | |
}, { | |
key: 'next', | |
value: function next(x) { | |
subscriberNext.call(this, x); | |
} | |
}, { | |
key: 'error', | |
value: function error(e) { | |
subscriberError.call(this, e); | |
} | |
}, { | |
key: 'complete', | |
value: function complete() { | |
subscriberComplete.call(this); | |
} | |
}, { | |
key: '_next', | |
value: function _next(x) { | |
_subscriberNext.call(this, x); | |
} | |
}, { | |
key: '_error', | |
value: function _error(e) { | |
_subscriberError.call(this, e); | |
} | |
}, { | |
key: '_complete', | |
value: function _complete() { | |
_subscriberComplete.call(this); | |
} | |
}]); | |
return BidirectionalSubject; | |
})(Subject); | |
var EventEmitter = (function (_Subject) { | |
babelHelpers_inherits(EventEmitter, _Subject); | |
function EventEmitter() { | |
var isAsync = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; | |
babelHelpers_classCallCheck(this, EventEmitter); | |
babelHelpers_get(Object.getPrototypeOf(EventEmitter.prototype), 'constructor', this).call(this); | |
this._isAsync = isAsync; | |
} | |
babelHelpers_createClass(EventEmitter, [{ | |
key: 'subscribe', | |
value: function subscribe(generatorOrNext, error, complete) { | |
if (generatorOrNext && typeof generatorOrNext === 'object') { | |
var schedulerFn = this._isAsync ? function (value) { | |
setTimeout(function () { | |
return generatorOrNext.next(value); | |
}); | |
} : function (value) { | |
generatorOrNext.next(value); | |
}; | |
return babelHelpers_get(Object.getPrototypeOf(EventEmitter.prototype), 'subscribe', this).call(this, schedulerFn, function (err) { | |
return generatorOrNext.error ? generatorOrNext.error(err) : null; | |
}, function () { | |
return generatorOrNext.complete ? generatorOrNext.complete() : null; | |
}); | |
} else { | |
var schedulerFn = this._isAsync ? function (value) { | |
setTimeout(function () { | |
return generatorOrNext(value); | |
}); | |
} : function (value) { | |
generatorOrNext(value); | |
}; | |
return babelHelpers_get(Object.getPrototypeOf(EventEmitter.prototype), 'subscribe', this).call(this, schedulerFn, function (err) { | |
return error ? error(err) : null; | |
}, function () { | |
return complete ? complete() : null; | |
}); | |
} | |
} | |
}]); | |
return EventEmitter; | |
})(Subject); | |
var NativeCustomEvent = CustomEvent; | |
function useNative() { | |
try { | |
var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } }); | |
return 'cat' === p.type && 'bar' === p.detail.foo; | |
} catch (e) { | |
return false; | |
} | |
} | |
function fromCreateEvent(type) { | |
var params = arguments.length <= 1 || arguments[1] === undefined ? { bubbles: false, cancelable: false, detail: {} } : arguments[1]; | |
var e = document.createEvent('CustomEvent'); | |
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); | |
return e; | |
} | |
function fromCreateEventObject(type) { | |
var params = arguments.length <= 1 || arguments[1] === undefined ? { bubbles: false, cancelable: false, detail: {} } : arguments[1]; | |
var e = document.createEventObject(); | |
e.type = type; | |
e.bubbles = params.bubbles; | |
e.cancelable = params.cancelable; | |
e.detail = params.detail; | |
return e; | |
} | |
var eventExport = undefined; | |
if (useNative()) { | |
eventExport = NativeCustomEvent; | |
} else if (typeof document.createEvent === 'function') { | |
eventExport = fromCreateEvent; | |
} else { | |
eventExport = fromCreateEventObject; | |
} | |
var CustomEvent$1 = eventExport; | |
function outputsBuilder(instance, element, $scope, outputs) { | |
var subscriptions = []; | |
var create = function create(eventKey, emitter) { | |
return emitter.subscribe(function (data) { | |
var event = new CustomEvent$1(eventKey, { detail: data, bubbles: false }); | |
element[0].dispatchEvent(event); | |
}); | |
}; | |
for (var key in outputs) { | |
if (instance[key] && instance[key] instanceof EventEmitter) { | |
subscriptions.push(create(outputs[key], instance[key])); | |
} | |
} | |
$scope.$on('$destroy', function (event) { | |
subscriptions.forEach(function (subscription) { | |
return subscription.unsubscribe(); | |
}); | |
}); | |
} | |
function directiveControllerFactory(caller, injects, controller, ddo, $injector, locals) { | |
var instance = Object.create(controller.prototype); | |
for (var key in ddo.inputMap) { | |
inputsBuilder(instance, key, ddo.inputMap[key]); | |
} | |
Object.assign(instance, caller); | |
$injector.invoke([].concat(babelHelpers_toConsumableArray(injects), [controller]), instance, locals); | |
var $element = locals.$element; | |
var $scope = locals.$scope; | |
outputsBuilder(instance, $element, $scope, ddo.outputMap || {}); | |
return instance; | |
} | |
var TYPE$2 = 'directive'; | |
function Directive(_ref) { | |
var selector = _ref.selector; | |
var _ref$providers = _ref.providers; | |
var providers = _ref$providers === undefined ? [] : _ref$providers; | |
return function (t) { | |
if (!selector) { | |
throw new Error('Directive selector must be provided'); | |
} | |
var _parseSelector = parseSelector(selector); | |
var name = _parseSelector.name; | |
var restrict = _parseSelector.type; | |
if (restrict !== 'A') { | |
throw new Error('@Directive selectors can only be attributes'); | |
} | |
if (providers !== undefined && !Array.isArray(providers)) { | |
throw new TypeError('Directive providers must be an array'); | |
} | |
providerStore.set('name', name, t); | |
providerStore.set('type', TYPE$2, t); | |
Providers.apply(undefined, babelHelpers_toConsumableArray(providers))(t); | |
componentStore.set('restrict', restrict, t); | |
}; | |
} | |
Module.addProvider(TYPE$2, function (target, name, injects, ngModule) { | |
var ddo = {}; | |
componentStore.forEach(function (val, key) { | |
ddo[key] = val; | |
}, target); | |
if (ddo.controllerAs) { | |
ddo.bindToController = inputsMap(ddo.inputs); | |
} | |
ngModule.directive(name, ['$injector', function ($injector) { | |
ddo.link = function ($scope, $element, $attrs, $requires, $transclude) { | |
return directiveControllerFactory(this, injects, target, ddo, $injector, { | |
$scope: $scope, | |
$element: $element, | |
$attrs: $attrs, | |
$transclude: $transclude, | |
$requires: $requires | |
}); | |
}; | |
return ddo; | |
}]); | |
}); | |
var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) { | |
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); | |
switch (arguments.length) { | |
case 2: | |
return decorators.reduceRight(function (o, d) { | |
return d && d(o) || o; | |
}, target); | |
case 3: | |
return decorators.reduceRight(function (o, d) { | |
return d && d(target, key), void 0; | |
}, void 0); | |
case 4: | |
return decorators.reduceRight(function (o, d) { | |
return d && d(target, key, o) || o; | |
}, desc); | |
} | |
}; | |
var __metadata = undefined && undefined.__metadata || function (k, v) { | |
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | |
};var events = new Set(['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'keydown', 'keyup', 'keypress', 'submit', 'focus', 'blur', 'copy', 'cut', 'paste', 'change', 'dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend', 'error', 'input', 'load', 'wheel', 'scroll']); | |
function resolve() { | |
var directives = []; | |
events.forEach(function (event) { | |
var selector = "[(" + dasherize(event) + ")]"; | |
var EventHandler = (function () { | |
function EventHandler($parse, $element, $attrs, $scope) { | |
var _this = this; | |
babelHelpers_classCallCheck(this, EventHandler); | |
this.$element = $element; | |
this.$scope = $scope; | |
var _parseSelector = parseSelector(selector); | |
var attrName = _parseSelector.name; | |
this.expression = $parse($attrs[attrName]); | |
$element.on(event, function (e) { | |
return _this.eventHandler(e); | |
}); | |
$scope.$on('$destroy', function () { | |
return _this.onDestroy(); | |
}); | |
} | |
babelHelpers_createClass(EventHandler, [{ | |
key: "eventHandler", | |
value: function eventHandler() { | |
var $event = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | |
var detail = $event.detail; | |
if (!detail && $event.originalEvent && $event.originalEvent.detail) { | |
detail = $event.originalEvent.detail; | |
} else if (!detail) { | |
detail = {}; | |
} | |
this.expression(this.$scope, Object.assign(detail, { $event: $event })); | |
this.$scope.$applyAsync(); | |
} | |
}, { | |
key: "onDestroy", | |
value: function onDestroy() { | |
this.$element.off(event); | |
} | |
}]); | |
return EventHandler; | |
})(); | |
EventHandler = __decorate([Directive({ selector: selector }), Inject('$parse', '$element', '$attrs', '$scope'), __metadata('design:paramtypes', [Function, Object, Object, Object])], EventHandler); | |
directives.push(EventHandler); | |
}); | |
return directives; | |
} | |
function add() { | |
for (var _len = arguments.length, customEvents = Array(_len), _key = 0; _key < _len; _key++) { | |
customEvents[_key] = arguments[_key]; | |
} | |
customEvents.forEach(function (event) { | |
return events.add(event); | |
}); | |
} | |
var events$1 = { resolve: resolve, add: add }; | |
function bundle(moduleName, provider) { | |
var _Module; | |
var otherProviders = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; | |
var getProvidersFrom = function getProvidersFrom(t) { | |
return bundleStore.get('providers', t) || []; | |
}; | |
var getModulesFrom = function getModulesFrom(t) { | |
return bundleStore.get('modules', t) || []; | |
}; | |
var setHasProviderWithToken = function setHasProviderWithToken(_set, token) { | |
return [].concat(babelHelpers_toConsumableArray(_set)).filter(function (p) { | |
return token && p.token === token; | |
}).length > 0; | |
}; | |
var _groupModulesAndProviders = groupModulesAndProviders([provider].concat(babelHelpers_toConsumableArray(otherProviders))); | |
var startingModules = _groupModulesAndProviders.modules; | |
var startingProviders = _groupModulesAndProviders.providers; | |
var providers = new Set(); | |
var modules = new Set(startingModules); | |
function parseProvider(provider) { | |
if (provider) { | |
if (providers.has(provider) || setHasProviderWithToken(providers, provider.token)) { | |
return; | |
} | |
providers.add(provider); | |
var annotated = provider.useClass || provider.useFactory || provider; | |
getModulesFrom(annotated).forEach(function (mod) { | |
return modules.add(mod); | |
}); | |
getProvidersFrom(annotated).forEach(parseProvider); | |
} | |
} | |
startingProviders.forEach(parseProvider); | |
return (_Module = Module(moduleName, [].concat(babelHelpers_toConsumableArray(modules)))).add.apply(_Module, babelHelpers_toConsumableArray(events$1.resolve()).concat(babelHelpers_toConsumableArray(providers))); | |
} | |
function bootstrap(component) { | |
var otherProviders = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; | |
var selector = bundleStore.get('selector', component); | |
var rootElement = document.querySelector(selector); | |
bundle(selector, component, otherProviders); | |
return angular.bootstrap(rootElement, [selector]); | |
} | |
var TYPE$3 = 'pipe'; | |
var Pipe = decoratorFactory(TYPE$3); | |
Module.addProvider(TYPE$3, function (provider, name, injects, ngModule) { | |
ngModule.filter(name, [].concat(babelHelpers_toConsumableArray(injects), [function () { | |
for (var _len = arguments.length, dependencies = Array(_len), _key = 0; _key < _len; _key++) { | |
dependencies[_key] = arguments[_key]; | |
} | |
var pipe = new (babelHelpers_bind.apply(provider, [null].concat(dependencies)))(); | |
if (!pipe.transform) { | |
throw new Error('Filters must implement a transform method'); | |
} | |
return function (input) { | |
for (var _len2 = arguments.length, params = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | |
params[_key2 - 1] = arguments[_key2]; | |
} | |
if (pipe.supports && !pipe.supports(input)) { | |
throw new Error('Filter ' + name + ' does not support ' + input); | |
} | |
return pipe.transform.apply(pipe, [input].concat(params)); | |
}; | |
}])); | |
}); | |
function parsePropertyMap(props) { | |
var map = {}; | |
for (var i = 0; i < props.length; i++) { | |
var split = props[i].split(':'); | |
for (var y = 0; y < split.length; y++) { | |
split[y] = split[y].trim(); | |
} | |
if (split.length === 1) { | |
map[split[0]] = split[0]; | |
} else if (split.length === 2) { | |
map[split[0]] = split[1]; | |
} else { | |
throw new Error('Inputs and outputs must be in the form of "propName: attrName" or in the form of "attrName"'); | |
} | |
} | |
return map; | |
} | |
var writeMapMulti = function writeMapMulti(t, names, storeKey) { | |
var putMap = parsePropertyMap(names); | |
var previousPutMap = componentStore.get(storeKey, t) || {}; | |
componentStore.set(storeKey, Object.assign({}, previousPutMap, putMap), t); | |
return putMap; | |
}; | |
var TYPE$1 = 'component'; | |
function Component(_ref) { | |
var selector = _ref.selector; | |
var controllerAs = _ref.controllerAs; | |
var template = _ref.template; | |
var templateUrl = _ref.templateUrl; | |
var _ref$providers = _ref.providers; | |
var providers = _ref$providers === undefined ? [] : _ref$providers; | |
var _ref$inputs = _ref.inputs; | |
var inputs = _ref$inputs === undefined ? [] : _ref$inputs; | |
var _ref$outputs = _ref.outputs; | |
var outputs = _ref$outputs === undefined ? [] : _ref$outputs; | |
var _ref$pipes = _ref.pipes; | |
var pipes = _ref$pipes === undefined ? [] : _ref$pipes; | |
var _ref$directives = _ref.directives; | |
var directives = _ref$directives === undefined ? [] : _ref$directives; | |
return function (t) { | |
if (!selector) { | |
throw new Error('Component Decorator Error in "' + t.name + '": Component selector must be provided'); | |
} | |
var _parseSelector = parseSelector(selector); | |
var name = _parseSelector.name; | |
var restrict = _parseSelector.type; | |
providerStore.set('name', name, t); | |
providerStore.set('type', TYPE$1, t); | |
bundleStore.set('selector', selector, t); | |
Providers.apply(undefined, babelHelpers_toConsumableArray(providers))(t); | |
componentStore.set('restrict', restrict, t); | |
componentStore.set('scope', {}, t); | |
componentStore.set('transclude', true, t); | |
componentStore.set('bindToController', true, t); | |
[['inputs', inputs], ['providers', providers], ['directives', directives], ['outputs', outputs]].forEach(function (_ref2) { | |
var _ref22 = babelHelpers_slicedToArray(_ref2, 2); | |
var propName = _ref22[0]; | |
var propVal = _ref22[1]; | |
if (propVal !== undefined && !Array.isArray(propVal)) { | |
throw new TypeError('Component Decorator Error in "' + t.name + '": Component ' + propName + ' must be an array'); | |
} | |
}); | |
writeMapMulti(t, inputs, 'inputMap'); | |
var outputMap = writeMapMulti(t, outputs, 'outputMap'); | |
Object.keys(outputMap).forEach(function (key) { | |
return events$1.add(key); | |
}); | |
if (controllerAs) { | |
componentStore.set('controllerAs', controllerAs, t); | |
} else { | |
componentStore.set('controllerAs', name, t); | |
} | |
if (t.link) { | |
componentStore.set('link', t.link, t); | |
} | |
if (t.compile) { | |
componentStore.set('compile', t.compile, t); | |
} | |
View({ | |
selector: selector, | |
template: template, | |
templateUrl: templateUrl, | |
pipes: pipes, | |
directives: directives | |
})(t); | |
}; | |
} | |
function View(_ref3) { | |
var selector = _ref3.selector; | |
var template = _ref3.template; | |
var templateUrl = _ref3.templateUrl; | |
var _ref3$pipes = _ref3.pipes; | |
var pipes = _ref3$pipes === undefined ? [] : _ref3$pipes; | |
var _ref3$directives = _ref3.directives; | |
var directives = _ref3$directives === undefined ? [] : _ref3$directives; | |
return function (t) { | |
if (templateUrl) { | |
componentStore.set('templateUrl', templateUrl, t); | |
} else if (template) { | |
componentStore.set('template', template, t); | |
} else { | |
throw new Error('@Component config must include either a template or a template url for component with selector ' + selector + ' on ' + t.name); | |
} | |
Providers.apply(undefined, babelHelpers_toConsumableArray(directives))(t); | |
Providers.apply(undefined, babelHelpers_toConsumableArray(pipes))(t); | |
}; | |
} | |
Module.addProvider(TYPE$1, function (target, name, injects, ngModule) { | |
var ddo = {}; | |
componentStore.forEach(function (val, key) { | |
ddo[key] = val; | |
}, target); | |
var bindProp = angular.version.minor >= 4 ? 'bindToController' : 'scope'; | |
ddo[bindProp] = inputsMap(ddo.inputMap); | |
checkComponentConfig(); | |
ddo.controller = ['$scope', '$element', '$attrs', '$transclude', '$injector', function ($scope, $element, $attrs, $transclude, $injector) { | |
return directiveControllerFactory(this, injects, target, ddo, $injector, { | |
$scope: $scope, | |
$element: $element, | |
$attrs: $attrs, | |
$transclude: $transclude | |
}); | |
}]; | |
ngModule.directive(name, function () { | |
return ddo; | |
}); | |
function createConfigErrorMessage(message) { | |
return 'Processing "' + target.name + '" in "' + ngModule.name + '": ' + message; | |
} | |
function checkComponentConfig() { | |
if (ddo.restrict !== 'E') { | |
throw new Error(createConfigErrorMessage('@Component selectors can only be elements. ' + 'Perhaps you meant to use @Directive?')); | |
} | |
} | |
}); | |
(function extendJQLite(proto) { | |
Object.defineProperties(proto, { | |
nativeElement: { | |
get: function get() { | |
return this[0]; | |
} | |
}, | |
componentInstance: { | |
get: function get() { | |
if (this._componentInstance) return this._componentInstance; | |
var isolateScope = this.isolateScope(); | |
var name = dashToCamel(this[0].tagName.toLowerCase()); | |
this._componentInstance = isolateScope && isolateScope[name] || null; | |
return this._componentInstance; | |
} | |
}, | |
componentViewChildren: { | |
get: function get() { | |
return [].concat(babelHelpers_toConsumableArray(this.children())).map(function (child) { | |
return angular.element(child); | |
}); | |
} | |
}, | |
getLocal: { | |
value: function value(injectable) { | |
return (this.injector() || this.inheritedData('$injector')).get(getInjectableName(injectable)); | |
} | |
}, | |
query: { | |
value: function value(predicate, scope) { | |
throw new Error('Not yet implemented in ng-forward.'); | |
} | |
}, | |
queryAll: { | |
value: function value(predicate, scope) { | |
throw new Error('Not yet implemented in ng-forward.'); | |
} | |
}, | |
getDirectiveInstance: { | |
value: function value(index) { | |
throw new Error('Not yet implemented in ng-forward.'); | |
} | |
}, | |
triggerEventHandler: { | |
value: function value(eventName, eventObj) { | |
throw new Error('Not yet implemented in ng-forward.'); | |
} | |
}, | |
inject: { | |
value: function value(type) { | |
throw new Error('Not yet implemented in ng-forward.'); | |
} | |
}, | |
hasDirective: { | |
value: function value(type) { | |
throw new Error('Not yet implemented in ng-forward.'); | |
} | |
} | |
}); | |
})(angular.element.prototype); | |
exports.Module = Module; | |
exports.Metastore = Metastore; | |
exports.OpaqueToken = OpaqueToken; | |
exports.Provider = Provider; | |
exports.provide = provide; | |
exports.Component = Component; | |
exports.Directive = Directive; | |
exports.Inject = Inject; | |
exports.Injectable = Injectable; | |
exports.Pipe = Pipe; | |
exports.Providers = Providers; | |
exports.events = events$1; | |
exports.EventEmitter = EventEmitter; | |
exports.bootstrap = bootstrap; | |
exports.bundle = bundle; | |
exports.getInjectableName = getInjectableName; | |
exports.bundleStore = bundleStore; | |
exports.providerStore = providerStore; | |
exports.componentStore = componentStore; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment