0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00
verdaccio/node_modules/es6-shim/es6-shim.min.js
2014-11-25 03:08:06 +03:00

11 lines
No EOL
27 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* https://github.com/paulmillr/es6-shim
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
* and contributors, MIT License
* es6-shim: v0.21.0
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
* Details and documentation:
* https://github.com/paulmillr/es6-shim/
*/
(function(e,t){if(typeof define==="function"&&define.amd){define(t)}else if(typeof exports==="object"){module.exports=t()}else{e.returnExports=t()}})(this,function(){"use strict";var e=function(e){try{e()}catch(t){return false}return true};var t=function(e,t){try{var r=function(){e.apply(this,arguments)};if(!r.__proto__){return false}Object.setPrototypeOf(r,e);r.prototype=Object.create(e.prototype,{constructor:{value:e}});return t(r)}catch(n){return false}};var r=function(){try{Object.defineProperty({},"x",{});return true}catch(e){return false}};var n=function(){var e=false;if(String.prototype.startsWith){try{"/a/".startsWith(/a/)}catch(t){e=true}}return e};var o=new Function("return this;");var i=o();var a=i.isFinite;var u=!!Object.defineProperty&&r();var s=n();var f=Array.prototype.slice;var l=String.prototype.indexOf;var c=Object.prototype.toString;var h=Object.prototype.hasOwnProperty;var p;var v=function(e,t,r,n){if(!n&&t in e){return}if(u){Object.defineProperty(e,t,{configurable:true,enumerable:false,writable:true,value:r})}else{e[t]=r}};var y=function(e,t){Object.keys(t).forEach(function(r){var n=t[r];v(e,r,n,false)})};var d=Object.create||function(e,t){function r(){}r.prototype=e;var n=new r;if(typeof t!=="undefined"){y(n,t)}return n};var b=typeof Symbol==="function"&&Symbol.iterator||"_es6-shim iterator_";if(i.Set&&typeof(new i.Set)["@@iterator"]==="function"){b="@@iterator"}var g=function(e,t){if(!t){t=function n(){return this}}var r={};r[b]=t;y(e,r);if(!e[b]&&typeof b==="symbol"){e[b]=t}};var m=function $(e){var t=c.call(e);var r=t==="[object Arguments]";if(!r){r=t!=="[object Array]"&&e!==null&&typeof e==="object"&&typeof e.length==="number"&&e.length>=0&&c.call(e.callee)==="[object Function]"}return r};var w=function(e){if(!j.TypeIsObject(e)){throw new TypeError("bad object")}if(!e._es6construct){if(e.constructor&&j.IsCallable(e.constructor["@@create"])){e=e.constructor["@@create"](e)}y(e,{_es6construct:true})}return e};var j={CheckObjectCoercible:function(e,t){if(e==null){throw new TypeError(t||"Cannot call method on "+e)}return e},TypeIsObject:function(e){return e!=null&&Object(e)===e},ToObject:function(e,t){return Object(j.CheckObjectCoercible(e,t))},IsCallable:function(e){return typeof e==="function"&&c.call(e)==="[object Function]"},ToInt32:function(e){return e>>0},ToUint32:function(e){return e>>>0},ToInteger:function(e){var t=+e;if(Number.isNaN(t)){return 0}if(t===0||!Number.isFinite(t)){return t}return(t>0?1:-1)*Math.floor(Math.abs(t))},ToLength:function(e){var t=j.ToInteger(e);if(t<=0){return 0}if(t>Number.MAX_SAFE_INTEGER){return Number.MAX_SAFE_INTEGER}return t},SameValue:function(e,t){if(e===t){if(e===0){return 1/e===1/t}return true}return Number.isNaN(e)&&Number.isNaN(t)},SameValueZero:function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)},IsIterable:function(e){return j.TypeIsObject(e)&&(typeof e[b]!=="undefined"||m(e))},GetIterator:function(e){if(m(e)){return new p(e,"value")}var t=e[b];if(!j.IsCallable(t)){throw new TypeError("value is not an iterable")}var r=t.call(e);if(!j.TypeIsObject(r)){throw new TypeError("bad iterator")}return r},IteratorNext:function(e){var t=arguments.length>1?e.next(arguments[1]):e.next();if(!j.TypeIsObject(t)){throw new TypeError("bad iterator")}return t},Construct:function(e,t){var r;if(j.IsCallable(e["@@create"])){r=e["@@create"]()}else{r=d(e.prototype||null)}y(r,{_es6construct:true});var n=e.apply(r,t);return j.TypeIsObject(n)?n:r}};var I=function(){function e(e){var t=Math.floor(e),r=e-t;if(r<.5){return t}if(r>.5){return t+1}return t%2?t+1:t}function t(t,r,n){var o=(1<<r-1)-1,i,a,u,s,f,l,c;if(t!==t){a=(1<<r)-1;u=Math.pow(2,n-1);i=0}else if(t===Infinity||t===-Infinity){a=(1<<r)-1;u=0;i=t<0?1:0}else if(t===0){a=0;u=0;i=1/t===-Infinity?1:0}else{i=t<0;t=Math.abs(t);if(t>=Math.pow(2,1-o)){a=Math.min(Math.floor(Math.log(t)/Math.LN2),1023);u=e(t/Math.pow(2,a)*Math.pow(2,n));if(u/Math.pow(2,n)>=2){a=a+1;u=1}if(a>o){a=(1<<r)-1;u=0}else{a=a+o;u=u-Math.pow(2,n)}}else{a=0;u=e(t/Math.pow(2,1-o-n))}}f=[];for(s=n;s;s-=1){f.push(u%2?1:0);u=Math.floor(u/2)}for(s=r;s;s-=1){f.push(a%2?1:0);a=Math.floor(a/2)}f.push(i?1:0);f.reverse();l=f.join("");c=[];while(l.length){c.push(parseInt(l.slice(0,8),2));l=l.slice(8)}return c}function r(e,t,r){var n=[],o,i,a,u,s,f,l,c;for(o=e.length;o;o-=1){a=e[o-1];for(i=8;i;i-=1){n.push(a%2?1:0);a=a>>1}}n.reverse();u=n.join("");s=(1<<t-1)-1;f=parseInt(u.slice(0,1),2)?-1:1;l=parseInt(u.slice(1,1+t),2);c=parseInt(u.slice(1+t),2);if(l===(1<<t)-1){return c!==0?NaN:f*Infinity}else if(l>0){return f*Math.pow(2,l-s)*(1+c/Math.pow(2,r))}else if(c!==0){return f*Math.pow(2,-(s-1))*(c/Math.pow(2,r))}else{return f<0?-0:0}}function n(e){return r(e,11,52)}function o(e){return t(e,11,52)}function i(e){return r(e,8,23)}function a(e){return t(e,8,23)}var u={toFloat32:function(e){return i(a(e))}};if(typeof Float32Array!=="undefined"){var s=new Float32Array(1);u.toFloat32=function(e){s[0]=e;return s[0]}}return u}();y(String,{fromCodePoint:function B(e){var t=[];var r;for(var n=0,o=arguments.length;n<o;n++){r=Number(arguments[n]);if(!j.SameValue(r,j.ToInteger(r))||r<0||r>1114111){throw new RangeError("Invalid code point "+r)}if(r<65536){t.push(String.fromCharCode(r))}else{r-=65536;t.push(String.fromCharCode((r>>10)+55296));t.push(String.fromCharCode(r%1024+56320))}}return t.join("")},raw:function H(e){var t=j.ToObject(e,"bad callSite");var r=t.raw;var n=j.ToObject(r,"bad raw value");var o=n.length;var i=j.ToLength(o);if(i<=0){return""}var a=[];var u=0;var s,f,l,c;while(u<i){s=String(u);f=n[s];l=String(f);a.push(l);if(u+1>=i){break}f=u+1<arguments.length?arguments[u+1]:"";c=String(f);a.push(c);u++}return a.join("")}});if(String.fromCodePoint.length!==1){var O=String.fromCodePoint;v(String,"fromCodePoint",function(e){return O.apply(this,arguments)},true)}var _={repeat:function(){var e=function(t,r){if(r<1){return""}if(r%2){return e(t,r-1)+t}var n=e(t,r/2);return n+n};return function(t){var r=String(j.CheckObjectCoercible(this));t=j.ToInteger(t);if(t<0||t===Infinity){throw new RangeError("Invalid String#repeat value")}return e(r,t)}}(),startsWith:function(e){var t=String(j.CheckObjectCoercible(this));if(c.call(e)==="[object RegExp]"){throw new TypeError('Cannot call method "startsWith" with a regex')}e=String(e);var r=arguments.length>1?arguments[1]:void 0;var n=Math.max(j.ToInteger(r),0);return t.slice(n,n+e.length)===e},endsWith:function(e){var t=String(j.CheckObjectCoercible(this));if(c.call(e)==="[object RegExp]"){throw new TypeError('Cannot call method "endsWith" with a regex')}e=String(e);var r=t.length;var n=arguments.length>1?arguments[1]:void 0;var o=typeof n==="undefined"?r:j.ToInteger(n);var i=Math.min(Math.max(o,0),r);return t.slice(i-e.length,i)===e},includes:function J(e){var t=arguments.length>1?arguments[1]:void 0;return l.call(this,e,t)!==-1},codePointAt:function(e){var t=String(j.CheckObjectCoercible(this));var r=j.ToInteger(e);var n=t.length;if(r<0||r>=n){return}var o=t.charCodeAt(r);var i=r+1===n;if(o<55296||o>56319||i){return o}var a=t.charCodeAt(r+1);if(a<56320||a>57343){return o}return(o-55296)*1024+(a-56320)+65536}};y(String.prototype,_);var T="\x85".trim().length!==1;if(T){var N=String.prototype.trim;delete String.prototype.trim;var M=[" \n \f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003","\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028","\u2029\ufeff"].join("");var S=new RegExp("(^["+M+"]+)|(["+M+"]+$)","g");y(String.prototype,{trim:function(){if(typeof this==="undefined"||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(S,"")}})}var x=function(e){this._s=String(j.CheckObjectCoercible(e));this._i=0};x.prototype.next=function(){var e=this._s,t=this._i;if(typeof e==="undefined"||t>=e.length){this._s=void 0;return{value:void 0,done:true}}var r=e.charCodeAt(t),n,o;if(r<55296||r>56319||t+1==e.length){o=1}else{n=e.charCodeAt(t+1);o=n<56320||n>57343?1:2}this._i=t+o;return{value:e.substr(t,o),done:false}};g(x.prototype);g(String.prototype,function(){return new x(this)});if(!s){String.prototype.startsWith=_.startsWith;String.prototype.endsWith=_.endsWith}var E={from:function(e){var t=arguments.length>1?arguments[1]:void 0;var r=j.ToObject(e,"bad iterable");if(typeof t!=="undefined"&&!j.IsCallable(t)){throw new TypeError("Array.from: when provided, the second argument must be a function")}var n=arguments.length>2;var o=n?arguments[2]:void 0;var i=j.IsIterable(r);var a;var u,s,f;if(i){s=0;u=j.IsCallable(this)?Object(new this):[];var l=i?j.GetIterator(r):null;var c;do{c=j.IteratorNext(l);if(!c.done){f=c.value;if(t){u[s]=n?t.call(o,f,s):t(f,s)}else{u[s]=f}s+=1}}while(!c.done);a=s}else{a=j.ToLength(r.length);u=j.IsCallable(this)?Object(new this(a)):new Array(a);for(s=0;s<a;++s){f=r[s];if(t){u[s]=n?t.call(o,f,s):t(f,s)}else{u[s]=f}}}u.length=a;return u},of:function(){return Array.from(arguments)}};y(Array,E);var C=function(){try{return Array.from({length:-1}).length===0}catch(e){return false}};if(!C()){v(Array,"from",E.from,true)}p=function(e,t){this.i=0;this.array=e;this.kind=t};y(p.prototype,{next:function(){var e=this.i,t=this.array;if(!(this instanceof p)){throw new TypeError("Not an ArrayIterator")}if(typeof t!=="undefined"){var r=j.ToLength(t.length);for(;e<r;e++){var n=this.kind;var o;if(n==="key"){o=e}else if(n==="value"){o=t[e]}else if(n==="entry"){o=[e,t[e]]}this.i=e+1;return{value:o,done:false}}}this.array=void 0;return{value:void 0,done:true}}});g(p.prototype);var k={copyWithin:function(e,t){var r=arguments[2];var n=j.ToObject(this);var o=j.ToLength(n.length);e=j.ToInteger(e);t=j.ToInteger(t);var i=e<0?Math.max(o+e,0):Math.min(e,o);var a=t<0?Math.max(o+t,0):Math.min(t,o);r=typeof r==="undefined"?o:j.ToInteger(r);var u=r<0?Math.max(o+r,0):Math.min(r,o);var s=Math.min(u-a,o-i);var f=1;if(a<i&&i<a+s){f=-1;a+=s-1;i+=s-1}while(s>0){if(h.call(n,a)){n[i]=n[a]}else{delete n[a]}a+=f;i+=f;s-=1}return n},fill:function(e){var t=arguments.length>1?arguments[1]:void 0;var r=arguments.length>2?arguments[2]:void 0;var n=j.ToObject(this);var o=j.ToLength(n.length);t=j.ToInteger(typeof t==="undefined"?0:t);r=j.ToInteger(typeof r==="undefined"?o:r);var i=t<0?Math.max(o+t,0):Math.min(t,o);var a=r<0?o+r:r;for(var u=i;u<o&&u<a;++u){n[u]=e}return n},find:function K(e){var t=j.ToObject(this);var r=j.ToLength(t.length);if(!j.IsCallable(e)){throw new TypeError("Array#find: predicate must be a function")}var n=arguments.length>1?arguments[1]:null;for(var o=0,i;o<r;o++){i=t[o];if(n){if(e.call(n,i,o,t)){return i}}else{if(e(i,o,t)){return i}}}return},findIndex:function Q(e){var t=j.ToObject(this);var r=j.ToLength(t.length);if(!j.IsCallable(e)){throw new TypeError("Array#findIndex: predicate must be a function")}var n=arguments.length>1?arguments[1]:null;for(var o=0;o<r;o++){if(n){if(e.call(n,t[o],o,t)){return o}}else{if(e(t[o],o,t)){return o}}}return-1},keys:function(){return new p(this,"key")},values:function(){return new p(this,"value")},entries:function(){return new p(this,"entry")}};if(Array.prototype.keys&&!j.IsCallable([1].keys().next)){delete Array.prototype.keys}if(Array.prototype.entries&&!j.IsCallable([1].entries().next)){delete Array.prototype.entries}if(Array.prototype.keys&&Array.prototype.entries&&!Array.prototype.values&&Array.prototype[b]){y(Array.prototype,{values:Array.prototype[b]})}y(Array.prototype,k);g(Array.prototype,function(){return this.values()});if(Object.getPrototypeOf){g(Object.getPrototypeOf([].values()))}var P=Math.pow(2,53)-1;y(Number,{MAX_SAFE_INTEGER:P,MIN_SAFE_INTEGER:-P,EPSILON:2.220446049250313e-16,parseInt:i.parseInt,parseFloat:i.parseFloat,isFinite:function(e){return typeof e==="number"&&a(e)},isInteger:function(e){return Number.isFinite(e)&&j.ToInteger(e)===e},isSafeInteger:function(e){return Number.isInteger(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER},isNaN:function(e){return e!==e}});if(![,1].find(function(e,t){return t===0})){v(Array.prototype,"find",k.find,true)}if([,1].findIndex(function(e,t){return t===0})!==0){v(Array.prototype,"findIndex",k.findIndex,true)}if(u){y(Object,{getPropertyDescriptor:function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);var n=Object.getPrototypeOf(e);while(typeof r==="undefined"&&n!==null){r=Object.getOwnPropertyDescriptor(n,t);n=Object.getPrototypeOf(n)}return r},getPropertyNames:function(e){var t=Object.getOwnPropertyNames(e);var r=Object.getPrototypeOf(e);var n=function(e){if(t.indexOf(e)===-1){t.push(e)}};while(r!==null){Object.getOwnPropertyNames(r).forEach(n);r=Object.getPrototypeOf(r)}return t}});y(Object,{assign:function(e,t){if(!j.TypeIsObject(e)){throw new TypeError("target must be an object")}return Array.prototype.reduce.call(arguments,function(e,t){return Object.keys(Object(t)).reduce(function(e,r){e[r]=t[r];return e},e)})},is:function(e,t){return j.SameValue(e,t)},setPrototypeOf:function(e,t){var r;var n=function(e,t){if(!j.TypeIsObject(e)){throw new TypeError("cannot set prototype on a non-object")}if(!(t===null||j.TypeIsObject(t))){throw new TypeError("can only set prototype to an object or null"+t)}};var o=function(e,t){n(e,t);r.call(e,t);return e};try{r=e.getOwnPropertyDescriptor(e.prototype,t).set;r.call({},null)}catch(i){if(e.prototype!=={}[t]){return}r=function(e){this[t]=e};o.polyfill=o(o({},null),e.prototype)instanceof e}return o}(Object,"__proto__")})}if(Object.setPrototypeOf&&Object.getPrototypeOf&&Object.getPrototypeOf(Object.setPrototypeOf({},null))!==null&&Object.getPrototypeOf(Object.create(null))===null){(function(){var e=Object.create(null);var t=Object.getPrototypeOf,r=Object.setPrototypeOf;Object.getPrototypeOf=function(r){var n=t(r);return n===e?null:n};Object.setPrototypeOf=function(t,n){if(n===null){n=e}return r(t,n)};Object.setPrototypeOf.polyfill=false})()}try{Object.keys("foo")}catch(A){var R=Object.keys;Object.keys=function(e){return R(j.ToObject(e))}}var F={acosh:function(e){e=Number(e);if(Number.isNaN(e)||e<1){return NaN}if(e===1){return 0}if(e===Infinity){return e}return Math.log(e+Math.sqrt(e*e-1))},asinh:function(e){e=Number(e);if(e===0||!a(e)){return e}return e<0?-Math.asinh(-e):Math.log(e+Math.sqrt(e*e+1))},atanh:function(e){e=Number(e);if(Number.isNaN(e)||e<-1||e>1){return NaN}if(e===-1){return-Infinity}if(e===1){return Infinity}if(e===0){return e}return.5*Math.log((1+e)/(1-e))},cbrt:function(e){e=Number(e);if(e===0){return e}var t=e<0,r;if(t){e=-e}r=Math.pow(e,1/3);return t?-r:r},clz32:function(e){e=Number(e);var t=j.ToUint32(e);if(t===0){return 32}return 32-t.toString(2).length},cosh:function(e){e=Number(e);if(e===0){return 1}if(Number.isNaN(e)){return NaN}if(!a(e)){return Infinity}if(e<0){e=-e}if(e>21){return Math.exp(e)/2}return(Math.exp(e)+Math.exp(-e))/2},expm1:function(e){e=Number(e);if(e===-Infinity){return-1}if(!a(e)||e===0){return e}return Math.exp(e)-1},hypot:function(e,t){var r=false;var n=true;var o=false;var i=[];Array.prototype.every.call(arguments,function(e){var t=Number(e);if(Number.isNaN(t)){r=true}else if(t===Infinity||t===-Infinity){o=true}else if(t!==0){n=false}if(o){return false}else if(!r){i.push(Math.abs(t))}return true});if(o){return Infinity}if(r){return NaN}if(n){return 0}i.sort(function(e,t){return t-e});var a=i[0];var u=i.map(function(e){return e/a});var s=u.reduce(function(e,t){return e+=t*t},0);return a*Math.sqrt(s)},log2:function(e){return Math.log(e)*Math.LOG2E},log10:function(e){return Math.log(e)*Math.LOG10E},log1p:function(e){e=Number(e);if(e<-1||Number.isNaN(e)){return NaN}if(e===0||e===Infinity){return e}if(e===-1){return-Infinity}var t=0;var r=50;if(e<0||e>1){return Math.log(1+e)}for(var n=1;n<r;n++){if(n%2===0){t-=Math.pow(e,n)/n}else{t+=Math.pow(e,n)/n}}return t},sign:function(e){var t=+e;if(t===0){return t}if(Number.isNaN(t)){return t}return t<0?-1:1},sinh:function(e){e=Number(e);if(!a(e)||e===0){return e}return(Math.exp(e)-Math.exp(-e))/2},tanh:function(e){e=Number(e);if(Number.isNaN(e)||e===0){return e}if(e===Infinity){return 1}if(e===-Infinity){return-1}return(Math.exp(e)-Math.exp(-e))/(Math.exp(e)+Math.exp(-e))},trunc:function(e){var t=Number(e);return t<0?-Math.floor(-t):Math.floor(t)},imul:function(e,t){e=j.ToUint32(e);t=j.ToUint32(t);var r=e>>>16&65535;var n=e&65535;var o=t>>>16&65535;var i=t&65535;return n*i+(r*i+n*o<<16>>>0)|0},fround:function(e){if(e===0||e===Infinity||e===-Infinity||Number.isNaN(e)){return e}var t=Number(e);return I.toFloat32(t)}};y(Math,F);if(Math.imul(4294967295,5)!==-5){Math.imul=F.imul}var z=function(){var e,t;j.IsPromise=function(e){if(!j.TypeIsObject(e)){return false}if(!e._promiseConstructor){return false}if(typeof e._status==="undefined"){return false}return true};var r=function(e){if(!j.IsCallable(e)){throw new TypeError("bad promise constructor")}var t=this;var r=function(e,r){t.resolve=e;t.reject=r};t.promise=j.Construct(e,[r]);if(!t.promise._es6construct){throw new TypeError("bad promise constructor")}if(!(j.IsCallable(t.resolve)&&j.IsCallable(t.reject))){throw new TypeError("bad promise constructor")}};var n=i.setTimeout;var o;if(typeof window!=="undefined"&&j.IsCallable(window.postMessage)){o=function(){var e=[];var t="zero-timeout-message";var r=function(r){e.push(r);window.postMessage(t,"*")};var n=function(r){if(r.source==window&&r.data==t){r.stopPropagation();if(e.length===0){return}var n=e.shift();n()}};window.addEventListener("message",n,true);return r}}var a=function(){var e=i.Promise;return e&&e.resolve&&function(t){return e.resolve().then(t)}};var u=j.IsCallable(i.setImmediate)?i.setImmediate.bind(i):typeof process==="object"&&process.nextTick?process.nextTick:a()||(j.IsCallable(o)?o():function(e){n(e,0)});var s=function(e,t){e.forEach(function(e){u(function(){var r=e.handler;var n=e.capability;var o=n.resolve;var i=n.reject;try{var a=r(t);if(a===n.promise){throw new TypeError("self resolution")}var u=f(a,n);if(!u){o(a)}}catch(s){i(s)}})})};var f=function(e,t){if(!j.TypeIsObject(e)){return false}var r=t.resolve;var n=t.reject;try{var o=e.then;if(!j.IsCallable(o)){return false}o.call(e,r,n)}catch(i){n(i)}return true};var l=function(e,t,n){return function(o){if(o===e){return n(new TypeError("self resolution"))}var i=e._promiseConstructor;var a=new r(i);var u=f(o,a);if(u){return a.promise.then(t,n)}else{return t(o)}}};e=function(e){var t=this;t=w(t);if(!t._promiseConstructor){throw new TypeError("bad promise")}if(typeof t._status!=="undefined"){throw new TypeError("promise already initialized")}if(!j.IsCallable(e)){throw new TypeError("not a valid resolver")}t._status="unresolved";t._resolveReactions=[];t._rejectReactions=[];var r=function(e){if(t._status!=="unresolved"){return}var r=t._resolveReactions;t._result=e;t._resolveReactions=void 0;t._rejectReactions=void 0;t._status="has-resolution";s(r,e)};var n=function(e){if(t._status!=="unresolved"){return}var r=t._rejectReactions;t._result=e;t._resolveReactions=void 0;t._rejectReactions=void 0;t._status="has-rejection";s(r,e)};try{e(r,n)}catch(o){n(o)}return t};t=e.prototype;y(e,{"@@create":function(e){var r=this;var n=r.prototype||t;e=e||d(n);y(e,{_status:void 0,_result:void 0,_resolveReactions:void 0,_rejectReactions:void 0,_promiseConstructor:void 0});e._promiseConstructor=r;return e}});var c=function(e,t,r,n){var o=false;return function(i){if(o){return}o=true;t[e]=i;if(--n.count===0){var a=r.resolve;a(t)}}};e.all=function(e){var t=this;var n=new r(t);var o=n.resolve;var i=n.reject;try{if(!j.IsIterable(e)){throw new TypeError("bad iterable")}var a=j.GetIterator(e);var u=[],s={count:1};for(var f=0;;f++){var l=j.IteratorNext(a);if(l.done){break}var h=t.resolve(l.value);var p=c(f,u,n,s);s.count++;h.then(p,n.reject)}if(--s.count===0){o(u)}}catch(v){i(v)}return n.promise};e.race=function(e){var t=this;var n=new r(t);var o=n.resolve;var i=n.reject;try{if(!j.IsIterable(e)){throw new TypeError("bad iterable")}var a=j.GetIterator(e);while(true){var u=j.IteratorNext(a);if(u.done){break}var s=t.resolve(u.value);s.then(o,i)}}catch(f){i(f)}return n.promise};e.reject=function(e){var t=this;var n=new r(t);var o=n.reject;o(e);return n.promise};e.resolve=function(e){var t=this;if(j.IsPromise(e)){var n=e._promiseConstructor;if(n===t){return e}}var o=new r(t);var i=o.resolve;i(e);return o.promise};e.prototype["catch"]=function(e){return this.then(void 0,e)};e.prototype.then=function(e,t){var n=this;if(!j.IsPromise(n)){throw new TypeError("not a promise")}var o=this.constructor;var i=new r(o);if(!j.IsCallable(t)){t=function(e){throw e}}if(!j.IsCallable(e)){e=function(e){return e}}var a=l(n,e,t);var u={capability:i,handler:a};var f={capability:i,handler:t};switch(n._status){case"unresolved":n._resolveReactions.push(u);n._rejectReactions.push(f);break;case"has-resolution":s([u],n._result);break;case"has-rejection":s([f],n._result);break;default:throw new TypeError("unexpected")}return i.promise};return e}();if(i.Promise){delete i.Promise.accept;delete i.Promise.defer;delete i.Promise.prototype.chain}y(i,{Promise:z});var D=t(i.Promise,function(e){return e.resolve(42)instanceof e});var G=function(){try{i.Promise.reject(42).then(null,5).then(null,function(){});return true}catch(e){return false}}();var L=function(){try{Promise.call(3,function(){})}catch(e){return true}return false}();if(!D||!G||!L){i.Promise=z}var W=function(e){var t=Object.keys(e.reduce(function(e,t){e[t]=true;return e},{}));return e.join(":")===t.join(":")};var V=W(["z","a","bb"]);var Z=W(["z",1,"a","3",2]);if(u){var U=function Y(e){if(!V){return null}var t=typeof e;if(t==="string"){return"$"+e}else if(t==="number"){if(!Z){return"n"+e}return e}return null};var X=function et(){return Object.create?Object.create(null):{}};var q={Map:function(){var e={};function t(e,t){this.key=e;this.value=t;this.next=null;this.prev=null}t.prototype.isRemoved=function(){return this.key===e};function r(e,t){this.head=e._head;this.i=this.head;this.kind=t}r.prototype={next:function(){var e=this.i,t=this.kind,r=this.head,n;if(typeof this.i==="undefined"){return{value:void 0,done:true}}while(e.isRemoved()&&e!==r){e=e.prev}while(e.next!==r){e=e.next;if(!e.isRemoved()){if(t==="key"){n=e.key}else if(t==="value"){n=e.value}else{n=[e.key,e.value]}this.i=e;return{value:n,done:false}}}this.i=void 0;return{value:void 0,done:true}}};g(r.prototype);function n(e){var r=this;if(!j.TypeIsObject(r)){throw new TypeError("Map does not accept arguments when called as a function")}r=w(r);if(!r._es6map){throw new TypeError("bad map")}var n=new t(null,null);n.next=n.prev=n;y(r,{_head:n,_storage:X(),_size:0});if(typeof e!=="undefined"&&e!==null){var o=j.GetIterator(e);var i=r.set;if(!j.IsCallable(i)){throw new TypeError("bad map")}while(true){var a=j.IteratorNext(o);if(a.done){break}var u=a.value;if(!j.TypeIsObject(u)){throw new TypeError("expected iterable of pairs")}i.call(r,u[0],u[1])}}return r}var o=n.prototype;y(n,{"@@create":function(e){var t=this;var r=t.prototype||o;e=e||d(r);y(e,{_es6map:true});return e}});Object.defineProperty(n.prototype,"size",{configurable:true,enumerable:false,get:function(){if(typeof this._size==="undefined"){throw new TypeError("size method called on incompatible Map")}return this._size}});y(n.prototype,{get:function(e){var t=U(e);if(t!==null){var r=this._storage[t];if(r){return r.value}else{return}}var n=this._head,o=n;while((o=o.next)!==n){if(j.SameValueZero(o.key,e)){return o.value}}return},has:function(e){var t=U(e);if(t!==null){return typeof this._storage[t]!=="undefined"}var r=this._head,n=r;while((n=n.next)!==r){if(j.SameValueZero(n.key,e)){return true}}return false},set:function(e,r){var n=this._head,o=n,i;var a=U(e);if(a!==null){if(typeof this._storage[a]!=="undefined"){this._storage[a].value=r;return this}else{i=this._storage[a]=new t(e,r);o=n.prev}}while((o=o.next)!==n){if(j.SameValueZero(o.key,e)){o.value=r;return this}}i=i||new t(e,r);if(j.SameValue(-0,e)){i.key=+0}i.next=this._head;i.prev=this._head.prev;i.prev.next=i;i.next.prev=i;this._size+=1;return this},"delete":function(t){var r=this._head,n=r;var o=U(t);if(o!==null){if(typeof this._storage[o]==="undefined"){return false}n=this._storage[o].prev;delete this._storage[o]}while((n=n.next)!==r){if(j.SameValueZero(n.key,t)){n.key=n.value=e;n.prev.next=n.next;n.next.prev=n.prev;this._size-=1;return true}}return false},clear:function(){this._size=0;this._storage=X();var t=this._head,r=t,n=r.next;while((r=n)!==t){r.key=r.value=e;n=r.next;r.next=r.prev=t}t.next=t.prev=t},keys:function(){return new r(this,"key")},values:function(){return new r(this,"value")},entries:function(){return new r(this,"key+value")},forEach:function(e){var t=arguments.length>1?arguments[1]:null;var r=this.entries();for(var n=r.next();!n.done;n=r.next()){if(t){e.call(t,n.value[1],n.value[0],this)}else{e(n.value[1],n.value[0],this)}}}});g(n.prototype,function(){return this.entries()});return n}(),Set:function(){var e=function n(e){var t=this;if(!j.TypeIsObject(t)){throw new TypeError("Set does not accept arguments when called as a function")}t=w(t);if(!t._es6set){throw new TypeError("bad set")}y(t,{"[[SetData]]":null,_storage:X()});if(typeof e!=="undefined"&&e!==null){var r=j.GetIterator(e);var n=t.add;if(!j.IsCallable(n)){throw new TypeError("bad set")}while(true){var o=j.IteratorNext(r);if(o.done){break}var i=o.value;n.call(t,i)}}return t};var t=e.prototype;y(e,{"@@create":function(e){var r=this;var n=r.prototype||t;e=e||d(n);y(e,{_es6set:true});return e}});var r=function o(e){if(!e["[[SetData]]"]){var t=e["[[SetData]]"]=new q.Map;Object.keys(e._storage).forEach(function(e){if(e.charCodeAt(0)===36){e=e.slice(1)}else if(e.charAt(0)==="n"){e=+e.slice(1)}else{e=+e}t.set(e,e)});e._storage=null}};Object.defineProperty(e.prototype,"size",{configurable:true,enumerable:false,get:function(){if(typeof this._storage==="undefined"){throw new TypeError("size method called on incompatible Set")}r(this);return this["[[SetData]]"].size}});y(e.prototype,{has:function(e){var t;if(this._storage&&(t=U(e))!==null){return!!this._storage[t]}r(this);return this["[[SetData]]"].has(e)},add:function(e){var t;if(this._storage&&(t=U(e))!==null){this._storage[t]=true;return this}r(this);this["[[SetData]]"].set(e,e);return this},"delete":function(e){var t;if(this._storage&&(t=U(e))!==null){var n=h.call(this._storage,t);return delete this._storage[t]&&n}r(this);return this["[[SetData]]"]["delete"](e)},clear:function(){if(this._storage){this._storage=X();return}return this["[[SetData]]"].clear()},values:function(){r(this);return this["[[SetData]]"].values()},entries:function(){r(this);return this["[[SetData]]"].entries()},forEach:function(e){var t=arguments.length>1?arguments[1]:null;var n=this;r(n);this["[[SetData]]"].forEach(function(r,o){if(t){e.call(t,o,o,n)}else{e(o,o,n)}})}});v(e,"keys",e.values,true);g(e.prototype,function(){return this.values()});return e}()};y(i,q);if(i.Map||i.Set){if(typeof i.Map.prototype.clear!=="function"||(new i.Set).size!==0||(new i.Map).size!==0||typeof i.Map.prototype.keys!=="function"||typeof i.Set.prototype.keys!=="function"||typeof i.Map.prototype.forEach!=="function"||typeof i.Set.prototype.forEach!=="function"||e(i.Map)||e(i.Set)||!t(i.Map,function(e){var t=new e([]);t.set(42,42);return t instanceof e})){i.Map=q.Map;i.Set=q.Set}}if(i.Set.prototype.keys!==i.Set.prototype.values){v(i.Set.prototype,"keys",i.Set.prototype.values,true)}g(Object.getPrototypeOf((new i.Map).keys()));g(Object.getPrototypeOf((new i.Set).keys()))}return i});
//# sourceMappingURL=es6-shim.map