/* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2017 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ /** * bluebird build version 3.5.0 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each */ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=a},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,s,void 0,u,h),l._then(a,c,void 0,u,h),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+H.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function s(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?H.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function a(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function f(){this._trace=new S(this._peekContext())}function _(t,e){if(N(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=j(t);H.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),H.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&W){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=w(a),l=c.length-1;l>=0;--l){var u=c[l];if(!U.test(u)){var p=u.match(M);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var h=c[0],l=0;l0&&(s="\n"+a[l-1]);break}}var f="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(f,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new L(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=j(o);o.stack=s.message+"\n"+s.stack.join("\n")}tt("warning",o)||E(o,"",!0)}}function m(t,e){for(var n=0;n=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function w(t){for(var e=[],n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function j(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?C(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:w(e)}}function E(t,e,n){if("undefined"!=typeof console){var r;if(H.isObject(t)){var i=t.stack;r=e+Q(i,t)}else r=e+String(t);"function"==typeof D?D(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function k(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){I.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||E(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():H.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+x(e)+">, no stack trace)"}function x(t){var e=41;return t.lengths||0>a||!n||!r||n!==r||s>=a||(nt=function(t){if(B.test(t))return!0;var e=P(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function S(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,S),e>32&&this.uncycle()}var O,A,D,V=e._getDomain,I=e._async,L=t("./errors").Warning,H=t("./util"),N=H.canAttachTrace,B=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,U=/\((?:timers\.js):\d+:\d+\)/,M=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,Q=null,$=!1,G=!(0==H.env("BLUEBIRD_DEBUG")||!H.env("BLUEBIRD_DEBUG")&&"development"!==H.env("NODE_ENV")),z=!(0==H.env("BLUEBIRD_WARNINGS")||!G&&!H.env("BLUEBIRD_WARNINGS")),X=!(0==H.env("BLUEBIRD_LONG_STACK_TRACES")||!G&&!H.env("BLUEBIRD_LONG_STACK_TRACES")),W=0!=H.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(z||!!H.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),I.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){k("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),k("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=V();A="function"==typeof t?null===e?t:H.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=V();O="function"==typeof t?null===e?t:H.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&T()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),I.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=f,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&T()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!H.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!H.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),H.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!H.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return H.isNode?function(){return process.emit.apply(process,arguments)}:H.global?function(t){var e="on"+t.toLowerCase(),n=H.global[e];return n?(n.apply(H.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){I.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){I.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,W=ot.warnings,H.isObject(n)&&"wForgottenReturn"in n&&(W=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=a,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=s,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;H.inherits(S,Error),n.CapturedTrace=S,S.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},S.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=j(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(w(i.stack.split("\n"))),i=i._parent;b(r),g(r),H.notEnumerableProp(t,"stack",m(n,r)),H.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,Q=e;var n=Error.captureStackTrace;return nt=function(t){return B.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,Q=e,$=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(Q=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,Q=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(D=function(t){console.warn(t)},H.isNode&&process.stderr.isTTY?D=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:H.isNode||"string"!=typeof(new Error).stack||(D=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:z,longStackTraces:!1,cancellation:!1,monitoring:!1};return X&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return h},checkForgottenReturns:d,setBounds:R,warn:y,deprecated:v,CapturedTrace:S,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,h=r("Warning","warning"),f=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),m=0;m1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return l.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(h.e=t,h)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var f=n(u,i);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),h.e=_,h}f.isPending()&&f._attachCancellationCallback(new o(this))}return f._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),h.e=t,h):(s(this),t)}var u=t("./util"),p=e.CancellationError,h=u.errorObj,f=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!u.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(f(i,a,this),1,void 0,l)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();var i=l();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var l=e._getDomain,u=t("./util"),p=u.tryCatch,h=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var l=this._promise,u=this._callback,f=l._boundValue();l._pushContext();var _=p(u).call(f,t,n,o),d=l._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",l),_===h)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var m=++this._totalResolved;return m>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlighto;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return p("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(x.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,w,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new E(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=O(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new E(t).promise()},i.cast=function(t){var e=j(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(b),l=this._target(),u=l._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var p=c();if(0!==(50397184&u)){var h,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,h=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,h=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),h=e),v.invoke(d,l,{handler:null===p?h:"function"==typeof h&&f.domainBind(p,h),promise:a,receiver:r,value:_})}else l._addCallbacks(t,e,a,r,p);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(t){this._bitField=-65536&this._bitField|65535&t},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(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===h?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=h),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=h),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:f.domainBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:f.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=j(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new g("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&x.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===w?n&&"number"==typeof n.length?o=O(t).apply(this._boundValue(),n):(o=S,o.e=new m("cannot .spread() a non-array: "+f.classString(n))):o=O(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===C?r._reject(n):o===S?r._rejectCallback(o.e,!1):(x.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,O(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof E?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,f.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){x.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,j,p,x),t("./bind")(i,b,j,x),t("./cancel")(i,E,p,x),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,E,j,b,v,c),i.Promise=i,i.version="3.5.0",t("./map.js")(i,E,p,j,b,x),t("./call_get.js")(i),t("./using.js")(i,p,j,F,b,x),t("./timers.js")(i,b,x),t("./generators.js")(i,p,b,j,n,x),t("./nodeify.js")(i),t("./promisify.js")(i,b),t("./props.js")(i,E,j,p),t("./race.js")(i,b,j,p),t("./reduce.js")(i,E,p,j,b,x),t("./settle.js")(i,E,x),t("./some.js")(i,E,p),t("./filter.js")(i,b),t("./each.js")(i,b),t("./any.js")(i),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(b)),x.setBounds(d.firstLineError,f.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(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nc;c+=2){var u=s[c],p=s[c+1],_=u+e;if(r===k)t[_]=k(u,h,u,p,e,i);else{var d=r(p,function(){return k(u,h,u,p,e,i)});f.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return f.toFastProperties(t),t}function u(t,e,n){return k(t,e,void 0,t,null,n)}var p,h={},f=t("./util"),_=t("./nodeback"),d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,m=t("./errors").TypeError,g="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},E=function(t){return t.replace(/([$])/,"\\$")},k=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?h:e.context,o=!!e.multiArgs,s=u(t,n,o);return f.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new m("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=g);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=k),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=f.inheritedDataKeys(t),a=0;ao;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return l(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),l=c.isObject,u=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),h=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=h(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacityh;++h){var _=t[h];(void 0!==_||h in t)&&e.cast(_)._then(u,p,void 0,l,null)}return l}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=h();this._fn=null===s?n:f.domainBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function u(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=_(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var h=e._getDomain,f=t("./util"),_=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;if(void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;i>r;++r){var o={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(u,void 0,void 0,o,void 0)}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return l(this,t,e,null)},e.reduce=function(t,e,n,r){return l(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){var l=s.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o:function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t), this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,l=s.isArray,u={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=l(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.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=e.prototype.error=e.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()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),u=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,h=c.tryCatch(r).call(t,o,s);return p=!1,a&&h===l&&(a._rejectCallback(h.e,!0,!0),a=null),u}var c=t("./util"),l=c.errorObj,u=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(l,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return u(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function l(t,n){function i(){if(s>=l)return u._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,l=t.length,u=new e(o);return i(),u}function u(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function h(t){return u.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function f(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,m=_.tryCatch,g={};u.prototype.data=function(){return this._data},u.prototype.promise=function(){return this._promise},u.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():g},u.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==g?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},u.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,u),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},f.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new f(t),p=0;t>p;++p){var d=o[p];if(u.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var g=r(d);g instanceof e&&(d=g._then(h,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function h(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function f(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return D.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function m(t){try{u(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i10||t[0]>0}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(U){B.lastLineError=U}e.exports=B},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var ConnectivityDiagnosticsManager = (function () { function ConnectivityDiagnosticsManager(mode) { if (mode === void 0) { mode = DiagnosticsInitializationMode.FGDiag; } this.RENDER_MODE_IMAGES = "Images"; this.EVENTS_TIMEOUT = { BeginTest: 0, IndexHtmlRequest: 8000, BasicApplicationResourceLoad: 4000, ApplicationResourceLoad: 16000, SharedDomainRequest: 10000, ConnectionToServer: 10000, LoadingStateChange: 10000, RectangleUpdate: 10000 }; this.isFailed = false; var mode = this.getDiagnosticsInitializationMode(); switch (mode) { case DiagnosticsInitializationMode.ImageProd: this.finalEvent = DiagnosticsEvent.SharedDomainRequest; break; case DiagnosticsInitializationMode.ImageDev: this.finalEvent = DiagnosticsEvent.SharedDomainRequest; break; case DiagnosticsInitializationMode.LayoutTreeProd: this.finalEvent = DiagnosticsEvent.SharedDomainRequest; break; case DiagnosticsInitializationMode.LayoutTreeDev: this.finalEvent = DiagnosticsEvent.SharedDomainRequest; break; case DiagnosticsInitializationMode.FGDiag: default: this.finalEvent = DiagnosticsEvent.RectangleUpdate; break; } this.updateEventsTimeout(mode); this.createStageMappings(); } ConnectivityDiagnosticsManager.prototype.startDiagnostics = function (startingPoint) { if (startingPoint === void 0) { startingPoint = DiagnosticsEvent.BeginTest; } this.clearStageTimeout(); this.diagnosticsData = {}; this.setManagerRunning(); this.lastSuccessfulStage = startingPoint != DiagnosticsEvent.BeginTest ? this.diagnosticsStages[startingPoint - 1] : null; this.onDiagnosticsEvent(startingPoint); }; ConnectivityDiagnosticsManager.prototype.setHandler = function (handler) { this.diagnosticsHandler = handler; }; ConnectivityDiagnosticsManager.prototype.isRelevantDiagnosticsDataType = function (diagnosticsDataType) { switch (diagnosticsDataType) { case DiagnosticsDataType.MainUrl: case DiagnosticsDataType.HostName: case DiagnosticsDataType.ApplicationServer: case DiagnosticsDataType.ApplicationPort: case DiagnosticsDataType.Transport: case DiagnosticsDataType.IsHttpOnly: case DiagnosticsDataType.ResourceServer: case DiagnosticsDataType.SharedDomainHosts: case DiagnosticsDataType.ProxyVerdict: case DiagnosticsDataType.ProxyHttpVerdict: case DiagnosticsDataType.ProxyHttpsVerdict: case DiagnosticsDataType.ResourceServerConnectivity: case DiagnosticsDataType.ResourceServerHttpVerdict: case DiagnosticsDataType.ResourceServerHttpsVerdict: case DiagnosticsDataType.AdblockDetectionEnabled: return true; default: return false; } }; ConnectivityDiagnosticsManager.prototype.onDiagnosticsData = function (dataType, data) { if (!this.isRelevantDiagnosticsDataType(dataType)) { return; } this.diagnosticsData[dataType] = data; }; ConnectivityDiagnosticsManager.prototype.onDiagnosticsError = function (_error, _data) { this.stopDiagnostic(); }; ConnectivityDiagnosticsManager.prototype.onDiagnosticsEvent = function (event) { var stage = this.diagnosticsStages[event]; if (!stage) { this.stopDiagnostic(); return; } if (this.getNextStage(this.lastSuccessfulStage) !== stage && event !== this.finalEvent) { return; } if (this.isFailed) { this.setManagerRunning(); } if (!this.isRunning) { return; } this.lastSuccessfulStage = stage; if (this.diagnosticsHandler) { this.diagnosticsHandler.onStagePassed(this.diagnosticsStagesToStepsMap[this.lastSuccessfulStage.type], this.diagnosticsData); } if (event === this.finalEvent) { this.setManagerFinishedSuccessfully(); if (this.diagnosticsHandler) { this.diagnosticsHandler.onDiagnosticsCompleted(this.diagnosticsData); } return; } this.setStageTimeout(this.getNextStage(stage)); }; ConnectivityDiagnosticsManager.prototype.setManagerRunning = function () { this.isFailed = false; this.isRunning = true; }; ConnectivityDiagnosticsManager.prototype.setManagerFailed = function () { this.clearStageTimeout(); this.isRunning = false; this.isFailed = true; }; ConnectivityDiagnosticsManager.prototype.setManagerFinishedSuccessfully = function () { this.stopStageTimeouts(); this.isRunning = false; this.isFailed = false; }; ConnectivityDiagnosticsManager.prototype.stopStageTimeouts = function () { this.clearStageTimeout(); }; ConnectivityDiagnosticsManager.prototype.stopDiagnostic = function () { var _this = this; if (!this.isRunning) { return; } var failedStage = this.getNextStage(this.lastSuccessfulStage); if (failedStage.investigator && this.diagnosticsHandler) { failedStage.investigator.run(this.diagnosticsData).then(function (response) { if (response.error === InvestigationError.UnknownError) { if (!failedStage.failOnUnknownError) { _this.onDiagnosticsEvent(failedStage.type); return; } response.error = InvestigationError.UnknownError; } _this.setManagerFailed(); var generatedResponse = DiagnosticsResponseGenerator.generateResponse(_this.diagnosticsData, response.error); _this.isFailed = true; _this.diagnosticsHandler.onErrorDiagnosed(response.step, generatedResponse, _this.diagnosticsData); }); } }; ConnectivityDiagnosticsManager.prototype.setStageTimeout = function (stage) { var _this = this; this.clearStageTimeout(); this.nextStageTimeout = setTimeout(function () { return _this.onStageTimedOut(); }, stage.timeout); }; ConnectivityDiagnosticsManager.prototype.clearStageTimeout = function () { if (this.nextStageTimeout) { clearTimeout(this.nextStageTimeout); this.nextStageTimeout = null; } }; ConnectivityDiagnosticsManager.prototype.getNextStage = function (stage) { return this.diagnosticsStages[stage ? stage.type + 1 : DiagnosticsEvent.BeginTest]; }; ConnectivityDiagnosticsManager.prototype.onStageTimedOut = function () { this.stopDiagnostic(); }; ConnectivityDiagnosticsManager.prototype.getDiagnosticsInitializationMode = function () { if (!window.config || document.location.href.indexOf('fireglass_iframe_mode_url') !== -1) { return DiagnosticsInitializationMode.FGDiag; } if (window.config.renderingMode === this.RENDER_MODE_IMAGES) { if (window.config.isDev) { return DiagnosticsInitializationMode.ImageDev; } else { return DiagnosticsInitializationMode.ImageProd; } } else { if (window.config.isDev) { return DiagnosticsInitializationMode.LayoutTreeDev; } else { return DiagnosticsInitializationMode.LayoutTreeProd; } } }; ConnectivityDiagnosticsManager.prototype.createStageMappings = function () { var stagesArray = [ { type: DiagnosticsEvent.BeginTest, timeout: this.EVENTS_TIMEOUT.BeginTest, failOnUnknownError: true, result: false, investigator: null }, { type: DiagnosticsEvent.IndexHtmlRequest, timeout: this.EVENTS_TIMEOUT.IndexHtmlRequest, failOnUnknownError: true, result: false, investigator: new ProxyInvestigator() }, { type: DiagnosticsEvent.BasicApplicationResourceLoad, timeout: this.EVENTS_TIMEOUT.BasicApplicationResourceLoad, failOnUnknownError: false, result: false, investigator: new NodeResourcesInvestigator() }, { type: DiagnosticsEvent.ApplicationResourceLoad, timeout: this.EVENTS_TIMEOUT.ApplicationResourceLoad, failOnUnknownError: true, result: false, investigator: new NodeInvestigator() }, { type: DiagnosticsEvent.SharedDomainRequest, timeout: this.EVENTS_TIMEOUT.SharedDomainRequest, failOnUnknownError: true, result: false, investigator: new SharedDomainInvestigator() }, { type: DiagnosticsEvent.ConnectionToServer, timeout: this.EVENTS_TIMEOUT.ConnectionToServer, failOnUnknownError: true, result: false, investigator: new WebsocketInvestigator() }, { type: DiagnosticsEvent.LoadingStateChange, timeout: this.EVENTS_TIMEOUT.LoadingStateChange, failOnUnknownError: true, result: false, investigator: new InternetConnectivityInvestigator() }, { type: DiagnosticsEvent.RectangleUpdate, timeout: this.EVENTS_TIMEOUT.RectangleUpdate, failOnUnknownError: true, result: false, investigator: null } ]; this.diagnosticsStages = {}; for (var i = 0; i < stagesArray.length; ++i) { this.diagnosticsStages[stagesArray[i].type] = stagesArray[i]; } this.diagnosticsStagesToStepsMap = {}; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.BeginTest] = DiagnosticsStep.BeginTest; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.IndexHtmlRequest] = DiagnosticsStep.ProxyAccess; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.ApplicationResourceLoad] = DiagnosticsStep.ClientResourceFetch; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.SharedDomainRequest] = DiagnosticsStep.ClientSideInitialization; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.ConnectionToServer] = DiagnosticsStep.ConnectionToIsolationServer; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.LoadingStateChange] = DiagnosticsStep.ServerSidePageLoad; this.diagnosticsStagesToStepsMap[DiagnosticsEvent.RectangleUpdate] = DiagnosticsStep.FirstVisualFeed; }; ConnectivityDiagnosticsManager.prototype.updateEventsTimeout = function (mode) { try { var additionalResourceLoadingTimeout = 15000; var gracePeriodBiasFactorMs = 1000; var diagnosticsInitMode = this.getDiagnosticsInitializationMode(); var gracePeriodInMilliSeconds = diagnosticsInitMode == DiagnosticsInitializationMode.FGDiag ? 0 : Number(window.config.timeoutsBiasBase) * gracePeriodBiasFactorMs; var devMode = mode === DiagnosticsInitializationMode.LayoutTreeDev || mode === DiagnosticsInitializationMode.ImageDev; for (var event_1 in this.EVENTS_TIMEOUT) { if (gracePeriodInMilliSeconds) { this.EVENTS_TIMEOUT[event_1] += gracePeriodInMilliSeconds; } if (devMode && (event_1 === "BasicApplicationResourceLoad" || event_1 === "ApplicationResourceLoad")) { this.EVENTS_TIMEOUT[event_1] += additionalResourceLoadingTimeout; } } } catch (error) { console.log("Error in updateEventsTimeout. error: " + error.stack || error); } }; return ConnectivityDiagnosticsManager; }()); var DiagnosticsResponseGenerator = (function () { function DiagnosticsResponseGenerator() { } DiagnosticsResponseGenerator.initializeData = function () { DiagnosticsResponseGenerator.responseParameters = [ { paramName: "RESOURCE_SERVER_PARAM", dataType: DiagnosticsDataType.ResourceServer }, { paramName: "VERDICT_PARAM", dataType: DiagnosticsDataType.ProxyVerdict }, { paramName: "MAIN_URL_PARAM", dataType: DiagnosticsDataType.MainUrl }, { paramName: "APPLICATION_SERVER_PARAM", dataType: DiagnosticsDataType.ApplicationServer }, { paramName: "HOSTNAME_PARAM", dataType: DiagnosticsDataType.HostName } ]; DiagnosticsResponseGenerator.diagnosticsResponses = [ { errorName: InvestigationError[InvestigationError.ProxyConnectivityError], message: "No connectivity to the proxy server", suggestions: [ "Try restarting your browser to verify it's using the latest pac script version", "If you're using Symantec Threat Isolation as a proxy, try navigating to http://:8081/proxy.pac and verify your browser was able to download the pac script successfully", "If you're using a browser extension for your pac script configuration, try replacing it with system proxy configuration", "Make sure you have access to your proxy on port 8080 (and port 8081 if you're using Symantec Threat Isolation as a proxy server)", "If you're using Symantec Threat Isolation as a proxy, check services health on Symantec Threat Isolation proxy server by runnning `sudo fgcli services status`", ] }, { errorName: InvestigationError[InvestigationError.ProxyAuthenticationError], message: "Failed to download authenticated resource", suggestions: [ "Enable third-party cookies in your browser.", "Verify your ActiveDirectory or internal user configuration", "For Kerberos authentication verify your Keytab file" ] }, { errorName: InvestigationError[InvestigationError.ProxyCertificateError], message: "Certificate issue detected, click here and view certificate", suggestions: [ "Verify the root CA certificate is trusted by this machine", "Verify the root CA certificate configured on your proxy server is correct" ] }, { errorName: InvestigationError[InvestigationError.ProxySharedDomainCertificateError], message: "Certificate issue detected, click here and view certificate", suggestions: [ "Verify the root CA certificate is trusted by this machine", "Verify the root CA certificate configured on your proxy server is correct" ] }, { errorName: InvestigationError[InvestigationError.ProxyPolicyError], message: "The given URL MAIN_URL_PARAM resulted with the verdict VERDICT_PARAM", suggestions: [ "Try using the 'Advanced' panel in this page to modify the URL under test", "Configure your policy to Emulate MAIN_URL_PARAM URL" ] }, { errorName: InvestigationError[InvestigationError.ProxyHttpOnlyModeOnHttpsError], message: "You've tried to navigate to an HTTPS site when Symantec Threat Isolation system is configured to work in HTTP only mode", suggestions: [ "Login to your Symantec Threat Isolation Management Admin, and set 'System Configuration->Advanced Configuration->httpOnly.useSsl' to true", "Try using the 'Advanced' panel in this page to modify the URL under test to an HTTP site" ] }, { errorName: InvestigationError[InvestigationError.NodeConnectivityError], message: "Unable to download Symantec Threat Isolation client application from RESOURCE_SERVER_PARAM", suggestions: [ "Make sure your system firewall rules are configured to allow traffic on ports 80 or 443 to RESOURCE_SERVER_PARAM", "Check services health on RESOURCE_SERVER_PARAM by runnning `sudo fgcli services status`" ] }, { errorName: InvestigationError[InvestigationError.NodeHttpConnecitivityError], message: "No HTTP connectivity to RESOURCE_SERVER_PARAM", suggestions: [ "Misconfiguration between PAC file isolation server rule and the HTTP server configuration on RESOURCE_SERVER_PARAM", "Contact Symantec support for further investigation" ] }, { errorName: InvestigationError[InvestigationError.NodeCertificateError], message: "Certificate issue detected while trying to download Symantec Threat Isolation client application, click here and view certificate", suggestions: [ "Verify the server certificate on RESOURCE_SERVER_PARAM is correct and trusted by this machine" ] }, { errorName: InvestigationError[InvestigationError.NodeWebsocketConnectivityError], message: "No WebSocket connectivity to APPLICATION_SERVER_PARAM", suggestions: [ "This could be caused by an ad blocker or another browser extension blocking the websocket connection on this website.", "Otherwise, this could mean a misconfiguration between PAC file isolation server rule and the HTTP server configuration on APPLICATION_SERVER_PARAM", "Contact Symantec support for further investigation" ] }, { errorName: InvestigationError[InvestigationError.AdBlockerDomainError], message: "You are using an ad blocker.", suggestions: [ "Your ad blocker is blocking access to domains outside of HOSTNAME_PARAM, including the Symantec Threat Isolation server.", "Configure your ad blocker to allow ads on HOSTNAME_PARAM.", "If no customization options are available, disable the ad blocker temporarily to enable access to the website." ], errorPage: 'fireglass_adblock_error_page', errorPageReason: 'diagnostics_adblock_domain' }, { errorName: InvestigationError[InvestigationError.AdBlockerPathError], message: "You are using an ad blocker.", suggestions: [ "Your ad blocker is blocking access to some paths of HOSTNAME_PARAM and to other domains, including the Symantec Threat Isolation server.", "Configure your ad blocker to allow ads on HOSTNAME_PARAM.", "If no customization options are available, disable the ad blocker temporarily to enable access to the website." ], errorPage: 'fireglass_adblock_error_page', errorPageReason: 'diagnostics_adblock_path' }, { errorName: InvestigationError[InvestigationError.ThirdPartyCookiesBlocked], message: "Third-party cookies are blocked.", suggestions: [ "Enable third-party cookies in your browser.", "Contact your System Administrator or SE for further investigation." ] }, { errorName: InvestigationError[InvestigationError.DOMStorageDisabled], message: "Your DOM storage is disabled.", suggestions: [ "When using an IE browser, DOM storage must be enabled.", "Enable third-party cookies in your browser.", "Contact your System Administrator or SE for further investigation." ] }, { errorName: InvestigationError[InvestigationError.SharedDomainDirectAccess], message: "Isolation resource shareddomain.html is not accessible.", suggestions: [ "For downstream proxy topology, make sure the forwarding rules allow access to this resource.", "For classic proxy topology, make sure the PAC file is auto-generated." ] }, { errorName: InvestigationError[InvestigationError.MissingIdentityError], message: "Authentication Error - Bad Configuration. Instruction to Administrator: Web Isolation did not receive the authenticated user information for the shared-domain. Make sure to send the user information for all required Web Isolation domain.", suggestions: [ "Make sure to send the user information for all required Web Isolation domain (specifically global-shared.fire.glass and global-noauth-shared.fire.glass", "Contact your System Administrator or SE for further investigation." ] }, { errorName: InvestigationError[InvestigationError.UnknownError], message: "The webpage could not be isolated.", suggestions: [ "Contact your System Administrator or SE for further investigation." ] } ]; DiagnosticsResponseGenerator.diagnosticsResponsesMap = {}; for (var i = 0; i < DiagnosticsResponseGenerator.diagnosticsResponses.length; ++i) { DiagnosticsResponseGenerator.diagnosticsResponsesMap[InvestigationError[DiagnosticsResponseGenerator.diagnosticsResponses[i].errorName]] = DiagnosticsResponseGenerator.diagnosticsResponses[i]; } }; DiagnosticsResponseGenerator.getResponse = function (error) { var response = DiagnosticsResponseGenerator.diagnosticsResponsesMap[error]; return { errorName: response.errorName, message: response.message, suggestions: response.suggestions.slice(), errorPage: response.errorPage, errorPageReason: response.errorPageReason }; }; DiagnosticsResponseGenerator.replaceParams = function (data, response) { for (var i = 0; i < DiagnosticsResponseGenerator.responseParameters.length; ++i) { var responseParameter = DiagnosticsResponseGenerator.responseParameters[i]; response.message = response.message.replace(responseParameter.paramName, data[responseParameter.dataType] || ""); for (var j = 0; j < response.suggestions.length; ++j) { response.suggestions[j] = response.suggestions[j].replace(responseParameter.paramName, data[responseParameter.dataType] || ""); } } }; DiagnosticsResponseGenerator.generateResponse = function (data, error) { if (!DiagnosticsResponseGenerator.isInitialized) { DiagnosticsResponseGenerator.initializeData(); DiagnosticsResponseGenerator.isInitialized = true; } var response = DiagnosticsResponseGenerator.getResponse(error); DiagnosticsResponseGenerator.replaceParams(data, response); return response; }; DiagnosticsResponseGenerator.isInitialized = false; return DiagnosticsResponseGenerator; }()); var PerformanceDiagnosticsManager = (function () { function PerformanceDiagnosticsManager() { this.diagnosticsData = {}; this.connectivityDiagnosticsData = {}; } PerformanceDiagnosticsManager.prototype.reset = function () { this.diagnosticsData = {}; }; PerformanceDiagnosticsManager.prototype.collectPerformanceData = function (applicationFacade, dataHandler) { this.setHandler(dataHandler); applicationFacade.sendMessageToApplication({ type: "PerformanceTestInvocation", topic: "InvokeProfilerTest", data: null }); }; PerformanceDiagnosticsManager.prototype.onDiagnosticsData = function (dataType, data) { if (!this.isRelevantDiagnosticsDataType(dataType)) { return; } if (this.isConnectivityRelatedDiagnosticsDataType(dataType)) { this.connectivityDiagnosticsData[dataType] = data; } else { this.diagnosticsData[dataType] = data; } if (dataType === DiagnosticsDataType.PerformanceDiagnosticsResults) { if (this.diagnosticsHandler && this.diagnosticsHandler.onDiagnosticsCompleted) { var combinedData = this.combineDiagnosticsData(); this.diagnosticsHandler.onDiagnosticsCompleted(combinedData); } } }; PerformanceDiagnosticsManager.prototype.combineDiagnosticsData = function () { var combinedData = {}; for (var key in this.connectivityDiagnosticsData) { combinedData[key] = this.connectivityDiagnosticsData[key]; } for (var key in this.diagnosticsData) { combinedData[key] = this.diagnosticsData[key]; } return combinedData; }; PerformanceDiagnosticsManager.prototype.onDiagnosticsEvent = function (_event) { }; PerformanceDiagnosticsManager.prototype.onDiagnosticsError = function (_error, _data) { }; PerformanceDiagnosticsManager.prototype.setHandler = function (handler) { this.diagnosticsHandler = handler; }; PerformanceDiagnosticsManager.prototype.isConnectivityRelatedDiagnosticsDataType = function (diagnosticsDataType) { switch (diagnosticsDataType) { case DiagnosticsDataType.Latency: case DiagnosticsDataType.PageLoadProfiling: return true; default: return false; } }; PerformanceDiagnosticsManager.prototype.isPerformanceRelatedDataType = function (diagnosticsDataType) { switch (diagnosticsDataType) { case DiagnosticsDataType.FlowProfiler: case DiagnosticsDataType.BandwidthAjaxMbps: case DiagnosticsDataType.BandwidthWebsocketMbps: case DiagnosticsDataType.ClientLogsDump: case DiagnosticsDataType.PerformanceDiagnosticsResults: return true; default: return false; } }; PerformanceDiagnosticsManager.prototype.isRelevantDiagnosticsDataType = function (diagnosticsDataType) { return this.isConnectivityRelatedDiagnosticsDataType(diagnosticsDataType) || this.isPerformanceRelatedDataType(diagnosticsDataType); }; return PerformanceDiagnosticsManager; }()); var AbstractRequest = (function () { function AbstractRequest(timeout, url) { this.timeout = timeout; this.url = url; } return AbstractRequest; }()); var FetchResponse = (function () { function FetchResponse(statusCode, data) { this.statusCode = statusCode; this.data = data; } FetchResponse.prototype.is403 = function () { return this.statusCode === 403; }; FetchResponse.prototype.containsText = function (str) { if (!str) { return false; } return this.data.toLowerCase().indexOf(str.toLowerCase()) != -1; }; return FetchResponse; }()); var FetchRequest = (function (_super) { __extends(FetchRequest, _super); function FetchRequest(timeout, url) { return _super.call(this, timeout, url) || this; } FetchRequest.prototype.run = function () { var _this = this; return new Promise(function (resolve, reject) { var timeoutId = setTimeout(function () { reject(new Error("Request timed out")); }, _this.timeout); return fetch(_this.url) .then(function (response) { clearTimeout(timeoutId); return response; }) .then(function (response) { return response.text().then(function (data) { resolve(new FetchResponse(response.status, data)); }); }) .catch(function (error) { reject(error); }); }); }; return FetchRequest; }(AbstractRequest)); var FgApplicationFacade = (function () { function FgApplicationFacade() { var _this = this; var eventRegisterMethod = window.addEventListener ? 'addEventListener' : 'attachEvent'; var eventUnregisterMethod = window.removeEventListener ? 'removeEventListener' : 'detachEvent'; this.windowEventRegistrationMethod = window[eventRegisterMethod].bind(window); this.windowEventUnregistrationMethod = window[eventUnregisterMethod].bind(window); this.windowMessageEventName = eventRegisterMethod === 'attachEvent' ? 'onmessage' : 'message'; this.messageListeners = []; this.handleApplicationMessageBoundToThis = function (event) { return _this.handleApplicationMessage(event); }; } FgApplicationFacade.prototype.setApplicationFrame = function (applicationFrame) { if (this.applicationFrame) { this.unregisterMessageHandler(); } this.applicationFrame = applicationFrame; this.registerMessageHandler(); }; FgApplicationFacade.prototype.sendMessageToApplication = function (message) { this.applicationFrame.postMessage(JSON.stringify(__assign({}, message, { fg_internal: true })), "*"); }; FgApplicationFacade.prototype.handleApplicationMessage = function (event) { var message = event[event.message ? 'message' : 'data']; try { message = JSON.parse(message); if (!message) { return; } for (var _i = 0, _a = this.messageListeners; _i < _a.length; _i++) { var listener = _a[_i]; listener(message); } } catch (e) { console.log("Error in message handler. error: " + e.stack || e); } }; FgApplicationFacade.prototype.onApplicationMessage = function (handler) { this.messageListeners.push(handler); }; FgApplicationFacade.prototype.registerMessageHandler = function () { this.windowEventRegistrationMethod(this.windowMessageEventName, this.handleApplicationMessageBoundToThis, false); }; FgApplicationFacade.prototype.unregisterMessageHandler = function () { this.windowEventUnregistrationMethod(this.windowMessageEventName, this.handleApplicationMessageBoundToThis, false); }; return FgApplicationFacade; }()); var HttpRequest = (function (_super) { __extends(HttpRequest, _super); function HttpRequest(timeout, url, method) { if (method === void 0) { method = "GET"; } var _this = _super.call(this, timeout, url) || this; _this.method = method; return _this; } HttpRequest.prototype.run = function () { var _this = this; return new Promise(function (resolve, reject) { var xmlhttp; var timeout = 0; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if (timeout) { clearTimeout(timeout); timeout = 0; } if (xmlhttp.readyState == XMLHttpRequest.DONE) { if (xmlhttp.status == 200) { resolve(xmlhttp.response); } else { reject("Error: " + xmlhttp.status); } } }; xmlhttp.onerror = function (error) { reject(error); }; xmlhttp.open(_this.method, _this.url, true); xmlhttp.send(); timeout = setTimeout(function () { timeout = 0; xmlhttp.abort(); reject("Timed out"); }); }); }; return HttpRequest; }(AbstractRequest)); var JsonpRequest = (function (_super) { __extends(JsonpRequest, _super); function JsonpRequest(timeout, url, callback) { var _this = _super.call(this, timeout, url) || this; _this.callback = callback; return _this; } JsonpRequest.prototype.run = function () { if (this.callback) { return this.runWithCallback(); } else { return this.runWithoutCallback(); } }; JsonpRequest.prototype.runWithCallback = function () { var _this = this; var callbackName = 'callback' + Math.random().toString().substring(2); var url = UrlResolver.appendQueryParam(this.url, 'callback', callbackName); return new Promise(function (resolve, reject) { var timeout = setTimeout(function () { timeout = 0; reject("Request timed out"); }, _this.timeout); var script = document.createElement('script'); script.onerror = function (err) { if (timeout) { clearTimeout(timeout); timeout = 0; reject(err); } }; window[callbackName] = function (result) { if (timeout) { clearTimeout(timeout); timeout = 0; resolve(result); } }; script.src = url; document.getElementsByTagName('head')[0].appendChild(script); }); }; JsonpRequest.prototype.runWithoutCallback = function () { var _this = this; return new Promise(function (resolve, reject) { var timeout = setTimeout(function () { reject("Request timed out"); timeout = 0; }, _this.timeout); var script = document.createElement('script'); script.onload = function () { if (timeout) { clearTimeout(timeout); resolve(); } }; script.src = _this.url; document.getElementsByTagName('head')[0].appendChild(script); }); }; return JsonpRequest; }(AbstractRequest)); var UrlResolver = (function () { function UrlResolver() { } UrlResolver.getUrl = function (url, scheme) { var urlParser = document.createElement("a"); urlParser.href = url; urlParser.protocol = scheme + ":"; return urlParser.href; }; UrlResolver.appendQueryParam = function (url, key, value) { var queryParam = key + "=" + value; var urlParser = document.createElement("a"); urlParser.href = url; var search = urlParser.search || "?"; urlParser.search = search.replace("?", queryParam + "&"); return urlParser.href; }; return UrlResolver; }()); var WebsocketRequest = (function (_super) { __extends(WebsocketRequest, _super); function WebsocketRequest(timeout, url) { return _super.call(this, timeout, url) || this; } WebsocketRequest.prototype.run = function () { return Promise.resolve(); }; return WebsocketRequest; }(AbstractRequest)); var DIAGNOSTICS_DIV_NAME = "diag_error_div"; function removeDiagnosticsDiv() { var elem = document.getElementById(DIAGNOSTICS_DIV_NAME); if (elem && elem.parentNode) { elem.parentNode.removeChild(elem); } } function createDiagnosticsDiv(response, diagnosticsData) { var diagnosticsDiv = generateDivContent(response, diagnosticsData); diagnosticsDiv.align = "center"; diagnosticsDiv.style.width = "auto"; diagnosticsDiv.style["z-index"] = 2147483646; diagnosticsDiv.style.display = "inline-block"; diagnosticsDiv.style.left = '0px'; diagnosticsDiv.style.right = '0px'; diagnosticsDiv.style["text-align"] = "center"; diagnosticsDiv.style.position = "absolute"; diagnosticsDiv.style.margin = "10% auto auto"; diagnosticsDiv.id = DIAGNOSTICS_DIV_NAME; document.body.appendChild(diagnosticsDiv); } function generateDivContent(response, diagnosticsData) { var diagnosticsErrorContent = "\n \"Logo\"\n \n MESSAGE\n \n \n "; var suggestionTemplate = " SUGGESTION "; var suggestions = ""; for (var i = 0; i < response.suggestions.length; ++i) { suggestions += suggestionTemplate.replace("SUGGESTION", response.suggestions[i]); } diagnosticsErrorContent = diagnosticsErrorContent.replace("MESSAGE", response.message); diagnosticsErrorContent = diagnosticsErrorContent.replace("SUGGESTIONS", suggestions); diagnosticsErrorContent = diagnosticsErrorContent.replace("RESOURCE_SERVER_PARAM", diagnosticsData[DiagnosticsDataType.ResourceServer]); var diagnosticsDiv = document.createElement('div'); diagnosticsDiv.innerHTML = diagnosticsErrorContent; return diagnosticsDiv; } function redirectToErrorPage(page, reason) { if (location.search) { location.search += "&" + page + "=true&fireglass_error_reason=" + reason; } else { location.search = "?" + page + "=true&fireglass_error_reason=" + reason; } } function setDiagnosticsHandler() { window.diagnosticManager.setHandler({ onErrorDiagnosed: function (_step, response, diagnosticsData) { removeDiagnosticsDiv(); createDiagnosticsDiv(response, diagnosticsData); }, onStagePassed: function (_step, _diagnosticsData) { removeDiagnosticsDiv(); }, onDiagnosticsCompleted: function (_data) { } }); } setTimeout(function () { if (window.config && window.config.diagnostics && !window.diagnosticManager && document.location.href.indexOf("fgLayoutTreeSubFrameId") === -1 && document.location.href.indexOf('fireglass_iframe_mode_url') === -1) { window.diagnosticManager = new ConnectivityDiagnosticsManager(); window.diagnosticManager.startDiagnostics(DiagnosticsEvent.IndexHtmlRequest); setDiagnosticsHandler(); window.diagnosticManager.onDiagnosticsData(DiagnosticsDataType.ResourceServer, window.config.resourceServer); window.diagnosticManager.onDiagnosticsData(DiagnosticsDataType.HostName, window.location.hostname); window.diagnosticManager.onDiagnosticsData(DiagnosticsDataType.AdblockDetectionEnabled, window.config.adblockDetectionEnabled); } else if (location.href.indexOf('fireglass_iframe_mode_url') !== -1 && parent !== window && window.diagnosticManager) { setDiagnosticsHandler(); } }, 0); window.diagnosticWasLoaded = true; var AdBlockerInvestigator = (function () { function AdBlockerInvestigator() { } AdBlockerInvestigator.prototype.run = function (data) { var shouldRun = data[DiagnosticsDataType.AdblockDetectionEnabled]; if (!shouldRun) { return Promise.resolve({ error: InvestigationError.UnknownError, step: DiagnosticsStep.ClientResourceFetch }); } var mainHost = data[DiagnosticsDataType.HostName]; return Promise.join(this.runRequest(mainHost), this.runRequest(AdBlockerInvestigator.AD_BLOCKER_TEST_URL), function (mainHostResult, adblockUrlResult) { var error; if (!adblockUrlResult) { error = mainHostResult ? InvestigationError.AdBlockerDomainError : InvestigationError.AdBlockerPathError; } else { error = InvestigationError.UnknownError; } return { error: error, step: DiagnosticsStep.ClientResourceFetch }; }); }; AdBlockerInvestigator.prototype.runRequest = function (host) { return new JsonpRequest(AdBlockerInvestigator.REQUEST_TIMEOUT, location.protocol + ("//" + host + "/" + AdBlockerInvestigator.DIAGNOSTICS_QUERY_PARAM), true) .run() .then(function () { return true; }) .catch(function () { return false; }); }; AdBlockerInvestigator.REQUEST_TIMEOUT = 2000; AdBlockerInvestigator.DIAGNOSTICS_QUERY_PARAM = '?fireglass_diagnostics=true'; AdBlockerInvestigator.AD_BLOCKER_TEST_URL = 'test-ad-blocker.fire.glass'; return AdBlockerInvestigator; }()); var InternetConnectivityInvestigator = (function () { function InternetConnectivityInvestigator() { } InternetConnectivityInvestigator.prototype.run = function (_data) { return Promise.resolve({ error: InvestigationError.UnknownError, step: DiagnosticsStep.ServerSidePageLoad }); }; return InternetConnectivityInvestigator; }()); var NodeConnectivityInvestigator = (function () { function NodeConnectivityInvestigator() { } NodeConnectivityInvestigator.prototype.run = function (data) { var _this = this; var resourceServer = data[DiagnosticsDataType.ResourceServer]; return this.runRequest("https", resourceServer).catch(function (error) { if (location.href.indexOf('https') !== 0) { return _this.runRequest("http", resourceServer); } else { return Promise.reject(error); } }).then(function () { return true; }).catch(function () { return false; }).then(function (response) { _this.appendDiagnosticsData(data, response); return { error: _this.investigate(data, response), step: DiagnosticsStep.ClientResourceFetch }; }); }; NodeConnectivityInvestigator.prototype.appendDiagnosticsData = function (data, response) { data[DiagnosticsDataType.ResourceServerConnectivity] = response; }; NodeConnectivityInvestigator.prototype.investigate = function (_data, response) { if (!response) { return InvestigationError.NodeConnectivityError; } else { return InvestigationError.UnknownError; } }; NodeConnectivityInvestigator.prototype.runRequest = function (scheme, resourceServer) { return new JsonpRequest(NodeConnectivityInvestigator.REQUEST_TIMEOUT, scheme + "://" + resourceServer + "/" + NodeConnectivityInvestigator.DIAGNOSTIC_PATH).run(); }; NodeConnectivityInvestigator.DIAGNOSTIC_PATH = "diagnosticsConnectivityTest"; NodeConnectivityInvestigator.REQUEST_TIMEOUT = 2000; return NodeConnectivityInvestigator; }()); var NodeInvestigator = (function () { function NodeInvestigator() { this.adBlockerInvestigator = new AdBlockerInvestigator(); this.nodeConnectivityInvestigator = new NodeConnectivityInvestigator(); this.nodeResourcesInvestigator = new NodeResourcesInvestigator(); } NodeInvestigator.prototype.run = function (data) { var _this = this; return this.adBlockerInvestigator.run(data).then(function (response) { if (response.error === InvestigationError.UnknownError) { return _this.nodeConnectivityInvestigator.run(data); } return response; }).then(function (response) { if (response.error === InvestigationError.UnknownError) { return _this.nodeResourcesInvestigator.run(data); } return response; }); }; return NodeInvestigator; }()); var NodeResourcesInvestigator = (function () { function NodeResourcesInvestigator() { } NodeResourcesInvestigator.prototype.run = function (data) { var _this = this; var resourceServer = data[DiagnosticsDataType.ResourceServer]; return Promise.all([ this.runRequest("http", resourceServer), this.runRequest("https", resourceServer), ]).then(function (responses) { _this.appendDiagnosticsData(data, responses[0], responses[1]); return { error: _this.investigate(data, responses[0], responses[1]), step: DiagnosticsStep.ClientResourceFetch }; }); }; NodeResourcesInvestigator.prototype.appendDiagnosticsData = function (data, httpResponse, httpsResponse) { data[DiagnosticsDataType.ResourceServerHttpVerdict] = httpResponse; data[DiagnosticsDataType.ResourceServerHttpsVerdict] = httpsResponse; }; NodeResourcesInvestigator.prototype.investigate = function (data, httpResponse, httpsResponse) { var isHttpOnly = data[DiagnosticsDataType.IsHttpOnly]; if (!httpsResponse && !httpResponse) { return InvestigationError.NodeConnectivityError; } else if (!httpsResponse && !isHttpOnly && httpResponse) { return InvestigationError.NodeCertificateError; } else { return InvestigationError.UnknownError; } }; NodeResourcesInvestigator.prototype.runRequest = function (scheme, host) { if (scheme === "http" && location.href.indexOf('https') === 0) { return Promise.resolve(false); } return new JsonpRequest(NodeResourcesInvestigator.REQUEST_TIMEOUT, scheme + "://" + host + "/" + NodeResourcesInvestigator.DIAGNOSTIC_PATH).run() .then(function () { return true; }).catch(function () { return false; }); }; NodeResourcesInvestigator.DIAGNOSTIC_PATH = "diagnosticResource"; NodeResourcesInvestigator.REQUEST_TIMEOUT = 2000; return NodeResourcesInvestigator; }()); var ProxyConnectivityInvestigator = (function () { function ProxyConnectivityInvestigator() { } ProxyConnectivityInvestigator.prototype.run = function (data) { var _this = this; var url = data[DiagnosticsDataType.MainUrl]; url = UrlResolver.appendQueryParam(url, ProxyConnectivityInvestigator.DIAGNOSTICS_QUERY_PARAM, 'true'); return Promise.all([ this.runUrl(UrlResolver.getUrl(url, "http")), this.runUrl(UrlResolver.getUrl(url, "https")) ]).then(function (responses) { _this.appendDiagnosticsData(data, responses[0], responses[1]); return { error: _this.investigate(data, responses[0], responses[1]), step: DiagnosticsStep.ProxyAccess }; }); }; ProxyConnectivityInvestigator.prototype.appendDiagnosticsData = function (data, httpResponse, httpsResponse) { var url = data[DiagnosticsDataType.MainUrl]; var isHttpsScheme = url.indexOf("https://") !== -1; var proxyResponse = isHttpsScheme ? httpsResponse : httpResponse; this.overrideResponseToString(httpResponse); this.overrideResponseToString(httpsResponse); data[DiagnosticsDataType.ProxyHttpVerdict] = httpResponse; data[DiagnosticsDataType.ProxyHttpsVerdict] = httpsResponse; data[DiagnosticsDataType.ProxyVerdict] = proxyResponse.verdict || "Unkown"; }; ProxyConnectivityInvestigator.prototype.investigate = function (data, httpResponse, httpsResponse) { var url = data[DiagnosticsDataType.MainUrl]; var isHttpsScheme = url.indexOf("https://") !== -1; var isHttpOnly = httpResponse.success ? httpResponse.isHttpOnly : httpsResponse.isHttpOnly; if (!httpResponse.success && !httpsResponse.success) { return InvestigationError.ProxyConnectivityError; } else if (!httpsResponse.success && !isHttpOnly && isHttpsScheme) { return InvestigationError.ProxyCertificateError; } else { return InvestigationError.UnknownError; } }; ProxyConnectivityInvestigator.prototype.overrideResponseToString = function (response) { response.toString = function () { return response.success ? "Verdict: " + response.verdict.toUpperCase() + ", HttpOnly: " + response.isHttpOnly : "Error: " + (response.error && response.error.status ? response.error.status : "unkown error"); }; }; ProxyConnectivityInvestigator.prototype.runUrl = function (url) { return new JsonpRequest(ProxyConnectivityInvestigator.REQUEST_TIMEOUT, url, true).run() .then(function (response) { return { success: true, verdict: response.verdict.toUpperCase(), isHttpOnly: response.httpOnly, error: undefined }; }).catch(function (error) { return { success: false, verdict: '', isHttpOnly: false, error: error }; }); }; ProxyConnectivityInvestigator.DIAGNOSTICS_QUERY_PARAM = "fireglass_diagnostics"; ProxyConnectivityInvestigator.REQUEST_TIMEOUT = 2000; return ProxyConnectivityInvestigator; }()); var ProxyInvestigator = (function () { function ProxyInvestigator() { this.proxyConnectivityInvestigator = new ProxyConnectivityInvestigator(); this.proxyPolicyInvestigator = new ProxyPolicyInvestigator(); } ProxyInvestigator.prototype.run = function (data) { var _this = this; return this.proxyConnectivityInvestigator.run(data).then(function (response) { if (response.error === InvestigationError.UnknownError) { return _this.proxyPolicyInvestigator.run(data); } return response; }); }; return ProxyInvestigator; }()); var ProxyPolicyInvestigator = (function () { function ProxyPolicyInvestigator() { } ProxyPolicyInvestigator.prototype.run = function (data) { return Promise.resolve({ error: this.investigate(data), step: DiagnosticsStep.PolicyMatch }); }; ProxyPolicyInvestigator.prototype.investigate = function (data) { var url = data[DiagnosticsDataType.MainUrl]; var isHttpsScheme = url.indexOf("https://") !== -1; var httpResponse = data[DiagnosticsDataType.ProxyHttpVerdict]; var httpsResponse = data[DiagnosticsDataType.ProxyHttpsVerdict]; if (httpsResponse.success && isHttpsScheme && !httpsResponse.isHttpOnly && httpsResponse.verdict.toUpperCase() !== ProxyPolicyInvestigator.EMULATION_VERDICT) { return InvestigationError.ProxyPolicyError; } else if (httpResponse.success && !isHttpsScheme && httpResponse.verdict.toUpperCase() !== ProxyPolicyInvestigator.EMULATION_VERDICT) { return InvestigationError.ProxyPolicyError; } else if (isHttpsScheme && httpResponse && httpResponse.isHttpOnly) { return InvestigationError.ProxyHttpOnlyModeOnHttpsError; } else { return InvestigationError.UnknownError; } }; ProxyPolicyInvestigator.EMULATION_VERDICT = "EMULATE"; return ProxyPolicyInvestigator; }()); var SharedDomainInvestigator = (function () { function SharedDomainInvestigator() { this.sharedDomainInitStatus = { isSuccessful: false, errorCode: "failed_to_open_iframe" }; this.registerOnFrameMessages(this.setsharedDomainInitStatus.bind(this)); } SharedDomainInvestigator.prototype.registerOnFrameMessages = function (callback) { var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message"; window[eventMethod](messageEvent, callback, false); }; SharedDomainInvestigator.prototype.isMessageFromSharedDomain = function (message) { return message && message.data && message.data.indexOf && message.data.indexOf("isFromSharedDomain") !== -1; }; SharedDomainInvestigator.prototype.setsharedDomainInitStatus = function (message) { if (!this.isMessageFromSharedDomain(message)) { return; } var data; if (location.href.indexOf("iframe") !== -1 && location.href.indexOf("is_in_fg_diag=true") !== -1) { parent.postMessage(message.data, "*"); } try { data = JSON.parse(message.data); } catch (error) { return; } if (data.responseType === "ready" && data.sharedDomainInitStatus) { this.sharedDomainInitStatus = data.sharedDomainInitStatus; } }; SharedDomainInvestigator.prototype.run = function (data) { var _this = this; var sharedDomainHosts = data[DiagnosticsDataType.SharedDomainHosts]; var runUrlPromiseArray = []; runUrlPromiseArray.push(this.appendUrlToDocument("http", sharedDomainHosts.auth)); runUrlPromiseArray.push(this.appendUrlToDocument("https", sharedDomainHosts.auth)); if (sharedDomainHosts.noAuth) { runUrlPromiseArray.push(this.appendUrlToDocument("http", sharedDomainHosts.noAuth)); runUrlPromiseArray.push(this.appendUrlToDocument("https", sharedDomainHosts.noAuth)); } else { runUrlPromiseArray.push(Promise.resolve(true)); runUrlPromiseArray.push(Promise.resolve(true)); } runUrlPromiseArray.push(this.checkIfMissingIdentity(data, sharedDomainHosts)); return Promise.all(runUrlPromiseArray).then(function (responses) { return { error: _this.investigate(data, responses[0], responses[1], responses[2], responses[3], responses[4]), step: DiagnosticsStep.ClientSideInitialization }; }); }; SharedDomainInvestigator.prototype.checkIfMissingIdentity = function (data, sharedDomainHosts) { var scheme = new URL(data[DiagnosticsDataType.MainUrl]).protocol.replace(":", ""); var fetchPromise = this.fetchUrl(scheme, sharedDomainHosts.auth) .then(function (response) { return response.is403() && response.containsText("missing identity"); }) .catch(function () { return false; }); return fetchPromise; }; SharedDomainInvestigator.prototype.investigate = function (data, httpAuth, httpsAuth, httpNoAuth, httpsNoAuth, hasMissingIdentityError) { var url = data[DiagnosticsDataType.MainUrl]; var isHttpOnly = data[DiagnosticsDataType.IsHttpOnly]; var isHttpsScheme = url.indexOf("https://") !== -1; var http = httpNoAuth || httpAuth; var https = httpsNoAuth || httpsAuth; var auth = httpAuth || httpsAuth; var noAuth = httpNoAuth || httpsNoAuth; if (!http && (isHttpOnly || !https)) { return hasMissingIdentityError ? InvestigationError.MissingIdentityError : InvestigationError.ProxyConnectivityError; } if (!isHttpOnly && !https && http && isHttpsScheme) { return InvestigationError.ProxySharedDomainCertificateError; } if (noAuth && !auth) { return InvestigationError.ProxyAuthenticationError; } if (!this.sharedDomainInitStatus.isSuccessful) { switch (this.sharedDomainInitStatus.errorCode) { case "no_access_to_session_storage": return InvestigationError.ThirdPartyCookiesBlocked; case "no_access_to_local_storage": return InvestigationError.ThirdPartyCookiesBlocked; case "session_storage_is_undefined": return InvestigationError.DOMStorageDisabled; case "local_storage_is_undefined": return InvestigationError.DOMStorageDisabled; case "direct_access_to_shared_domain_url": return InvestigationError.SharedDomainDirectAccess; default: return InvestigationError.UnknownError; } } return InvestigationError.UnknownError; }; SharedDomainInvestigator.prototype.appendUrlToDocument = function (scheme, sharedDomainHost) { var url = scheme + "://" + sharedDomainHost + "/" + SharedDomainInvestigator.SHARED_DOMAIN_PATH; return new JsonpRequest(SharedDomainInvestigator.REQUEST_TIMEOUT, url) .run() .then(function () { return true; }) .catch(function () { return false; }); }; SharedDomainInvestigator.prototype.fetchUrl = function (scheme, sharedDomainHost) { var url = scheme + "://" + sharedDomainHost + "/" + SharedDomainInvestigator.SHARED_DOMAIN_PATH; return new FetchRequest(SharedDomainInvestigator.REQUEST_TIMEOUT, url).run(); }; SharedDomainInvestigator.SHARED_DOMAIN_PATH = "shareddomain.html"; SharedDomainInvestigator.REQUEST_TIMEOUT = 2000; return SharedDomainInvestigator; }()); var WebsocketInvestigator = (function () { function WebsocketInvestigator() { this.nodeConnectivityInvestigator = new NodeConnectivityInvestigator(); this.nodeResourcesInvestigator = new NodeResourcesInvestigator(); } WebsocketInvestigator.prototype.run = function (data) { var _this = this; var applicationServer = data[DiagnosticsDataType.ApplicationServer]; var applicationPort = data[DiagnosticsDataType.ApplicationPort]; return this.nodeConnectivityInvestigator.run(data).then(function (response) { if (response.error === InvestigationError.UnknownError) { return _this.nodeResourcesInvestigator.run(data); } return response; }).then(function (response) { if (response.error === InvestigationError.UnknownError) { return Promise.all([ _this.runWebsocketRequest("ws", applicationServer, applicationPort), _this.runWebsocketRequest("wss", applicationServer, applicationPort), ]).then(function (responses) { return { error: _this.investigate(data, responses[0], responses[1]), step: DiagnosticsStep.ConnectionToIsolationServer }; }); } return response; }).then(function (response) { if (response.error === InvestigationError.UnknownError) { response.error = InvestigationError.NodeWebsocketConnectivityError; } return response; }); }; WebsocketInvestigator.prototype.investigate = function (data, http, https) { var isHttpOnly = data[DiagnosticsDataType.IsHttpOnly]; if (!http && isHttpOnly) { return InvestigationError.NodeWebsocketConnectivityError; } else if (!https && !isHttpOnly) { return InvestigationError.NodeCertificateError; } else { return InvestigationError.UnknownError; } }; WebsocketInvestigator.prototype.runWebsocketRequest = function (scheme, applicationServer, applicationPort) { var url = scheme + "://" + applicationServer + ":" + applicationPort + "?" + WebsocketInvestigator.CONNECTIVITY_TEST_QUERY_PARAM; return new WebsocketRequest(WebsocketInvestigator.REQUEST_TIMEOUT, url).run() .then(function () { return true; }).catch(function () { return false; }); }; WebsocketInvestigator.CONNECTIVITY_TEST_QUERY_PARAM = "navigation_reason=ConnectivityTest"; WebsocketInvestigator.REQUEST_TIMEOUT = 2000; return WebsocketInvestigator; }()); var DiagnosticsDataType; (function (DiagnosticsDataType) { DiagnosticsDataType[DiagnosticsDataType["MainUrl"] = 0] = "MainUrl"; DiagnosticsDataType[DiagnosticsDataType["HostName"] = 1] = "HostName"; DiagnosticsDataType[DiagnosticsDataType["AdblockDetectionEnabled"] = 2] = "AdblockDetectionEnabled"; DiagnosticsDataType[DiagnosticsDataType["ApplicationServer"] = 3] = "ApplicationServer"; DiagnosticsDataType[DiagnosticsDataType["ApplicationPort"] = 4] = "ApplicationPort"; DiagnosticsDataType[DiagnosticsDataType["Transport"] = 5] = "Transport"; DiagnosticsDataType[DiagnosticsDataType["IsHttpOnly"] = 6] = "IsHttpOnly"; DiagnosticsDataType[DiagnosticsDataType["ResourceServer"] = 7] = "ResourceServer"; DiagnosticsDataType[DiagnosticsDataType["SharedDomainHosts"] = 8] = "SharedDomainHosts"; DiagnosticsDataType[DiagnosticsDataType["ProxyVerdict"] = 9] = "ProxyVerdict"; DiagnosticsDataType[DiagnosticsDataType["ProxyHttpVerdict"] = 10] = "ProxyHttpVerdict"; DiagnosticsDataType[DiagnosticsDataType["ProxyHttpsVerdict"] = 11] = "ProxyHttpsVerdict"; DiagnosticsDataType[DiagnosticsDataType["ResourceServerConnectivity"] = 12] = "ResourceServerConnectivity"; DiagnosticsDataType[DiagnosticsDataType["ResourceServerHttpVerdict"] = 13] = "ResourceServerHttpVerdict"; DiagnosticsDataType[DiagnosticsDataType["ResourceServerHttpsVerdict"] = 14] = "ResourceServerHttpsVerdict"; DiagnosticsDataType[DiagnosticsDataType["FlowProfiler"] = 15] = "FlowProfiler"; DiagnosticsDataType[DiagnosticsDataType["BandwidthAjaxMbps"] = 16] = "BandwidthAjaxMbps"; DiagnosticsDataType[DiagnosticsDataType["BandwidthWebsocketMbps"] = 17] = "BandwidthWebsocketMbps"; DiagnosticsDataType[DiagnosticsDataType["Latency"] = 18] = "Latency"; DiagnosticsDataType[DiagnosticsDataType["ClientLogsDump"] = 19] = "ClientLogsDump"; DiagnosticsDataType[DiagnosticsDataType["PerformanceDiagnosticsResults"] = 20] = "PerformanceDiagnosticsResults"; DiagnosticsDataType[DiagnosticsDataType["PageLoadProfiling"] = 21] = "PageLoadProfiling"; })(DiagnosticsDataType || (DiagnosticsDataType = {})); var DiagnosticsError; (function (DiagnosticsError) { DiagnosticsError[DiagnosticsError["IncompatibleBrowserDetected"] = 0] = "IncompatibleBrowserDetected"; DiagnosticsError[DiagnosticsError["ConnectionError"] = 1] = "ConnectionError"; DiagnosticsError[DiagnosticsError["InvalidDiagnosticStage"] = 2] = "InvalidDiagnosticStage"; DiagnosticsError[DiagnosticsError["StageTimedOut"] = 3] = "StageTimedOut"; })(DiagnosticsError || (DiagnosticsError = {})); var DiagnosticsEvent; (function (DiagnosticsEvent) { DiagnosticsEvent[DiagnosticsEvent["BeginTest"] = 0] = "BeginTest"; DiagnosticsEvent[DiagnosticsEvent["IndexHtmlRequest"] = 1] = "IndexHtmlRequest"; DiagnosticsEvent[DiagnosticsEvent["BasicApplicationResourceLoad"] = 2] = "BasicApplicationResourceLoad"; DiagnosticsEvent[DiagnosticsEvent["ApplicationResourceLoad"] = 3] = "ApplicationResourceLoad"; DiagnosticsEvent[DiagnosticsEvent["SharedDomainRequest"] = 4] = "SharedDomainRequest"; DiagnosticsEvent[DiagnosticsEvent["ConnectionToServer"] = 5] = "ConnectionToServer"; DiagnosticsEvent[DiagnosticsEvent["LoadingStateChange"] = 6] = "LoadingStateChange"; DiagnosticsEvent[DiagnosticsEvent["RectangleUpdate"] = 7] = "RectangleUpdate"; })(DiagnosticsEvent || (DiagnosticsEvent = {})); var DiagnosticsInitializationMode; (function (DiagnosticsInitializationMode) { DiagnosticsInitializationMode[DiagnosticsInitializationMode["ImageProd"] = 0] = "ImageProd"; DiagnosticsInitializationMode[DiagnosticsInitializationMode["ImageDev"] = 1] = "ImageDev"; DiagnosticsInitializationMode[DiagnosticsInitializationMode["FGDiag"] = 2] = "FGDiag"; DiagnosticsInitializationMode[DiagnosticsInitializationMode["LayoutTreeProd"] = 3] = "LayoutTreeProd"; DiagnosticsInitializationMode[DiagnosticsInitializationMode["LayoutTreeDev"] = 4] = "LayoutTreeDev"; })(DiagnosticsInitializationMode || (DiagnosticsInitializationMode = {})); var DiagnosticsStep; (function (DiagnosticsStep) { DiagnosticsStep[DiagnosticsStep["BeginTest"] = 0] = "BeginTest"; DiagnosticsStep[DiagnosticsStep["ProxyAccess"] = 1] = "ProxyAccess"; DiagnosticsStep[DiagnosticsStep["PolicyMatch"] = 2] = "PolicyMatch"; DiagnosticsStep[DiagnosticsStep["ClientResourceFetch"] = 3] = "ClientResourceFetch"; DiagnosticsStep[DiagnosticsStep["ClientSideInitialization"] = 4] = "ClientSideInitialization"; DiagnosticsStep[DiagnosticsStep["ConnectionToIsolationServer"] = 5] = "ConnectionToIsolationServer"; DiagnosticsStep[DiagnosticsStep["ServerSidePageLoad"] = 6] = "ServerSidePageLoad"; DiagnosticsStep[DiagnosticsStep["FirstVisualFeed"] = 7] = "FirstVisualFeed"; })(DiagnosticsStep || (DiagnosticsStep = {})); var InvestigationError; (function (InvestigationError) { InvestigationError[InvestigationError["UnknownError"] = 0] = "UnknownError"; InvestigationError[InvestigationError["MissingIdentityError"] = 1] = "MissingIdentityError"; InvestigationError[InvestigationError["ProxyConnectivityError"] = 2] = "ProxyConnectivityError"; InvestigationError[InvestigationError["ProxyCertificateError"] = 3] = "ProxyCertificateError"; InvestigationError[InvestigationError["ProxySharedDomainCertificateError"] = 4] = "ProxySharedDomainCertificateError"; InvestigationError[InvestigationError["ProxyAuthenticationError"] = 5] = "ProxyAuthenticationError"; InvestigationError[InvestigationError["ProxyPolicyError"] = 6] = "ProxyPolicyError"; InvestigationError[InvestigationError["ProxyHttpOnlyModeOnHttpsError"] = 7] = "ProxyHttpOnlyModeOnHttpsError"; InvestigationError[InvestigationError["NodeConnectivityError"] = 8] = "NodeConnectivityError"; InvestigationError[InvestigationError["NodeHttpConnecitivityError"] = 9] = "NodeHttpConnecitivityError"; InvestigationError[InvestigationError["NodeCertificateError"] = 10] = "NodeCertificateError"; InvestigationError[InvestigationError["NodeWebsocketConnectivityError"] = 11] = "NodeWebsocketConnectivityError"; InvestigationError[InvestigationError["IsolationServerInternetConnectivityError"] = 12] = "IsolationServerInternetConnectivityError"; InvestigationError[InvestigationError["AdBlockerDomainError"] = 13] = "AdBlockerDomainError"; InvestigationError[InvestigationError["AdBlockerPathError"] = 14] = "AdBlockerPathError"; InvestigationError[InvestigationError["ThirdPartyCookiesBlocked"] = 15] = "ThirdPartyCookiesBlocked"; InvestigationError[InvestigationError["DOMStorageDisabled"] = 16] = "DOMStorageDisabled"; InvestigationError[InvestigationError["SharedDomainDirectAccess"] = 17] = "SharedDomainDirectAccess"; })(InvestigationError || (InvestigationError = {}));