From c5fd724e2f7be4e20be597f9cc73801375a601cc Mon Sep 17 00:00:00 2001
From: Chung Leong
Date: Wed, 30 Jan 2019 21:57:52 +0100
Subject: [PATCH] Reworked code to allow use of basePath other than / (issue
#20). Throwing error properly in JSON retrieval code (issue #44).
---
cordova/sample-app/www/front-end.js | 16 ++--
cordova/sample-app/www/index.html | 2 +
cordova/sample-app/www/styles.css | 130 +++++++++++++++++++++-------
server/client/front-end.js | 4 +-
server/index.js | 29 ++++---
server/json-retriever.js | 6 ++
server/page-renderer.js | 3 +-
server/www/front-end.js | 4 +-
server/www/report.html | 2 +-
src/index.html | 2 +-
src/main.js | 20 ++---
webpack.config.js | 74 ++++++++--------
12 files changed, 187 insertions(+), 105 deletions(-)
diff --git a/cordova/sample-app/www/front-end.js b/cordova/sample-app/www/front-end.js
index 5629883..37ff9f4 100644
--- a/cordova/sample-app/www/front-end.js
+++ b/cordova/sample-app/www/front-end.js
@@ -1,4 +1,4 @@
-!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="./main.js")}({"../../relaks-route-manager/index.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){k.call(this),this.active=!1,this.preloaded=!1,this.options={},this.routes={},this.rewrites=[],this.name="",this.params="",this.context={},this.route=null,this.url="",this.path="",this.query={},this.search="",this.hash="",this.history=[],this.startTime=h(),this.queue=[];for(var t in x)e&&void 0!==e[t]?this.options[t]=e[t]:this.options[t]=x[t];if(e){if(e.basePath){var n={from:function(t,n){var r=c(e.basePath,t.path);r&&(t.path=r)},to:function(t,n){t.path=e.basePath+t.path}};this.addRewrites([n])}e.routes&&this.addRoutes(e.routes),e.rewrites&&this.addRewrites(e.rewrites)}this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this)}function i(e,t,n){if(!e)return null;var r=e.replace(S,function(e){var r,o=e.substr(2,e.length-3),i=t?t[o]:String;return i===Number||i===Boolean?r="[\\d\\.]*":"object"===(void 0===i?"undefined":(0,L.default)(i))&&(r=i.pattern),r||(r=n?"[^/]*":".*"),"("+r+")"});if(n){r+="/"===r.charAt(r-1)?"?":"/?",r="^"+r+"$"}var o=E[r];return o||(o=E[r]=new RegExp(r)),o}function s(e){var t=e.match(S),n=[];if(t)for(var r=0;r=0;r--){var o=this.rewrites[r];if(o.to&&!1===o.to(t,n))break}},D.load=function(e){try{var t,n=this,r=e?this.routes[e.name]:null;if(!r)throw new g(404,"No route");return r.load&&(t=r.load(e)),b.default.resolve(t).catch(function(e){throw n.options.reloadFaultyScript&&/Loading chunk/i.test(e.message)&&"object"===("undefined"==typeof performance?"undefined":(0,L.default)(performance))&&"object"===(0,L.default)(performance.navigation)&&1!==performance.navigation.type&&navigator.onLine&&(console.log("Reloading page..."),location.reload(!0)),e})}catch(e){return b.default.reject(e)}},D.preload=function(){var e=[];for(var t in this.routes){var n=this.routes[t];if(n&&n.load){var r={params:{},context:{}};e.push(n.load(r))}}return b.default.all(e)},D.getLocationURL=function(e){var t=window.location;if(e!==t){if(e.host!==t.host)throw new g(400,"Host does not match");if(e.protocol!==t.protocol)throw new g(400,"Protocol does not match");if(this.options.useHashFallback){if(e.pathname!==t.pathname)throw new g(400,"Path does not match");if(e.search!==t.search)throw new g(400,"Query string does not match")}}if(this.options.useHashFallback){return e.hash.substr(1)||"/"}return e.pathname+e.search+e.hash},D.updateHistory=function(e,t,n){if(e.time>=this.startTime){if(!t){for(var r=-1,o=null,i=0;i0?this.history[this.history.length-1]=e:this.history.push(e),e},D.setLocationURL=function(e,t,n){if(this.options.trackLocation){this.getLocationURL(location)!==e&&(this.options.useHashFallback&&(e="#"+e),n?window.history.replaceState(t,"",e):window.history.pushState(t,"",e))}},D.handleLinkClick=function(e){if(0===e.button&&!e.defaultPrevented){var t=_(e.target);if(t&&!t.target&&!t.download)try{var n=this.getLocationURL(t);if(n){var r=this.match(n);if(r){var o=h();e.preventDefault(),e.stopPropagation(),this.apply(r,o,!0,!1)}}}catch(e){}}},D.handlePopState=function(e){var t=e.state?e.state.time:h(),n=this.getLocationURL(window.location),r=this.match(n),o=this.apply(r,t,!1,!1),i=this.backResolve,s=this.backReject;i&&(this.backResolve=void 0,this.backReject=void 0,o.then(i,s))};var S=/\$\{\w+\}/g,E={},P=0;y.prototype=(0,j.default)(T.prototype),g.prototype=(0,j.default)(Error.prototype),e.exports=o,e.exports.RelaksRouteManager=o,e.exports.RelaksRouteManagerEvent=y,e.exports.RelaksRouteManagerError=g},"../../relaks-wordpress-data-source/index.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){I.call(this),this.active=!1,this.activationPromise=null,this.queries=[],this.authentications=[],this.authorizations=[],this.options={};for(var t in q)e&&void 0!==e[t]?this.options[t]=e[t]:this.options[t]=q[t]}function i(e,t,n,r){var o=e.options?e.options[t]:null;if(o||(o=r),"string"==typeof o)switch(o){case"refresh":o=a;break;case"ignore":o=s;break;default:switch(e.type+"::"+o){case"object::replace":o=u;break;case"list::replace":case"page::replace":o=l;break;case"list::unshift":case"page::unshift":o=d;break;case"list::push":case"page::push":o=c;break;case"object::remove":o=m;break;case"list::remove":case"page::remove":o=f;break;default:o=a}}if("object"===e.type){var i=!0;if(e.object&&n)try{i=o(e.object,n)}catch(e){console.error(e)}if(!1===i)return!1;if(i instanceof Object){var _=i;e.object=_,e.promise=H.default.resolve(_)}else e.expired=!0;return!0}if("page"===e.type||"list"===e.type){var i=!0;if(e.objects&&n.every(Boolean)){T(n);try{i=o(e.objects,n)}catch(e){console.error(e)}}if(!1===i)return!1;if(i instanceof Array){var h=i;if("list"===e.type){var p=h.length-e.objects.length;h.total=e.objects.total+p,"list"===e.type&&(h.more=e.objects.more)}e.objects=h,e.promise=H.default.resolve(h)}else e.expired=!0;return!0}}function s(){return!1}function a(){return!0}function u(e,t){return!h(t,e)&&t}function l(e,t){var n=!1,r=e.map(function(e){var r=L(t,e);return r&&!h(r,e)?(n=!0,r):e});return!!n&&r}function d(e,t){var n=e.slice();return t.forEach(function(e){n.unshift(e)}),n}function c(e,t){var n=e.slice();return t.forEach(function(e){n.push(e)}),n}function m(e,t){return!0}function f(e,t){var n=!1,r=e.filter(function(e){return-1===w(t,e)||(n=!0,!1)});return!!n&&r}function _(e,t){for(var n in t)if(!h(e[n],t[n]))return!1;return!0}function h(e,t){if(e!==t){if(!(e instanceof Object&&t instanceof Object))return!1;if(e.constructor!==t.constructor)return!1;if(e instanceof Array){if(e.length!==t.length)return!1;for(var n=0;n1?M(e,"page",t):e}function M(e,t,n){var r,o=e.indexOf("?"),i=-1===o?"?":"&";return n instanceof Array&&1===n.length&&(n=n[0]),r=n instanceof Array?n.map(function(e){return t+"[]="+encodeURI(e)}).join("&"):t+"="+encodeURI(n),e+i+r}function j(e){var t=e.lastIndexOf("?");return-1!==t&&(e=e.substr(0,t)),e}function w(e,t){for(var n=t.id,r=0;r0)return r}}function T(e){e.sort(function(e,t){var n=e.id,r=t.id;return nr?1:0})}function Y(e,t){return e?(t=t.filter(function(t){return-1===w(e,t)}),e.concat(t)):t}function x(e,t){for(var n=[],r=!1,o=0;o=0;r--){var o=e[r],i=w(t,o);if(-1!==i){n=i+1;break}}var s=t.filter(function(t,r){if(r>=n)return-1===w(e,t)});return e.concat(s)}function S(e,t,n){var r=e?e.minimum:void 0;if("string"==typeof r&&(r=r.trim(),"%"===r.charAt(r.length-1))){var o=parseInt(r);r=Math.ceil(t*(o/100))}return r<0&&(r=t+r)<1&&(r=1),r||n}function E(e){var t=new Date;return e&&(t=new Date(t.getTime()+e)),t.toISOString()}function P(e,t,n){W.call(this,e,t,n)}function C(e,t){this.status=e,this.message=t}var O=n("../node_modules/babel-runtime/core-js/promise.js"),H=r(O),A=n("../node_modules/babel-runtime/helpers/typeof.js"),R=r(A),N=n("../node_modules/babel-runtime/core-js/object/create.js"),F=r(N),I=n("../node_modules/relaks-event-emitter/index.js"),W=I.GenericEvent,q={baseURL:"",permalinks:!0,refreshInterval:0,fetchFunc:null},U=o.prototype=(0,F.default)(I.prototype);U.activate=function(){if(!this.active){if(this.active=!0,this.activationPromise){var e=this.activationPromise.resolve;this.activationPromise=null,e()}this.startExpirationCheck(),this.checkExpiration()}},U.deactivate=function(){this.active&&(this.stopExpirationCheck(),this.active=!1)},U.resolveURL=function(e){if("string"!=typeof e)return e;var t=this.options.baseURL;if(t&&!/^https?:/.test(e)){/^https?:/.test(t)||"object"===("undefined"==typeof location?"undefined":(0,R.default)(location))&&(t=location.protocol+"//"+location.host+t);e=this.options.permalinks?p(t)+y(e):t+"?rest_route="+encodeURI(e)}return g(e)},U.resolveURLs=function(e){var t=this;return e.map(function(e){return t.resolveURL(e)})},U.notifyChanges=function(e){return!1!==e&&(this.triggerEvent(new P("change",this)),!0)},U.fetchOne=function(e,t,n){if(t)return this.fetchMultiple(e,[t],n).then(function(e){return e[0]||null});var r=this,o=this.resolveURL(e),i={type:"object",url:o,options:n||{}},s=this.findQuery(i);if(!s){var a=E();s=i,s.promise=this.get(o).then(function(e){var t=e;return s.object=t,s.time=a,r.processFreshObject(t,o,s,!0),t}),this.queries.unshift(s)}return s.promise.then(function(e){return s.expired&&r.refreshOne(s),e})},U.fetchPage=function(e,t,n){var r=this,o=this.resolveURL(e),i={type:"page",url:o,page:t,options:n||{}},s=this.findQuery(i);if(!s){var a=b(o,t),u=E();s=i,s.promise=this.get(a).then(function(e){var t=e;return s.objects=t,s.time=u,r.processFreshObjects(t,a,s,!0),t}),this.queries.push(s)}return s.promise.then(function(e){return s.expired&&r.refreshPage(s),e})},U.fetchList=function(e,t){var n=this,r=this.resolveURL(e),o={type:"list",url:r,options:t||{}},i=this.findQuery(o);return i||(i=o,i.promise=this.fetchNextPage(i,!0),this.queries.push(i)),i.promise.then(function(e){return i.expired&&n.refreshList(i),e})},U.fetchNoMore=function(e){return e.promise},U.fetchNextPage=function(e,t){if(e.nextPromise)return e.nextPromise;var n=this,r=E(),o=b(e.url,e.nextPage),i=this.get(o).then(function(s){var a=s.total,u=s,l=Y(e.objects,u);if(e.objects=l,e.promise=i,e.nextPromise=null,e.nextPage=(e.nextPage||1)+1,t&&(e.time=r),n.processFreshObjects(u,o,e,t),l.length0){l.more=n.fetchNextPage.bind(n,e,!1),l.total=a;var d=S(e.options,a,NaN);if(l.length0&&!this.expirationCheckInterval){var t=this;this.expirationCheckInterval=setInterval(function(){t.checkExpiration()},Math.min(100,e/10))}},U.stopExpirationCheck=function(){this.expirationCheckInterval&&(clearInterval(this.expirationCheckInterval),this.expirationCheckInterval=0)},U.checkExpiration=function(){var e=Number(this.options.refreshInterval);if(e){var t=E(-e);this.invalidate(t)}},U.get=function(e){var t={method:"GET"};return this.request(e,t)},U.request=function(e,t){return t||(t={}),this.fetch(e,t).then(function(e){if(e.status<400){if(204==e.status)return null;var t=parseInt(e.headers.get("X-WP-Total"));return e.json().then(function(e){return e instanceof Array&&t===t&&(e.total=t),e})}throw new C(e.status,e.statusText)})},U.fetch=function(e,t){var n=this;return this.waitForActivation().then(function(){var r=n.options.fetchFunc;return r||(r=fetch),r(e,t).catch(function(r){if(n.active)throw r;return n.fetch(e,t)})})},U.waitForActivation=function(){if(this.active)return H.default.resolve();if(!this.activationPromise){var e,t;this.activationPromise=new H.default(function(n,r){e=n,t=r}),this.activationPromise.resolve=e,this.activationPromise.reject=t}return this.activationPromise},P.prototype=(0,F.default)(W.prototype),C.prototype=(0,F.default)(Error.prototype),e.exports=o,e.exports.RelaksWordpressDataSource=o,e.exports.RelaksWordpressDataSourceEvent=P,e.exports.RelaksWordpressDataSourceError=C},"../node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss":function(e,t){},"../node_modules/@fortawesome/fontawesome-free/scss/regular.scss":function(e,t){},"../node_modules/@fortawesome/fontawesome-free/scss/solid.scss":function(e,t){},"../node_modules/babel-runtime/core-js/get-iterator.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/get-iterator.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/assign.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/assign.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/create.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/create.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/define-property.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/define-property.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/get-prototype-of.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/get-prototype-of.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/set-prototype-of.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/set-prototype-of.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/promise.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/promise.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/symbol.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/symbol/index.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/symbol/iterator.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/symbol/iterator.js"),__esModule:!0}},"../node_modules/babel-runtime/helpers/asyncToGenerator.js":function(e,t,n){"use strict";t.__esModule=!0;var r=n("../node_modules/babel-runtime/core-js/promise.js"),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){return function(){var t=e.apply(this,arguments);return new o.default(function(e,n){function r(i,s){try{var a=t[i](s),u=a.value}catch(e){return void n(e)}if(!a.done)return o.default.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}return r("next")})}}},"../node_modules/babel-runtime/helpers/classCallCheck.js":function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},"../node_modules/babel-runtime/helpers/createClass.js":function(e,t,n){"use strict";t.__esModule=!0;var r=n("../node_modules/babel-runtime/core-js/object/define-property.js"),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function o(e){var t=r(e),n=t[0],o=t[1];return 3*(n+o)/4-o}function i(e,t,n){return 3*(t+n)/4-n}function s(e){for(var t,n=r(e),o=n[0],s=n[1],a=new m(i(e,o,s)),u=0,l=s>0?o-4:o,d=0;d>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=c[e.charCodeAt(d)]<<2|c[e.charCodeAt(d+1)]>>4,a[u++]=255&t),1===s&&(t=c[e.charCodeAt(d)]<<10|c[e.charCodeAt(d+1)]<<4|c[e.charCodeAt(d+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function a(e){return d[e>>18&63]+d[e>>12&63]+d[e>>6&63]+d[63&e]}function u(e,t,n){for(var r,o=[],i=t;is?s:i+16383));return 1===r?(t=e[n-1],o.push(d[t>>2]+d[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(d[t>>10]+d[t>>4&63]+d[t<<2&63]+"=")),o.join("")}t.byteLength=o,t.toByteArray=s,t.fromByteArray=l;for(var d=[],c=[],m="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0,h=f.length;_=0;r--){var o=this.rewrites[r];if(o.to&&!1===o.to(t,n))break}},x.load=function(e){try{var t,n=this,r=e?this.routes[e.name]:null;if(!r)throw new y(404,"No route");return r.load&&(t=r.load(e)),v.default.resolve(t).catch(function(e){throw n.options.reloadFaultyScript&&/Loading chunk/i.test(e.message)&&"object"===("undefined"==typeof performance?"undefined":(0,w.default)(performance))&&"object"===(0,w.default)(performance.navigation)&&1!==performance.navigation.type&&navigator.onLine&&(console.log("Reloading page..."),location.reload(!0)),e})}catch(e){return v.default.reject(e)}},x.preload=function(){var e=[];for(var t in this.routes){var n=this.routes[t];if(n&&n.load){var r={params:{},context:{}};e.push(n.load(r))}}return v.default.all(e)},x.getLocationURL=function(e){var t=window.location;if(e!==t){if(e.host!==t.host)throw new y(400,"Host does not match");if(e.protocol!==t.protocol)throw new y(400,"Protocol does not match");if(this.options.useHashFallback){if(e.pathname!==t.pathname)throw new y(400,"Path does not match");if(e.search!==t.search)throw new y(400,"Query string does not match")}}if(this.options.useHashFallback){return e.hash.substr(1)||"/"}return e.pathname+e.search+e.hash},x.updateHistory=function(e,t,n){if(e.time>=this.startTime){if(!t){for(var r=-1,o=null,s=0;s0?this.history[this.history.length-1]=e:this.history.push(e),e},x.setLocationURL=function(e,t,n){if(this.options.trackLocation){this.getLocationURL(location)!==e&&(this.options.useHashFallback&&(e="#"+e),n?window.history.replaceState(t,"",e):window.history.pushState(t,"",e))}},x.handleLinkClick=function(e){if(0===e.button&&!e.defaultPrevented){var t=m(e.target);if(t&&!t.target&&!t.download)try{var n=this.getLocationURL(t);if(n){var r=this.match(n);if(r){var o=_();e.preventDefault(),e.stopPropagation(),this.apply(r,o,!0,!1)}}}catch(e){}}},x.handlePopState=function(e){var t=e.state?e.state.time:_(),n=this.getLocationURL(window.location),r=this.match(n),o=this.apply(r,t,!1,!1),s=this.backResolve,i=this.backReject;s&&(this.backResolve=void 0,this.backReject=void 0,o.then(s,i))};var D=/\$\{\w+\}/g,S={},E=0;p.prototype=(0,M.default)(L.prototype),y.prototype=(0,M.default)(Error.prototype),e.exports=o,e.exports.RelaksRouteManager=o,e.exports.RelaksRouteManagerEvent=p,e.exports.RelaksRouteManagerError=y},"../../relaks-wordpress-data-source/index.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){I.call(this),this.active=!1,this.activationPromise=null,this.queries=[],this.authentications=[],this.authorizations=[],this.options={};for(var t in U)e&&void 0!==e[t]?this.options[t]=e[t]:this.options[t]=U[t]}function s(e,t,n,r){var o=e.options?e.options[t]:null;if(o||(o=r),"string"==typeof o)switch(o){case"refresh":o=a;break;case"ignore":o=i;break;default:switch(e.type+"::"+o){case"object::replace":o=u;break;case"list::replace":case"page::replace":o=l;break;case"list::unshift":case"page::unshift":o=d;break;case"list::push":case"page::push":o=c;break;case"object::remove":o=f;break;case"list::remove":case"page::remove":o=m;break;default:o=a}}if("object"===e.type){var s=!0;if(e.object&&n)try{s=o(e.object,n)}catch(e){console.error(e)}if(!1===s)return!1;if(s instanceof Object){var _=s;e.object=_,e.promise=H.default.resolve(_)}else e.expired=!0;return!0}if("page"===e.type||"list"===e.type){var s=!0;if(e.objects&&n.every(Boolean)){T(n);try{s=o(e.objects,n)}catch(e){console.error(e)}}if(!1===s)return!1;if(s instanceof Array){var h=s;if("list"===e.type){var p=h.length-e.objects.length;h.total=e.objects.total+p,"list"===e.type&&(h.more=e.objects.more)}e.objects=h,e.promise=H.default.resolve(h)}else e.expired=!0;return!0}}function i(){return!1}function a(){return!0}function u(e,t){return!h(t,e)&&t}function l(e,t){var n=!1,r=e.map(function(e){var r=k(t,e);return r&&!h(r,e)?(n=!0,r):e});return!!n&&r}function d(e,t){var n=e.slice();return t.forEach(function(e){n.unshift(e)}),n}function c(e,t){var n=e.slice();return t.forEach(function(e){n.push(e)}),n}function f(e,t){return!0}function m(e,t){var n=!1,r=e.filter(function(e){return-1===w(t,e)||(n=!0,!1)});return!!n&&r}function _(e,t){for(var n in t)if(!h(e[n],t[n]))return!1;return!0}function h(e,t){if(e!==t){if(!(e instanceof Object&&t instanceof Object))return!1;if(e.constructor!==t.constructor)return!1;if(e instanceof Array){if(e.length!==t.length)return!1;for(var n=0;n=1?M(e,"page",t):e}function M(e,t,n){var r,o=e.indexOf("?"),s=-1===o?"?":"&";return n instanceof Array&&1===n.length&&(n=n[0]),r=n instanceof Array?n.map(function(e){return t+"[]="+encodeURI(e)}).join("&"):t+"="+encodeURI(n),e+s+r}function j(e){var t=e.lastIndexOf("?");return-1!==t&&(e=e.substr(0,t)),e}function w(e,t){for(var n=t.id,r=0;r0)return r}}function T(e){e.sort(function(e,t){var n=e.id,r=t.id;return nr?1:0})}function Y(e,t){return e?(t=t.filter(function(t){return-1===w(e,t)}),e.concat(t)):t}function x(e,t){for(var n=[],r=!1,o=0;o=0;r--){var o=e[r],s=w(t,o);if(-1!==s){n=s+1;break}}var i=t.filter(function(t,r){if(r>=n)return-1===w(e,t)});return e.concat(i)}function S(e,t,n){var r=e?e.minimum:void 0;if("string"==typeof r&&(r=r.trim(),"%"===r.charAt(r.length-1))){var o=parseInt(r);r=Math.ceil(t*(o/100))}return r<0&&(r=t+r)<1&&(r=1),r||n}function E(e){var t=new Date;return e&&(t=new Date(t.getTime()+e)),t.toISOString()}function P(e,t,n){W.call(this,e,t,n)}function C(e,t){this.status=e,this.message=t}var O=n("../node_modules/babel-runtime/core-js/promise.js"),H=r(O),A=n("../node_modules/babel-runtime/helpers/typeof.js"),R=r(A),N=n("../node_modules/babel-runtime/core-js/object/create.js"),F=r(N),I=n("../node_modules/relaks-event-emitter/index.js"),W=I.GenericEvent,U={baseURL:"",permalinks:!0,refreshInterval:0,fetchFunc:null},q=o.prototype=(0,F.default)(I.prototype);q.activate=function(){if(!this.active){if(this.active=!0,this.activationPromise){var e=this.activationPromise.resolve;this.activationPromise=null,e()}this.startExpirationCheck(),this.checkExpiration()}},q.deactivate=function(){this.active&&(this.stopExpirationCheck(),this.active=!1)},q.resolveURL=function(e){if("string"!=typeof e)return e;var t=this.options.baseURL;if(t&&!/^https?:/.test(e)){/^https?:/.test(t)||"object"===("undefined"==typeof location?"undefined":(0,R.default)(location))&&(t=location.protocol+"//"+location.host+t);e=this.options.permalinks?p(t)+y(e):t+"?rest_route="+encodeURI(e)}return g(e)},q.resolveURLs=function(e){var t=this;return e.map(function(e){return t.resolveURL(e)})},q.notifyChanges=function(e){return!1!==e&&(this.triggerEvent(new P("change",this)),!0)},q.fetchOne=function(e,t,n){if(t)return this.fetchMultiple(e,[t],n).then(function(e){return e[0]||null});var r=this,o=this.resolveURL(e),s={type:"object",url:o,options:n||{}},i=this.findQuery(s);if(!i){var a=E();i=s,i.promise=this.get(o).then(function(e){var t=e;return i.object=t,i.time=a,r.processFreshObject(t,o,i,!0),t}),this.queries.unshift(i)}return i.promise.then(function(e){return i.expired&&r.refreshOne(i),e})},q.fetchPage=function(e,t,n){var r=this,o=this.resolveURL(e),s={type:"page",url:o,page:t,options:n||{}},i=this.findQuery(s);if(!i){var a=b(o,t),u=E();i=s,i.promise=this.get(a).then(function(e){var t=e;return i.objects=t,i.time=u,r.processFreshObjects(t,a,i,!0),t}),this.queries.push(i)}return i.promise.then(function(e){return i.expired&&r.refreshPage(i),e})},q.fetchList=function(e,t){var n=this,r=this.resolveURL(e),o={type:"list",url:r,options:t||{}},s=this.findQuery(o);return s||(s=o,s.promise=this.fetchNextPage(s,!0),this.queries.push(s)),s.promise.then(function(e){return s.expired&&n.refreshList(s),e})},q.fetchNoMore=function(e){return e.promise},q.fetchNextPage=function(e,t){if(e.nextPromise)return e.nextPromise;var n=this,r=E(),o=b(e.url,e.nextPage),s=this.get(o).then(function(i){var a=i.total,u=i,l=Y(e.objects,u);if(e.objects=l,e.promise=s,e.nextPromise=null,e.nextPage=(e.nextPage||1)+1,t&&(e.time=r),n.processFreshObjects(u,o,e,t),l.length0){l.more=n.fetchNextPage.bind(n,e,!1),l.total=a;var d=S(e.options,a,NaN);if(l.length0&&!this.expirationCheckInterval){var t=this;this.expirationCheckInterval=setInterval(function(){t.checkExpiration()},Math.min(100,e/10))}},q.stopExpirationCheck=function(){this.expirationCheckInterval&&(clearInterval(this.expirationCheckInterval),this.expirationCheckInterval=0)},q.checkExpiration=function(){var e=Number(this.options.refreshInterval);if(e){var t=E(-e);this.invalidate(t)}},q.get=function(e){var t={method:"GET"};return this.request(e,t)},q.request=function(e,t){return t||(t={}),this.fetch(e,t).then(function(e){if(e.status<400){if(204==e.status)return null;var t=parseInt(e.headers.get("X-WP-Total"));return e.json().then(function(e){return e instanceof Array&&t===t&&(e.total=t),e})}throw new C(e.status,e.statusText)})},q.fetch=function(e,t){var n=this;return this.waitForActivation().then(function(){var r=n.options.fetchFunc;return r||(r=fetch),r(e,t).catch(function(r){if(n.active)throw r;return n.fetch(e,t)})})},q.waitForActivation=function(){if(this.active)return H.default.resolve();if(!this.activationPromise){var e,t;this.activationPromise=new H.default(function(n,r){e=n,t=r}),this.activationPromise.resolve=e,this.activationPromise.reject=t}return this.activationPromise},P.prototype=(0,F.default)(W.prototype),C.prototype=(0,F.default)(Error.prototype),e.exports=o,e.exports.RelaksWordpressDataSource=o,e.exports.RelaksWordpressDataSourceEvent=P,e.exports.RelaksWordpressDataSourceError=C},"../node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss":function(e,t){},"../node_modules/@fortawesome/fontawesome-free/scss/regular.scss":function(e,t){},"../node_modules/@fortawesome/fontawesome-free/scss/solid.scss":function(e,t){},"../node_modules/babel-runtime/core-js/get-iterator.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/get-iterator.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/assign.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/assign.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/create.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/create.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/define-property.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/define-property.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/get-prototype-of.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/get-prototype-of.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/object/set-prototype-of.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/object/set-prototype-of.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/promise.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/promise.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/symbol.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/symbol/index.js"),__esModule:!0}},"../node_modules/babel-runtime/core-js/symbol/iterator.js":function(e,t,n){e.exports={default:n("../node_modules/core-js/library/fn/symbol/iterator.js"),__esModule:!0}},"../node_modules/babel-runtime/helpers/asyncToGenerator.js":function(e,t,n){"use strict";t.__esModule=!0;var r=n("../node_modules/babel-runtime/core-js/promise.js"),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){return function(){var t=e.apply(this,arguments);return new o.default(function(e,n){function r(s,i){try{var a=t[s](i),u=a.value}catch(e){return void n(e)}if(!a.done)return o.default.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}return r("next")})}}},"../node_modules/babel-runtime/helpers/classCallCheck.js":function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},"../node_modules/babel-runtime/helpers/createClass.js":function(e,t,n){"use strict";t.__esModule=!0;var r=n("../node_modules/babel-runtime/core-js/object/define-property.js"),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function o(e){var t=r(e),n=t[0],o=t[1];return 3*(n+o)/4-o}function s(e,t,n){return 3*(t+n)/4-n}function i(e){for(var t,n=r(e),o=n[0],i=n[1],a=new f(s(e,o,i)),u=0,l=i>0?o-4:o,d=0;d>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===i&&(t=c[e.charCodeAt(d)]<<2|c[e.charCodeAt(d+1)]>>4,a[u++]=255&t),1===i&&(t=c[e.charCodeAt(d)]<<10|c[e.charCodeAt(d+1)]<<4|c[e.charCodeAt(d+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function a(e){return d[e>>18&63]+d[e>>12&63]+d[e>>6&63]+d[63&e]}function u(e,t,n){for(var r,o=[],s=t;si?i:s+16383));return 1===r?(t=e[n-1],o.push(d[t>>2]+d[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(d[t>>10]+d[t>>4&63]+d[t<<2&63]+"=")),o.join("")}t.byteLength=o,t.toByteArray=i,t.fromByteArray=l;for(var d=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0,h=m.length;_0;)l(e)}function l(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var n=e.shift(),r=e.shift();t.call(n,r)}}var d;try{throw new Error}catch(e){d=e}var c=e("./schedule"),m=e("./queue"),f=e("./util");o.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},o.prototype.hasCustomScheduler=function(){return this._customScheduler},o.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},o.prototype.disableTrampolineIfNecessary=function(){f.hasDevTools&&(this._trampolineEnabled=!1)},o.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},o.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},o.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},f.hasDevTools?(o.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?i.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},o.prototype.invoke=function(e,t,n){this._trampolineEnabled?s.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},o.prototype.settlePromises=function(e){this._trampolineEnabled?a.call(this,e):this._schedule(function(){e._settlePromises()})}):(o.prototype.invokeLater=i,o.prototype.invoke=s,o.prototype.settlePromises=a),o.prototype._drainQueues=function(){u(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,u(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},n.exports=o,n.exports.firstLineError=d},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){var o=!1,i=function(e,t){this._reject(t)},s=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(i,i,null,this,e)},a=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},u=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(i){o||(o=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var l=n(i),d=new e(t);d._propagateFrom(this,1);var c=this._target();if(d._setBoundTo(l),l instanceof e){var m={promiseRejectionQueued:!1,promise:d,target:c,bindingPromise:l};c._then(t,s,void 0,d,m),l._then(a,u,void 0,d,m),d._setOnCancel(l)}else d._resolveCallback(c);return d},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){"use strict";function r(){try{Promise===i&&(Promise=o)}catch(e){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=e("./promise")();i.noConflict=r,t.exports=i},{"./promise":22}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}t.exports=function(t){function n(e,n){var r;if(null!=e&&(r=e[n]),"function"!=typeof r){var o="Object "+a.classString(e)+" has no method '"+a.toString(n)+"'";throw new t.TypeError(o)}return r}function r(e){return n(e,this.pop()).apply(e,this)}function o(e){return e[this]}function i(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var s,a=e("./util"),u=a.canEvaluate;a.isIdentifier;t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(r,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t,n="number"==typeof e;if(n)t=i;else if(u){var r=s(e);t=null!==r?r:o}else t=o;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){"use strict";t.exports=function(t,n,r,o){var i=e("./util"),s=i.tryCatch,a=i.errorObj,u=t._async;t.prototype.break=t.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(i.isArray(e))for(var n=0;n=0)return i[e]}var o=!1,i=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=i.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=n,t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var n=e.prototype._pushContext,i=e.prototype._popContext,s=e._peekContext,a=e.prototype._peekContext,u=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=i,e._peekContext=s,e.prototype._peekContext=a,e.prototype._promiseCreated=u,o=!1},o=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=r,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}},{}],9:[function(e,n,r){"use strict";n.exports=function(n,r){function o(e,t){return{promise:t}}function i(){return!1}function s(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+I.toString(e));r._attachCancellationCallback(e)})}catch(e){return e}}function a(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?I.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function u(){return this._onCancelField}function l(e){this._onCancelField=e}function d(){this._cancellationParent=void 0,this._onCancelField=void 0}function c(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function m(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function f(){var e=this._boundTo;return void 0!==e&&e instanceof n?e.isFulfilled()?e.value():void 0:e}function _(){this._trace=new C(this._peekContext())}function h(e,t){if(q(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=k(e);I.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),I.notEnumerableProp(e,"__stackCleaned__",!0)}}}function p(){this._trace=void 0}function y(e,t,n,r,o){if(void 0===e&&null!==t&&X){if(void 0!==o&&o._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var i="",s="";if(t._trace){for(var a=t._trace.stack.split("\n"),u=w(a),l=u.length-1;l>=0;--l){var d=u[l];if(!z.test(d)){var c=d.match(B);c&&(i="at "+c[1]+":"+c[2]+":"+c[3]+" ");break}}if(u.length>0)for(var m=u[0],l=0;l0&&(s="\n"+a[l-1]);break}}var f="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(f,!0,t)}}function g(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),v(n)}function v(e,t,r){if(ue.warnings){var o,i=new F(e);if(t)r._attachExtraTrace(i);else if(ue.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(i);else{var s=k(i);i.stack=s.message+"\n"+s.stack.join("\n")}re("warning",i)||T(i,"",!0)}}function b(e,t){for(var n=0;n=0;--a)if(r[a]===i){s=a;break}for(var a=s;a>=0;--a){var u=r[a];if(t[o]!==u)break;t.pop(),o--}t=r}}function w(e){for(var t=[],n=0;n0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}function k(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?L(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:w(t)}}function T(e,t,n){if("undefined"!=typeof console){var r;if(I.isObject(e)){var o=e.stack;r=t+G(o,e)}else r=t+String(e);"function"==typeof A?A(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function Y(e,t,n,r){var o=!1;try{"function"==typeof t&&(o=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(e){N.throwLater(e)}"unhandledRejection"===e?re(e,n,r)||o||T(n,"Unhandled rejection "):re(e,r)}function x(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():I.toString(e);if(/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+D(t)+">, no stack trace)"}function D(e){return e.length<41?e:e.substr(0,38)+"..."}function S(){return"function"==typeof ae}function E(e){var t=e.match(se);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function P(e,t){if(S()){for(var n,r,o=e.stack.split("\n"),i=t.stack.split("\n"),s=-1,a=-1,u=0;u=a||(ie=function(e){if(U.test(e))return!0;var t=E(e);return!!(t&&t.fileName===n&&s<=t.line&&t.line<=a)})}}function C(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);ae(this,C),t>32&&this.uncycle()}var O,H,A,R=n._getDomain,N=n._async,F=e("./errors").Warning,I=e("./util"),W=e("./es5"),q=I.canAttachTrace,U=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,z=/\((?:timers\.js):\d+:\d+\)/,B=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,V=null,G=null,J=!1,$=!(0==I.env("BLUEBIRD_DEBUG")),K=!(0==I.env("BLUEBIRD_WARNINGS")||!$&&!I.env("BLUEBIRD_WARNINGS")),Q=!(0==I.env("BLUEBIRD_LONG_STACK_TRACES")||!$&&!I.env("BLUEBIRD_LONG_STACK_TRACES")),X=0!=I.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(K||!!I.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){Y("rejectionHandled",O,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),Y("unhandledRejection",H,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(e,t,n){return v(e,t,n||this)},n.onPossiblyUnhandledRejection=function(e){var t=R();H="function"==typeof e?null===t?e:I.domainBind(t,e):void 0},n.onUnhandledRejectionHandled=function(e){var t=R();O="function"==typeof e?null===t?e:I.domainBind(t,e):void 0};var Z=function(){};n.longStackTraces=function(){if(N.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ue.longStackTraces&&S()){var e=n.prototype._captureStackTrace,t=n.prototype._attachExtraTrace,o=n.prototype._dereferenceTrace;ue.longStackTraces=!0,Z=function(){if(N.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=e,n.prototype._attachExtraTrace=t,n.prototype._dereferenceTrace=o,r.deactivateLongStackTraces(),N.enableTrampoline(),ue.longStackTraces=!1},n.prototype._captureStackTrace=_,n.prototype._attachExtraTrace=h,n.prototype._dereferenceTrace=p,r.activateLongStackTraces(),N.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return ue.longStackTraces&&S()};var ee=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return I.global.dispatchEvent(e),function(e,t){var n={detail:t,cancelable:!0};W.defineProperty(n,"promise",{value:t.promise}),W.defineProperty(n,"reason",{value:t.reason});var r=new CustomEvent(e.toLowerCase(),n);return!I.global.dispatchEvent(r)}}if("function"==typeof Event){var e=new Event("CustomEvent");return I.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,W.defineProperty(n,"promise",{value:t.promise}),W.defineProperty(n,"reason",{value:t.reason}),!I.global.dispatchEvent(n)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),I.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!I.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),te=function(){return I.isNode?function(){return t.emit.apply(t,arguments)}:I.global?function(e){var t="on"+e.toLowerCase(),n=I.global[t];return!!n&&(n.apply(I.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),ne={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:o},re=function(e){var t=!1;try{t=te.apply(null,arguments)}catch(e){N.throwLater(e),t=!0}var n=!1;try{n=ee(e,ne[e].apply(null,arguments))}catch(e){N.throwLater(e),n=!0}return n||t};n.config=function(e){if(e=Object(e),"longStackTraces"in e&&(e.longStackTraces?n.longStackTraces():!e.longStackTraces&&n.hasLongStackTraces()&&Z()),"warnings"in e){var t=e.warnings;ue.warnings=!!t,X=ue.warnings,I.isObject(t)&&"wForgottenReturn"in t&&(X=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!ue.cancellation){if(N.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=d,n.prototype._propagateFrom=c,n.prototype._onCancel=u,n.prototype._setOnCancel=l,n.prototype._attachCancellationCallback=a,n.prototype._execute=s,oe=c,ue.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!ue.monitoring?(ue.monitoring=!0,n.prototype._fireEvent=re):!e.monitoring&&ue.monitoring&&(ue.monitoring=!1,n.prototype._fireEvent=i)),n},n.prototype._fireEvent=i,n.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(e){},n.prototype._attachCancellationCallback=function(e){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(e,t){};var oe=m,ie=function(){return!1},se=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;I.inherits(C,Error),r.CapturedTrace=C,C.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},r=0,o=this;void 0!==o;++r)t.push(o),o=o._parent;e=this._length=r;for(var r=e-1;r>=0;--r){var i=t[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;r0&&(t[a-1]._parent=void 0,t[a-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var u=r>0?t[r-1]:this;a=0;--d)t[d]._length=l,l++;return}}}},C.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=k(e),n=t.message,r=[t.stack],o=this;void 0!==o;)r.push(w(o.stack.split("\n"))),o=o._parent;j(r),M(r),I.notEnumerableProp(e,"stack",b(n,r)),I.notEnumerableProp(e,"__stackCleaned__",!0)}};var ae=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():x(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,V=e,G=t;var n=Error.captureStackTrace;return ie=function(e){return U.test(e)},function(e,t){Error.stackTraceLimit+=6,n(e,t),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return V=/@/,G=t,J=!0,function(e){e.stack=(new Error).stack};var o;try{throw new Error}catch(e){o="stack"in e}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(G=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?x(t):t.toString()},null):(V=e,G=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(A=function(e){console.warn(e)},I.isNode&&t.stderr.isTTY?A=function(e,t){var n=t?"[33m":"[31m";console.warn(n+e+"[0m\n")}:I.isNode||"string"!=typeof(new Error).stack||(A=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var ue={warnings:K,longStackTraces:!1,cancellation:!1,monitoring:!1};return Q&&n.longStackTraces(),{longStackTraces:function(){return ue.longStackTraces},warnings:function(){return ue.warnings},cancellation:function(){return ue.cancellation},monitoring:function(){return ue.monitoring},propagateFromFunction:function(){return oe},boundValueFunction:function(){return f},checkForgottenReturns:y,setBounds:P,warn:v,deprecated:g,CapturedTrace:C,fireDomEvent:ee,fireGlobalEvent:te}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,n){"use strict";t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1],r=function(){throw t};return this.caught(e,r)},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];r instanceof e&&r.suppressUnhandledRejections();var o=function(){return r};return this.caught(n,o)}}},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){function n(){return i(this)}function r(e,n){return o(e,n,t,t)}var o=e.reduce,i=e.all;e.prototype.each=function(e){return o(this,e,t,0)._then(n,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return o(this,e,t,t)},e.each=function(e,r){return o(e,r,t,0)._then(n,void 0,void 0,e,void 0)},e.mapSeries=r}},{}],12:[function(e,t,n){"use strict";function r(e,t){function n(r){if(!(this instanceof n))return new n(r);c(this,"message","string"==typeof r?r:t),c(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return d(n,Error),n}function o(e){if(!(this instanceof o))return new o(e);c(this,"name","OperationalError"),c(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(c(this,"message",e.message),c(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var i,s,a=e("./es5"),u=a.freeze,l=e("./util"),d=l.inherits,c=l.notEnumerableProp,m=r("Warning","warning"),f=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),h=r("AggregateError","aggregate error");try{i=TypeError,s=RangeError}catch(e){i=r("TypeError","type error"),s=r("RangeError","range error")}for(var p="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function a(){return l.call(this,this.promise._target()._settledValue())}function u(e){if(!s(this,e))return m.e=e,m}function l(e){var o=this.promise,l=this.handler;if(!this.called){this.called=!0;var d=this.isFinallyHandler()?l.call(o._boundValue()):l.call(o._boundValue(),e);if(d===r)return d;if(void 0!==d){o._setReturnedNonUndefined();var f=n(d,o);if(f instanceof t){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new c("late cancellation observer");return o._attachExtraTrace(_),m.e=_,m}f.isPending()&&f._attachCancellationCallback(new i(this))}return f._then(a,u,void 0,this,void 0)}}}return o.isRejected()?(s(this),m.e=e,m):(s(this),e)}var d=e("./util"),c=t.CancellationError,m=d.errorObj,f=e("./catch_filter")(r);return o.prototype.isFinallyHandler=function(){return 0===this.type},i.prototype._resultCancelled=function(){s(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,r){return"function"!=typeof e?this.then():this._then(n,r,void 0,new o(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,l,l)},t.prototype.tap=function(e){return this._passThrough(e,1,l)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,l);var r,o=new Array(n-1),i=0;for(r=0;r0&&"function"==typeof arguments[t]){e=arguments[t];var r}var o=[].slice.call(arguments);e&&o.pop();var r=new n(o).promise();return void 0!==e?r.spread(e):r}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i,s){function a(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var o=l();this._callback=null===o?t:d.domainBind(o,t),this._preservedValues=r===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function u(e,n,o,i){if("function"!=typeof n)return r("expecting a function but got "+d.classString(n));var s=0;if(void 0!==o){if("object"!=typeof o||null===o)return t.reject(new TypeError("options argument must be an object but it is "+d.classString(o)));if("number"!=typeof o.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+d.classString(o.concurrency)));s=o.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(e,n,s,i).promise()}var l=t._getDomain,d=e("./util"),c=d.tryCatch,m=d.errorObj,f=t._async;d.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(e,n){var r=this._values,i=this.length(),a=this._preservedValues,u=this._limit;if(n<0){if(n=-1*n-1,r[n]=e,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return r[n]=e,this._queue.push(n),!1;null!==a&&(a[n]=e);var l=this._promise,d=this._callback,f=l._boundValue();l._pushContext();var _=c(d).call(f,e,n,i),h=l._popContext();if(s.checkForgottenReturns(_,h,null!==a?"Promise.filter":"Promise.map",l),_===m)return this._reject(_.e),!0;var p=o(_,this._promise);if(p instanceof t){p=p._target();var y=p._bitField;if(0==(50397184&y))return u>=1&&this._inFlight++,r[n]=p,p._proxy(this,-1*(n+1)),!1;if(0==(33554432&y))return 0!=(16777216&y)?(this._reject(p._reason()),!0):(this._cancel(),!0);_=p._value()}r[n]=_}return++this._totalResolved>=i&&(null!==a?this._filter(r,a):this._resolve(r),!0)},a.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight1){i.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],d=arguments[2];u=s.isArray(l)?a(e).apply(d,l):a(e).call(d,l)}else u=a(e)();var c=r._popContext();return i.checkForgottenReturns(u,c,"Promise.try",r),r._resolveFromSyncValue(u),r},t.prototype._resolveFromSyncValue=function(e){e===s.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){"use strict";function r(e){return e instanceof Error&&d.getPrototypeOf(e)===Error.prototype}function o(e){var t;if(r(e)){t=new l(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var n=d.keys(e),o=0;o1){var n,r=new Array(t-1),o=0;for(n=0;n0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+_.classString(e);arguments.length>1&&(n+=", "+_.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},i.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},i.prototype.spread=function(e){return"function"!=typeof e?m("expecting a function but got "+_.classString(e)):this.all()._then(e,void 0,void 0,j,void 0)},i.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},i.prototype.error=function(e){return this.caught(_.originatesFromRejection,e)},i.getNewLibraryCopy=n.exports,i.is=function(e){return e instanceof i},i.fromNode=i.fromCallback=function(e){var t=new i(M);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=C(e)(E(t,n));return r===P&&t._rejectCallback(r.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},i.all=function(e){return new k(e).promise()},i.cast=function(e){var t=L(e);return t instanceof i||(t=new i(M),t._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(e){var t=new i(M);return t._captureStackTrace(),t._rejectCallback(e,!0),t},i.setScheduler=function(e){if("function"!=typeof e)throw new v("expecting a function but got "+_.classString(e));return y.setScheduler(e)},i.prototype._then=function(e,t,n,r,o){var s=void 0!==o,a=s?o:new i(M),u=this._target(),d=u._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&d)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var c=l();if(0!=(50397184&d)){var m,f,h=u._settlePromiseCtx;0!=(33554432&d)?(f=u._rejectionHandler0,m=e):0!=(16777216&d)?(f=u._fulfillmentHandler0,m=t,u._unsetRejectionIsUnhandled()):(h=u._settlePromiseLateCancellationObserver,f=new b("late cancellation observer"),u._attachExtraTrace(f),m=t),y.invoke(h,u,{handler:null===c?m:"function"==typeof m&&_.domainBind(c,m),promise:a,receiver:r,value:f})}else u._addCallbacks(e,t,a,r,c);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},i.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){y.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==f)return void 0===t&&this._isBound()?this._boundValue():t},i.prototype._promiseAt=function(e){return this[4*e-4+2]},i.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},i.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(e){var t=(e._bitField,e._fulfillmentHandler0),n=e._rejectionHandler0,r=e._promise0,o=e._receiverAt(0);void 0===o&&(o=f),this._addCallbacks(t,n,r,o,null)},i.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),o=e._promiseAt(t),i=e._receiverAt(t);void 0===i&&(i=f),this._addCallbacks(n,r,o,i,null)},i.prototype._addCallbacks=function(e,t,n,r,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===o?e:_.domainBind(o,e)),"function"==typeof t&&(this._rejectionHandler0=null===o?t:_.domainBind(o,t));else{var s=4*i-4;this[s+2]=n,this[s+3]=r,"function"==typeof e&&(this[s+0]=null===o?e:_.domainBind(o,e)),"function"==typeof t&&(this[s+1]=null===o?t:_.domainBind(o,t))}return this._setLength(i+1),i},i.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},i.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(d(),!1);var n=L(e,this);if(!(n instanceof i))return this._fulfill(e);t&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(d());var o=r._bitField;if(0==(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;a>>16)){if(e===this){var n=d();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():y.settlePromises(this),this._dereferenceTrace())}},i.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return y.fatalError(e,_.isNode);(65535&t)>0?y.settlePromises(this):this._ensurePossibleRejectionHandled()}},i.prototype._fulfillPromises=function(e,t){for(var n=1;n0){if(0!=(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,e),this._fulfillPromises(t,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var e=this._bitField;return 0!=(33554432&e)?this._rejectionHandler0:0!=(16777216&e)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new i(M),resolve:s,reject:a}},_.notEnumerableProp(i,"_makeSelfResolutionError",d),e("./method")(i,M,L,m,x),e("./bind")(i,M,L,x),e("./cancel")(i,k,m,x),e("./direct_resolve")(i),e("./synchronous_inspection")(i),e("./join")(i,k,L,M,y,l),i.Promise=i,i.version="3.5.3",e("./map.js")(i,k,m,L,M,x),e("./call_get.js")(i),e("./using.js")(i,m,L,Y,M,x),e("./timers.js")(i,M,x),e("./generators.js")(i,m,M,L,r,x),e("./nodeify.js")(i),e("./promisify.js")(i,M),e("./props.js")(i,k,L,m),e("./race.js")(i,M,L,m),e("./reduce.js")(i,k,m,L,M,x),e("./settle.js")(i,k,x),e("./some.js")(i,k,m),e("./filter.js")(i,M),e("./each.js")(i,M),e("./any.js")(i),_.toFastProperties(i),_.toFastProperties(i.prototype),u({a:1}),u({b:2}),u({c:3}),u(1),u(function(){}),u(void 0),u(!1),u(new i(M)),x.setBounds(p.firstLineError,_.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i){function s(e){switch(e){case-2:return[];case-3:return{};case-6:return new Map}}function a(e){var r=this._promise=new t(n);e instanceof t&&r._propagateFrom(e,3),r._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var u=e("./util");u.isArray;return u.inherits(a,i),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function e(n,i){var a=r(this._values,this._promise);if(a instanceof t){a=a._target();var l=a._bitField;if(this._values=a,0==(50397184&l))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,i);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(a._reason()):this._cancel();a=a._value()}if(null===(a=u.asArray(a))){var d=o("expecting an array or an iterable object but got "+u.classString(a)).reason();return void this._promise._rejectCallback(d,!1)}if(0===a.length)return void(-5===i?this._resolveEmptyArray():this._resolve(s(i)));this._iterate(a)},a.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var o=this._promise,i=!1,s=null,a=0;a=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var n=0;n=this._length){var n;if(this._isMap)n=m(this._values);else{n={};for(var r=this.length(),o=0,i=this.length();o>1},t.prototype.props=function(){return s(this)},t.props=function(e){return s(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,n){"use strict";function r(e,t,n,r,o){for(var i=0;i=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(e,t){var n=new i;return n._bitField=33554432,n._settledValueField=e,this._promiseResolved(t,n)},o.prototype._promiseRejected=function(e,t){var n=new i;return n._bitField=16777216,n._settledValueField=e,this._promiseResolved(t,n)},t.settle=function(e){return r.deprecated(".settle()",".reflect()"),new o(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,n){"use strict";t.exports=function(t,n,r){function o(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function i(e,t){if((0|t)!==t||t<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new o(e),i=n.promise();return n.setHowMany(t),n.init(),i}var s=e("./util"),a=e("./errors").RangeError,u=e("./errors").AggregateError,l=s.isArray,d={};s.inherits(o,n),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var e=l(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(e){this._howMany=e},o.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},o.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},o.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(d),this._checkOutcome())},o.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new u,t=this.length();t0?this._reject(e):this._cancel(),!0}return!1},o.prototype._fulfilled=function(){return this._totalResolved},o.prototype._rejected=function(){return this._values.length-this.length()},o.prototype._addRejected=function(e){this._values.push(e)},o.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},o.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},o.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new a(t)},o.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return i(e,t)},t.prototype.some=function(e){return i(this,e)},t._SomePromiseArray=o}},{"./errors":12,"./util":36}],32:[function(e,t,n){"use strict";t.exports=function(e){function t(e){void 0!==e?(e=e._target(),this._bitField=e._bitField,this._settledValueField=e._isFateSealed()?e._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var n=t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},o=t.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},i=t.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},s=t.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=t.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};t.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},e.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},e.prototype._isCancelled=function(){return this._target().__isCancelled()},e.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},e.prototype.isPending=function(){return s.call(this._target())},e.prototype.isRejected=function(){return i.call(this._target())},e.prototype.isFulfilled=function(){return o.call(this._target())},e.prototype.isResolved=function(){return a.call(this._target())},e.prototype.value=function(){return n.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),r.call(e)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}},{}],33:[function(e,t,n){"use strict";t.exports=function(t,n){function r(e,r){if(d(e)){if(e instanceof t)return e;var o=i(e);if(o===l){r&&r._pushContext();var u=t.reject(o.e);return r&&r._popContext(),u}if("function"==typeof o){if(s(e)){var u=new t(n);return e._then(u._fulfill,u._reject,void 0,u,null),u}return a(e,o,r)}}return e}function o(e){return e.then}function i(e){try{return o(e)}catch(e){return l.e=e,l}}function s(e){try{return c.call(e,"_promise0")}catch(e){return!1}}function a(e,r,o){function i(e){a&&(a._resolveCallback(e),a=null)}function s(e){a&&(a._rejectCallback(e,c,!0),a=null)}var a=new t(n),d=a;o&&o._pushContext(),a._captureStackTrace(),o&&o._popContext();var c=!0,m=u.tryCatch(r).call(e,i,s);return c=!1,a&&m===l&&(a._rejectCallback(m.e,!0,!0),a=null),d}var u=e("./util"),l=u.errorObj,d=u.isObject,c={}.hasOwnProperty;return r}},{"./util":36}],34:[function(e,t,n){"use strict";t.exports=function(t,n,r){function o(e){this.handle=e}function i(e){return clearTimeout(this.handle),e}function s(e){throw clearTimeout(this.handle),e}var a=e("./util"),u=t.TimeoutError;o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(e){return d(+this).thenReturn(e)},d=t.delay=function(e,i){var s,a;return void 0!==i?(s=t.resolve(i)._then(l,null,null,e,void 0),r.cancellation()&&i instanceof t&&s._setOnCancel(i)):(s=new t(n),a=setTimeout(function(){s._fulfill()},+e),r.cancellation()&&s._setOnCancel(new o(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};t.prototype.delay=function(e){return d(e,this)};var c=function(e,t,n){var r;r="string"!=typeof t?t instanceof Error?t:new u("operation timed out"):new u(t),a.markAsOriginatingFromRejection(r),e._attachExtraTrace(r),e._reject(r),null!=n&&n.cancel()};t.prototype.timeout=function(e,t){e=+e;var n,a,u=new o(setTimeout(function(){n.isPending()&&c(n,t,a)},e));return r.cancellation()?(a=this.then(),n=a._then(i,s,void 0,u,void 0),n._setOnCancel(u)):n=this._then(i,s,void 0,u,void 0),n}}},{"./util":36}],35:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i,s){function a(e){setTimeout(function(){throw e},0)}function u(e){var t=r(e);return t!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}function l(e,n){function o(){if(s>=l)return d._fulfill();var i=u(e[s++]);if(i instanceof t&&i._isDisposable()){try{i=r(i._getDisposer().tryDispose(n),e.promise)}catch(e){return a(e)}if(i instanceof t)return i._then(o,a,null,null,null)}o()}var s=0,l=e.length,d=new t(i);return o(),d}function d(e,t,n){this._data=e,this._promise=t,this._context=n}function c(e,t,n){this.constructor$(e,t,n)}function m(e){return d.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function f(e){this.length=e,this.promise=null,this[e-1]=null}var _=e("./util"),h=e("./errors").TypeError,p=e("./util").inherits,y=_.errorObj,g=_.tryCatch,v={};d.prototype.data=function(){return this._data},d.prototype.promise=function(){return this._promise},d.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():v},d.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=t!==v?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},d.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},p(c,d),c.prototype.doDispose=function(e,t){return this.data().call(e,e,t)},f.prototype._resultCancelled=function(){for(var e=this.length,n=0;n0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(e){if("function"==typeof e)return new c(e,this,o());throw new h}}},{"./errors":12,"./util":36}],36:[function(e,r,o){"use strict";function i(){try{var e=E;return E=null,e.apply(this,arguments)}catch(e){return S.e=e,S}}function s(e){return E=e,i}function a(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function u(e){return"function"==typeof e||"object"==typeof e&&null!==e}function l(e){return a(e)?new Error(g(e)):e}function d(e,t){var n,r=e.length,o=new Array(r+1);for(n=0;n1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),o=H.test(e+"")&&x.names(e).length>0;if(n||r||o)return!0}return!1}catch(e){return!1}}function h(e){function t(){}function n(){return typeof r.foo}t.prototype=e;var r=new t;return n(),n(),e}function p(e){return A.test(e)}function y(e,t,n){for(var r=new Array(e),o=0;o10||e[0]>0}(),q.isNode&&q.toFastProperties(t);try{throw new Error}catch(e){q.lastLineError=e}r.exports=q},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(t,n("../node_modules/process/browser.js"),n("../node_modules/webpack/buildin/global.js"),n("../node_modules/timers-browserify/main.js").setImmediate)},"../node_modules/buffer/index.js":function(e,t,n){"use strict";(function(e){function r(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function h(e){return+e!=e&&(e=0),i.alloc(+e)}function p(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return x(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return Y(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){function i(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}var l;if(o){var d=-1;for(l=n;la&&(n=a-u),l=n;l>=0;l--){for(var c=!0,m=0;mo&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=n){var u,l,d,c;switch(a){case 1:i<128&&(s=i);break;case 2:u=e[o+1],128==(192&u)&&(c=(31&i)<<6|63&u)>127&&(s=c);break;case 3:u=e[o+1],l=e[o+2],128==(192&u)&&128==(192&l)&&(c=(15&i)<<12|(63&u)<<6|63&l)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:u=e[o+1],l=e[o+2],d=e[o+3],128==(192&u)&&128==(192&l)&&128==(192&d)&&(c=(15&i)<<18|(63&u)<<12|(63&l)<<6|63&d)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),o+=a}return D(r)}function D(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function H(e,t,n,r,o,s){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function A(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function N(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,o){return o||N(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,n,r,23,4),n+4}function I(e,t,n,r,o){return o||N(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,n,r,52,8),n+8}function W(e){if(e=q(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function q(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var n,r=e.length,o=null,i=[],s=0;s55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function B(e){for(var t=[],n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function G(e){return K.toByteArray(W(e))}function J(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e){return e!==e}/*!
+!function(t){e.exports=t()}(function(){var e,o,s;return function e(t,n,r){function o(i,a){if(!n[i]){if(!t[i]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(i,!0);if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var d=n[i]={exports:{}};t[i][0].call(d.exports,function(e){var n=t[i][1][e];return o(n||e)},d,d.exports,e,t,n,r)}return n[i].exports}for(var s="function"==typeof _dereq_&&_dereq_,i=0;i0;)l(e)}function l(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var n=e.shift(),r=e.shift();t.call(n,r)}}var d;try{throw new Error}catch(e){d=e}var c=e("./schedule"),f=e("./queue"),m=e("./util");o.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},o.prototype.hasCustomScheduler=function(){return this._customScheduler},o.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},o.prototype.disableTrampolineIfNecessary=function(){m.hasDevTools&&(this._trampolineEnabled=!1)},o.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},o.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},o.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},m.hasDevTools?(o.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?s.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},o.prototype.invoke=function(e,t,n){this._trampolineEnabled?i.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},o.prototype.settlePromises=function(e){this._trampolineEnabled?a.call(this,e):this._schedule(function(){e._settlePromises()})}):(o.prototype.invokeLater=s,o.prototype.invoke=i,o.prototype.settlePromises=a),o.prototype._drainQueues=function(){u(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,u(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},n.exports=o,n.exports.firstLineError=d},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){var o=!1,s=function(e,t){this._reject(t)},i=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(s,s,null,this,e)},a=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},u=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(s){o||(o=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var l=n(s),d=new e(t);d._propagateFrom(this,1);var c=this._target();if(d._setBoundTo(l),l instanceof e){var f={promiseRejectionQueued:!1,promise:d,target:c,bindingPromise:l};c._then(t,i,void 0,d,f),l._then(a,u,void 0,d,f),d._setOnCancel(l)}else d._resolveCallback(c);return d},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){"use strict";function r(){try{Promise===s&&(Promise=o)}catch(e){}return s}var o;"undefined"!=typeof Promise&&(o=Promise);var s=e("./promise")();s.noConflict=r,t.exports=s},{"./promise":22}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var o=r(null),s=r(null);o[" size"]=s[" size"]=0}t.exports=function(t){function n(e,n){var r;if(null!=e&&(r=e[n]),"function"!=typeof r){var o="Object "+a.classString(e)+" has no method '"+a.toString(n)+"'";throw new t.TypeError(o)}return r}function r(e){return n(e,this.pop()).apply(e,this)}function o(e){return e[this]}function s(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var i,a=e("./util"),u=a.canEvaluate;a.isIdentifier;t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(r,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t,n="number"==typeof e;if(n)t=s;else if(u){var r=i(e);t=null!==r?r:o}else t=o;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){"use strict";t.exports=function(t,n,r,o){var s=e("./util"),i=s.tryCatch,a=s.errorObj,u=t._async;t.prototype.break=t.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(s.isArray(e))for(var n=0;n=0)return s[e]}var o=!1,s=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,s.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=s.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=n,t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var n=e.prototype._pushContext,s=e.prototype._popContext,i=e._peekContext,a=e.prototype._peekContext,u=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=s,e._peekContext=i,e.prototype._peekContext=a,e.prototype._promiseCreated=u,o=!1},o=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=r,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}},{}],9:[function(e,n,r){"use strict";n.exports=function(n,r){function o(e,t){return{promise:t}}function s(){return!1}function i(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+I.toString(e));r._attachCancellationCallback(e)})}catch(e){return e}}function a(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?I.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function u(){return this._onCancelField}function l(e){this._onCancelField=e}function d(){this._cancellationParent=void 0,this._onCancelField=void 0}function c(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function f(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function m(){var e=this._boundTo;return void 0!==e&&e instanceof n?e.isFulfilled()?e.value():void 0:e}function _(){this._trace=new C(this._peekContext())}function h(e,t){if(U(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=L(e);I.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),I.notEnumerableProp(e,"__stackCleaned__",!0)}}}function p(){this._trace=void 0}function y(e,t,n,r,o){if(void 0===e&&null!==t&&X){if(void 0!==o&&o._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var s="",i="";if(t._trace){for(var a=t._trace.stack.split("\n"),u=w(a),l=u.length-1;l>=0;--l){var d=u[l];if(!z.test(d)){var c=d.match(B);c&&(s="at "+c[1]+":"+c[2]+":"+c[3]+" ");break}}if(u.length>0)for(var f=u[0],l=0;l0&&(i="\n"+a[l-1]);break}}var m="a promise was created in a "+n+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+i;r._warn(m,!0,t)}}function g(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),v(n)}function v(e,t,r){if(ue.warnings){var o,s=new F(e);if(t)r._attachExtraTrace(s);else if(ue.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(s);else{var i=L(s);s.stack=i.message+"\n"+i.stack.join("\n")}re("warning",s)||T(s,"",!0)}}function b(e,t){for(var n=0;n=0;--a)if(r[a]===s){i=a;break}for(var a=i;a>=0;--a){var u=r[a];if(t[o]!==u)break;t.pop(),o--}t=r}}function w(e){for(var t=[],n=0;n0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}function L(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?k(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:w(t)}}function T(e,t,n){if("undefined"!=typeof console){var r;if(I.isObject(e)){var o=e.stack;r=t+G(o,e)}else r=t+String(e);"function"==typeof A?A(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function Y(e,t,n,r){var o=!1;try{"function"==typeof t&&(o=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(e){N.throwLater(e)}"unhandledRejection"===e?re(e,n,r)||o||T(n,"Unhandled rejection "):re(e,r)}function x(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():I.toString(e);if(/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+D(t)+">, no stack trace)"}function D(e){return e.length<41?e:e.substr(0,38)+"..."}function S(){return"function"==typeof ae}function E(e){var t=e.match(ie);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function P(e,t){if(S()){for(var n,r,o=e.stack.split("\n"),s=t.stack.split("\n"),i=-1,a=-1,u=0;u=a||(se=function(e){if(q.test(e))return!0;var t=E(e);return!!(t&&t.fileName===n&&i<=t.line&&t.line<=a)})}}function C(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);ae(this,C),t>32&&this.uncycle()}var O,H,A,R=n._getDomain,N=n._async,F=e("./errors").Warning,I=e("./util"),W=e("./es5"),U=I.canAttachTrace,q=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,z=/\((?:timers\.js):\d+:\d+\)/,B=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,V=null,G=null,J=!1,$=!(0==I.env("BLUEBIRD_DEBUG")),K=!(0==I.env("BLUEBIRD_WARNINGS")||!$&&!I.env("BLUEBIRD_WARNINGS")),Q=!(0==I.env("BLUEBIRD_LONG_STACK_TRACES")||!$&&!I.env("BLUEBIRD_LONG_STACK_TRACES")),X=0!=I.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(K||!!I.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){Y("rejectionHandled",O,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),Y("unhandledRejection",H,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(e,t,n){return v(e,t,n||this)},n.onPossiblyUnhandledRejection=function(e){var t=R();H="function"==typeof e?null===t?e:I.domainBind(t,e):void 0},n.onUnhandledRejectionHandled=function(e){var t=R();O="function"==typeof e?null===t?e:I.domainBind(t,e):void 0};var Z=function(){};n.longStackTraces=function(){if(N.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ue.longStackTraces&&S()){var e=n.prototype._captureStackTrace,t=n.prototype._attachExtraTrace,o=n.prototype._dereferenceTrace;ue.longStackTraces=!0,Z=function(){if(N.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=e,n.prototype._attachExtraTrace=t,n.prototype._dereferenceTrace=o,r.deactivateLongStackTraces(),N.enableTrampoline(),ue.longStackTraces=!1},n.prototype._captureStackTrace=_,n.prototype._attachExtraTrace=h,n.prototype._dereferenceTrace=p,r.activateLongStackTraces(),N.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return ue.longStackTraces&&S()};var ee=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return I.global.dispatchEvent(e),function(e,t){var n={detail:t,cancelable:!0};W.defineProperty(n,"promise",{value:t.promise}),W.defineProperty(n,"reason",{value:t.reason});var r=new CustomEvent(e.toLowerCase(),n);return!I.global.dispatchEvent(r)}}if("function"==typeof Event){var e=new Event("CustomEvent");return I.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,W.defineProperty(n,"promise",{value:t.promise}),W.defineProperty(n,"reason",{value:t.reason}),!I.global.dispatchEvent(n)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),I.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!I.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),te=function(){return I.isNode?function(){return t.emit.apply(t,arguments)}:I.global?function(e){var t="on"+e.toLowerCase(),n=I.global[t];return!!n&&(n.apply(I.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),ne={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:o},re=function(e){var t=!1;try{t=te.apply(null,arguments)}catch(e){N.throwLater(e),t=!0}var n=!1;try{n=ee(e,ne[e].apply(null,arguments))}catch(e){N.throwLater(e),n=!0}return n||t};n.config=function(e){if(e=Object(e),"longStackTraces"in e&&(e.longStackTraces?n.longStackTraces():!e.longStackTraces&&n.hasLongStackTraces()&&Z()),"warnings"in e){var t=e.warnings;ue.warnings=!!t,X=ue.warnings,I.isObject(t)&&"wForgottenReturn"in t&&(X=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!ue.cancellation){if(N.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=d,n.prototype._propagateFrom=c,n.prototype._onCancel=u,n.prototype._setOnCancel=l,n.prototype._attachCancellationCallback=a,n.prototype._execute=i,oe=c,ue.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!ue.monitoring?(ue.monitoring=!0,n.prototype._fireEvent=re):!e.monitoring&&ue.monitoring&&(ue.monitoring=!1,n.prototype._fireEvent=s)),n},n.prototype._fireEvent=s,n.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(e){},n.prototype._attachCancellationCallback=function(e){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(e,t){};var oe=f,se=function(){return!1},ie=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;I.inherits(C,Error),r.CapturedTrace=C,C.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},r=0,o=this;void 0!==o;++r)t.push(o),o=o._parent;e=this._length=r;for(var r=e-1;r>=0;--r){var s=t[r].stack;void 0===n[s]&&(n[s]=r)}for(var r=0;r0&&(t[a-1]._parent=void 0,t[a-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var u=r>0?t[r-1]:this;a=0;--d)t[d]._length=l,l++;return}}}},C.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=L(e),n=t.message,r=[t.stack],o=this;void 0!==o;)r.push(w(o.stack.split("\n"))),o=o._parent;j(r),M(r),I.notEnumerableProp(e,"stack",b(n,r)),I.notEnumerableProp(e,"__stackCleaned__",!0)}};var ae=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():x(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,V=e,G=t;var n=Error.captureStackTrace;return se=function(e){return q.test(e)},function(e,t){Error.stackTraceLimit+=6,n(e,t),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return V=/@/,G=t,J=!0,function(e){e.stack=(new Error).stack};var o;try{throw new Error}catch(e){o="stack"in e}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(G=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?x(t):t.toString()},null):(V=e,G=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(A=function(e){console.warn(e)},I.isNode&&t.stderr.isTTY?A=function(e,t){var n=t?"[33m":"[31m";console.warn(n+e+"[0m\n")}:I.isNode||"string"!=typeof(new Error).stack||(A=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var ue={warnings:K,longStackTraces:!1,cancellation:!1,monitoring:!1};return Q&&n.longStackTraces(),{longStackTraces:function(){return ue.longStackTraces},warnings:function(){return ue.warnings},cancellation:function(){return ue.cancellation},monitoring:function(){return ue.monitoring},propagateFromFunction:function(){return oe},boundValueFunction:function(){return m},checkForgottenReturns:y,setBounds:P,warn:v,deprecated:g,CapturedTrace:C,fireDomEvent:ee,fireGlobalEvent:te}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,n){"use strict";t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1],r=function(){throw t};return this.caught(e,r)},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];r instanceof e&&r.suppressUnhandledRejections();var o=function(){return r};return this.caught(n,o)}}},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){function n(){return s(this)}function r(e,n){return o(e,n,t,t)}var o=e.reduce,s=e.all;e.prototype.each=function(e){return o(this,e,t,0)._then(n,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return o(this,e,t,t)},e.each=function(e,r){return o(e,r,t,0)._then(n,void 0,void 0,e,void 0)},e.mapSeries=r}},{}],12:[function(e,t,n){"use strict";function r(e,t){function n(r){if(!(this instanceof n))return new n(r);c(this,"message","string"==typeof r?r:t),c(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return d(n,Error),n}function o(e){if(!(this instanceof o))return new o(e);c(this,"name","OperationalError"),c(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(c(this,"message",e.message),c(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var s,i,a=e("./es5"),u=a.freeze,l=e("./util"),d=l.inherits,c=l.notEnumerableProp,f=r("Warning","warning"),m=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),h=r("AggregateError","aggregate error");try{s=TypeError,i=RangeError}catch(e){s=r("TypeError","type error"),i=r("RangeError","range error")}for(var p="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function a(){return l.call(this,this.promise._target()._settledValue())}function u(e){if(!i(this,e))return f.e=e,f}function l(e){var o=this.promise,l=this.handler;if(!this.called){this.called=!0;var d=this.isFinallyHandler()?l.call(o._boundValue()):l.call(o._boundValue(),e);if(d===r)return d;if(void 0!==d){o._setReturnedNonUndefined();var m=n(d,o);if(m instanceof t){if(null!=this.cancelPromise){if(m._isCancelled()){var _=new c("late cancellation observer");return o._attachExtraTrace(_),f.e=_,f}m.isPending()&&m._attachCancellationCallback(new s(this))}return m._then(a,u,void 0,this,void 0)}}}return o.isRejected()?(i(this),f.e=e,f):(i(this),e)}var d=e("./util"),c=t.CancellationError,f=d.errorObj,m=e("./catch_filter")(r);return o.prototype.isFinallyHandler=function(){return 0===this.type},s.prototype._resultCancelled=function(){i(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,r){return"function"!=typeof e?this.then():this._then(n,r,void 0,new o(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,l,l)},t.prototype.tap=function(e){return this._passThrough(e,1,l)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,l);var r,o=new Array(n-1),s=0;for(r=0;r0&&"function"==typeof arguments[t]){e=arguments[t];var r}var o=[].slice.call(arguments);e&&o.pop();var r=new n(o).promise();return void 0!==e?r.spread(e):r}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,s,i){function a(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var o=l();this._callback=null===o?t:d.domainBind(o,t),this._preservedValues=r===s?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],m.invoke(this._asyncInit,this,void 0)}function u(e,n,o,s){if("function"!=typeof n)return r("expecting a function but got "+d.classString(n));var i=0;if(void 0!==o){if("object"!=typeof o||null===o)return t.reject(new TypeError("options argument must be an object but it is "+d.classString(o)));if("number"!=typeof o.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+d.classString(o.concurrency)));i=o.concurrency}return i="number"==typeof i&&isFinite(i)&&i>=1?i:0,new a(e,n,i,s).promise()}var l=t._getDomain,d=e("./util"),c=d.tryCatch,f=d.errorObj,m=t._async;d.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(e,n){var r=this._values,s=this.length(),a=this._preservedValues,u=this._limit;if(n<0){if(n=-1*n-1,r[n]=e,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return r[n]=e,this._queue.push(n),!1;null!==a&&(a[n]=e);var l=this._promise,d=this._callback,m=l._boundValue();l._pushContext();var _=c(d).call(m,e,n,s),h=l._popContext();if(i.checkForgottenReturns(_,h,null!==a?"Promise.filter":"Promise.map",l),_===f)return this._reject(_.e),!0;var p=o(_,this._promise);if(p instanceof t){p=p._target();var y=p._bitField;if(0==(50397184&y))return u>=1&&this._inFlight++,r[n]=p,p._proxy(this,-1*(n+1)),!1;if(0==(33554432&y))return 0!=(16777216&y)?(this._reject(p._reason()),!0):(this._cancel(),!0);_=p._value()}r[n]=_}return++this._totalResolved>=s&&(null!==a?this._filter(r,a):this._resolve(r),!0)},a.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight1){s.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],d=arguments[2];u=i.isArray(l)?a(e).apply(d,l):a(e).call(d,l)}else u=a(e)();var c=r._popContext();return s.checkForgottenReturns(u,c,"Promise.try",r),r._resolveFromSyncValue(u),r},t.prototype._resolveFromSyncValue=function(e){e===i.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){"use strict";function r(e){return e instanceof Error&&d.getPrototypeOf(e)===Error.prototype}function o(e){var t;if(r(e)){t=new l(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var n=d.keys(e),o=0;o1){var n,r=new Array(t-1),o=0;for(n=0;n0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+_.classString(e);arguments.length>1&&(n+=", "+_.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},s.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},s.prototype.spread=function(e){return"function"!=typeof e?f("expecting a function but got "+_.classString(e)):this.all()._then(e,void 0,void 0,j,void 0)},s.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},s.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new L(this).promise()},s.prototype.error=function(e){return this.caught(_.originatesFromRejection,e)},s.getNewLibraryCopy=n.exports,s.is=function(e){return e instanceof s},s.fromNode=s.fromCallback=function(e){var t=new s(M);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=C(e)(E(t,n));return r===P&&t._rejectCallback(r.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},s.all=function(e){return new L(e).promise()},s.cast=function(e){var t=k(e);return t instanceof s||(t=new s(M),t._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},s.resolve=s.fulfilled=s.cast,s.reject=s.rejected=function(e){var t=new s(M);return t._captureStackTrace(),t._rejectCallback(e,!0),t},s.setScheduler=function(e){if("function"!=typeof e)throw new v("expecting a function but got "+_.classString(e));return y.setScheduler(e)},s.prototype._then=function(e,t,n,r,o){var i=void 0!==o,a=i?o:new s(M),u=this._target(),d=u._bitField;i||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&d)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var c=l();if(0!=(50397184&d)){var f,m,h=u._settlePromiseCtx;0!=(33554432&d)?(m=u._rejectionHandler0,f=e):0!=(16777216&d)?(m=u._fulfillmentHandler0,f=t,u._unsetRejectionIsUnhandled()):(h=u._settlePromiseLateCancellationObserver,m=new b("late cancellation observer"),u._attachExtraTrace(m),f=t),y.invoke(h,u,{handler:null===c?f:"function"==typeof f&&_.domainBind(c,f),promise:a,receiver:r,value:m})}else u._addCallbacks(e,t,a,r,c);return a},s.prototype._length=function(){return 65535&this._bitField},s.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},s.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},s.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},s.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},s.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},s.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},s.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},s.prototype._isFinal=function(){return(4194304&this._bitField)>0},s.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},s.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},s.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},s.prototype._setAsyncGuaranteed=function(){y.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},s.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==m)return void 0===t&&this._isBound()?this._boundValue():t},s.prototype._promiseAt=function(e){return this[4*e-4+2]},s.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},s.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},s.prototype._boundValue=function(){},s.prototype._migrateCallback0=function(e){var t=(e._bitField,e._fulfillmentHandler0),n=e._rejectionHandler0,r=e._promise0,o=e._receiverAt(0);void 0===o&&(o=m),this._addCallbacks(t,n,r,o,null)},s.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),o=e._promiseAt(t),s=e._receiverAt(t);void 0===s&&(s=m),this._addCallbacks(n,r,o,s,null)},s.prototype._addCallbacks=function(e,t,n,r,o){var s=this._length();if(s>=65531&&(s=0,this._setLength(0)),0===s)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===o?e:_.domainBind(o,e)),"function"==typeof t&&(this._rejectionHandler0=null===o?t:_.domainBind(o,t));else{var i=4*s-4;this[i+2]=n,this[i+3]=r,"function"==typeof e&&(this[i+0]=null===o?e:_.domainBind(o,e)),"function"==typeof t&&(this[i+1]=null===o?t:_.domainBind(o,t))}return this._setLength(s+1),s},s.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},s.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(d(),!1);var n=k(e,this);if(!(n instanceof s))return this._fulfill(e);t&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(d());var o=r._bitField;if(0==(50397184&o)){var i=this._length();i>0&&r._migrateCallback0(this);for(var a=1;a>>16)){if(e===this){var n=d();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():y.settlePromises(this),this._dereferenceTrace())}},s.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return y.fatalError(e,_.isNode);(65535&t)>0?y.settlePromises(this):this._ensurePossibleRejectionHandled()}},s.prototype._fulfillPromises=function(e,t){for(var n=1;n0){if(0!=(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,e),this._fulfillPromises(t,r)}this._setLength(0)}this._clearCancellationData()},s.prototype._settledValue=function(){var e=this._bitField;return 0!=(33554432&e)?this._rejectionHandler0:0!=(16777216&e)?this._fulfillmentHandler0:void 0},s.defer=s.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new s(M),resolve:i,reject:a}},_.notEnumerableProp(s,"_makeSelfResolutionError",d),e("./method")(s,M,k,f,x),e("./bind")(s,M,k,x),e("./cancel")(s,L,f,x),e("./direct_resolve")(s),e("./synchronous_inspection")(s),e("./join")(s,L,k,M,y,l),s.Promise=s,s.version="3.5.3",e("./map.js")(s,L,f,k,M,x),e("./call_get.js")(s),e("./using.js")(s,f,k,Y,M,x),e("./timers.js")(s,M,x),e("./generators.js")(s,f,M,k,r,x),e("./nodeify.js")(s),e("./promisify.js")(s,M),e("./props.js")(s,L,k,f),e("./race.js")(s,M,k,f),e("./reduce.js")(s,L,f,k,M,x),e("./settle.js")(s,L,x),e("./some.js")(s,L,f),e("./filter.js")(s,M),e("./each.js")(s,M),e("./any.js")(s),_.toFastProperties(s),_.toFastProperties(s.prototype),u({a:1}),u({b:2}),u({c:3}),u(1),u(function(){}),u(void 0),u(!1),u(new s(M)),x.setBounds(p.firstLineError,_.lastLineError),s}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,s){function i(e){switch(e){case-2:return[];case-3:return{};case-6:return new Map}}function a(e){var r=this._promise=new t(n);e instanceof t&&r._propagateFrom(e,3),r._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var u=e("./util");u.isArray;return u.inherits(a,s),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function e(n,s){var a=r(this._values,this._promise);if(a instanceof t){a=a._target();var l=a._bitField;if(this._values=a,0==(50397184&l))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,s);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(a._reason()):this._cancel();a=a._value()}if(null===(a=u.asArray(a))){var d=o("expecting an array or an iterable object but got "+u.classString(a)).reason();return void this._promise._rejectCallback(d,!1)}if(0===a.length)return void(-5===s?this._resolveEmptyArray():this._resolve(i(s)));this._iterate(a)},a.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var o=this._promise,s=!1,i=null,a=0;a=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var n=0;n=this._length){var n;if(this._isMap)n=f(this._values);else{n={};for(var r=this.length(),o=0,s=this.length();o>1},t.prototype.props=function(){return i(this)},t.props=function(e){return i(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,n){"use strict";function r(e,t,n,r,o){for(var s=0;s=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(e,t){var n=new s;return n._bitField=33554432,n._settledValueField=e,this._promiseResolved(t,n)},o.prototype._promiseRejected=function(e,t){var n=new s;return n._bitField=16777216,n._settledValueField=e,this._promiseResolved(t,n)},t.settle=function(e){return r.deprecated(".settle()",".reflect()"),new o(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,n){"use strict";t.exports=function(t,n,r){function o(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function s(e,t){if((0|t)!==t||t<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new o(e),s=n.promise();return n.setHowMany(t),n.init(),s}var i=e("./util"),a=e("./errors").RangeError,u=e("./errors").AggregateError,l=i.isArray,d={};i.inherits(o,n),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var e=l(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(e){this._howMany=e},o.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},o.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},o.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(d),this._checkOutcome())},o.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new u,t=this.length();t0?this._reject(e):this._cancel(),!0}return!1},o.prototype._fulfilled=function(){return this._totalResolved},o.prototype._rejected=function(){return this._values.length-this.length()},o.prototype._addRejected=function(e){this._values.push(e)},o.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},o.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},o.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new a(t)},o.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return s(e,t)},t.prototype.some=function(e){return s(this,e)},t._SomePromiseArray=o}},{"./errors":12,"./util":36}],32:[function(e,t,n){"use strict";t.exports=function(e){function t(e){void 0!==e?(e=e._target(),this._bitField=e._bitField,this._settledValueField=e._isFateSealed()?e._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var n=t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},o=t.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},s=t.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},i=t.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=t.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};t.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},e.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},e.prototype._isCancelled=function(){return this._target().__isCancelled()},e.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},e.prototype.isPending=function(){return i.call(this._target())},e.prototype.isRejected=function(){return s.call(this._target())},e.prototype.isFulfilled=function(){return o.call(this._target())},e.prototype.isResolved=function(){return a.call(this._target())},e.prototype.value=function(){return n.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),r.call(e)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}},{}],33:[function(e,t,n){"use strict";t.exports=function(t,n){function r(e,r){if(d(e)){if(e instanceof t)return e;var o=s(e);if(o===l){r&&r._pushContext();var u=t.reject(o.e);return r&&r._popContext(),u}if("function"==typeof o){if(i(e)){var u=new t(n);return e._then(u._fulfill,u._reject,void 0,u,null),u}return a(e,o,r)}}return e}function o(e){return e.then}function s(e){try{return o(e)}catch(e){return l.e=e,l}}function i(e){try{return c.call(e,"_promise0")}catch(e){return!1}}function a(e,r,o){function s(e){a&&(a._resolveCallback(e),a=null)}function i(e){a&&(a._rejectCallback(e,c,!0),a=null)}var a=new t(n),d=a;o&&o._pushContext(),a._captureStackTrace(),o&&o._popContext();var c=!0,f=u.tryCatch(r).call(e,s,i);return c=!1,a&&f===l&&(a._rejectCallback(f.e,!0,!0),a=null),d}var u=e("./util"),l=u.errorObj,d=u.isObject,c={}.hasOwnProperty;return r}},{"./util":36}],34:[function(e,t,n){"use strict";t.exports=function(t,n,r){function o(e){this.handle=e}function s(e){return clearTimeout(this.handle),e}function i(e){throw clearTimeout(this.handle),e}var a=e("./util"),u=t.TimeoutError;o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(e){return d(+this).thenReturn(e)},d=t.delay=function(e,s){var i,a;return void 0!==s?(i=t.resolve(s)._then(l,null,null,e,void 0),r.cancellation()&&s instanceof t&&i._setOnCancel(s)):(i=new t(n),a=setTimeout(function(){i._fulfill()},+e),r.cancellation()&&i._setOnCancel(new o(a)),i._captureStackTrace()),i._setAsyncGuaranteed(),i};t.prototype.delay=function(e){return d(e,this)};var c=function(e,t,n){var r;r="string"!=typeof t?t instanceof Error?t:new u("operation timed out"):new u(t),a.markAsOriginatingFromRejection(r),e._attachExtraTrace(r),e._reject(r),null!=n&&n.cancel()};t.prototype.timeout=function(e,t){e=+e;var n,a,u=new o(setTimeout(function(){n.isPending()&&c(n,t,a)},e));return r.cancellation()?(a=this.then(),n=a._then(s,i,void 0,u,void 0),n._setOnCancel(u)):n=this._then(s,i,void 0,u,void 0),n}}},{"./util":36}],35:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,s,i){function a(e){setTimeout(function(){throw e},0)}function u(e){var t=r(e);return t!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}function l(e,n){function o(){if(i>=l)return d._fulfill();var s=u(e[i++]);if(s instanceof t&&s._isDisposable()){try{s=r(s._getDisposer().tryDispose(n),e.promise)}catch(e){return a(e)}if(s instanceof t)return s._then(o,a,null,null,null)}o()}var i=0,l=e.length,d=new t(s);return o(),d}function d(e,t,n){this._data=e,this._promise=t,this._context=n}function c(e,t,n){this.constructor$(e,t,n)}function f(e){return d.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function m(e){this.length=e,this.promise=null,this[e-1]=null}var _=e("./util"),h=e("./errors").TypeError,p=e("./util").inherits,y=_.errorObj,g=_.tryCatch,v={};d.prototype.data=function(){return this._data},d.prototype.promise=function(){return this._promise},d.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():v},d.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=t!==v?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},d.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},p(c,d),c.prototype.doDispose=function(e,t){return this.data().call(e,e,t)},m.prototype._resultCancelled=function(){for(var e=this.length,n=0;n0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(e){if("function"==typeof e)return new c(e,this,o());throw new h}}},{"./errors":12,"./util":36}],36:[function(e,r,o){"use strict";function s(){try{var e=E;return E=null,e.apply(this,arguments)}catch(e){return S.e=e,S}}function i(e){return E=e,s}function a(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function u(e){return"function"==typeof e||"object"==typeof e&&null!==e}function l(e){return a(e)?new Error(g(e)):e}function d(e,t){var n,r=e.length,o=new Array(r+1);for(n=0;n1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),o=H.test(e+"")&&x.names(e).length>0;if(n||r||o)return!0}return!1}catch(e){return!1}}function h(e){function t(){}function n(){return typeof r.foo}t.prototype=e;var r=new t;return n(),n(),e}function p(e){return A.test(e)}function y(e,t,n){for(var r=new Array(e),o=0;o10||e[0]>0}(),U.isNode&&U.toFastProperties(t);try{throw new Error}catch(e){U.lastLineError=e}r.exports=U},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(t,n("../node_modules/process/browser.js"),n("../node_modules/webpack/buildin/global.js"),n("../node_modules/timers-browserify/main.js").setImmediate)},"../node_modules/buffer/index.js":function(e,t,n){"use strict";(function(e){function r(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function h(e){return+e!=e&&(e=0),s.alloc(+e)}function p(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return x(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return Y(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){function s(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}var i=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;i=2,a/=2,u/=2,n/=2}var l;if(o){var d=-1;for(l=n;la&&(n=a-u),l=n;l>=0;l--){for(var c=!0,f=0;fo&&(r=o):r=o;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var i=0;i239?4:s>223?3:s>191?2:1;if(o+a<=n){var u,l,d,c;switch(a){case 1:s<128&&(i=s);break;case 2:u=e[o+1],128==(192&u)&&(c=(31&s)<<6|63&u)>127&&(i=c);break;case 3:u=e[o+1],l=e[o+2],128==(192&u)&&128==(192&l)&&(c=(15&s)<<12|(63&u)<<6|63&l)>2047&&(c<55296||c>57343)&&(i=c);break;case 4:u=e[o+1],l=e[o+2],d=e[o+3],128==(192&u)&&128==(192&l)&&128==(192&d)&&(c=(15&s)<<18|(63&u)<<12|(63&l)<<6|63&d)>65535&&c<1114112&&(i=c)}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return D(r)}function D(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function H(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function A(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function N(e,t,n,r,o,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,o){return o||N(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,n,r,23,4),n+4}function I(e,t,n,r,o){return o||N(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,n,r,52,8),n+8}function W(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var n,r=e.length,o=null,s=[],i=0;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(i+1===r){(t-=3)>-1&&s.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function B(e){for(var t=[],n=0;n>8,o=n%256,s.push(o),s.push(r);return s}function G(e){return K.toByteArray(W(e))}function J(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e){return e!==e}/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh
* @license MIT
*/
-var K=n("../node_modules/base64-js/index.js"),Q=n("../node_modules/ieee754/index.js"),X=n("../node_modules/isarray/index.js");t.Buffer=i,t.SlowBuffer=h,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,n){return s(null,e,t,n)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,n){return u(null,e,t,n)},i.allocUnsafe=function(e){return l(null,e)},i.allocUnsafeSlow=function(e){return l(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,s=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,o){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var s=o-r,a=n-t,u=Math.min(s,a),l=this.slice(r,o),d=e.slice(t,n),c=0;co)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return M(this,e,t,n);case"utf8":case"utf-8":return j(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return L(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)r+=this[e+--t]*o;return r},i.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],o=1,i=0;++i=o&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){H(this,e,t,n,Math.pow(2,8*n)-1,0)}var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);H(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);H(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(s<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;sd;)if((a=u[d++])!=a)return!0}else for(;l>d;d++)if((e||d in u)&&u[d]===n)return e||d||0;return!e&&-1}}},"../node_modules/core-js/library/modules/_classof.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_cof.js"),o=n("../node_modules/core-js/library/modules/_wks.js")("toStringTag"),i="Arguments"==r(function(){return arguments}()),s=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=s(t=Object(e),o))?n:i?r(t):"Object"==(a=r(t))&&"function"==typeof t.callee?"Arguments":a}},"../node_modules/core-js/library/modules/_cof.js":function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},"../node_modules/core-js/library/modules/_core.js":function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},"../node_modules/core-js/library/modules/_ctx.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_a-function.js");e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},"../node_modules/core-js/library/modules/_defined.js":function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},"../node_modules/core-js/library/modules/_descriptors.js":function(e,t,n){e.exports=!n("../node_modules/core-js/library/modules/_fails.js")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},"../node_modules/core-js/library/modules/_dom-create.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_is-object.js"),o=n("../node_modules/core-js/library/modules/_global.js").document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},"../node_modules/core-js/library/modules/_enum-bug-keys.js":function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"../node_modules/core-js/library/modules/_enum-keys.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_object-keys.js"),o=n("../node_modules/core-js/library/modules/_object-gops.js"),i=n("../node_modules/core-js/library/modules/_object-pie.js");e.exports=function(e){var t=r(e),n=o.f;if(n)for(var s,a=n(e),u=i.f,l=0;a.length>l;)u.call(e,s=a[l++])&&t.push(s);return t}},"../node_modules/core-js/library/modules/_export.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_global.js"),o=n("../node_modules/core-js/library/modules/_core.js"),i=n("../node_modules/core-js/library/modules/_ctx.js"),s=n("../node_modules/core-js/library/modules/_hide.js"),a=n("../node_modules/core-js/library/modules/_has.js"),u=function(e,t,n){var l,d,c,m=e&u.F,f=e&u.G,_=e&u.S,h=e&u.P,p=e&u.B,y=e&u.W,g=f?o:o[t]||(o[t]={}),v=g.prototype,b=f?r:_?r[t]:(r[t]||{}).prototype;f&&(n=t);for(l in n)(d=!m&&b&&void 0!==b[l])&&a(g,l)||(c=d?b[l]:n[l],g[l]=f&&"function"!=typeof b[l]?n[l]:p&&d?i(c,r):y&&b[l]==c?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(c):h&&"function"==typeof c?i(Function.call,c):c,h&&((g.virtual||(g.virtual={}))[l]=c,e&u.R&&v&&!v[l]&&s(v,l,c)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},"../node_modules/core-js/library/modules/_fails.js":function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},"../node_modules/core-js/library/modules/_for-of.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_ctx.js"),o=n("../node_modules/core-js/library/modules/_iter-call.js"),i=n("../node_modules/core-js/library/modules/_is-array-iter.js"),s=n("../node_modules/core-js/library/modules/_an-object.js"),a=n("../node_modules/core-js/library/modules/_to-length.js"),u=n("../node_modules/core-js/library/modules/core.get-iterator-method.js"),l={},d={},t=e.exports=function(e,t,n,c,m){var f,_,h,p,y=m?function(){return e}:u(e),g=r(n,c,t?2:1),v=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(i(y)){for(f=a(e.length);f>v;v++)if((p=t?g(s(_=e[v])[0],_[1]):g(e[v]))===l||p===d)return p}else for(h=y.call(e);!(_=h.next()).done;)if((p=o(h,g,_.value,t))===l||p===d)return p};t.BREAK=l,t.RETURN=d},"../node_modules/core-js/library/modules/_global.js":function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"../node_modules/core-js/library/modules/_has.js":function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},"../node_modules/core-js/library/modules/_hide.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_object-dp.js"),o=n("../node_modules/core-js/library/modules/_property-desc.js");e.exports=n("../node_modules/core-js/library/modules/_descriptors.js")?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},"../node_modules/core-js/library/modules/_html.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_global.js").document;e.exports=r&&r.documentElement},"../node_modules/core-js/library/modules/_ie8-dom-define.js":function(e,t,n){e.exports=!n("../node_modules/core-js/library/modules/_descriptors.js")&&!n("../node_modules/core-js/library/modules/_fails.js")(function(){return 7!=Object.defineProperty(n("../node_modules/core-js/library/modules/_dom-create.js")("div"),"a",{get:function(){return 7}}).a})},"../node_modules/core-js/library/modules/_invoke.js":function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},"../node_modules/core-js/library/modules/_iobject.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_cof.js");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},"../node_modules/core-js/library/modules/_is-array-iter.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_iterators.js"),o=n("../node_modules/core-js/library/modules/_wks.js")("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},"../node_modules/core-js/library/modules/_is-array.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_cof.js");e.exports=Array.isArray||function(e){return"Array"==r(e)}},"../node_modules/core-js/library/modules/_is-object.js":function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},"../node_modules/core-js/library/modules/_iter-call.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_an-object.js");e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},"../node_modules/core-js/library/modules/_iter-create.js":function(e,t,n){"use strict";var r=n("../node_modules/core-js/library/modules/_object-create.js"),o=n("../node_modules/core-js/library/modules/_property-desc.js"),i=n("../node_modules/core-js/library/modules/_set-to-string-tag.js"),s={};n("../node_modules/core-js/library/modules/_hide.js")(s,n("../node_modules/core-js/library/modules/_wks.js")("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(s,{next:o(1,n)}),i(e,t+" Iterator")}},"../node_modules/core-js/library/modules/_iter-define.js":function(e,t,n){"use strict";var r=n("../node_modules/core-js/library/modules/_library.js"),o=n("../node_modules/core-js/library/modules/_export.js"),i=n("../node_modules/core-js/library/modules/_redefine.js"),s=n("../node_modules/core-js/library/modules/_hide.js"),a=n("../node_modules/core-js/library/modules/_iterators.js"),u=n("../node_modules/core-js/library/modules/_iter-create.js"),l=n("../node_modules/core-js/library/modules/_set-to-string-tag.js"),d=n("../node_modules/core-js/library/modules/_object-gpo.js"),c=n("../node_modules/core-js/library/modules/_wks.js")("iterator"),m=!([].keys&&"next"in[].keys()),f=function(){return this};e.exports=function(e,t,n,_,h,p,y){u(n,t,_);var g,v,b,M=function(e){if(!m&&e in k)return k[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},j=t+" Iterator",w="values"==h,L=!1,k=e.prototype,T=k[c]||k["@@iterator"]||h&&k[h],Y=T||M(h),x=h?w?M("entries"):Y:void 0,D="Array"==t?k.entries||T:T;if(D&&(b=d(D.call(new e)))!==Object.prototype&&b.next&&(l(b,j,!0),r||"function"==typeof b[c]||s(b,c,f)),w&&T&&"values"!==T.name&&(L=!0,Y=function(){return T.call(this)}),r&&!y||!m&&!L&&k[c]||s(k,c,Y),a[t]=Y,a[j]=f,h)if(g={values:w?Y:M("values"),keys:p?Y:M("keys"),entries:x},y)for(v in g)v in k||i(k,v,g[v]);else o(o.P+o.F*(m||L),t,g);return g}},"../node_modules/core-js/library/modules/_iter-detect.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_wks.js")("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i=[7],s=i[r]();s.next=function(){return{done:n=!0}},i[r]=function(){return s},e(i)}catch(e){}return n}},"../node_modules/core-js/library/modules/_iter-step.js":function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},"../node_modules/core-js/library/modules/_iterators.js":function(e,t){e.exports={}},"../node_modules/core-js/library/modules/_library.js":function(e,t){e.exports=!0},"../node_modules/core-js/library/modules/_meta.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_uid.js")("meta"),o=n("../node_modules/core-js/library/modules/_is-object.js"),i=n("../node_modules/core-js/library/modules/_has.js"),s=n("../node_modules/core-js/library/modules/_object-dp.js").f,a=0,u=Object.isExtensible||function(){return!0},l=!n("../node_modules/core-js/library/modules/_fails.js")(function(){return u(Object.preventExtensions({}))}),d=function(e){s(e,r,{value:{i:"O"+ ++a,w:{}}})},c=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!u(e))return"F";if(!t)return"E";d(e)}return e[r].i},m=function(e,t){if(!i(e,r)){if(!u(e))return!0;if(!t)return!1;d(e)}return e[r].w},f=function(e){return l&&_.NEED&&u(e)&&!i(e,r)&&d(e),e},_=e.exports={KEY:r,NEED:!1,fastKey:c,getWeak:m,onFreeze:f}},"../node_modules/core-js/library/modules/_microtask.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_global.js"),o=n("../node_modules/core-js/library/modules/_task.js").set,i=r.MutationObserver||r.WebKitMutationObserver,s=r.process,a=r.Promise,u="process"==n("../node_modules/core-js/library/modules/_cof.js")(s);e.exports=function(){var e,t,n,l=function(){var r,o;for(u&&(r=s.domain)&&r.exit();e;){o=e.fn,e=e.next;try{o()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(u)n=function(){s.nextTick(l)};else if(!i||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var d=a.resolve(void 0);n=function(){d.then(l)}}else n=function(){o.call(r,l)};else{var c=!0,m=document.createTextNode("");new i(l).observe(m,{characterData:!0}),n=function(){m.data=c=!c}}return function(r){var o={fn:r,next:void 0};t&&(t.next=o),e||(e=o,n()),t=o}}},"../node_modules/core-js/library/modules/_new-promise-capability.js":function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=o(t),this.reject=o(n)}var o=n("../node_modules/core-js/library/modules/_a-function.js");e.exports.f=function(e){return new r(e)}},"../node_modules/core-js/library/modules/_object-assign.js":function(e,t,n){"use strict";var r=n("../node_modules/core-js/library/modules/_object-keys.js"),o=n("../node_modules/core-js/library/modules/_object-gops.js"),i=n("../node_modules/core-js/library/modules/_object-pie.js"),s=n("../node_modules/core-js/library/modules/_to-object.js"),a=n("../node_modules/core-js/library/modules/_iobject.js"),u=Object.assign;e.exports=!u||n("../node_modules/core-js/library/modules/_fails.js")(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=u({},e)[n]||Object.keys(u({},t)).join("")!=r})?function(e,t){for(var n=s(e),u=arguments.length,l=1,d=o.f,c=i.f;u>l;)for(var m,f=a(arguments[l++]),_=d?r(f).concat(d(f)):r(f),h=_.length,p=0;h>p;)c.call(f,m=_[p++])&&(n[m]=f[m]);return n}:u},"../node_modules/core-js/library/modules/_object-create.js":function(e,t,n){var r=n("../node_modules/core-js/library/modules/_an-object.js"),o=n("../node_modules/core-js/library/modules/_object-dps.js"),i=n("../node_modules/core-js/library/modules/_enum-bug-keys.js"),s=n("../node_modules/core-js/library/modules/_shared-key.js")("IE_PROTO"),a=function(){},u=function(){var e,t=n("../node_modules/core-js/library/modules/_dom-create.js")("iframe"),r=i.length;for(t.style.display="none",n("../node_modules/core-js/library/modules/_html.js").appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("
diff --git a/src/index.html b/src/index.html
index e81427c..f149702 100644
--- a/src/index.html
+++ b/src/index.html
@@ -3,7 +3,7 @@
<% if (htmlWebpackPlugin.options.cordova) { %>
-
+
<% } %>
Relaks WordPress Example
diff --git a/src/main.js b/src/main.js
index 1e96844..20bb816 100644
--- a/src/main.js
+++ b/src/main.js
@@ -8,22 +8,20 @@ import RouteManager from 'relaks-route-manager';
import { harvest } from 'relaks-harvest';
import Relaks, { plant } from 'relaks';
-const pageBasePath = '';
-
-if (typeof(window) === 'object') {
+if (process.env.TARGET === 'browser') {
async function initialize(evt) {
// create data source
let host = process.env.DATA_HOST || `${location.protocol}//${location.host}`;
+ let basePath = process.env.BASE_PATH;
let dataSource = new WordpressDataSource({
- baseURL: `${host}/json`,
+ baseURL: host + basePath + 'json',
});
dataSource.activate();
// create route manager
let routeManager = new RouteManager({
routes,
- basePath: pageBasePath,
- preloadingDelay: 2000,
+ basePath,
useHashFallback: (location.host === ''),
});
routeManager.addEventListener('beforechange', (evt) => {
@@ -46,7 +44,7 @@ if (typeof(window) === 'object') {
render(csrElement, container);
// check for changes periodically
- let mtimeURL = `${host}/.mtime`;
+ let mtimeURL = host + basePath + '.mtime';
let mtimeLast;
for (;;) {
try {
@@ -66,17 +64,18 @@ if (typeof(window) === 'object') {
}
window.addEventListener('load', initialize);
-} else {
+} else if (process.env.TARGET === 'node') {
async function serverSideRender(options) {
+ let basePath = process.env.BASE_PATH;
let dataSource = new WordpressDataSource({
- baseURL: `${options.host}/json`,
+ baseURL: options.host + basePath + 'json',
fetchFunc: options.fetch,
});
dataSource.activate();
let routeManager = new RouteManager({
routes,
- basePath: pageBasePath,
+ basePath,
});
routeManager.addEventListener('beforechange', (evt) => {
let route = new Route(routeManager, dataSource);
@@ -90,4 +89,5 @@ if (typeof(window) === 'object') {
}
exports.render = serverSideRender;
+ exports.basePath = process.env.BASE_PATH;
}
diff --git a/webpack.config.js b/webpack.config.js
index 2222bda..4cbb942 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -9,16 +9,19 @@ var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var ExtractTextPlugin = require("extract-text-webpack-plugin");
-var event = process.env.npm_lifecycle_event;
-var devDataHost = 'http://localhost:8000';
-var cordovaDataHost = process.env.CORDOVA_DATA_HOST;
+var EVENT = process.env.npm_lifecycle_event;
+var BUILD = (EVENT === 'build') ? 'production' : 'development';
+var IS_DEV_SERVER = process.argv.find((arg) => { return arg.includes('webpack-dev-server') });
+var DEV_DATA_HOST = (IS_DEV_SERVER) ? 'http://localhost:8000' : undefined;
+var CORDOVA_DATA_HOST = process.env.CORDOVA_DATA_HOST;
+var BASE_PATH = '/';
var clientConfig = {
context: Path.resolve('./src'),
entry: './main',
output: {
path: Path.resolve('./server/www'),
- publicPath: '/',
+ publicPath: BASE_PATH,
filename: 'front-end.js',
},
resolve: {
@@ -65,15 +68,21 @@ var clientConfig = {
]
},
plugins: [
+ new DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify(BUILD),
+ 'process.env.TARGET': JSON.stringify('browser'),
+ 'process.env.DATA_HOST': JSON.stringify(DEV_DATA_HOST),
+ 'process.env.BASE_PATH': JSON.stringify(BASE_PATH),
+ }),
new NamedChunksPlugin,
new NamedModulesPlugin,
new BundleAnalyzerPlugin({
- analyzerMode: (event === 'build') ? 'static' : 'disabled',
+ analyzerMode: (EVENT === 'build') ? 'static' : 'disabled',
reportFilename: `report.html`,
}),
new ExtractTextPlugin("styles.css"),
],
- devtool: (event === 'build') ? false : 'inline-source-map',
+ devtool: (EVENT === 'build') ? false : 'inline-source-map',
};
var serverConfig = {
@@ -82,13 +91,19 @@ var serverConfig = {
target: 'node',
output: {
path: Path.resolve('./server/client'),
- publicPath: '/',
+ publicPath: BASE_PATH,
filename: 'front-end.js',
libraryTarget: 'commonjs2',
},
resolve: clientConfig.resolve,
module: clientConfig.module,
plugins: [
+ new DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify(BUILD),
+ 'process.env.TARGET': JSON.stringify('node'),
+ 'process.env.DATA_HOST': JSON.stringify(undefined),
+ 'process.env.BASE_PATH': JSON.stringify(BASE_PATH),
+ }),
new NamedChunksPlugin,
new NamedModulesPlugin,
new HtmlWebpackPlugin({
@@ -111,62 +126,53 @@ var cordovaConfig = {
resolve: clientConfig.resolve,
module: clientConfig.module,
plugins: [
+ new DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify(BUILD),
+ 'process.env.TARGET': JSON.stringify('browser'),
+ 'process.env.DATA_HOST': JSON.stringify(CORDOVA_DATA_HOST),
+ 'process.env.BASE_PATH': JSON.stringify(BASE_PATH),
+ }),
new NamedChunksPlugin,
new NamedModulesPlugin,
new HtmlWebpackPlugin({
template: Path.resolve(`./src/index.html`),
filename: 'index.html',
cordova: true,
+ host: CORDOVA_DATA_HOST
}),
new ExtractTextPlugin('styles.css'),
],
devtool: clientConfig.devtool,
};
-var configs = module.exports = [ clientConfig, serverConfig ];
+var configs = module.exports = [];
-var isDevServer = process.argv.find((arg) => {
- return arg.includes('webpack-dev-server') ;
-});
-if (isDevServer) {
- // remove server config
- configs.pop();
+if (IS_DEV_SERVER) {
// need HTML page
clientConfig.plugins.push(new HtmlWebpackPlugin({
template: Path.resolve(`./src/index.html`),
filename: 'index.html',
}));
- // set data host
- var constants = {
- 'process.env.DATA_HOST': JSON.stringify(devDataHost),
- };
- clientConfig.plugins.unshift(new DefinePlugin(constants));
// config dev-server to support client-side routing
clientConfig.devServer = {
inline: true,
historyApiFallback: true,
};
+ configs.push(clientConfig);
+} else {
+ configs.push(clientConfig, serverConfig)
+ if (CORDOVA_DATA_HOST) {
+ configs.push(cordovaConfig);
+ console.log('Building for Cordova: ' + CORDOVA_DATA_HOST);
+ }
}
var constants = {};
-if (event === 'build') {
- if (cordovaDataHost) {
- configs.push(cordovaConfig);
- console.log('Building for Cordova: ' + cordovaDataHost);
- }
-
+if (EVENT === 'build') {
console.log('Optimizing JS code');
configs.forEach((config) => {
- // set NODE_ENV to production
- var dataHost = (config === cordovaConfig) ? cordovaDataHost : undefined;
- var constants = {
- 'process.env.NODE_ENV': JSON.stringify('production'),
- 'process.env.DATA_HOST': JSON.stringify(dataHost),
- };
- config.plugins.unshift(new DefinePlugin(constants));
-
// use Uglify to remove dead-code
- config.plugins.unshift(new UglifyJSPlugin({
+ config.plugins.push(new UglifyJSPlugin({
uglifyOptions: {
compress: {
drop_console: true,