/*!

* @overview RSVP - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
* @license   Licensed under MIT license
*            See https://raw.githubusercontent.com/tildeio/rsvp.js/master/LICENSE
* @version   3.0.14
*/

(function(){function M(a,b){if(a&&“object”===typeof a&&a.constructor===this)return a;var c=new this(s,b);q(c,a);return c}function y(a,b,c){1===C.push({name:a,H:{M:b.q+b.r,L:a,detail:b.b,K:c&&b.q+c.r,label:b.u,timeStamp:N(),stack:Error(b.u).stack}})&&setTimeout(function(){for(var a,b=0;b,h.l(a.name,a.H);C.length=0},50)}function O(a,b){for(var c=0,d=a.length;c===b)return c;return-1}function G(a){var b=a.v;b||(b=a.v={});return b}function P(a,b){if(“onerror”===a)h.k(“error”, b);else if(2===arguments.length)h=b;else return h}function z(a){return“function”===typeof a}function Q(){}function s(){}function aa(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function ba(a,b,c){h.async(function(a){var e=!1,f=aa(c,b,function©{e||(e=!0,b!==c?q(a,c):p(a,c))},function(b){e||(e=!0,m(a,b))});!e&&f&&(e=!0,m(a,f))},a)}function ca(a,b){1===b.a?p(a,b.b):2===a.a?m(a,b.b):D(b,void 0,function©{b!==c?q(a,c):p(a,c)},function(b){m(a,b)})}function q(a,b){if(a===b)p(a,b);else if(“function”=== typeof b||“object”===typeof b&&null!==b)if(b.constructor===a.constructor)ca(a,b);else{var c;try{c=b.then}catch(d){E.error=d,c=E}c===E?m(a,E.error):void 0===c?p(a,b):z©?ba(a,b,c):p(a,b)}else p(a,b)}function da(a){a.d&&a.d(a.b);H(a)}function p(a,b){void 0===a.a&&(a.b=b,a.a=1,0===a.i.length?h.g&&y(“fulfilled”,a):h.async(H,a))}function m(a,b){void 0===a.a&&(a.a=2,a.b=b,h.async(da,a))}function D(a,b,c,d){var e=a.i,f=e.length;a.d=null;e=b;e=c;e=d;0===f&&a.a&&h.async(H,a)}function H(a){var b= a.i,c=a.a;h.g&&y(1===c?“fulfilled”:“rejected”,a);if(0!==b.length){for(var d,e,f=a.b,g=0;g,e=b,d?R(c,d,e,f):e(f);a.i.length=0}}function S(){this.error=null}function R(a,b,c,d){var e=z©,f,g,h,l;if(e){try{f=c(d)}catch(k){I.error=k,f=I}f===I?(l=!0,g=f.error,f=null):h=!0;if(b===f){m(b,new TypeError(“A promises callback cannot return that same promise.”));return}}else f=d,h=!0;void 0===b.a&&(e&&h?q(b,f):l?m(b,g):1===a?p(b,f):2===a&&m(b,f))}function ea(a,b){try{b(function(b){q(a, b)},function(b){m(a,b)})}catch©{m(a,c)}}function T(a,b,c){return 1===a?{state:“fulfilled”,value:c}:{state:“rejected”,reason:c}}function k(a,b,c,d){this.B=a;this.c=new a(s,d);this.A=c;this.w(b)?(this.t=b,this.e=this.length=b.length,this.s(),0===this.length?p(this.c,this.b):(this.length=this.length||0,this.p(),0===this.e&&p(this.c,this.b))):m(this.c,this.j())}function r(a,b){this.r=fa++;this.u=b;this.b=this.a=void 0;this.i=[];h.g&&y(“created”,this);if(s!==a){if(!z(a))throw new TypeError(“You must pass a resolver function as the first argument to the promise constructor”); if(!(this instanceof r))throw new TypeError(“Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.”);ea(this,a)}}function U(){this.value=void 0}function V(a,b,c){try{a.apply(b,c)}catch(d){return (w.value = d, w)}}function ga(a,b){return{then:function(c,d){return a.call(b,c,d)}}}function ha(a,b,c,d){b=V(c,d,b);b===w&&m(a,b.value);return a}function ia(a,b,c,d){return l.all(b).then(function(b){b=V(c,d,b);b===w&&m(a,b.value);return a})}function A(a, b,c){this.f(a,b,!1,c)}function t(a,b,c){this.f(a,b,!0,c)}function B(a,b,c){this.f(a,b,!1,c)}function ja(){return function(){process.N(F)}}function ka(){var a=0,b=new W(F),c=document.createTextNode(“”);b.observe(c,{characterData:!0});return function(){c.data=a=++a%2}}function la(){var a=new MessageChannel;a.port1.onmessage=F;return function(){a.port2.postMessage(0)}}function ma(){return function(){setTimeout(F,1)}}function F(){for(var a=0;a)(x),x=void 0,x=void 0;u=0}function X(){h.k.apply(h, arguments)}var Y={G:function(a){a.k=this.k;a.n=this.n;a.l=this.l;a.v=void 0;return a},k:function(a,b){var c=G(this),d;(d=c)||(d=c=[]);-1===O(d,b)&&d.push(b)},n:function(a,b){var c=G(this),d;b?(c=c,d=O(c,b),-1!==d&&c.splice(d,1)):c=[]},l:function(a,b){var c,d;if(c=G(this))for(var e=0;e,d(b)}},h={g:!1};Y.G(h);var J=Array.isArray?Array.isArray:function(a){return“[object Array]”===Object.prototype.toString.call(a)},N=Date.now||function(){return(new Date).getTime()}, n=Object.create||function(a){if(1<arguments.length)throw Error(“Second argument not supported”);if(“object”!==typeof a)throw new TypeError(“Argument must be an object”);Q.prototype=a;return new Q},C=[],E=new S,I=new S;k.prototype.w=function(a){return J(a)};k.prototype.j=function(){return Error(“Array Methods must be provided an Array”)};k.prototype.s=function(){this.b=Array(this.length)};k.prototype.p=function(){for(var a=this.length,b=this.c,c=this.t,d=0;void 0===b.a&&d,d)};k.prototype.o= function(a,b){var c=this.B;“object”===typeof a&&null!==a?a.constructor===c&&void 0!==a.a?(a.d=null,this.m(a.a,b,a.b)):this.C(c.resolve(a),b):(this.e–,this.b=this.h(1,b,a))};k.prototype.m=function(a,b,c){var d=this.c;void 0===d.a&&(this.e–,this.A&&2===a?m(d,c):this.b=this.h(a,b,c));0===this.e&&p(d,this.b)};k.prototype.h=function(a,b,c){return c};k.prototype.C=function(a,b){var c=this;D(a,void 0,function(a){c.m(1,b,a)},function(a){c.m(2,b,a)})};var na=“rsvp_”+N()+“-”,fa=0,l=r;r.J=M;r.all=function(a, b){return(new k(this,a,!0,b)).c};r.race=function(a,b){function c(a){q(e,a)}function d(a){m(e,a)}var e=new this(s,b);if(!J(a))return (m(e,new TypeError(“You must pass an array to race.”)), e);for(var f=a.length,g=0;void 0===e.a&&g),void 0,c,d);return e};r.resolve=M;r.reject=function(a,b){var c=new this(s,b);m(c,a);return c};r.prototype={constructor:r,q:na,d:function(a){h.l(“error”,a)},then:function(a,b,c){var d=this.a;if(1===d&&!a||2===d&&!b)return (h.g&&y(“chained”,this,this), this);this.d=null;var e=new this.constructor(s,c),f=this.b;h.g&&y(“chained”,this,e);if(d){var g=arguments;h.async(function(){R(d,e,g,f)})}else D(this,e,a,b);return e},“catch”:function(a,b){return this.then(null,a,b)}};var w=new U,Z=new U;A.prototype=n(k.prototype);A.prototype.f=k;A.prototype.h=T;A.prototype.j=function(){return Error(“allSettled must be called with an array”)};t.prototype=n(k.prototype);t.prototype.f=k;t.prototype.s=function(){this.b={}};t.prototype.w=function(a){return a&&“object”=== typeof a};t.prototype.j=function(){return Error(“Promise.hash must be called with an object”)};t.prototype.p=function(){var a=this.c,b=this.t,c=[],d;for(d in b)void 0===a.a&&b.hasOwnProperty(d)&&c.push({position:d,D:b});this.e=b=c.length;for(var e=0;void 0===a.a&&e,this.o(d.D,d.position)};B.prototype=n(t.prototype);B.prototype.f=k;B.prototype.h=T;B.prototype.j=function(){return Error(“hashSettled must be called with an object”)};var u=0,n=“undefined”!==typeof window?window:{},W=n.MutationObserver|| n.WebKitMutationObserver,n=“undefined”!==typeof Uint8ClampedArray&&“undefined”!==typeof importScripts&&“undefined”!==typeof MessageChannel,x=Array(1E3),$;$=“undefined”!==typeof process&&“[object process]”==={}.toString.call(process)?ja():W?ka():n?la():ma();h.async=function(a,b){x=a;x=b;u+=2;2===u&&$()};if(“undefined”!==typeof window&&“object”===typeof window.PROMISE_INSTRUMENTATION){n=window.PROMISE_INSTRUMENTATION;P(“instrument”,!0);for(var K in n)n.hasOwnProperty(K)&&X(K,n)}var L= {race:function(a,b){return l.race(a,b)},Promise:l,allSettled:function(a,b){return(new A(l,a,b)).c},hash:function(a,b){return(new t(l,a,b)).c},hashSettled:function(a,b){return(new B(l,a,b)).c},denodeify:function(a,b){function c(){for(var c=arguments.length,e=Array(c+1),f,g=!1,h=0;h<c;++h){f=arguments;if(!g){if(f&&“object”===typeof f){var k;if(f.constructor===l)k=!0;else try{k=f.then}catch(n){w.value=n,k=w}g=k}else g=!1;if(g===Z)return (c=new l(s), m(c,Z.value), c);g&&!0!==g&&(f=ga(g,f))}e=f}var v= new l(s);e=function(a,c){if(a)m(v,a);else if(void 0===b)q(v,c);else if(!0===b){for(var d=arguments,e=d.length,f=Array(e-1),g=1;g=d;q(v,f)}else if(J(b)){for(var f=arguments,d={},g=f.length,e=Array(g),h=0;h=f;for(g=0;g,d=e;q(v,d)}else q(v,c)};return g?ia(v,e,a,this):ha(v,e,a,this)}c.__proto__=a;return c},on:X,off:function(){h.n.apply(h,arguments)},map:function(a,b,c){return l.all(a,c).then(function(a){if(!z(b))throw new TypeError(“You must pass a function as map's second argument.”); for(var e=a.length,f=Array(e),g=0;g=b(a);return l.all(f,c)})},filter:function(a,b,c){return l.all(a,c).then(function(a){if(!z(b))throw new TypeError(“You must pass a function as filter's second argument.”);for(var e=a.length,f=Array(e),g=0;g=b(a);return l.all(f,c).then(function(b){for(var c=Array(e),f=0,g=0;g&&(c=a,f++);c.length=f;return c})})},resolve:function(a,b){return l.resolve(a,b)},reject:function(a,b){return l.reject(a,b)},all:function(a,b){return l.all(a, b)},rethrow:function(a){setTimeout(function(){throw a;});throw a;},defer:function(a){var b={};b.c=new l(function(a,d){b.resolve=a;b.reject=d},a);return b},EventTarget:Y,configure:P,async:function(a,b){h.async(a,b)}};“function”===typeof define&&define.I?define(function(){return L}):“undefined”!==typeof module&&module.F?module.F=L:“undefined”!==typeof this&&(this.RSVP=L)}).call(this);