From 7dd83197eff59728c09cb8850fa72ed2d4dcda30 Mon Sep 17 00:00:00 2001 From: rodrigocam Date: Mon, 8 Apr 2019 11:43:38 -0300 Subject: [PATCH] Build version 0.0.4 and add to example --- build/ar-gif.min.js | 2 +- example/ar-gif.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/ar-gif.min.js b/build/ar-gif.min.js index 4b33d24..d75f9eb 100644 --- a/build/ar-gif.min.js +++ b/build/ar-gif.min.js @@ -1,2 +1,2 @@ !function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports="data:;base64,AAACgAAAAeBAgwrsW6bUSwAAAAAAAAAAQHQ3KqAAAAAAAAAAAAAAAAAAAAAAAAAAQIL0K3dHyf9AbbNowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAA/uWNa4AAAAL+3lTLAAAAAv17YFWAAAAA/VYLXIAAAAECCe0YgAAAAQIJlMOAAAABAdDcqoAAAAEBts2jAAAAAP+8OmzqkDy4="},function(t,e,n){t.exports=n(8)},function(t,e,n){(function(n,r){var i,o,s,a;/** gifler.js | github.com/themadcreator/gifler | @license: Apache-2.0 */ -!function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){if(!c&&("function"==typeof i&&i))return i(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return o(n||t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof i&&i,a=0;a=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this).map(function(n){return t.decodeFrame(e,n)})},t.decodeFramesAsync=function(e){var n;return a.map(function(){n=[];for(var t=0,r=e.numFrames();r>=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this),function(n){return t.decodeFrame(e,n)},1)},t.decodeFrame=function(t,e){var n;return(n=t.frameInfo(e)).pixels=new Uint8ClampedArray(t.width*t.height*4),t.decodeAndBlitFrameRGBA(e,n.pixels),n},t}(),r=function(){function t(t,e){var n;this._reader=t,this._frames=e,this._advanceFrame=l(this._advanceFrame,this),this._nextFrameRender=l(this._nextFrameRender,this),this._nextFrame=l(this._nextFrame,this),n=this._reader,this.width=n.width,this.height=n.height,this._loopCount=this._reader.loopCount(),this._loops=0,this._frameIndex=0,this._running=!1}return t.createBufferCanvas=function(t,e,n){var r,i,o;return i=(r=document.createElement("canvas")).getContext("2d"),r.width=t.width,r.height=t.height,(o=i.createImageData(e,n)).data.set(t.pixels),i.putImageData(o,-t.x,-t.y),r},t.prototype.start=function(){return this._lastTime=(new Date).valueOf(),this._delayCompensation=0,this._running=!0,setTimeout(this._nextFrame,0),this},t.prototype.stop=function(){return this._running=!1,this},t.prototype.reset=function(){return this._frameIndex=0,this._loops=0,this},t.prototype.running=function(){return this._running},t.prototype._nextFrame=function(){requestAnimationFrame(this._nextFrameRender)},t.prototype._nextFrameRender=function(){var t,e;if(this._running)return t=this._frames[this._frameIndex],null!=(e=this.onFrame)&&e.apply(this,[t,this._frameIndex]),this._enqueueNextFrame()},t.prototype._advanceFrame=function(){this._frameIndex+=1,this._frameIndex>=this._frames.length&&(0!==this._loopCount&&this._loopCount===this._loops?this.stop():(this._frameIndex=0,this._loops+=1))},t.prototype._enqueueNextFrame=function(){var t,e,n,r;for(this._advanceFrame();this._running;){if(n=this._frames[this._frameIndex],e=(new Date).valueOf()-this._lastTime,this._lastTime+=e,this._delayCompensation+=e,t=(r=10*n.delay)-this._delayCompensation,this._delayCompensation-=r,!(0>t)){setTimeout(this._nextFrame,t);break}this._advanceFrame()}},t.prototype.animateInCanvas=function(e,n){var r;return null==n&&(n=!0),n&&(e.width=this.width,e.height=this.height),r=e.getContext("2d"),null==this.onDrawFrame&&(this.onDrawFrame=function(t,e,n){return t.drawImage(e.buffer,e.x,e.y)}),null==this.onFrame&&(this.onFrame=function(n){return function(i,o){var s,a;switch(null==i.buffer&&(i.buffer=t.createBufferCanvas(i,n.width,n.height)),"function"==typeof n.disposeFrame&&n.disposeFrame(),i.disposal){case 2:n.disposeFrame=function(){return r.clearRect(0,0,e.width,e.height)};break;case 3:a=r.getImageData(0,0,e.width,e.height),n.disposeFrame=function(){return r.putImageData(a,0,0)};break;default:n.disposeFrame=null}return null!=(s=n.onDrawFrame)?s.apply(n,[r,i,o]):void 0}}(this)),this.start(),this},t}(),c.Gif=o,c.Decoder=i,c.Animator=r,"undefined"!=typeof window&&null!==window&&(window.gifler=c),null!=e&&(e.exports=c)},{bluebird:2,omggif:4}],2:[function(i,c,l){(function(n,i){!function(n){"object"==typeof l&&void 0!==c?c.exports=n():(s=[],void 0===(a="function"==typeof(o=n)?o.apply(e,s):o)||(t.exports=a))}(function(){return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[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=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return i(n||t)},u,u.exports,t,e,n,r)}return n[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()}},i.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},i.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},i.prototype._reset=function(){this._isTickUsed=!1},e.exports=i,e.exports.firstLineError=c},{"./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 h=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:h,bindingPromise:l};h._then(e,s,void 0,u,f),l._then(a,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(h);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";var r;"undefined"!=typeof Promise&&(r=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(t){}return i},e.exports=i},{"./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 "+s.classString(t)+" has no method '"+s.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){return n(t,this.pop()).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=t("./util"),a=s.canEvaluate;s.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;if("number"==typeof t)e=o;else if(a){var n=(void 0)(t);e=null!==n?n: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(),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))},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._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?i[t]:void 0}var r=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return 0},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promisesCreated=0,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promisesCreated;return t._promisesCreated=0,e}return 0},e.CapturedTrace=null,e.create=function(){return r?new e:void 0},e.activateLongStackTraces=function(){r=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=n,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&t._promisesCreated++}},e}},{}],9:[function(t,e,r){"use strict";e.exports=function(e,r){function i(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: "+E.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function o(t){if(!this.isCancellable())return this;var e=this._onCancel();void 0!==e?E.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function a(t){this._onCancelField=t}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function l(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 u(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new w(this._peekContext())}function f(t,e){if(T(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=_(t);E.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),E.notEnumerableProp(t,"__stackCleaned__",!0)}}}function p(t,n,r){if(B.warnings){var i,o=new x(t);if(n)r._attachExtraTrace(o);else if(B.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=_(o);o.stack=s.message+"\n"+s.stack.join("\n")}v(o,"",!0)}}function d(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:d(e)}}function v(t,e,n){if("undefined"!=typeof console){var r;if(E.isObject(t)){var i=t.stack;r=e+O(i,t)}else r=e+String(t);"function"==typeof k?k(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function y(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){F.throwLater(t)}var o=!1;try{o=U(t,n,r)}catch(t){o=!0,F.throwLater(t)}var s=!1;if(V)try{s=V(t.toLowerCase(),{reason:n,promise:r})}catch(t){s=!0,F.throwLater(t)}o||i||s||"unhandledRejection"!==t||v(n,"Unhandled rejection ")}function m(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():E.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function g(){return"function"==typeof N}function b(t){var e=t.match(L);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function w(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);N(this,w),e>32&&this.uncycle()}var A,C,k,j=e._getDomain,F=e._async,x=t("./errors").Warning,E=t("./util"),T=E.canAttachTrace,P=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,R=null,O=null,S=!1,I=!(0==E.env("BLUEBIRD_WARNINGS")),D=!(0==E.env("BLUEBIRD_LONG_STACK_TRACES"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|2097152},e.prototype._ensurePossibleRejectionHandled=function(){0==(2097152&this._bitField)&&(this._setRejectionIsUnhandled(),F.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){y("rejectionHandled",A,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),y("unhandledRejection",C,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){return p(t,e,this)},e.onPossiblyUnhandledRejection=function(t){var e=j();C="function"==typeof t?null===e?t:e.bind(t):void 0},e.onUnhandledRejectionHandled=function(t){var e=j();A="function"==typeof t?null===e?t:e.bind(t):void 0},e.longStackTraces=function(){if(F.haveItemsQueued()&&!B.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");!B.longStackTraces&&g()&&(B.longStackTraces=!0,e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=f,r.activateLongStackTraces(),F.disableTrampolineIfNecessary())},e.hasLongStackTraces=function(){return B.longStackTraces&&g()},e.config=function(t){if("longStackTraces"in(t=Object(t))&&t.longStackTraces&&e.longStackTraces(),"warnings"in t&&(B.warnings=!!t.warnings),"cancellation"in t&&t.cancellation&&!B.cancellation){if(F.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=c,e.prototype._propagateFrom=l,e.prototype._onCancel=s,e.prototype._setOnCancel=a,e.prototype._attachCancellationCallback=o,e.prototype._execute=i,M=l,B.cancellation=!0}},e.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},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 M=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)},H=function(){return!1},L=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;E.inherits(w,Error),r.CapturedTrace=w,w.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;for(r=(t=this._length=r)-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(r=0;t>r;++r){var s=n[e[r].stack];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var a=r>0?e[r-1]:this;t-1>s?(a._parent=e[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var c=a._length+1,l=r-2;l>=0;--l)e[l]._length=c,c++;return}}}},w.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=_(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(d(i.stack.split("\n"))),i=i._parent;(function(t){for(var e=t[0],n=1;n=0;--a)if(r[a]===o){s=a;break}for(a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}})(r),function(t){for(var e=0;e=0)return R=/@/,O=e,S=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(O=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?m(e):e.toString()},null):(R=t,O=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}(),U=function(){if(E.isNode)return function(t,e,r){return"rejectionHandled"===t?n.emit(t,r):n.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(t){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(t){e=!1}e&&(V=function(e,n){var r;return t?r=new self.CustomEvent(e,{detail:n,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(r=document.createEvent("CustomEvent")).initCustomEvent(e,!1,!0,n),!!r&&!self.dispatchEvent(r)});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,n){var r=o[t],i=self[r];return!!i&&("rejectionHandled"===t?i.call(self,n):i.call(self,e,n),!0)}}();"undefined"!=typeof console&&void 0!==console.warn&&(k=function(t){console.warn(t)},E.isNode&&n.stderr.isTTY?k=function(t,e){var r=e?"":"";n.stderr.write(r+t+"\n")}:E.isNode||"string"!=typeof(new Error).stack||(k=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var B={warnings:I,longStackTraces:!1,cancellation:!1};return D&&e.longStackTraces(),{longStackTraces:function(){return B.longStackTraces},warnings:function(){return B.warnings},cancellation:function(){return B.cancellation},propagateFromFunction:function(){return M},boundValueFunction:function(){return u},checkForgottenReturns:function(t,e,n,r){if(void 0===t&&e>0&&B.longStackTraces&&B.warnings){var i="a promise was created in a "+n+" handler but was not returned from it";r._warn(i)}},setBounds:function(t,e){if(g()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;cs||0>a||!n||!r||n!==r||s>=a||(H=function(t){if(P.test(t))return!0;var e=b(t);return!!(e&&e.fileName===n&&s<=e.line&&e.line<=a)})}},warn:p,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),p(n)},CapturedTrace:w}}},{"./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];return this.caught(t,function(){throw e})},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();return this.caught(n,function(){return r})}}},{}],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 this.mapSeries(t)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,e){return r(t,e)._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?(h(this,"message","string"==typeof r?r:e),h(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?(h(this,"name","OperationalError"),h(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(h(this,"message",t.message),h(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,h=l.notEnumerableProp,f=r("Warning","warning"),p=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(t){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function o(){return a.call(this,this.promise._target()._settledValue())}function s(t){return i(this,t)?void 0:(u.e=t,u)}function a(t){var a=this.promise,c=this.handler;if(!this.called){this.called=!0;var h=0===this.type?c.call(a._boundValue()):c.call(a._boundValue(),t);if(void 0!==h){var f=n(h,a);if(f instanceof e){if(null!=this.cancelPromise){if(f.isCancelled()){var p=new l("late cancellation observer");return a._attachExtraTrace(p),u.e=p,u}f.isPending()&&f._attachCancellationCallback(new r(this))}return f._then(o,s,void 0,this,void 0)}}}return a.isRejected()?(i(this),u.e=t,u):(i(this),t)}var c=t("./util"),l=e.CancellationError,u=c.errorObj;return r.prototype._resultCancelled=function(){i(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,{promise:this,handler:t,called:!1,cancelPromise:null,type:e},void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,a,a)},e.prototype.tap=function(t){return this._passThrough(t,1,a)},a}},{"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,i,o){var s=this._promise=new e(r);s._captureStackTrace(),s._setOnCancel(this),this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(f):f,this._yieldedPromise=null}var c=t("./errors").TypeError,l=t("./util"),u=l.errorObj,h=l.tryCatch,f=[];l.inherits(a,o),a.prototype._isResolved=function(){return null===this.promise},a.prototype._cleanup=function(){this._promise=this._generator=null},a.prototype._promiseCancelled=function(){if(!this._isResolved()){var t;if(void 0!==this._generator.return)this._promise._pushContext(),t=h(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var n=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=n,this._promise._attachExtraTrace(n),this._promise._pushContext(),t=h(this._generator.throw).call(this._generator,n),this._promise._popContext(),t===u&&t.e===n&&(t=null)}var r=this._promise;this._cleanup(),t===u?r._rejectCallback(t.e,!1):r.cancel()}},a.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=h(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},a.prototype.promise=function(){return this._promise},a.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},a.prototype._continue=function(t){var n=this._promise;if(t===u)return this._cleanup(),n._rejectCallback(t.e,!1);var r=t.value;if(!0===t.done)return this._cleanup(),n._resolveCallback(r);var o=i(r,this._promise);if(o instanceof e||null!==(o=function(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]&&(t=arguments[e]);var r=[].slice.call(arguments);t&&r.pop();var i=new n(r).promise();return void 0!==t?i.spread(t):i}}},{"./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:i.bind(e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=n>=1?[]:p,this._init$(void 0,-2)}function c(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+u.classString(e));var o="object"==typeof n&&null!==n?n.concurrency:0;return new a(t,e,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,i).promise()}var l=e._getDomain,u=t("./util"),h=u.tryCatch,f=u.errorObj,p=[];u.inherits(a,n),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(r[n=-1*n-1]=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,p=l._boundValue();l._pushContext();var d=h(u).call(p,t,n,o),_=l._popContext();if(s.checkForgottenReturns(d,_,null!==a?"Promise.filter":"Promise.map",l),d===f)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var y=(v=v._target())._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);d=v._value()}r[n]=d}return++this._totalResolved>=o&&(null!==a?this._filter(r,a):this._resolve(r),!0)},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);return r._popContext(),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,c=new e(n);if(c._captureStackTrace(),c._pushContext(),arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];r=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else r=a(t)();return c._popContext(),c._resolveFromSyncValue(r),c},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){var e;if(function(t){return t instanceof Error&&a.getPrototypeOf(t)===Error.prototype}(t)){(e=new s(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=a.keys(t),r=0;r1){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 u("expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,E(r,t,this))}return this.then(void 0,t)},r.prototype.reflect=function(){return this._then(l,l,void 0,this,void 0)},r.prototype.then=function(t,e){if(F.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)},r.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},r.prototype.spread=function(t){return"function"!=typeof t?u("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,b,void 0)},r.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},r.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new C(this).promise()},r.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},r.is=function(t){return t instanceof r},r.fromNode=r.fromCallback=function(t){var e=new r(g),n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=R(t)(T(e,n));return i===P&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},r.all=function(t){return new C(t).promise()},r.cast=function(t){var e=A(t);return e instanceof r||((e=new r(g))._setFulfilled(),e._rejectionHandler0=t),e},r.resolve=r.fulfilled=r.cast,r.reject=r.rejected=function(t){var e=new r(g);return e._captureStackTrace(),e._rejectCallback(t,!0),e},r.setScheduler=function(t){if("function"!=typeof t)throw new y("expecting a function but got "+f.classString(t));var e=_._schedule;return _._schedule=t,e},r.prototype._then=function(t,e,n,i,o){var s=void 0!==o,c=s?o:new r(g),l=this._target(),u=l._bitField;s||(c._propagateFrom(this,3),c._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo));var h=a();if(0!=(50397184&u)){var f,p,d=l._settlePromiseCtx;0!=(33554432&u)?(p=l._rejectionHandler0,f=t):0!=(16777216&u)?(p=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,p=new m("late cancellation observer"),l._attachExtraTrace(p),f=e),_.invoke(d,l,{handler:null===h?f:"function"==typeof f&&h.bind(f),promise:c,receiver:i,value:p})}else l._addCallbacks(t,e,c,i,h);return c},r.prototype._length=function(){return 65535&this._bitField},r.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},r.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},r.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},r.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField},r.prototype._setRejected=function(){this._bitField=16777216|this._bitField},r.prototype._setFollowing=function(){this._bitField=67108864|this._bitField},r.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},r.prototype._isFinal=function(){return(4194304&this._bitField)>0},r.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},r.prototype._setCancelled=function(){this._bitField=65536|this._bitField},r.prototype._setAsyncGuaranteed=function(){this._bitField=134217728|this._bitField},r.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},r.prototype._promiseAt=function(t){return this[4*t-4+2]},r.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},r.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},r.prototype._boundValue=function(){},r.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)},r.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)},r.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:i.bind(t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:i.bind(e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:i.bind(t)),"function"==typeof e&&(this[s+1]=null===i?e:i.bind(e))}return this._setLength(o+1),o},r.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},r.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=A(t,this);if(!(n instanceof r))return this._fulfill(t);e&&this._propagateFrom(n,2);var i=n._target(),o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;s>a;++a)i._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(i)}else if(0!=(33554432&o))this._fulfill(i._value());else if(0!=(16777216&o))this._reject(i._reason());else{var l=new m("late cancellation observer");i._attachExtraTrace(l),this._reject(l)}}},r.prototype._rejectCallback=function(t,e){var n=f.ensureErrorObject(t),r=n===t;if(!r&&F.warnings()){var i="a promise was rejected with a non-error: "+f.classString(t);this._warn(i,!0)}this._attachExtraTrace(n,!!e&&r),this._reject(t)},r.prototype._resolveFromExecutor=function(t){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)},r.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0==(65536&i)){var o;r._pushContext(),e===b?n&&"number"==typeof n.length?o=R(t).apply(this._boundValue(),n):(o=P).e=new y("cannot .spread() a non-array: "+f.classString(n)):o=R(t).call(e,n);var s=r._popContext();if(0==(65536&(i=r._bitField)))if(o===w)r._reject(n);else if(o===P||o===r){var a=o===r?c():o.e;r._rejectCallback(a,!1)}else void 0===o&&s>0&&F.longStackTraces()&&F.warnings()&&r._warn("a promise was created in a handler but none were returned from it",!0),r._resolveCallback(o)}},r.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},r.prototype._followee=function(){return this._rejectionHandler0},r.prototype._setFollowee=function(t){this._rejectionHandler0=t},r.prototype._settlePromise=function(t,n,i,o){var s=t instanceof r,a=this._bitField,c=0!=(134217728&a);0!=(65536&a)?(s&&t._invokeInternalOnCancel(),n===x?(i.cancelPromise=t,R(n).call(i,o)===P&&t._reject(P.e)):n===l?t._fulfill(l.call(i)):i instanceof e?i._promiseCancelled(t):s||t instanceof C?t._cancel():i.cancel()):"function"==typeof n?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(n,i,o,t)):n.call(i,o,t):i instanceof e?i._isResolved()||(0!=(33554432&a)?i._promiseFulfilled(o,t):i._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!=(33554432&a)?t._fulfill(o):t._reject(o))},r.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,i=t.receiver,o=t.value;"function"==typeof e?n instanceof r?this._settlePromiseFromHandler(e,i,o,n):e.call(i,o,n):n instanceof r&&n._reject(o)},r.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},r.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)},r.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},r.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():_.settlePromises(this))}},r.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?_.fatalError(t,f.isNode):void((65535&e)>0?0!=(134217728&e)?this._settlePromises():_.settlePromises(this):this._ensurePossibleRejectionHandled())},r.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)}},r.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)}},r.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()},r.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},r.defer=r.pending=function(){return F.deprecated("Promise.defer","new Promise"),{promise:new r(g),resolve:i,reject:o}},f.notEnumerableProp(r,"_makeSelfResolutionError",c),t("./method")(r,g,A,u,F),t("./bind")(r,g,A,F),t("./cancel")(r,C,u,F),t("./direct_resolve")(r),t("./synchronous_inspection")(r),t("./join")(r,C,A,g,F),r.Promise=r,t("./map.js")(r,C,u,A,g,F),t("./using.js")(r,u,A,j,g,F),t("./timers.js")(r,g),t("./generators.js")(r,u,g,A,e,F),t("./nodeify.js")(r),t("./call_get.js")(r),t("./props.js")(r,C,A,u),t("./race.js")(r,g,A,u),t("./reduce.js")(r,C,u,A,g,F),t("./settle.js")(r,C,F),t("./some.js")(r,C,u),t("./promisify.js")(r,g),t("./any.js")(r),t("./each.js")(r,g),t("./filter.js")(r,g),f.toFastProperties(r),f.toFastProperties(r.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new r(g)),F.setBounds(d.firstLineError,f.lastLineError),r}},{"./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){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 a=t("./util");return a.isArray,a.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,o){var s=r(this._values,this._promise);if(s instanceof e){var c=(s=s._target())._bitField;if(this._values=s,0==(50397184&c))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,o);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))return 0===s.length?void(-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{}}}(o))):void this._iterate(s);var l=i("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(l,!1)},s.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?s=(c=c._target())._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()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise.isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nu;u+=2){var f=a[u],p=a[u+1],d=f+e;if(r===g)t[d]=g(f,c,f,p,e,i);else{var _=r(p,function(){return g(f,c,f,p,e,i)});l.notEnumerableProp(_,"__isPromisified__",!0),t[d]=_}}return l.toFastProperties(t),t}var c={},l=t("./util"),u=t("./nodeback"),h=l.withAppended,f=l.maybeWrapAsError,p=l.canEvaluate,d=t("./errors").TypeError,_={__isPromisified__:!0},v=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),y=function(t){return l.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},m=function(t){return t.replace(/([$])/,"\\$")},g=p?void 0:function(t,r,i,o,s,a){function p(){var i=r;r===c&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof _&&this!==d?this[_]:t,l=u(o,a);try{s.apply(i,h(arguments,l))}catch(t){o._rejectCallback(f(t),!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var d=function(){return this}(),_=t;return"string"==typeof _&&(t=o),l.notEnumerableProp(p,"__isPromisified__",!0),p};e.promisify=function(t,e){if("function"!=typeof t)throw new d("expecting a function but got "+l.classString(t));if(i(t))return t;var n=function(t,e,n){return g(t,e,void 0,t,null,n)}(t,void 0===(e=Object(e)).context?c:e.context,!!e.multiArgs);return l.copyDescriptors(t,n,r),n},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new d("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var n=!!(e=Object(e)).multiArgs,r=e.suffix;"string"!=typeof r&&(r="Async");var i=e.filter;"function"!=typeof i&&(i=y);var o=e.promisifier;if("function"!=typeof o&&(o=g),!l.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=l.inheritedDataKeys(t),c=0;co;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,-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 h=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}}();c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){var n;if(this._isMap)n=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}(this._values);else{n={};for(var r=this.length(),i=0,o=this.length();o>i;++i)n[this._values[i+r]]=this._values[i]}return this._resolve(n),!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){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacityo;++o)n[o+r]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},e.exports=r},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(null===(t=s.asArray(t)))return i("expecting an array or an iterable object but got "+s.classString(t));var l=new e(n);void 0!==o&&l._propagateFrom(o,3);for(var u=l._fulfill,h=l._reject,f=0,p=t.length;p>f;++f){var d=t[f];(void 0!==d||f in t)&&e.cast(d)._then(u,h,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=f();this._fn=null===s?n:s.bind(n),void 0!==r&&(r=e.resolve(r))._attachCancellationCallback(this),this._initialValue=r,this._currentCancellable=null,this._eachValues=i===o?[]: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){return"function"!=typeof e?r("expecting a function but got "+p.classString(e)):new a(t,e,n,i).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(h,void 0,void 0,this,void 0)):h.call(this,n)}function h(t){var n,r=this.array,i=r._promise,o=d(r._fn);i._pushContext(),(n=void 0!==r._eachValues?o.call(i._boundValue(),t,this.index,this.length):o.call(i._boundValue(),this.accum,t,this.index,this.length))instanceof e&&(r._currentCancellable=n);var a=i._popContext();return s.checkForgottenReturns(n,a,void 0!==r._eachValues?"Promise.each":"Promise.reduce",i),n}var f=e._getDomain,p=t("./util"),d=p.tryCatch;p.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return 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,o){"use strict";var s,a=t("./util");if(a.isNode&&"undefined"==typeof MutationObserver){var c=i.setImmediate,l=n.nextTick;s=a.isRecentNode?function(t){c.call(i,t)}:function(t){l.call(n,t)}}else"undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&window.navigator.standalone?s=void 0!==r?function(t){r(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:(s=function(t){var e=document.createElement("div");return new MutationObserver(t).observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}}).isStatic=!0;e.exports=s},{"./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;t("./util").inherits(i,n),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},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)},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=t.prototype._isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype.isCancelled=function(){return this._target()._isCancelled()},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,s){var a=new e(n),c=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var l=!0,u=i.tryCatch(r).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,l),a=null)});return l=!1,a&&u===o&&(a._rejectCallback(u.e,!0),a=null),c}var i=t("./util"),o=i.errorObj,s=i.isObject,a={}.hasOwnProperty;return function(t,i){if(s(t)){if(t instanceof e)return t;var c=function(t){try{return function(t){return t.then}(t)}catch(t){return o.e=t,o}}(t);if(c===o){i&&i._pushContext();var l=e.reject(c.e);return i&&i._popContext(),l}if("function"==typeof c)return function(t){return a.call(t,"_promise0")}(t)?(l=new e(n),t._then(l._fulfill,l._reject,void 0,l,null),l):r(t,c,i)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util"),s=e.TimeoutError,a=function(t,e){var n;t.isPending()&&(n="string"!=typeof e?e instanceof Error?e:new s("operation timed out"):new s(e),o.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n))},c=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var i;return void 0!==r?i=e.resolve(r)._then(c,null,null,t,void 0):(i=new e(n),setTimeout(function(){i._fulfill()},+t)),i._setAsyncGuaranteed(),i};e.prototype.delay=function(t){return l(t,this)},e.prototype.timeout=function(t,e){t=+t;var n=this.then(),o=setTimeout(function(){a(n,e)},t);return n._then(r,i,void 0,o,void 0)}}},{"./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,n){var i=0,s=t.length,c=new e(o);return function o(){if(i>=s)return c._fulfill();var l=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(l instanceof e&&l._isDisposable()){try{l=r(l._getDisposer().tryDispose(n),t.promise)}catch(t){return a(t)}if(l instanceof e)return l._then(o,a,null,null,null)}o()}(),c}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function u(t,e,n){this.constructor$(t,e,n)}function h(t){return l.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 p=t("./util"),d=t("./errors").TypeError,_=t("./util").inherits,v=p.errorObj,y=p.tryCatch;l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=null!==e?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},_(u,l),u.prototype.doDispose=function(t,e){return this.data().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 "+p.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(t=(o=arguments[0]).length,a=!1):(o=arguments,t--);for(var u=new f(t),d=0;t>d;++d){var _=o[d];if(l.isDisposer(_)){var m=_;(_=_.promise())._setDisposable(m)}else{var g=r(_);g instanceof e&&(_=g._then(h,null,null,{resources:u,index:d},void 0))}u[d]=_}var b=new Array(u.length);for(d=0;d0},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 u(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,r){"use strict";function i(){try{var t=u;return u=null,t.apply(this,arguments)}catch(t){return p.e=t,p}}function o(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function s(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return h.defineProperty(t,e,r),t}function a(t){try{return t+""}catch(t){return"[no string representation]"}}function c(t){return t instanceof Error&&h.propertyIsWritable(t,"stack")}function l(t){return{}.toString.call(t)}var u,h=t("./es5"),f="undefined"==typeof navigator,p={e:{}},d=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=_.test(t+"")&&h.names(t).length>0;if(n||r||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return v.test(t)},inheritedDataKeys:d,getDataPropertyOrDefault:function(t,e,n){if(!h.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},thrower:function(t){throw t},isArray:h.isArray,asArray:m,notEnumerableProp:s,isPrimitive:o,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},canEvaluate:f,errorObj:p,tryCatch:function(t){return u=t,i},inherits:function(t,e){function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(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},maybeWrapAsError:function(t){return o(t)?new Error(a(t)):t},toFastProperties:function(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t},filledRange:function(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r},toString:a,canAttachTrace:c,ensureErrorObject:y,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{s(t,"isOperational",!0)}catch(t){}},classString:l,copyDescriptors:function(t,e,n){for(var r=h.names(t),i=0;i10||t[0]>0}(),w.isNode&&w.toFastProperties(n);try{throw new Error}catch(t){w.lastLineError=t}e.exports=w},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,i("_process"),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(t,e,n){function r(){u=!1,a.length?l=a.concat(l):h=-1,l.length&&i()}function i(){if(!u){var t=setTimeout(r);u=!0;for(var e=l.length;e;){for(a=l,l=[];++h1)for(var n=1;nu&&0!==p;)h|=t[e++]<u)break;var v=h&l;if(h>>=c,u-=c,v!==o){if(v===s)break;for(var y=a>v?v:_,m=0,g=y;g>o;)g=d[g]>>8,++m;var b=g;if(f+m+(y!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[f++]=b;var w=f+=m;for(y!==v&&(n[f++]=b),g=y;m--;)g=d[g],n[--w]=255&g,g>>=8;null!==_&&4096>a&&(d[a++]=_<<8|b,a>=l+1&&12>c&&(++c,l=l<<1|1)),_=v}else a=s+1,l=(1<<(c=i+1))-1,_=null}return f!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(t,e,n,r){function i(t){var e=t.length;if(2>e||e>256||e&e-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return e}var o=0,s=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(0>=e||0>=n||e>65535||n>65535)throw"Width/Height invalid.";t[o++]=71,t[o++]=73,t[o++]=70,t[o++]=56,t[o++]=57,t[o++]=97;var c=0,l=0;if(null!==a){for(var u=i(a);u>>=1;)++c;if(u=1<=u)throw"Background index out of range.";if(0===l)throw"Background index explicitly passed as 0."}}if(t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=(null!==a?128:0)|c,t[o++]=l,t[o++]=0,null!==a)for(var h=0,f=a.length;f>h;++h){var p=a[h];t[o++]=p>>16&255,t[o++]=p>>8&255,t[o++]=255&p}if(null!==s){if(0>s||s>65535)throw"Loop count invalid.";t[o++]=33,t[o++]=255,t[o++]=11,t[o++]=78,t[o++]=69,t[o++]=84,t[o++]=83,t[o++]=67,t[o++]=65,t[o++]=80,t[o++]=69,t[o++]=50,t[o++]=46,t[o++]=48,t[o++]=3,t[o++]=1,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=0}var d=!1;this.addFrame=function(e,n,r,s,c,l){if(!0===d&&(--o,d=!1),l=void 0===l?{}:l,0>e||0>n||e>65535||n>65535)throw"x/y invalid.";if(0>=r||0>=s||r>65535||s>65535)throw"Width/Height invalid.";if(c.length>=1;)++p;f=1<v||v>3)throw"Disposal out of range.";var y=!1,m=0;if(void 0!==l.transparent&&null!==l.transparent&&(y=!0,0>(m=l.transparent)||m>=f))throw"Transparent color index.";if((0!==v||y||0!==_)&&(t[o++]=33,t[o++]=249,t[o++]=4,t[o++]=v<<2|(!0===y?1:0),t[o++]=255&_,t[o++]=_>>8&255,t[o++]=m,t[o++]=0),t[o++]=44,t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=255&r,t[o++]=r>>8&255,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=!0===u?128|p-1:0,!0===u)for(var g=0,b=h.length;b>g;++g){var w=h[g];t[o++]=w>>16&255,t[o++]=w>>8&255,t[o++]=255&w}o=function(t,e,n,r){function i(n){for(;f>=n;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++)}function o(t){p|=t<v;++v){var m=r[v]&c,g=d<<8|m,b=_[g];if(void 0===b){for(p|=d<=8;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++);4096===u?(o(a),u=l+1,h=n+1,_={}):(u>=1<p?2:p,c)},this.end=function(){return!1===d&&(t[o++]=59,d=!0),o}},n.GifReader=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw"Invalid GIF 87a/89a header.";var n=t[e++]|t[e++]<<8,i=t[e++]|t[e++]<<8,o=t[e++],s=o>>7,a=1<<1+(7&o);t[e++],t[e++];var c=null;s&&(c=e,e+=3*a);var l=!0,u=[],h=0,f=null,p=0,d=null;for(this.width=n,this.height=i;l&&e>2&7,e++;break;case 254:for(;0!==(j=t[e++]);)e+=j;break;default:throw"Unknown graphic control label: 0x"+t[e-1].toString(16)}break;case 44:var v=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,m=t[e++]|t[e++]<<8,g=t[e++]|t[e++]<<8,b=t[e++],w=b>>6&1,A=c,C=!1;b>>7&&(C=!0,A=e,e+=3*(1<<1+(7&b)));var k=e;for(e++;;){var j;if(0===(j=t[e++]))break;e+=j}u.push({x:v,y:y,width:m,height:g,has_local_palette:C,palette_offset:A,data_offset:k,data_length:e-k,transparent_index:f,interlaced:!!w,delay:h,disposal:p});break;case 59:l=!1;break;default:throw"Unknown gif block: 0x"+t[e-1].toString(16)}this.numFrames=function(){return u.length},this.loopCount=function(){return d},this.frameInfo=function(t){if(0>t||t>=u.length)throw"Frame index out of range.";return u[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=C,i[_++]=A,i[_++]=w,i[_++]=255}--f}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=w,i[_++]=A,i[_++]=C,i[_++]=255}--f}}}}catch(t){}},{}]},{},[1])}).call(this,n(0),n(4).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(5),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,c=1,l={},u=!1,h=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){d(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){d(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(d,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n{console.warn=function(){},e.data.marker.id==t&&(o.gifLoaded||(o.gif=gifler(o.contentProps.src).animate(o.textureCanvas),o.gifLoaded=!0),o.gifPlaying=!0,r.needsUpdate=!0)}),console.log("Initialized marker ",t,this.textureCanvas)}get3DMarker(t,e){return e.arController.threePatternMarkers[t]}create3DMarker(t,e){let n=e.createThreeMarker(t),r=this.create3DPlane();return n.add(r),n}create3DPlane(){let t=new THREE.PlaneGeometry,e=new THREE.Mesh(t,this.material),n=this.contentProps;return e.scale.set(n.scale.x,n.scale.y,n.scale.z),e.position.set(n.position.x,n.position.y,n.position.z),e.rotation.set(n.rotation.x,n.rotation.y,n.rotation.z),e}stringToVec3(t){let e=t.split(" ");return{x:e[0]||0,y:e[1]||0,z:e[2]||0}}static get observedAttributes(){return["gif-playing"]}attributeChangedCallback(t,e,n){switch(t){case"gif-playing":"true"==e&&"false"==n?this.gif.then(t=>{t.stop()}):"false"==e&&"true"==n&&this.gif.then(t=>{t.reset(),t.start()})}}set markerId(t){this.setAttribute("marker-id",t)}get markerId(){return this.getAttribute("marker-id")}set canvasTexture(t){this.setAttribute("canvas-texture",t)}get canvasTexture(){this.getAttribute("canvas-texture")}set gifPlaying(t){this.setAttribute("gif-playing",t)}get gifPlaying(){return this.getAttribute("gif-playing")}set patt(t){this.setAttribute("patt",t)}get patt(){return this.getAttribute("patt")}set content(t){this.setAttribute("content",t)}get content(){return this.getAttribute("content")}set mult(t){this.setAttribute("mult",t)}get mult(){return this.hasAttribute("mult")}});var r=n(1),i=n.n(r);customElements.define("ar-scene",class extends HTMLElement{constructor(){super(),this.htmlMarkers=[],this.threeMarkers={}}connectedCallback(){this.htmlMarkers=Array.from(this.children).filter(t=>"AR-MARKER"==t.tagName),this.init(),window.ARController&&ARController.getUserMediaThreeScene&&ARThreeOnLoad()}init(){console.log("AR-GIF version 0.0.3");const t=this;window.ARThreeOnLoad=(()=>{ARController.getUserMediaThreeScene({maxARVideoSize:640,cameraParam:i.a,facingMode:"environment",onSuccess:(e,n,r)=>{console.log("Initialized ar-scene"),t.registerMarkers(e,n);let i=t.createRenderer(e,n);i.domElement.setAttribute("id","arCanvas"),document.body.appendChild(i.domElement),window.addEventListener("resize",this.resizeWindow);let o=()=>{e.process(),e.renderOn(i),t.updateMarkersState(n),requestAnimationFrame(o)};o()}})})}registerMarkers(t,e){const n=this;this.htmlMarkers.map(r=>{r.mult?console.log("mult marker"):(console.log("Registering marker ",r.patt),e.loadMarker(r.patt,i=>{r.init(i,t,e),n.threeMarkers[i]=r}))})}updateMarkersState(t){Object.keys(t.threePatternMarkers).map((e,n)=>{let r=t.threePatternMarkers[e];r.visible?(r.children[0].material.needsUpdate=!0,r.children[0].material.map.needsUpdate=!0):r.markerTracker.inPrevious&&!r.markerTracker.inCurrent&&(this.threeMarkers[e].gifPlaying=!1)})}createRenderer(t,e){let n=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0}),r=window.innerHeight,i=640/480*window.screen.availHeight*window.devicePixelRatio;return n.setSize(i,r),"portrait"===e.orientation?(n.domElement.style.transformOrigin="0 0",n.domElement.style.transform="rotate(-90deg) translateX(-100%)"):window.screen.availWidth>window.screen.availHeight&&n.setSize(window.screen.availWidth,r),n}resizeWindow(){let t=document.getElementById("arCanvas");t.setAttribute("width",window.innerWidth),t.setAttribute("height",window.innerHeight),t.style.width=window.innerWidth,t.style.height=window.innerHeight}set arScene(t){this.setAttribute("arScene",t)}get arScene(){return this.getAttribute("arScene")}set arController(t){this.setAttribute("arController",t)}get arController(){return this.getAttribute("arController")}set renderer(t){this.setAttribute("renderer",t)}get renderer(){return this.getAttribute("renderer")}});n(7)}]); \ No newline at end of file +!function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){if(!c&&("function"==typeof i&&i))return i(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return o(n||t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof i&&i,a=0;a=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this).map(function(n){return t.decodeFrame(e,n)})},t.decodeFramesAsync=function(e){var n;return a.map(function(){n=[];for(var t=0,r=e.numFrames();r>=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this),function(n){return t.decodeFrame(e,n)},1)},t.decodeFrame=function(t,e){var n;return(n=t.frameInfo(e)).pixels=new Uint8ClampedArray(t.width*t.height*4),t.decodeAndBlitFrameRGBA(e,n.pixels),n},t}(),r=function(){function t(t,e){var n;this._reader=t,this._frames=e,this._advanceFrame=l(this._advanceFrame,this),this._nextFrameRender=l(this._nextFrameRender,this),this._nextFrame=l(this._nextFrame,this),n=this._reader,this.width=n.width,this.height=n.height,this._loopCount=this._reader.loopCount(),this._loops=0,this._frameIndex=0,this._running=!1}return t.createBufferCanvas=function(t,e,n){var r,i,o;return i=(r=document.createElement("canvas")).getContext("2d"),r.width=t.width,r.height=t.height,(o=i.createImageData(e,n)).data.set(t.pixels),i.putImageData(o,-t.x,-t.y),r},t.prototype.start=function(){return this._lastTime=(new Date).valueOf(),this._delayCompensation=0,this._running=!0,setTimeout(this._nextFrame,0),this},t.prototype.stop=function(){return this._running=!1,this},t.prototype.reset=function(){return this._frameIndex=0,this._loops=0,this},t.prototype.running=function(){return this._running},t.prototype._nextFrame=function(){requestAnimationFrame(this._nextFrameRender)},t.prototype._nextFrameRender=function(){var t,e;if(this._running)return t=this._frames[this._frameIndex],null!=(e=this.onFrame)&&e.apply(this,[t,this._frameIndex]),this._enqueueNextFrame()},t.prototype._advanceFrame=function(){this._frameIndex+=1,this._frameIndex>=this._frames.length&&(0!==this._loopCount&&this._loopCount===this._loops?this.stop():(this._frameIndex=0,this._loops+=1))},t.prototype._enqueueNextFrame=function(){var t,e,n,r;for(this._advanceFrame();this._running;){if(n=this._frames[this._frameIndex],e=(new Date).valueOf()-this._lastTime,this._lastTime+=e,this._delayCompensation+=e,t=(r=10*n.delay)-this._delayCompensation,this._delayCompensation-=r,!(0>t)){setTimeout(this._nextFrame,t);break}this._advanceFrame()}},t.prototype.animateInCanvas=function(e,n){var r;return null==n&&(n=!0),n&&(e.width=this.width,e.height=this.height),r=e.getContext("2d"),null==this.onDrawFrame&&(this.onDrawFrame=function(t,e,n){return t.drawImage(e.buffer,e.x,e.y)}),null==this.onFrame&&(this.onFrame=function(n){return function(i,o){var s,a;switch(null==i.buffer&&(i.buffer=t.createBufferCanvas(i,n.width,n.height)),"function"==typeof n.disposeFrame&&n.disposeFrame(),i.disposal){case 2:n.disposeFrame=function(){return r.clearRect(0,0,e.width,e.height)};break;case 3:a=r.getImageData(0,0,e.width,e.height),n.disposeFrame=function(){return r.putImageData(a,0,0)};break;default:n.disposeFrame=null}return null!=(s=n.onDrawFrame)?s.apply(n,[r,i,o]):void 0}}(this)),this.start(),this},t}(),c.Gif=o,c.Decoder=i,c.Animator=r,"undefined"!=typeof window&&null!==window&&(window.gifler=c),null!=e&&(e.exports=c)},{bluebird:2,omggif:4}],2:[function(i,c,l){(function(n,i){!function(n){"object"==typeof l&&void 0!==c?c.exports=n():(s=[],void 0===(a="function"==typeof(o=n)?o.apply(e,s):o)||(t.exports=a))}(function(){return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[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=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return i(n||t)},u,u.exports,t,e,n,r)}return n[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()}},i.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},i.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},i.prototype._reset=function(){this._isTickUsed=!1},e.exports=i,e.exports.firstLineError=c},{"./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 h=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:h,bindingPromise:l};h._then(e,s,void 0,u,f),l._then(a,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(h);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";var r;"undefined"!=typeof Promise&&(r=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(t){}return i},e.exports=i},{"./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 "+s.classString(t)+" has no method '"+s.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){return n(t,this.pop()).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=t("./util"),a=s.canEvaluate;s.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;if("number"==typeof t)e=o;else if(a){var n=(void 0)(t);e=null!==n?n: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(),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))},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._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?i[t]:void 0}var r=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return 0},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promisesCreated=0,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promisesCreated;return t._promisesCreated=0,e}return 0},e.CapturedTrace=null,e.create=function(){return r?new e:void 0},e.activateLongStackTraces=function(){r=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=n,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&t._promisesCreated++}},e}},{}],9:[function(t,e,r){"use strict";e.exports=function(e,r){function i(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: "+E.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function o(t){if(!this.isCancellable())return this;var e=this._onCancel();void 0!==e?E.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function a(t){this._onCancelField=t}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function l(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 u(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new w(this._peekContext())}function f(t,e){if(T(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=_(t);E.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),E.notEnumerableProp(t,"__stackCleaned__",!0)}}}function p(t,n,r){if(B.warnings){var i,o=new F(t);if(n)r._attachExtraTrace(o);else if(B.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=_(o);o.stack=s.message+"\n"+s.stack.join("\n")}v(o,"",!0)}}function d(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:d(e)}}function v(t,e,n){if("undefined"!=typeof console){var r;if(E.isObject(t)){var i=t.stack;r=e+O(i,t)}else r=e+String(t);"function"==typeof k?k(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function y(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){x.throwLater(t)}var o=!1;try{o=U(t,n,r)}catch(t){o=!0,x.throwLater(t)}var s=!1;if(V)try{s=V(t.toLowerCase(),{reason:n,promise:r})}catch(t){s=!0,x.throwLater(t)}o||i||s||"unhandledRejection"!==t||v(n,"Unhandled rejection ")}function m(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():E.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function g(){return"function"==typeof N}function b(t){var e=t.match(H);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function w(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);N(this,w),e>32&&this.uncycle()}var A,C,k,j=e._getDomain,x=e._async,F=t("./errors").Warning,E=t("./util"),T=E.canAttachTrace,P=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,R=null,O=null,S=!1,I=!(0==E.env("BLUEBIRD_WARNINGS")),M=!(0==E.env("BLUEBIRD_LONG_STACK_TRACES"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|2097152},e.prototype._ensurePossibleRejectionHandled=function(){0==(2097152&this._bitField)&&(this._setRejectionIsUnhandled(),x.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){y("rejectionHandled",A,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),y("unhandledRejection",C,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){return p(t,e,this)},e.onPossiblyUnhandledRejection=function(t){var e=j();C="function"==typeof t?null===e?t:e.bind(t):void 0},e.onUnhandledRejectionHandled=function(t){var e=j();A="function"==typeof t?null===e?t:e.bind(t):void 0},e.longStackTraces=function(){if(x.haveItemsQueued()&&!B.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");!B.longStackTraces&&g()&&(B.longStackTraces=!0,e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=f,r.activateLongStackTraces(),x.disableTrampolineIfNecessary())},e.hasLongStackTraces=function(){return B.longStackTraces&&g()},e.config=function(t){if("longStackTraces"in(t=Object(t))&&t.longStackTraces&&e.longStackTraces(),"warnings"in t&&(B.warnings=!!t.warnings),"cancellation"in t&&t.cancellation&&!B.cancellation){if(x.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=c,e.prototype._propagateFrom=l,e.prototype._onCancel=s,e.prototype._setOnCancel=a,e.prototype._attachCancellationCallback=o,e.prototype._execute=i,D=l,B.cancellation=!0}},e.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},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 D=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)},L=function(){return!1},H=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;E.inherits(w,Error),r.CapturedTrace=w,w.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;for(r=(t=this._length=r)-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(r=0;t>r;++r){var s=n[e[r].stack];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var a=r>0?e[r-1]:this;t-1>s?(a._parent=e[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var c=a._length+1,l=r-2;l>=0;--l)e[l]._length=c,c++;return}}}},w.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=_(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(d(i.stack.split("\n"))),i=i._parent;(function(t){for(var e=t[0],n=1;n=0;--a)if(r[a]===o){s=a;break}for(a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}})(r),function(t){for(var e=0;e=0)return R=/@/,O=e,S=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(O=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?m(e):e.toString()},null):(R=t,O=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}(),U=function(){if(E.isNode)return function(t,e,r){return"rejectionHandled"===t?n.emit(t,r):n.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(t){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(t){e=!1}e&&(V=function(e,n){var r;return t?r=new self.CustomEvent(e,{detail:n,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(r=document.createEvent("CustomEvent")).initCustomEvent(e,!1,!0,n),!!r&&!self.dispatchEvent(r)});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,n){var r=o[t],i=self[r];return!!i&&("rejectionHandled"===t?i.call(self,n):i.call(self,e,n),!0)}}();"undefined"!=typeof console&&void 0!==console.warn&&(k=function(t){console.warn(t)},E.isNode&&n.stderr.isTTY?k=function(t,e){var r=e?"":"";n.stderr.write(r+t+"\n")}:E.isNode||"string"!=typeof(new Error).stack||(k=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var B={warnings:I,longStackTraces:!1,cancellation:!1};return M&&e.longStackTraces(),{longStackTraces:function(){return B.longStackTraces},warnings:function(){return B.warnings},cancellation:function(){return B.cancellation},propagateFromFunction:function(){return D},boundValueFunction:function(){return u},checkForgottenReturns:function(t,e,n,r){if(void 0===t&&e>0&&B.longStackTraces&&B.warnings){var i="a promise was created in a "+n+" handler but was not returned from it";r._warn(i)}},setBounds:function(t,e){if(g()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;cs||0>a||!n||!r||n!==r||s>=a||(L=function(t){if(P.test(t))return!0;var e=b(t);return!!(e&&e.fileName===n&&s<=e.line&&e.line<=a)})}},warn:p,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),p(n)},CapturedTrace:w}}},{"./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];return this.caught(t,function(){throw e})},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();return this.caught(n,function(){return r})}}},{}],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 this.mapSeries(t)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,e){return r(t,e)._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?(h(this,"message","string"==typeof r?r:e),h(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?(h(this,"name","OperationalError"),h(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(h(this,"message",t.message),h(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,h=l.notEnumerableProp,f=r("Warning","warning"),p=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(t){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function o(){return a.call(this,this.promise._target()._settledValue())}function s(t){return i(this,t)?void 0:(u.e=t,u)}function a(t){var a=this.promise,c=this.handler;if(!this.called){this.called=!0;var h=0===this.type?c.call(a._boundValue()):c.call(a._boundValue(),t);if(void 0!==h){var f=n(h,a);if(f instanceof e){if(null!=this.cancelPromise){if(f.isCancelled()){var p=new l("late cancellation observer");return a._attachExtraTrace(p),u.e=p,u}f.isPending()&&f._attachCancellationCallback(new r(this))}return f._then(o,s,void 0,this,void 0)}}}return a.isRejected()?(i(this),u.e=t,u):(i(this),t)}var c=t("./util"),l=e.CancellationError,u=c.errorObj;return r.prototype._resultCancelled=function(){i(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,{promise:this,handler:t,called:!1,cancelPromise:null,type:e},void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,a,a)},e.prototype.tap=function(t){return this._passThrough(t,1,a)},a}},{"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,i,o){var s=this._promise=new e(r);s._captureStackTrace(),s._setOnCancel(this),this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(f):f,this._yieldedPromise=null}var c=t("./errors").TypeError,l=t("./util"),u=l.errorObj,h=l.tryCatch,f=[];l.inherits(a,o),a.prototype._isResolved=function(){return null===this.promise},a.prototype._cleanup=function(){this._promise=this._generator=null},a.prototype._promiseCancelled=function(){if(!this._isResolved()){var t;if(void 0!==this._generator.return)this._promise._pushContext(),t=h(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var n=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=n,this._promise._attachExtraTrace(n),this._promise._pushContext(),t=h(this._generator.throw).call(this._generator,n),this._promise._popContext(),t===u&&t.e===n&&(t=null)}var r=this._promise;this._cleanup(),t===u?r._rejectCallback(t.e,!1):r.cancel()}},a.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=h(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},a.prototype.promise=function(){return this._promise},a.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},a.prototype._continue=function(t){var n=this._promise;if(t===u)return this._cleanup(),n._rejectCallback(t.e,!1);var r=t.value;if(!0===t.done)return this._cleanup(),n._resolveCallback(r);var o=i(r,this._promise);if(o instanceof e||null!==(o=function(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]&&(t=arguments[e]);var r=[].slice.call(arguments);t&&r.pop();var i=new n(r).promise();return void 0!==t?i.spread(t):i}}},{"./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:i.bind(e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=n>=1?[]:p,this._init$(void 0,-2)}function c(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+u.classString(e));var o="object"==typeof n&&null!==n?n.concurrency:0;return new a(t,e,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,i).promise()}var l=e._getDomain,u=t("./util"),h=u.tryCatch,f=u.errorObj,p=[];u.inherits(a,n),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(r[n=-1*n-1]=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,p=l._boundValue();l._pushContext();var d=h(u).call(p,t,n,o),_=l._popContext();if(s.checkForgottenReturns(d,_,null!==a?"Promise.filter":"Promise.map",l),d===f)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var y=(v=v._target())._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);d=v._value()}r[n]=d}return++this._totalResolved>=o&&(null!==a?this._filter(r,a):this._resolve(r),!0)},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);return r._popContext(),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,c=new e(n);if(c._captureStackTrace(),c._pushContext(),arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];r=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else r=a(t)();return c._popContext(),c._resolveFromSyncValue(r),c},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){var e;if(function(t){return t instanceof Error&&a.getPrototypeOf(t)===Error.prototype}(t)){(e=new s(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=a.keys(t),r=0;r1){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 u("expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,E(r,t,this))}return this.then(void 0,t)},r.prototype.reflect=function(){return this._then(l,l,void 0,this,void 0)},r.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)},r.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},r.prototype.spread=function(t){return"function"!=typeof t?u("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,b,void 0)},r.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},r.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new C(this).promise()},r.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},r.is=function(t){return t instanceof r},r.fromNode=r.fromCallback=function(t){var e=new r(g),n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=R(t)(T(e,n));return i===P&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},r.all=function(t){return new C(t).promise()},r.cast=function(t){var e=A(t);return e instanceof r||((e=new r(g))._setFulfilled(),e._rejectionHandler0=t),e},r.resolve=r.fulfilled=r.cast,r.reject=r.rejected=function(t){var e=new r(g);return e._captureStackTrace(),e._rejectCallback(t,!0),e},r.setScheduler=function(t){if("function"!=typeof t)throw new y("expecting a function but got "+f.classString(t));var e=_._schedule;return _._schedule=t,e},r.prototype._then=function(t,e,n,i,o){var s=void 0!==o,c=s?o:new r(g),l=this._target(),u=l._bitField;s||(c._propagateFrom(this,3),c._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo));var h=a();if(0!=(50397184&u)){var f,p,d=l._settlePromiseCtx;0!=(33554432&u)?(p=l._rejectionHandler0,f=t):0!=(16777216&u)?(p=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,p=new m("late cancellation observer"),l._attachExtraTrace(p),f=e),_.invoke(d,l,{handler:null===h?f:"function"==typeof f&&h.bind(f),promise:c,receiver:i,value:p})}else l._addCallbacks(t,e,c,i,h);return c},r.prototype._length=function(){return 65535&this._bitField},r.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},r.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},r.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},r.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField},r.prototype._setRejected=function(){this._bitField=16777216|this._bitField},r.prototype._setFollowing=function(){this._bitField=67108864|this._bitField},r.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},r.prototype._isFinal=function(){return(4194304&this._bitField)>0},r.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},r.prototype._setCancelled=function(){this._bitField=65536|this._bitField},r.prototype._setAsyncGuaranteed=function(){this._bitField=134217728|this._bitField},r.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},r.prototype._promiseAt=function(t){return this[4*t-4+2]},r.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},r.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},r.prototype._boundValue=function(){},r.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)},r.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)},r.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:i.bind(t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:i.bind(e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:i.bind(t)),"function"==typeof e&&(this[s+1]=null===i?e:i.bind(e))}return this._setLength(o+1),o},r.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},r.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=A(t,this);if(!(n instanceof r))return this._fulfill(t);e&&this._propagateFrom(n,2);var i=n._target(),o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;s>a;++a)i._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(i)}else if(0!=(33554432&o))this._fulfill(i._value());else if(0!=(16777216&o))this._reject(i._reason());else{var l=new m("late cancellation observer");i._attachExtraTrace(l),this._reject(l)}}},r.prototype._rejectCallback=function(t,e){var n=f.ensureErrorObject(t),r=n===t;if(!r&&x.warnings()){var i="a promise was rejected with a non-error: "+f.classString(t);this._warn(i,!0)}this._attachExtraTrace(n,!!e&&r),this._reject(t)},r.prototype._resolveFromExecutor=function(t){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)},r.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0==(65536&i)){var o;r._pushContext(),e===b?n&&"number"==typeof n.length?o=R(t).apply(this._boundValue(),n):(o=P).e=new y("cannot .spread() a non-array: "+f.classString(n)):o=R(t).call(e,n);var s=r._popContext();if(0==(65536&(i=r._bitField)))if(o===w)r._reject(n);else if(o===P||o===r){var a=o===r?c():o.e;r._rejectCallback(a,!1)}else void 0===o&&s>0&&x.longStackTraces()&&x.warnings()&&r._warn("a promise was created in a handler but none were returned from it",!0),r._resolveCallback(o)}},r.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},r.prototype._followee=function(){return this._rejectionHandler0},r.prototype._setFollowee=function(t){this._rejectionHandler0=t},r.prototype._settlePromise=function(t,n,i,o){var s=t instanceof r,a=this._bitField,c=0!=(134217728&a);0!=(65536&a)?(s&&t._invokeInternalOnCancel(),n===F?(i.cancelPromise=t,R(n).call(i,o)===P&&t._reject(P.e)):n===l?t._fulfill(l.call(i)):i instanceof e?i._promiseCancelled(t):s||t instanceof C?t._cancel():i.cancel()):"function"==typeof n?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(n,i,o,t)):n.call(i,o,t):i instanceof e?i._isResolved()||(0!=(33554432&a)?i._promiseFulfilled(o,t):i._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!=(33554432&a)?t._fulfill(o):t._reject(o))},r.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,i=t.receiver,o=t.value;"function"==typeof e?n instanceof r?this._settlePromiseFromHandler(e,i,o,n):e.call(i,o,n):n instanceof r&&n._reject(o)},r.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},r.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)},r.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},r.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():_.settlePromises(this))}},r.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?_.fatalError(t,f.isNode):void((65535&e)>0?0!=(134217728&e)?this._settlePromises():_.settlePromises(this):this._ensurePossibleRejectionHandled())},r.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)}},r.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)}},r.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()},r.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},r.defer=r.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new r(g),resolve:i,reject:o}},f.notEnumerableProp(r,"_makeSelfResolutionError",c),t("./method")(r,g,A,u,x),t("./bind")(r,g,A,x),t("./cancel")(r,C,u,x),t("./direct_resolve")(r),t("./synchronous_inspection")(r),t("./join")(r,C,A,g,x),r.Promise=r,t("./map.js")(r,C,u,A,g,x),t("./using.js")(r,u,A,j,g,x),t("./timers.js")(r,g),t("./generators.js")(r,u,g,A,e,x),t("./nodeify.js")(r),t("./call_get.js")(r),t("./props.js")(r,C,A,u),t("./race.js")(r,g,A,u),t("./reduce.js")(r,C,u,A,g,x),t("./settle.js")(r,C,x),t("./some.js")(r,C,u),t("./promisify.js")(r,g),t("./any.js")(r),t("./each.js")(r,g),t("./filter.js")(r,g),f.toFastProperties(r),f.toFastProperties(r.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new r(g)),x.setBounds(d.firstLineError,f.lastLineError),r}},{"./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){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 a=t("./util");return a.isArray,a.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,o){var s=r(this._values,this._promise);if(s instanceof e){var c=(s=s._target())._bitField;if(this._values=s,0==(50397184&c))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,o);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))return 0===s.length?void(-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{}}}(o))):void this._iterate(s);var l=i("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(l,!1)},s.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?s=(c=c._target())._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()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise.isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nu;u+=2){var f=a[u],p=a[u+1],d=f+e;if(r===g)t[d]=g(f,c,f,p,e,i);else{var _=r(p,function(){return g(f,c,f,p,e,i)});l.notEnumerableProp(_,"__isPromisified__",!0),t[d]=_}}return l.toFastProperties(t),t}var c={},l=t("./util"),u=t("./nodeback"),h=l.withAppended,f=l.maybeWrapAsError,p=l.canEvaluate,d=t("./errors").TypeError,_={__isPromisified__:!0},v=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),y=function(t){return l.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},m=function(t){return t.replace(/([$])/,"\\$")},g=p?void 0:function(t,r,i,o,s,a){function p(){var i=r;r===c&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof _&&this!==d?this[_]:t,l=u(o,a);try{s.apply(i,h(arguments,l))}catch(t){o._rejectCallback(f(t),!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var d=function(){return this}(),_=t;return"string"==typeof _&&(t=o),l.notEnumerableProp(p,"__isPromisified__",!0),p};e.promisify=function(t,e){if("function"!=typeof t)throw new d("expecting a function but got "+l.classString(t));if(i(t))return t;var n=function(t,e,n){return g(t,e,void 0,t,null,n)}(t,void 0===(e=Object(e)).context?c:e.context,!!e.multiArgs);return l.copyDescriptors(t,n,r),n},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new d("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var n=!!(e=Object(e)).multiArgs,r=e.suffix;"string"!=typeof r&&(r="Async");var i=e.filter;"function"!=typeof i&&(i=y);var o=e.promisifier;if("function"!=typeof o&&(o=g),!l.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=l.inheritedDataKeys(t),c=0;co;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,-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 h=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}}();c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){var n;if(this._isMap)n=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}(this._values);else{n={};for(var r=this.length(),i=0,o=this.length();o>i;++i)n[this._values[i+r]]=this._values[i]}return this._resolve(n),!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){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacityo;++o)n[o+r]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},e.exports=r},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(null===(t=s.asArray(t)))return i("expecting an array or an iterable object but got "+s.classString(t));var l=new e(n);void 0!==o&&l._propagateFrom(o,3);for(var u=l._fulfill,h=l._reject,f=0,p=t.length;p>f;++f){var d=t[f];(void 0!==d||f in t)&&e.cast(d)._then(u,h,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=f();this._fn=null===s?n:s.bind(n),void 0!==r&&(r=e.resolve(r))._attachCancellationCallback(this),this._initialValue=r,this._currentCancellable=null,this._eachValues=i===o?[]: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){return"function"!=typeof e?r("expecting a function but got "+p.classString(e)):new a(t,e,n,i).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(h,void 0,void 0,this,void 0)):h.call(this,n)}function h(t){var n,r=this.array,i=r._promise,o=d(r._fn);i._pushContext(),(n=void 0!==r._eachValues?o.call(i._boundValue(),t,this.index,this.length):o.call(i._boundValue(),this.accum,t,this.index,this.length))instanceof e&&(r._currentCancellable=n);var a=i._popContext();return s.checkForgottenReturns(n,a,void 0!==r._eachValues?"Promise.each":"Promise.reduce",i),n}var f=e._getDomain,p=t("./util"),d=p.tryCatch;p.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return 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,o){"use strict";var s,a=t("./util");if(a.isNode&&"undefined"==typeof MutationObserver){var c=i.setImmediate,l=n.nextTick;s=a.isRecentNode?function(t){c.call(i,t)}:function(t){l.call(n,t)}}else"undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&window.navigator.standalone?s=void 0!==r?function(t){r(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:(s=function(t){var e=document.createElement("div");return new MutationObserver(t).observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}}).isStatic=!0;e.exports=s},{"./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;t("./util").inherits(i,n),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},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)},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=t.prototype._isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype.isCancelled=function(){return this._target()._isCancelled()},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,s){var a=new e(n),c=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var l=!0,u=i.tryCatch(r).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,l),a=null)});return l=!1,a&&u===o&&(a._rejectCallback(u.e,!0),a=null),c}var i=t("./util"),o=i.errorObj,s=i.isObject,a={}.hasOwnProperty;return function(t,i){if(s(t)){if(t instanceof e)return t;var c=function(t){try{return function(t){return t.then}(t)}catch(t){return o.e=t,o}}(t);if(c===o){i&&i._pushContext();var l=e.reject(c.e);return i&&i._popContext(),l}if("function"==typeof c)return function(t){return a.call(t,"_promise0")}(t)?(l=new e(n),t._then(l._fulfill,l._reject,void 0,l,null),l):r(t,c,i)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util"),s=e.TimeoutError,a=function(t,e){var n;t.isPending()&&(n="string"!=typeof e?e instanceof Error?e:new s("operation timed out"):new s(e),o.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n))},c=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var i;return void 0!==r?i=e.resolve(r)._then(c,null,null,t,void 0):(i=new e(n),setTimeout(function(){i._fulfill()},+t)),i._setAsyncGuaranteed(),i};e.prototype.delay=function(t){return l(t,this)},e.prototype.timeout=function(t,e){t=+t;var n=this.then(),o=setTimeout(function(){a(n,e)},t);return n._then(r,i,void 0,o,void 0)}}},{"./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,n){var i=0,s=t.length,c=new e(o);return function o(){if(i>=s)return c._fulfill();var l=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(l instanceof e&&l._isDisposable()){try{l=r(l._getDisposer().tryDispose(n),t.promise)}catch(t){return a(t)}if(l instanceof e)return l._then(o,a,null,null,null)}o()}(),c}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function u(t,e,n){this.constructor$(t,e,n)}function h(t){return l.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 p=t("./util"),d=t("./errors").TypeError,_=t("./util").inherits,v=p.errorObj,y=p.tryCatch;l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=null!==e?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},_(u,l),u.prototype.doDispose=function(t,e){return this.data().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 "+p.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(t=(o=arguments[0]).length,a=!1):(o=arguments,t--);for(var u=new f(t),d=0;t>d;++d){var _=o[d];if(l.isDisposer(_)){var m=_;(_=_.promise())._setDisposable(m)}else{var g=r(_);g instanceof e&&(_=g._then(h,null,null,{resources:u,index:d},void 0))}u[d]=_}var b=new Array(u.length);for(d=0;d0},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 u(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,r){"use strict";function i(){try{var t=u;return u=null,t.apply(this,arguments)}catch(t){return p.e=t,p}}function o(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function s(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return h.defineProperty(t,e,r),t}function a(t){try{return t+""}catch(t){return"[no string representation]"}}function c(t){return t instanceof Error&&h.propertyIsWritable(t,"stack")}function l(t){return{}.toString.call(t)}var u,h=t("./es5"),f="undefined"==typeof navigator,p={e:{}},d=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=_.test(t+"")&&h.names(t).length>0;if(n||r||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return v.test(t)},inheritedDataKeys:d,getDataPropertyOrDefault:function(t,e,n){if(!h.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},thrower:function(t){throw t},isArray:h.isArray,asArray:m,notEnumerableProp:s,isPrimitive:o,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},canEvaluate:f,errorObj:p,tryCatch:function(t){return u=t,i},inherits:function(t,e){function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(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},maybeWrapAsError:function(t){return o(t)?new Error(a(t)):t},toFastProperties:function(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t},filledRange:function(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r},toString:a,canAttachTrace:c,ensureErrorObject:y,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{s(t,"isOperational",!0)}catch(t){}},classString:l,copyDescriptors:function(t,e,n){for(var r=h.names(t),i=0;i10||t[0]>0}(),w.isNode&&w.toFastProperties(n);try{throw new Error}catch(t){w.lastLineError=t}e.exports=w},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,i("_process"),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(t,e,n){function r(){u=!1,a.length?l=a.concat(l):h=-1,l.length&&i()}function i(){if(!u){var t=setTimeout(r);u=!0;for(var e=l.length;e;){for(a=l,l=[];++h1)for(var n=1;nu&&0!==p;)h|=t[e++]<u)break;var v=h&l;if(h>>=c,u-=c,v!==o){if(v===s)break;for(var y=a>v?v:_,m=0,g=y;g>o;)g=d[g]>>8,++m;var b=g;if(f+m+(y!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[f++]=b;var w=f+=m;for(y!==v&&(n[f++]=b),g=y;m--;)g=d[g],n[--w]=255&g,g>>=8;null!==_&&4096>a&&(d[a++]=_<<8|b,a>=l+1&&12>c&&(++c,l=l<<1|1)),_=v}else a=s+1,l=(1<<(c=i+1))-1,_=null}return f!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(t,e,n,r){function i(t){var e=t.length;if(2>e||e>256||e&e-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return e}var o=0,s=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(0>=e||0>=n||e>65535||n>65535)throw"Width/Height invalid.";t[o++]=71,t[o++]=73,t[o++]=70,t[o++]=56,t[o++]=57,t[o++]=97;var c=0,l=0;if(null!==a){for(var u=i(a);u>>=1;)++c;if(u=1<=u)throw"Background index out of range.";if(0===l)throw"Background index explicitly passed as 0."}}if(t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=(null!==a?128:0)|c,t[o++]=l,t[o++]=0,null!==a)for(var h=0,f=a.length;f>h;++h){var p=a[h];t[o++]=p>>16&255,t[o++]=p>>8&255,t[o++]=255&p}if(null!==s){if(0>s||s>65535)throw"Loop count invalid.";t[o++]=33,t[o++]=255,t[o++]=11,t[o++]=78,t[o++]=69,t[o++]=84,t[o++]=83,t[o++]=67,t[o++]=65,t[o++]=80,t[o++]=69,t[o++]=50,t[o++]=46,t[o++]=48,t[o++]=3,t[o++]=1,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=0}var d=!1;this.addFrame=function(e,n,r,s,c,l){if(!0===d&&(--o,d=!1),l=void 0===l?{}:l,0>e||0>n||e>65535||n>65535)throw"x/y invalid.";if(0>=r||0>=s||r>65535||s>65535)throw"Width/Height invalid.";if(c.length>=1;)++p;f=1<v||v>3)throw"Disposal out of range.";var y=!1,m=0;if(void 0!==l.transparent&&null!==l.transparent&&(y=!0,0>(m=l.transparent)||m>=f))throw"Transparent color index.";if((0!==v||y||0!==_)&&(t[o++]=33,t[o++]=249,t[o++]=4,t[o++]=v<<2|(!0===y?1:0),t[o++]=255&_,t[o++]=_>>8&255,t[o++]=m,t[o++]=0),t[o++]=44,t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=255&r,t[o++]=r>>8&255,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=!0===u?128|p-1:0,!0===u)for(var g=0,b=h.length;b>g;++g){var w=h[g];t[o++]=w>>16&255,t[o++]=w>>8&255,t[o++]=255&w}o=function(t,e,n,r){function i(n){for(;f>=n;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++)}function o(t){p|=t<v;++v){var m=r[v]&c,g=d<<8|m,b=_[g];if(void 0===b){for(p|=d<=8;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++);4096===u?(o(a),u=l+1,h=n+1,_={}):(u>=1<p?2:p,c)},this.end=function(){return!1===d&&(t[o++]=59,d=!0),o}},n.GifReader=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw"Invalid GIF 87a/89a header.";var n=t[e++]|t[e++]<<8,i=t[e++]|t[e++]<<8,o=t[e++],s=o>>7,a=1<<1+(7&o);t[e++],t[e++];var c=null;s&&(c=e,e+=3*a);var l=!0,u=[],h=0,f=null,p=0,d=null;for(this.width=n,this.height=i;l&&e>2&7,e++;break;case 254:for(;0!==(j=t[e++]);)e+=j;break;default:throw"Unknown graphic control label: 0x"+t[e-1].toString(16)}break;case 44:var v=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,m=t[e++]|t[e++]<<8,g=t[e++]|t[e++]<<8,b=t[e++],w=b>>6&1,A=c,C=!1;b>>7&&(C=!0,A=e,e+=3*(1<<1+(7&b)));var k=e;for(e++;;){var j;if(0===(j=t[e++]))break;e+=j}u.push({x:v,y:y,width:m,height:g,has_local_palette:C,palette_offset:A,data_offset:k,data_length:e-k,transparent_index:f,interlaced:!!w,delay:h,disposal:p});break;case 59:l=!1;break;default:throw"Unknown gif block: 0x"+t[e-1].toString(16)}this.numFrames=function(){return u.length},this.loopCount=function(){return d},this.frameInfo=function(t){if(0>t||t>=u.length)throw"Frame index out of range.";return u[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=C,i[_++]=A,i[_++]=w,i[_++]=255}--f}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=w,i[_++]=A,i[_++]=C,i[_++]=255}--f}}}}catch(t){}},{}]},{},[1])}).call(this,n(0),n(4).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(5),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,c=1,l={},u=!1,h=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){d(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){d(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(d,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n{console.warn=function(){},e.data.marker.id==t&&(o.gifLoaded||(o.gif=gifler(o.contentProps.src).animate(o.textureCanvas),o.gifLoaded=!0),o.gifPlaying=!0,r.needsUpdate=!0)}),console.log("Initialized marker ",t,this.textureCanvas)}get3DMarker(t,e){return e.arController.threePatternMarkers[t]}create3DMarker(t,e){let n=e.createThreeMarker(t),r=this.create3DPlane();return n.add(r),n}create3DPlane(){let t=new THREE.PlaneGeometry,e=new THREE.Mesh(t,this.material),n=this.contentProps;return e.scale.set(n.scale.x,n.scale.y,n.scale.z),e.position.set(n.position.x,n.position.y,n.position.z),e.rotation.set(n.rotation.x,n.rotation.y,n.rotation.z),e}stringToVec3(t){let e=t.split(" ");return{x:e[0]||0,y:e[1]||0,z:e[2]||0}}static get observedAttributes(){return["gif-playing"]}attributeChangedCallback(t,e,n){switch(t){case"gif-playing":"true"==e&&"false"==n?this.gif.then(t=>{t.stop()}):"false"==e&&"true"==n&&this.gif.then(t=>{t.reset(),t.start()})}}set markerId(t){this.setAttribute("marker-id",t)}get markerId(){return this.getAttribute("marker-id")}set canvasTexture(t){this.setAttribute("canvas-texture",t)}get canvasTexture(){this.getAttribute("canvas-texture")}set gifPlaying(t){this.setAttribute("gif-playing",t)}get gifPlaying(){return this.getAttribute("gif-playing")}set patt(t){this.setAttribute("patt",t)}get patt(){return this.getAttribute("patt")}set content(t){this.setAttribute("content",t)}get content(){return this.getAttribute("content")}set mult(t){this.setAttribute("mult",t)}get mult(){return this.hasAttribute("mult")}});var r=n(1),i=n.n(r);function o(t){let e,n;return"portrait"===t?(e=window.innerHeight,n=window.innerWidth):(e=window.innerWidth,n=window.innerHeight),{width:e,height:n}}var s={x:0,y:0,w:640,h:480};customElements.define("ar-scene",class extends HTMLElement{constructor(){super(),this.htmlMarkers=[],this.threeMarkers={},this.renderer={},this.croppedRenderer={}}connectedCallback(){this.htmlMarkers=Array.from(this.children).filter(t=>"AR-MARKER"==t.tagName),this.init(),window.ARController&&ARController.getUserMediaThreeScene&&ARThreeOnLoad()}init(){console.log("AR-GIF version 0.0.4"),window.ARThreeOnLoad=(()=>{ARController.getUserMediaThreeScene({maxARVideoSize:640,cameraParam:i.a,facingMode:"environment",onSuccess:(t,e,n)=>{console.log("Initialized ar-scene"),this.registerMarkers(t,e),window.arController=e;let{renderer:r,croppedRenderer:i}=this.createRenderers(e);this.renderer=r,this.croppedRenderer=i,document.body.appendChild(this.croppedRenderer),this.resizeWindow(),window.addEventListener("resize",this.resizeWindow),window.addEventListener("onorientationchange orientationchange load",this.resizeWindow);let o=()=>{t.process(),t.renderOn(this.renderer),this.drawCroppedImage(this.renderer.domElement,this.croppedRenderer),this.updateMarkersState(e),requestAnimationFrame(o)};o()}})})}drawCroppedImage(t,e){const n=s;e.getContext("2d").drawImage(t,n.x,n.y,n.w,n.h,0,0,e.width,e.height)}registerMarkers(t,e){const n=this;this.htmlMarkers.map(r=>{r.mult?console.log("mult marker"):(console.log("Registering marker ",r.patt),e.loadMarker(r.patt,i=>{r.init(i,t,e),n.threeMarkers[i]=r}))})}updateMarkersState(t){Object.keys(t.threePatternMarkers).map((e,n)=>{let r=t.threePatternMarkers[e];r.visible?(r.children[0].material.needsUpdate=!0,r.children[0].material.map.needsUpdate=!0):r.markerTracker.inPrevious&&!r.markerTracker.inCurrent&&(this.threeMarkers[e].gifPlaying=!1)})}createRenderers(t){let e=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0});e.setSize(640,480),e.domElement.setAttribute("id","arCanvas");let n=document.createElement("canvas");n.setAttribute("id","drawingCanvas");let{width:r,height:i}=o(t.orientation);return n.width=r,n.height=i,"portrait"===t.orientation&&(n.style.transform="rotate(-90deg) translateX(-100%)",n.style.transformOrigin="0 0"),{renderer:e,croppedRenderer:n}}resizeWindow(){let{width:t,height:e}=o(window.arController.orientation);const n=document.getElementById("drawingCanvas");let r,i,a,c;n.width=t,n.height=e,t/e<640/480?(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)?"landscape"===window.arController.orientation?(c=640*t/e,a=480):(c=480,a=640*t/(.7*e)):(c=480,a=480*t/e),r=640-a,i=0):(r=0,a=640,i=480-(c=640*e/t)),s={x:r,y:i,w:a,h:c}}set arScene(t){this.setAttribute("arScene",t)}get arScene(){return this.getAttribute("arScene")}set arController(t){this.setAttribute("arController",t)}get arController(){return this.getAttribute("arController")}});n(7)}]); \ No newline at end of file diff --git a/example/ar-gif.min.js b/example/ar-gif.min.js index 4b33d24..d75f9eb 100644 --- a/example/ar-gif.min.js +++ b/example/ar-gif.min.js @@ -1,2 +1,2 @@ !function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports="data:;base64,AAACgAAAAeBAgwrsW6bUSwAAAAAAAAAAQHQ3KqAAAAAAAAAAAAAAAAAAAAAAAAAAQIL0K3dHyf9AbbNowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAA/uWNa4AAAAL+3lTLAAAAAv17YFWAAAAA/VYLXIAAAAECCe0YgAAAAQIJlMOAAAABAdDcqoAAAAEBts2jAAAAAP+8OmzqkDy4="},function(t,e,n){t.exports=n(8)},function(t,e,n){(function(n,r){var i,o,s,a;/** gifler.js | github.com/themadcreator/gifler | @license: Apache-2.0 */ -!function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){if(!c&&("function"==typeof i&&i))return i(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return o(n||t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof i&&i,a=0;a=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this).map(function(n){return t.decodeFrame(e,n)})},t.decodeFramesAsync=function(e){var n;return a.map(function(){n=[];for(var t=0,r=e.numFrames();r>=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this),function(n){return t.decodeFrame(e,n)},1)},t.decodeFrame=function(t,e){var n;return(n=t.frameInfo(e)).pixels=new Uint8ClampedArray(t.width*t.height*4),t.decodeAndBlitFrameRGBA(e,n.pixels),n},t}(),r=function(){function t(t,e){var n;this._reader=t,this._frames=e,this._advanceFrame=l(this._advanceFrame,this),this._nextFrameRender=l(this._nextFrameRender,this),this._nextFrame=l(this._nextFrame,this),n=this._reader,this.width=n.width,this.height=n.height,this._loopCount=this._reader.loopCount(),this._loops=0,this._frameIndex=0,this._running=!1}return t.createBufferCanvas=function(t,e,n){var r,i,o;return i=(r=document.createElement("canvas")).getContext("2d"),r.width=t.width,r.height=t.height,(o=i.createImageData(e,n)).data.set(t.pixels),i.putImageData(o,-t.x,-t.y),r},t.prototype.start=function(){return this._lastTime=(new Date).valueOf(),this._delayCompensation=0,this._running=!0,setTimeout(this._nextFrame,0),this},t.prototype.stop=function(){return this._running=!1,this},t.prototype.reset=function(){return this._frameIndex=0,this._loops=0,this},t.prototype.running=function(){return this._running},t.prototype._nextFrame=function(){requestAnimationFrame(this._nextFrameRender)},t.prototype._nextFrameRender=function(){var t,e;if(this._running)return t=this._frames[this._frameIndex],null!=(e=this.onFrame)&&e.apply(this,[t,this._frameIndex]),this._enqueueNextFrame()},t.prototype._advanceFrame=function(){this._frameIndex+=1,this._frameIndex>=this._frames.length&&(0!==this._loopCount&&this._loopCount===this._loops?this.stop():(this._frameIndex=0,this._loops+=1))},t.prototype._enqueueNextFrame=function(){var t,e,n,r;for(this._advanceFrame();this._running;){if(n=this._frames[this._frameIndex],e=(new Date).valueOf()-this._lastTime,this._lastTime+=e,this._delayCompensation+=e,t=(r=10*n.delay)-this._delayCompensation,this._delayCompensation-=r,!(0>t)){setTimeout(this._nextFrame,t);break}this._advanceFrame()}},t.prototype.animateInCanvas=function(e,n){var r;return null==n&&(n=!0),n&&(e.width=this.width,e.height=this.height),r=e.getContext("2d"),null==this.onDrawFrame&&(this.onDrawFrame=function(t,e,n){return t.drawImage(e.buffer,e.x,e.y)}),null==this.onFrame&&(this.onFrame=function(n){return function(i,o){var s,a;switch(null==i.buffer&&(i.buffer=t.createBufferCanvas(i,n.width,n.height)),"function"==typeof n.disposeFrame&&n.disposeFrame(),i.disposal){case 2:n.disposeFrame=function(){return r.clearRect(0,0,e.width,e.height)};break;case 3:a=r.getImageData(0,0,e.width,e.height),n.disposeFrame=function(){return r.putImageData(a,0,0)};break;default:n.disposeFrame=null}return null!=(s=n.onDrawFrame)?s.apply(n,[r,i,o]):void 0}}(this)),this.start(),this},t}(),c.Gif=o,c.Decoder=i,c.Animator=r,"undefined"!=typeof window&&null!==window&&(window.gifler=c),null!=e&&(e.exports=c)},{bluebird:2,omggif:4}],2:[function(i,c,l){(function(n,i){!function(n){"object"==typeof l&&void 0!==c?c.exports=n():(s=[],void 0===(a="function"==typeof(o=n)?o.apply(e,s):o)||(t.exports=a))}(function(){return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[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=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return i(n||t)},u,u.exports,t,e,n,r)}return n[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()}},i.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},i.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},i.prototype._reset=function(){this._isTickUsed=!1},e.exports=i,e.exports.firstLineError=c},{"./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 h=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:h,bindingPromise:l};h._then(e,s,void 0,u,f),l._then(a,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(h);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";var r;"undefined"!=typeof Promise&&(r=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(t){}return i},e.exports=i},{"./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 "+s.classString(t)+" has no method '"+s.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){return n(t,this.pop()).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=t("./util"),a=s.canEvaluate;s.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;if("number"==typeof t)e=o;else if(a){var n=(void 0)(t);e=null!==n?n: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(),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))},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._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?i[t]:void 0}var r=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return 0},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promisesCreated=0,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promisesCreated;return t._promisesCreated=0,e}return 0},e.CapturedTrace=null,e.create=function(){return r?new e:void 0},e.activateLongStackTraces=function(){r=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=n,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&t._promisesCreated++}},e}},{}],9:[function(t,e,r){"use strict";e.exports=function(e,r){function i(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: "+E.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function o(t){if(!this.isCancellable())return this;var e=this._onCancel();void 0!==e?E.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function a(t){this._onCancelField=t}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function l(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 u(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new w(this._peekContext())}function f(t,e){if(T(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=_(t);E.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),E.notEnumerableProp(t,"__stackCleaned__",!0)}}}function p(t,n,r){if(B.warnings){var i,o=new x(t);if(n)r._attachExtraTrace(o);else if(B.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=_(o);o.stack=s.message+"\n"+s.stack.join("\n")}v(o,"",!0)}}function d(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:d(e)}}function v(t,e,n){if("undefined"!=typeof console){var r;if(E.isObject(t)){var i=t.stack;r=e+O(i,t)}else r=e+String(t);"function"==typeof k?k(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function y(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){F.throwLater(t)}var o=!1;try{o=U(t,n,r)}catch(t){o=!0,F.throwLater(t)}var s=!1;if(V)try{s=V(t.toLowerCase(),{reason:n,promise:r})}catch(t){s=!0,F.throwLater(t)}o||i||s||"unhandledRejection"!==t||v(n,"Unhandled rejection ")}function m(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():E.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function g(){return"function"==typeof N}function b(t){var e=t.match(L);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function w(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);N(this,w),e>32&&this.uncycle()}var A,C,k,j=e._getDomain,F=e._async,x=t("./errors").Warning,E=t("./util"),T=E.canAttachTrace,P=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,R=null,O=null,S=!1,I=!(0==E.env("BLUEBIRD_WARNINGS")),D=!(0==E.env("BLUEBIRD_LONG_STACK_TRACES"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|2097152},e.prototype._ensurePossibleRejectionHandled=function(){0==(2097152&this._bitField)&&(this._setRejectionIsUnhandled(),F.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){y("rejectionHandled",A,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),y("unhandledRejection",C,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){return p(t,e,this)},e.onPossiblyUnhandledRejection=function(t){var e=j();C="function"==typeof t?null===e?t:e.bind(t):void 0},e.onUnhandledRejectionHandled=function(t){var e=j();A="function"==typeof t?null===e?t:e.bind(t):void 0},e.longStackTraces=function(){if(F.haveItemsQueued()&&!B.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");!B.longStackTraces&&g()&&(B.longStackTraces=!0,e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=f,r.activateLongStackTraces(),F.disableTrampolineIfNecessary())},e.hasLongStackTraces=function(){return B.longStackTraces&&g()},e.config=function(t){if("longStackTraces"in(t=Object(t))&&t.longStackTraces&&e.longStackTraces(),"warnings"in t&&(B.warnings=!!t.warnings),"cancellation"in t&&t.cancellation&&!B.cancellation){if(F.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=c,e.prototype._propagateFrom=l,e.prototype._onCancel=s,e.prototype._setOnCancel=a,e.prototype._attachCancellationCallback=o,e.prototype._execute=i,M=l,B.cancellation=!0}},e.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},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 M=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)},H=function(){return!1},L=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;E.inherits(w,Error),r.CapturedTrace=w,w.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;for(r=(t=this._length=r)-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(r=0;t>r;++r){var s=n[e[r].stack];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var a=r>0?e[r-1]:this;t-1>s?(a._parent=e[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var c=a._length+1,l=r-2;l>=0;--l)e[l]._length=c,c++;return}}}},w.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=_(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(d(i.stack.split("\n"))),i=i._parent;(function(t){for(var e=t[0],n=1;n=0;--a)if(r[a]===o){s=a;break}for(a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}})(r),function(t){for(var e=0;e=0)return R=/@/,O=e,S=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(O=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?m(e):e.toString()},null):(R=t,O=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}(),U=function(){if(E.isNode)return function(t,e,r){return"rejectionHandled"===t?n.emit(t,r):n.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(t){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(t){e=!1}e&&(V=function(e,n){var r;return t?r=new self.CustomEvent(e,{detail:n,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(r=document.createEvent("CustomEvent")).initCustomEvent(e,!1,!0,n),!!r&&!self.dispatchEvent(r)});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,n){var r=o[t],i=self[r];return!!i&&("rejectionHandled"===t?i.call(self,n):i.call(self,e,n),!0)}}();"undefined"!=typeof console&&void 0!==console.warn&&(k=function(t){console.warn(t)},E.isNode&&n.stderr.isTTY?k=function(t,e){var r=e?"":"";n.stderr.write(r+t+"\n")}:E.isNode||"string"!=typeof(new Error).stack||(k=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var B={warnings:I,longStackTraces:!1,cancellation:!1};return D&&e.longStackTraces(),{longStackTraces:function(){return B.longStackTraces},warnings:function(){return B.warnings},cancellation:function(){return B.cancellation},propagateFromFunction:function(){return M},boundValueFunction:function(){return u},checkForgottenReturns:function(t,e,n,r){if(void 0===t&&e>0&&B.longStackTraces&&B.warnings){var i="a promise was created in a "+n+" handler but was not returned from it";r._warn(i)}},setBounds:function(t,e){if(g()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;cs||0>a||!n||!r||n!==r||s>=a||(H=function(t){if(P.test(t))return!0;var e=b(t);return!!(e&&e.fileName===n&&s<=e.line&&e.line<=a)})}},warn:p,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),p(n)},CapturedTrace:w}}},{"./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];return this.caught(t,function(){throw e})},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();return this.caught(n,function(){return r})}}},{}],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 this.mapSeries(t)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,e){return r(t,e)._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?(h(this,"message","string"==typeof r?r:e),h(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?(h(this,"name","OperationalError"),h(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(h(this,"message",t.message),h(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,h=l.notEnumerableProp,f=r("Warning","warning"),p=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(t){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function o(){return a.call(this,this.promise._target()._settledValue())}function s(t){return i(this,t)?void 0:(u.e=t,u)}function a(t){var a=this.promise,c=this.handler;if(!this.called){this.called=!0;var h=0===this.type?c.call(a._boundValue()):c.call(a._boundValue(),t);if(void 0!==h){var f=n(h,a);if(f instanceof e){if(null!=this.cancelPromise){if(f.isCancelled()){var p=new l("late cancellation observer");return a._attachExtraTrace(p),u.e=p,u}f.isPending()&&f._attachCancellationCallback(new r(this))}return f._then(o,s,void 0,this,void 0)}}}return a.isRejected()?(i(this),u.e=t,u):(i(this),t)}var c=t("./util"),l=e.CancellationError,u=c.errorObj;return r.prototype._resultCancelled=function(){i(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,{promise:this,handler:t,called:!1,cancelPromise:null,type:e},void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,a,a)},e.prototype.tap=function(t){return this._passThrough(t,1,a)},a}},{"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,i,o){var s=this._promise=new e(r);s._captureStackTrace(),s._setOnCancel(this),this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(f):f,this._yieldedPromise=null}var c=t("./errors").TypeError,l=t("./util"),u=l.errorObj,h=l.tryCatch,f=[];l.inherits(a,o),a.prototype._isResolved=function(){return null===this.promise},a.prototype._cleanup=function(){this._promise=this._generator=null},a.prototype._promiseCancelled=function(){if(!this._isResolved()){var t;if(void 0!==this._generator.return)this._promise._pushContext(),t=h(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var n=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=n,this._promise._attachExtraTrace(n),this._promise._pushContext(),t=h(this._generator.throw).call(this._generator,n),this._promise._popContext(),t===u&&t.e===n&&(t=null)}var r=this._promise;this._cleanup(),t===u?r._rejectCallback(t.e,!1):r.cancel()}},a.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=h(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},a.prototype.promise=function(){return this._promise},a.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},a.prototype._continue=function(t){var n=this._promise;if(t===u)return this._cleanup(),n._rejectCallback(t.e,!1);var r=t.value;if(!0===t.done)return this._cleanup(),n._resolveCallback(r);var o=i(r,this._promise);if(o instanceof e||null!==(o=function(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]&&(t=arguments[e]);var r=[].slice.call(arguments);t&&r.pop();var i=new n(r).promise();return void 0!==t?i.spread(t):i}}},{"./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:i.bind(e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=n>=1?[]:p,this._init$(void 0,-2)}function c(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+u.classString(e));var o="object"==typeof n&&null!==n?n.concurrency:0;return new a(t,e,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,i).promise()}var l=e._getDomain,u=t("./util"),h=u.tryCatch,f=u.errorObj,p=[];u.inherits(a,n),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(r[n=-1*n-1]=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,p=l._boundValue();l._pushContext();var d=h(u).call(p,t,n,o),_=l._popContext();if(s.checkForgottenReturns(d,_,null!==a?"Promise.filter":"Promise.map",l),d===f)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var y=(v=v._target())._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);d=v._value()}r[n]=d}return++this._totalResolved>=o&&(null!==a?this._filter(r,a):this._resolve(r),!0)},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);return r._popContext(),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,c=new e(n);if(c._captureStackTrace(),c._pushContext(),arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];r=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else r=a(t)();return c._popContext(),c._resolveFromSyncValue(r),c},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){var e;if(function(t){return t instanceof Error&&a.getPrototypeOf(t)===Error.prototype}(t)){(e=new s(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=a.keys(t),r=0;r1){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 u("expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,E(r,t,this))}return this.then(void 0,t)},r.prototype.reflect=function(){return this._then(l,l,void 0,this,void 0)},r.prototype.then=function(t,e){if(F.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)},r.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},r.prototype.spread=function(t){return"function"!=typeof t?u("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,b,void 0)},r.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},r.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new C(this).promise()},r.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},r.is=function(t){return t instanceof r},r.fromNode=r.fromCallback=function(t){var e=new r(g),n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=R(t)(T(e,n));return i===P&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},r.all=function(t){return new C(t).promise()},r.cast=function(t){var e=A(t);return e instanceof r||((e=new r(g))._setFulfilled(),e._rejectionHandler0=t),e},r.resolve=r.fulfilled=r.cast,r.reject=r.rejected=function(t){var e=new r(g);return e._captureStackTrace(),e._rejectCallback(t,!0),e},r.setScheduler=function(t){if("function"!=typeof t)throw new y("expecting a function but got "+f.classString(t));var e=_._schedule;return _._schedule=t,e},r.prototype._then=function(t,e,n,i,o){var s=void 0!==o,c=s?o:new r(g),l=this._target(),u=l._bitField;s||(c._propagateFrom(this,3),c._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo));var h=a();if(0!=(50397184&u)){var f,p,d=l._settlePromiseCtx;0!=(33554432&u)?(p=l._rejectionHandler0,f=t):0!=(16777216&u)?(p=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,p=new m("late cancellation observer"),l._attachExtraTrace(p),f=e),_.invoke(d,l,{handler:null===h?f:"function"==typeof f&&h.bind(f),promise:c,receiver:i,value:p})}else l._addCallbacks(t,e,c,i,h);return c},r.prototype._length=function(){return 65535&this._bitField},r.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},r.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},r.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},r.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField},r.prototype._setRejected=function(){this._bitField=16777216|this._bitField},r.prototype._setFollowing=function(){this._bitField=67108864|this._bitField},r.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},r.prototype._isFinal=function(){return(4194304&this._bitField)>0},r.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},r.prototype._setCancelled=function(){this._bitField=65536|this._bitField},r.prototype._setAsyncGuaranteed=function(){this._bitField=134217728|this._bitField},r.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},r.prototype._promiseAt=function(t){return this[4*t-4+2]},r.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},r.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},r.prototype._boundValue=function(){},r.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)},r.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)},r.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:i.bind(t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:i.bind(e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:i.bind(t)),"function"==typeof e&&(this[s+1]=null===i?e:i.bind(e))}return this._setLength(o+1),o},r.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},r.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=A(t,this);if(!(n instanceof r))return this._fulfill(t);e&&this._propagateFrom(n,2);var i=n._target(),o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;s>a;++a)i._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(i)}else if(0!=(33554432&o))this._fulfill(i._value());else if(0!=(16777216&o))this._reject(i._reason());else{var l=new m("late cancellation observer");i._attachExtraTrace(l),this._reject(l)}}},r.prototype._rejectCallback=function(t,e){var n=f.ensureErrorObject(t),r=n===t;if(!r&&F.warnings()){var i="a promise was rejected with a non-error: "+f.classString(t);this._warn(i,!0)}this._attachExtraTrace(n,!!e&&r),this._reject(t)},r.prototype._resolveFromExecutor=function(t){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)},r.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0==(65536&i)){var o;r._pushContext(),e===b?n&&"number"==typeof n.length?o=R(t).apply(this._boundValue(),n):(o=P).e=new y("cannot .spread() a non-array: "+f.classString(n)):o=R(t).call(e,n);var s=r._popContext();if(0==(65536&(i=r._bitField)))if(o===w)r._reject(n);else if(o===P||o===r){var a=o===r?c():o.e;r._rejectCallback(a,!1)}else void 0===o&&s>0&&F.longStackTraces()&&F.warnings()&&r._warn("a promise was created in a handler but none were returned from it",!0),r._resolveCallback(o)}},r.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},r.prototype._followee=function(){return this._rejectionHandler0},r.prototype._setFollowee=function(t){this._rejectionHandler0=t},r.prototype._settlePromise=function(t,n,i,o){var s=t instanceof r,a=this._bitField,c=0!=(134217728&a);0!=(65536&a)?(s&&t._invokeInternalOnCancel(),n===x?(i.cancelPromise=t,R(n).call(i,o)===P&&t._reject(P.e)):n===l?t._fulfill(l.call(i)):i instanceof e?i._promiseCancelled(t):s||t instanceof C?t._cancel():i.cancel()):"function"==typeof n?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(n,i,o,t)):n.call(i,o,t):i instanceof e?i._isResolved()||(0!=(33554432&a)?i._promiseFulfilled(o,t):i._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!=(33554432&a)?t._fulfill(o):t._reject(o))},r.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,i=t.receiver,o=t.value;"function"==typeof e?n instanceof r?this._settlePromiseFromHandler(e,i,o,n):e.call(i,o,n):n instanceof r&&n._reject(o)},r.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},r.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)},r.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},r.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():_.settlePromises(this))}},r.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?_.fatalError(t,f.isNode):void((65535&e)>0?0!=(134217728&e)?this._settlePromises():_.settlePromises(this):this._ensurePossibleRejectionHandled())},r.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)}},r.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)}},r.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()},r.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},r.defer=r.pending=function(){return F.deprecated("Promise.defer","new Promise"),{promise:new r(g),resolve:i,reject:o}},f.notEnumerableProp(r,"_makeSelfResolutionError",c),t("./method")(r,g,A,u,F),t("./bind")(r,g,A,F),t("./cancel")(r,C,u,F),t("./direct_resolve")(r),t("./synchronous_inspection")(r),t("./join")(r,C,A,g,F),r.Promise=r,t("./map.js")(r,C,u,A,g,F),t("./using.js")(r,u,A,j,g,F),t("./timers.js")(r,g),t("./generators.js")(r,u,g,A,e,F),t("./nodeify.js")(r),t("./call_get.js")(r),t("./props.js")(r,C,A,u),t("./race.js")(r,g,A,u),t("./reduce.js")(r,C,u,A,g,F),t("./settle.js")(r,C,F),t("./some.js")(r,C,u),t("./promisify.js")(r,g),t("./any.js")(r),t("./each.js")(r,g),t("./filter.js")(r,g),f.toFastProperties(r),f.toFastProperties(r.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new r(g)),F.setBounds(d.firstLineError,f.lastLineError),r}},{"./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){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 a=t("./util");return a.isArray,a.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,o){var s=r(this._values,this._promise);if(s instanceof e){var c=(s=s._target())._bitField;if(this._values=s,0==(50397184&c))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,o);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))return 0===s.length?void(-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{}}}(o))):void this._iterate(s);var l=i("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(l,!1)},s.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?s=(c=c._target())._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()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise.isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nu;u+=2){var f=a[u],p=a[u+1],d=f+e;if(r===g)t[d]=g(f,c,f,p,e,i);else{var _=r(p,function(){return g(f,c,f,p,e,i)});l.notEnumerableProp(_,"__isPromisified__",!0),t[d]=_}}return l.toFastProperties(t),t}var c={},l=t("./util"),u=t("./nodeback"),h=l.withAppended,f=l.maybeWrapAsError,p=l.canEvaluate,d=t("./errors").TypeError,_={__isPromisified__:!0},v=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),y=function(t){return l.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},m=function(t){return t.replace(/([$])/,"\\$")},g=p?void 0:function(t,r,i,o,s,a){function p(){var i=r;r===c&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof _&&this!==d?this[_]:t,l=u(o,a);try{s.apply(i,h(arguments,l))}catch(t){o._rejectCallback(f(t),!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var d=function(){return this}(),_=t;return"string"==typeof _&&(t=o),l.notEnumerableProp(p,"__isPromisified__",!0),p};e.promisify=function(t,e){if("function"!=typeof t)throw new d("expecting a function but got "+l.classString(t));if(i(t))return t;var n=function(t,e,n){return g(t,e,void 0,t,null,n)}(t,void 0===(e=Object(e)).context?c:e.context,!!e.multiArgs);return l.copyDescriptors(t,n,r),n},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new d("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var n=!!(e=Object(e)).multiArgs,r=e.suffix;"string"!=typeof r&&(r="Async");var i=e.filter;"function"!=typeof i&&(i=y);var o=e.promisifier;if("function"!=typeof o&&(o=g),!l.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=l.inheritedDataKeys(t),c=0;co;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,-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 h=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}}();c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){var n;if(this._isMap)n=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}(this._values);else{n={};for(var r=this.length(),i=0,o=this.length();o>i;++i)n[this._values[i+r]]=this._values[i]}return this._resolve(n),!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){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacityo;++o)n[o+r]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},e.exports=r},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(null===(t=s.asArray(t)))return i("expecting an array or an iterable object but got "+s.classString(t));var l=new e(n);void 0!==o&&l._propagateFrom(o,3);for(var u=l._fulfill,h=l._reject,f=0,p=t.length;p>f;++f){var d=t[f];(void 0!==d||f in t)&&e.cast(d)._then(u,h,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=f();this._fn=null===s?n:s.bind(n),void 0!==r&&(r=e.resolve(r))._attachCancellationCallback(this),this._initialValue=r,this._currentCancellable=null,this._eachValues=i===o?[]: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){return"function"!=typeof e?r("expecting a function but got "+p.classString(e)):new a(t,e,n,i).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(h,void 0,void 0,this,void 0)):h.call(this,n)}function h(t){var n,r=this.array,i=r._promise,o=d(r._fn);i._pushContext(),(n=void 0!==r._eachValues?o.call(i._boundValue(),t,this.index,this.length):o.call(i._boundValue(),this.accum,t,this.index,this.length))instanceof e&&(r._currentCancellable=n);var a=i._popContext();return s.checkForgottenReturns(n,a,void 0!==r._eachValues?"Promise.each":"Promise.reduce",i),n}var f=e._getDomain,p=t("./util"),d=p.tryCatch;p.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return 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,o){"use strict";var s,a=t("./util");if(a.isNode&&"undefined"==typeof MutationObserver){var c=i.setImmediate,l=n.nextTick;s=a.isRecentNode?function(t){c.call(i,t)}:function(t){l.call(n,t)}}else"undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&window.navigator.standalone?s=void 0!==r?function(t){r(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:(s=function(t){var e=document.createElement("div");return new MutationObserver(t).observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}}).isStatic=!0;e.exports=s},{"./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;t("./util").inherits(i,n),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},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)},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=t.prototype._isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype.isCancelled=function(){return this._target()._isCancelled()},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,s){var a=new e(n),c=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var l=!0,u=i.tryCatch(r).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,l),a=null)});return l=!1,a&&u===o&&(a._rejectCallback(u.e,!0),a=null),c}var i=t("./util"),o=i.errorObj,s=i.isObject,a={}.hasOwnProperty;return function(t,i){if(s(t)){if(t instanceof e)return t;var c=function(t){try{return function(t){return t.then}(t)}catch(t){return o.e=t,o}}(t);if(c===o){i&&i._pushContext();var l=e.reject(c.e);return i&&i._popContext(),l}if("function"==typeof c)return function(t){return a.call(t,"_promise0")}(t)?(l=new e(n),t._then(l._fulfill,l._reject,void 0,l,null),l):r(t,c,i)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util"),s=e.TimeoutError,a=function(t,e){var n;t.isPending()&&(n="string"!=typeof e?e instanceof Error?e:new s("operation timed out"):new s(e),o.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n))},c=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var i;return void 0!==r?i=e.resolve(r)._then(c,null,null,t,void 0):(i=new e(n),setTimeout(function(){i._fulfill()},+t)),i._setAsyncGuaranteed(),i};e.prototype.delay=function(t){return l(t,this)},e.prototype.timeout=function(t,e){t=+t;var n=this.then(),o=setTimeout(function(){a(n,e)},t);return n._then(r,i,void 0,o,void 0)}}},{"./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,n){var i=0,s=t.length,c=new e(o);return function o(){if(i>=s)return c._fulfill();var l=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(l instanceof e&&l._isDisposable()){try{l=r(l._getDisposer().tryDispose(n),t.promise)}catch(t){return a(t)}if(l instanceof e)return l._then(o,a,null,null,null)}o()}(),c}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function u(t,e,n){this.constructor$(t,e,n)}function h(t){return l.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 p=t("./util"),d=t("./errors").TypeError,_=t("./util").inherits,v=p.errorObj,y=p.tryCatch;l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=null!==e?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},_(u,l),u.prototype.doDispose=function(t,e){return this.data().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 "+p.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(t=(o=arguments[0]).length,a=!1):(o=arguments,t--);for(var u=new f(t),d=0;t>d;++d){var _=o[d];if(l.isDisposer(_)){var m=_;(_=_.promise())._setDisposable(m)}else{var g=r(_);g instanceof e&&(_=g._then(h,null,null,{resources:u,index:d},void 0))}u[d]=_}var b=new Array(u.length);for(d=0;d0},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 u(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,r){"use strict";function i(){try{var t=u;return u=null,t.apply(this,arguments)}catch(t){return p.e=t,p}}function o(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function s(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return h.defineProperty(t,e,r),t}function a(t){try{return t+""}catch(t){return"[no string representation]"}}function c(t){return t instanceof Error&&h.propertyIsWritable(t,"stack")}function l(t){return{}.toString.call(t)}var u,h=t("./es5"),f="undefined"==typeof navigator,p={e:{}},d=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=_.test(t+"")&&h.names(t).length>0;if(n||r||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return v.test(t)},inheritedDataKeys:d,getDataPropertyOrDefault:function(t,e,n){if(!h.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},thrower:function(t){throw t},isArray:h.isArray,asArray:m,notEnumerableProp:s,isPrimitive:o,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},canEvaluate:f,errorObj:p,tryCatch:function(t){return u=t,i},inherits:function(t,e){function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(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},maybeWrapAsError:function(t){return o(t)?new Error(a(t)):t},toFastProperties:function(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t},filledRange:function(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r},toString:a,canAttachTrace:c,ensureErrorObject:y,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{s(t,"isOperational",!0)}catch(t){}},classString:l,copyDescriptors:function(t,e,n){for(var r=h.names(t),i=0;i10||t[0]>0}(),w.isNode&&w.toFastProperties(n);try{throw new Error}catch(t){w.lastLineError=t}e.exports=w},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,i("_process"),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(t,e,n){function r(){u=!1,a.length?l=a.concat(l):h=-1,l.length&&i()}function i(){if(!u){var t=setTimeout(r);u=!0;for(var e=l.length;e;){for(a=l,l=[];++h1)for(var n=1;nu&&0!==p;)h|=t[e++]<u)break;var v=h&l;if(h>>=c,u-=c,v!==o){if(v===s)break;for(var y=a>v?v:_,m=0,g=y;g>o;)g=d[g]>>8,++m;var b=g;if(f+m+(y!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[f++]=b;var w=f+=m;for(y!==v&&(n[f++]=b),g=y;m--;)g=d[g],n[--w]=255&g,g>>=8;null!==_&&4096>a&&(d[a++]=_<<8|b,a>=l+1&&12>c&&(++c,l=l<<1|1)),_=v}else a=s+1,l=(1<<(c=i+1))-1,_=null}return f!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(t,e,n,r){function i(t){var e=t.length;if(2>e||e>256||e&e-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return e}var o=0,s=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(0>=e||0>=n||e>65535||n>65535)throw"Width/Height invalid.";t[o++]=71,t[o++]=73,t[o++]=70,t[o++]=56,t[o++]=57,t[o++]=97;var c=0,l=0;if(null!==a){for(var u=i(a);u>>=1;)++c;if(u=1<=u)throw"Background index out of range.";if(0===l)throw"Background index explicitly passed as 0."}}if(t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=(null!==a?128:0)|c,t[o++]=l,t[o++]=0,null!==a)for(var h=0,f=a.length;f>h;++h){var p=a[h];t[o++]=p>>16&255,t[o++]=p>>8&255,t[o++]=255&p}if(null!==s){if(0>s||s>65535)throw"Loop count invalid.";t[o++]=33,t[o++]=255,t[o++]=11,t[o++]=78,t[o++]=69,t[o++]=84,t[o++]=83,t[o++]=67,t[o++]=65,t[o++]=80,t[o++]=69,t[o++]=50,t[o++]=46,t[o++]=48,t[o++]=3,t[o++]=1,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=0}var d=!1;this.addFrame=function(e,n,r,s,c,l){if(!0===d&&(--o,d=!1),l=void 0===l?{}:l,0>e||0>n||e>65535||n>65535)throw"x/y invalid.";if(0>=r||0>=s||r>65535||s>65535)throw"Width/Height invalid.";if(c.length>=1;)++p;f=1<v||v>3)throw"Disposal out of range.";var y=!1,m=0;if(void 0!==l.transparent&&null!==l.transparent&&(y=!0,0>(m=l.transparent)||m>=f))throw"Transparent color index.";if((0!==v||y||0!==_)&&(t[o++]=33,t[o++]=249,t[o++]=4,t[o++]=v<<2|(!0===y?1:0),t[o++]=255&_,t[o++]=_>>8&255,t[o++]=m,t[o++]=0),t[o++]=44,t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=255&r,t[o++]=r>>8&255,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=!0===u?128|p-1:0,!0===u)for(var g=0,b=h.length;b>g;++g){var w=h[g];t[o++]=w>>16&255,t[o++]=w>>8&255,t[o++]=255&w}o=function(t,e,n,r){function i(n){for(;f>=n;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++)}function o(t){p|=t<v;++v){var m=r[v]&c,g=d<<8|m,b=_[g];if(void 0===b){for(p|=d<=8;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++);4096===u?(o(a),u=l+1,h=n+1,_={}):(u>=1<p?2:p,c)},this.end=function(){return!1===d&&(t[o++]=59,d=!0),o}},n.GifReader=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw"Invalid GIF 87a/89a header.";var n=t[e++]|t[e++]<<8,i=t[e++]|t[e++]<<8,o=t[e++],s=o>>7,a=1<<1+(7&o);t[e++],t[e++];var c=null;s&&(c=e,e+=3*a);var l=!0,u=[],h=0,f=null,p=0,d=null;for(this.width=n,this.height=i;l&&e>2&7,e++;break;case 254:for(;0!==(j=t[e++]);)e+=j;break;default:throw"Unknown graphic control label: 0x"+t[e-1].toString(16)}break;case 44:var v=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,m=t[e++]|t[e++]<<8,g=t[e++]|t[e++]<<8,b=t[e++],w=b>>6&1,A=c,C=!1;b>>7&&(C=!0,A=e,e+=3*(1<<1+(7&b)));var k=e;for(e++;;){var j;if(0===(j=t[e++]))break;e+=j}u.push({x:v,y:y,width:m,height:g,has_local_palette:C,palette_offset:A,data_offset:k,data_length:e-k,transparent_index:f,interlaced:!!w,delay:h,disposal:p});break;case 59:l=!1;break;default:throw"Unknown gif block: 0x"+t[e-1].toString(16)}this.numFrames=function(){return u.length},this.loopCount=function(){return d},this.frameInfo=function(t){if(0>t||t>=u.length)throw"Frame index out of range.";return u[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=C,i[_++]=A,i[_++]=w,i[_++]=255}--f}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=w,i[_++]=A,i[_++]=C,i[_++]=255}--f}}}}catch(t){}},{}]},{},[1])}).call(this,n(0),n(4).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(5),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,c=1,l={},u=!1,h=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){d(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){d(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(d,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n{console.warn=function(){},e.data.marker.id==t&&(o.gifLoaded||(o.gif=gifler(o.contentProps.src).animate(o.textureCanvas),o.gifLoaded=!0),o.gifPlaying=!0,r.needsUpdate=!0)}),console.log("Initialized marker ",t,this.textureCanvas)}get3DMarker(t,e){return e.arController.threePatternMarkers[t]}create3DMarker(t,e){let n=e.createThreeMarker(t),r=this.create3DPlane();return n.add(r),n}create3DPlane(){let t=new THREE.PlaneGeometry,e=new THREE.Mesh(t,this.material),n=this.contentProps;return e.scale.set(n.scale.x,n.scale.y,n.scale.z),e.position.set(n.position.x,n.position.y,n.position.z),e.rotation.set(n.rotation.x,n.rotation.y,n.rotation.z),e}stringToVec3(t){let e=t.split(" ");return{x:e[0]||0,y:e[1]||0,z:e[2]||0}}static get observedAttributes(){return["gif-playing"]}attributeChangedCallback(t,e,n){switch(t){case"gif-playing":"true"==e&&"false"==n?this.gif.then(t=>{t.stop()}):"false"==e&&"true"==n&&this.gif.then(t=>{t.reset(),t.start()})}}set markerId(t){this.setAttribute("marker-id",t)}get markerId(){return this.getAttribute("marker-id")}set canvasTexture(t){this.setAttribute("canvas-texture",t)}get canvasTexture(){this.getAttribute("canvas-texture")}set gifPlaying(t){this.setAttribute("gif-playing",t)}get gifPlaying(){return this.getAttribute("gif-playing")}set patt(t){this.setAttribute("patt",t)}get patt(){return this.getAttribute("patt")}set content(t){this.setAttribute("content",t)}get content(){return this.getAttribute("content")}set mult(t){this.setAttribute("mult",t)}get mult(){return this.hasAttribute("mult")}});var r=n(1),i=n.n(r);customElements.define("ar-scene",class extends HTMLElement{constructor(){super(),this.htmlMarkers=[],this.threeMarkers={}}connectedCallback(){this.htmlMarkers=Array.from(this.children).filter(t=>"AR-MARKER"==t.tagName),this.init(),window.ARController&&ARController.getUserMediaThreeScene&&ARThreeOnLoad()}init(){console.log("AR-GIF version 0.0.3");const t=this;window.ARThreeOnLoad=(()=>{ARController.getUserMediaThreeScene({maxARVideoSize:640,cameraParam:i.a,facingMode:"environment",onSuccess:(e,n,r)=>{console.log("Initialized ar-scene"),t.registerMarkers(e,n);let i=t.createRenderer(e,n);i.domElement.setAttribute("id","arCanvas"),document.body.appendChild(i.domElement),window.addEventListener("resize",this.resizeWindow);let o=()=>{e.process(),e.renderOn(i),t.updateMarkersState(n),requestAnimationFrame(o)};o()}})})}registerMarkers(t,e){const n=this;this.htmlMarkers.map(r=>{r.mult?console.log("mult marker"):(console.log("Registering marker ",r.patt),e.loadMarker(r.patt,i=>{r.init(i,t,e),n.threeMarkers[i]=r}))})}updateMarkersState(t){Object.keys(t.threePatternMarkers).map((e,n)=>{let r=t.threePatternMarkers[e];r.visible?(r.children[0].material.needsUpdate=!0,r.children[0].material.map.needsUpdate=!0):r.markerTracker.inPrevious&&!r.markerTracker.inCurrent&&(this.threeMarkers[e].gifPlaying=!1)})}createRenderer(t,e){let n=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0}),r=window.innerHeight,i=640/480*window.screen.availHeight*window.devicePixelRatio;return n.setSize(i,r),"portrait"===e.orientation?(n.domElement.style.transformOrigin="0 0",n.domElement.style.transform="rotate(-90deg) translateX(-100%)"):window.screen.availWidth>window.screen.availHeight&&n.setSize(window.screen.availWidth,r),n}resizeWindow(){let t=document.getElementById("arCanvas");t.setAttribute("width",window.innerWidth),t.setAttribute("height",window.innerHeight),t.style.width=window.innerWidth,t.style.height=window.innerHeight}set arScene(t){this.setAttribute("arScene",t)}get arScene(){return this.getAttribute("arScene")}set arController(t){this.setAttribute("arController",t)}get arController(){return this.getAttribute("arController")}set renderer(t){this.setAttribute("renderer",t)}get renderer(){return this.getAttribute("renderer")}});n(7)}]); \ No newline at end of file +!function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){if(!c&&("function"==typeof i&&i))return i(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return o(n||t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof i&&i,a=0;a=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this).map(function(n){return t.decodeFrame(e,n)})},t.decodeFramesAsync=function(e){var n;return a.map(function(){n=[];for(var t=0,r=e.numFrames();r>=0?r>t:t>r;r>=0?t++:t--)n.push(t);return n}.apply(this),function(n){return t.decodeFrame(e,n)},1)},t.decodeFrame=function(t,e){var n;return(n=t.frameInfo(e)).pixels=new Uint8ClampedArray(t.width*t.height*4),t.decodeAndBlitFrameRGBA(e,n.pixels),n},t}(),r=function(){function t(t,e){var n;this._reader=t,this._frames=e,this._advanceFrame=l(this._advanceFrame,this),this._nextFrameRender=l(this._nextFrameRender,this),this._nextFrame=l(this._nextFrame,this),n=this._reader,this.width=n.width,this.height=n.height,this._loopCount=this._reader.loopCount(),this._loops=0,this._frameIndex=0,this._running=!1}return t.createBufferCanvas=function(t,e,n){var r,i,o;return i=(r=document.createElement("canvas")).getContext("2d"),r.width=t.width,r.height=t.height,(o=i.createImageData(e,n)).data.set(t.pixels),i.putImageData(o,-t.x,-t.y),r},t.prototype.start=function(){return this._lastTime=(new Date).valueOf(),this._delayCompensation=0,this._running=!0,setTimeout(this._nextFrame,0),this},t.prototype.stop=function(){return this._running=!1,this},t.prototype.reset=function(){return this._frameIndex=0,this._loops=0,this},t.prototype.running=function(){return this._running},t.prototype._nextFrame=function(){requestAnimationFrame(this._nextFrameRender)},t.prototype._nextFrameRender=function(){var t,e;if(this._running)return t=this._frames[this._frameIndex],null!=(e=this.onFrame)&&e.apply(this,[t,this._frameIndex]),this._enqueueNextFrame()},t.prototype._advanceFrame=function(){this._frameIndex+=1,this._frameIndex>=this._frames.length&&(0!==this._loopCount&&this._loopCount===this._loops?this.stop():(this._frameIndex=0,this._loops+=1))},t.prototype._enqueueNextFrame=function(){var t,e,n,r;for(this._advanceFrame();this._running;){if(n=this._frames[this._frameIndex],e=(new Date).valueOf()-this._lastTime,this._lastTime+=e,this._delayCompensation+=e,t=(r=10*n.delay)-this._delayCompensation,this._delayCompensation-=r,!(0>t)){setTimeout(this._nextFrame,t);break}this._advanceFrame()}},t.prototype.animateInCanvas=function(e,n){var r;return null==n&&(n=!0),n&&(e.width=this.width,e.height=this.height),r=e.getContext("2d"),null==this.onDrawFrame&&(this.onDrawFrame=function(t,e,n){return t.drawImage(e.buffer,e.x,e.y)}),null==this.onFrame&&(this.onFrame=function(n){return function(i,o){var s,a;switch(null==i.buffer&&(i.buffer=t.createBufferCanvas(i,n.width,n.height)),"function"==typeof n.disposeFrame&&n.disposeFrame(),i.disposal){case 2:n.disposeFrame=function(){return r.clearRect(0,0,e.width,e.height)};break;case 3:a=r.getImageData(0,0,e.width,e.height),n.disposeFrame=function(){return r.putImageData(a,0,0)};break;default:n.disposeFrame=null}return null!=(s=n.onDrawFrame)?s.apply(n,[r,i,o]):void 0}}(this)),this.start(),this},t}(),c.Gif=o,c.Decoder=i,c.Animator=r,"undefined"!=typeof window&&null!==window&&(window.gifler=c),null!=e&&(e.exports=c)},{bluebird:2,omggif:4}],2:[function(i,c,l){(function(n,i){!function(n){"object"==typeof l&&void 0!==c?c.exports=n():(s=[],void 0===(a="function"==typeof(o=n)?o.apply(e,s):o)||(t.exports=a))}(function(){return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[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=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return i(n||t)},u,u.exports,t,e,n,r)}return n[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()}},i.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},i.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},i.prototype._reset=function(){this._isTickUsed=!1},e.exports=i,e.exports.firstLineError=c},{"./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 h=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:h,bindingPromise:l};h._then(e,s,void 0,u,f),l._then(a,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(h);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";var r;"undefined"!=typeof Promise&&(r=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(t){}return i},e.exports=i},{"./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 "+s.classString(t)+" has no method '"+s.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){return n(t,this.pop()).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=t("./util"),a=s.canEvaluate;s.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;if("number"==typeof t)e=o;else if(a){var n=(void 0)(t);e=null!==n?n: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(),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))},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._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?i[t]:void 0}var r=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return 0},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promisesCreated=0,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promisesCreated;return t._promisesCreated=0,e}return 0},e.CapturedTrace=null,e.create=function(){return r?new e:void 0},e.activateLongStackTraces=function(){r=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=n,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&t._promisesCreated++}},e}},{}],9:[function(t,e,r){"use strict";e.exports=function(e,r){function i(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: "+E.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function o(t){if(!this.isCancellable())return this;var e=this._onCancel();void 0!==e?E.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function a(t){this._onCancelField=t}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function l(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 u(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new w(this._peekContext())}function f(t,e){if(T(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=_(t);E.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),E.notEnumerableProp(t,"__stackCleaned__",!0)}}}function p(t,n,r){if(B.warnings){var i,o=new F(t);if(n)r._attachExtraTrace(o);else if(B.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=_(o);o.stack=s.message+"\n"+s.stack.join("\n")}v(o,"",!0)}}function d(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:d(e)}}function v(t,e,n){if("undefined"!=typeof console){var r;if(E.isObject(t)){var i=t.stack;r=e+O(i,t)}else r=e+String(t);"function"==typeof k?k(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function y(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){x.throwLater(t)}var o=!1;try{o=U(t,n,r)}catch(t){o=!0,x.throwLater(t)}var s=!1;if(V)try{s=V(t.toLowerCase(),{reason:n,promise:r})}catch(t){s=!0,x.throwLater(t)}o||i||s||"unhandledRejection"!==t||v(n,"Unhandled rejection ")}function m(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():E.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function g(){return"function"==typeof N}function b(t){var e=t.match(H);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function w(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);N(this,w),e>32&&this.uncycle()}var A,C,k,j=e._getDomain,x=e._async,F=t("./errors").Warning,E=t("./util"),T=E.canAttachTrace,P=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,R=null,O=null,S=!1,I=!(0==E.env("BLUEBIRD_WARNINGS")),M=!(0==E.env("BLUEBIRD_LONG_STACK_TRACES"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|2097152},e.prototype._ensurePossibleRejectionHandled=function(){0==(2097152&this._bitField)&&(this._setRejectionIsUnhandled(),x.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){y("rejectionHandled",A,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),y("unhandledRejection",C,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){return p(t,e,this)},e.onPossiblyUnhandledRejection=function(t){var e=j();C="function"==typeof t?null===e?t:e.bind(t):void 0},e.onUnhandledRejectionHandled=function(t){var e=j();A="function"==typeof t?null===e?t:e.bind(t):void 0},e.longStackTraces=function(){if(x.haveItemsQueued()&&!B.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");!B.longStackTraces&&g()&&(B.longStackTraces=!0,e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=f,r.activateLongStackTraces(),x.disableTrampolineIfNecessary())},e.hasLongStackTraces=function(){return B.longStackTraces&&g()},e.config=function(t){if("longStackTraces"in(t=Object(t))&&t.longStackTraces&&e.longStackTraces(),"warnings"in t&&(B.warnings=!!t.warnings),"cancellation"in t&&t.cancellation&&!B.cancellation){if(x.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=c,e.prototype._propagateFrom=l,e.prototype._onCancel=s,e.prototype._setOnCancel=a,e.prototype._attachCancellationCallback=o,e.prototype._execute=i,D=l,B.cancellation=!0}},e.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},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 D=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)},L=function(){return!1},H=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;E.inherits(w,Error),r.CapturedTrace=w,w.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;for(r=(t=this._length=r)-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(r=0;t>r;++r){var s=n[e[r].stack];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var a=r>0?e[r-1]:this;t-1>s?(a._parent=e[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var c=a._length+1,l=r-2;l>=0;--l)e[l]._length=c,c++;return}}}},w.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=_(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(d(i.stack.split("\n"))),i=i._parent;(function(t){for(var e=t[0],n=1;n=0;--a)if(r[a]===o){s=a;break}for(a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}})(r),function(t){for(var e=0;e=0)return R=/@/,O=e,S=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(O=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?m(e):e.toString()},null):(R=t,O=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}(),U=function(){if(E.isNode)return function(t,e,r){return"rejectionHandled"===t?n.emit(t,r):n.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(t){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(t){e=!1}e&&(V=function(e,n){var r;return t?r=new self.CustomEvent(e,{detail:n,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(r=document.createEvent("CustomEvent")).initCustomEvent(e,!1,!0,n),!!r&&!self.dispatchEvent(r)});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,n){var r=o[t],i=self[r];return!!i&&("rejectionHandled"===t?i.call(self,n):i.call(self,e,n),!0)}}();"undefined"!=typeof console&&void 0!==console.warn&&(k=function(t){console.warn(t)},E.isNode&&n.stderr.isTTY?k=function(t,e){var r=e?"":"";n.stderr.write(r+t+"\n")}:E.isNode||"string"!=typeof(new Error).stack||(k=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var B={warnings:I,longStackTraces:!1,cancellation:!1};return M&&e.longStackTraces(),{longStackTraces:function(){return B.longStackTraces},warnings:function(){return B.warnings},cancellation:function(){return B.cancellation},propagateFromFunction:function(){return D},boundValueFunction:function(){return u},checkForgottenReturns:function(t,e,n,r){if(void 0===t&&e>0&&B.longStackTraces&&B.warnings){var i="a promise was created in a "+n+" handler but was not returned from it";r._warn(i)}},setBounds:function(t,e){if(g()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;cs||0>a||!n||!r||n!==r||s>=a||(L=function(t){if(P.test(t))return!0;var e=b(t);return!!(e&&e.fileName===n&&s<=e.line&&e.line<=a)})}},warn:p,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),p(n)},CapturedTrace:w}}},{"./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];return this.caught(t,function(){throw e})},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();return this.caught(n,function(){return r})}}},{}],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 this.mapSeries(t)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,e){return r(t,e)._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?(h(this,"message","string"==typeof r?r:e),h(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?(h(this,"name","OperationalError"),h(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(h(this,"message",t.message),h(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,h=l.notEnumerableProp,f=r("Warning","warning"),p=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(t){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function o(){return a.call(this,this.promise._target()._settledValue())}function s(t){return i(this,t)?void 0:(u.e=t,u)}function a(t){var a=this.promise,c=this.handler;if(!this.called){this.called=!0;var h=0===this.type?c.call(a._boundValue()):c.call(a._boundValue(),t);if(void 0!==h){var f=n(h,a);if(f instanceof e){if(null!=this.cancelPromise){if(f.isCancelled()){var p=new l("late cancellation observer");return a._attachExtraTrace(p),u.e=p,u}f.isPending()&&f._attachCancellationCallback(new r(this))}return f._then(o,s,void 0,this,void 0)}}}return a.isRejected()?(i(this),u.e=t,u):(i(this),t)}var c=t("./util"),l=e.CancellationError,u=c.errorObj;return r.prototype._resultCancelled=function(){i(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,{promise:this,handler:t,called:!1,cancelPromise:null,type:e},void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,a,a)},e.prototype.tap=function(t){return this._passThrough(t,1,a)},a}},{"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,i,o){var s=this._promise=new e(r);s._captureStackTrace(),s._setOnCancel(this),this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(f):f,this._yieldedPromise=null}var c=t("./errors").TypeError,l=t("./util"),u=l.errorObj,h=l.tryCatch,f=[];l.inherits(a,o),a.prototype._isResolved=function(){return null===this.promise},a.prototype._cleanup=function(){this._promise=this._generator=null},a.prototype._promiseCancelled=function(){if(!this._isResolved()){var t;if(void 0!==this._generator.return)this._promise._pushContext(),t=h(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var n=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=n,this._promise._attachExtraTrace(n),this._promise._pushContext(),t=h(this._generator.throw).call(this._generator,n),this._promise._popContext(),t===u&&t.e===n&&(t=null)}var r=this._promise;this._cleanup(),t===u?r._rejectCallback(t.e,!1):r.cancel()}},a.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=h(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(e)},a.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},a.prototype.promise=function(){return this._promise},a.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},a.prototype._continue=function(t){var n=this._promise;if(t===u)return this._cleanup(),n._rejectCallback(t.e,!1);var r=t.value;if(!0===t.done)return this._cleanup(),n._resolveCallback(r);var o=i(r,this._promise);if(o instanceof e||null!==(o=function(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]&&(t=arguments[e]);var r=[].slice.call(arguments);t&&r.pop();var i=new n(r).promise();return void 0!==t?i.spread(t):i}}},{"./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:i.bind(e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=n>=1?[]:p,this._init$(void 0,-2)}function c(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+u.classString(e));var o="object"==typeof n&&null!==n?n.concurrency:0;return new a(t,e,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,i).promise()}var l=e._getDomain,u=t("./util"),h=u.tryCatch,f=u.errorObj,p=[];u.inherits(a,n),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(r[n=-1*n-1]=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,p=l._boundValue();l._pushContext();var d=h(u).call(p,t,n,o),_=l._popContext();if(s.checkForgottenReturns(d,_,null!==a?"Promise.filter":"Promise.map",l),d===f)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var y=(v=v._target())._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);d=v._value()}r[n]=d}return++this._totalResolved>=o&&(null!==a?this._filter(r,a):this._resolve(r),!0)},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);return r._popContext(),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,c=new e(n);if(c._captureStackTrace(),c._pushContext(),arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];r=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else r=a(t)();return c._popContext(),c._resolveFromSyncValue(r),c},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){var e;if(function(t){return t instanceof Error&&a.getPrototypeOf(t)===Error.prototype}(t)){(e=new s(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=a.keys(t),r=0;r1){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 u("expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,E(r,t,this))}return this.then(void 0,t)},r.prototype.reflect=function(){return this._then(l,l,void 0,this,void 0)},r.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)},r.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},r.prototype.spread=function(t){return"function"!=typeof t?u("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,b,void 0)},r.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},r.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new C(this).promise()},r.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},r.is=function(t){return t instanceof r},r.fromNode=r.fromCallback=function(t){var e=new r(g),n=arguments.length>1&&!!Object(arguments[1]).multiArgs,i=R(t)(T(e,n));return i===P&&e._rejectCallback(i.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},r.all=function(t){return new C(t).promise()},r.cast=function(t){var e=A(t);return e instanceof r||((e=new r(g))._setFulfilled(),e._rejectionHandler0=t),e},r.resolve=r.fulfilled=r.cast,r.reject=r.rejected=function(t){var e=new r(g);return e._captureStackTrace(),e._rejectCallback(t,!0),e},r.setScheduler=function(t){if("function"!=typeof t)throw new y("expecting a function but got "+f.classString(t));var e=_._schedule;return _._schedule=t,e},r.prototype._then=function(t,e,n,i,o){var s=void 0!==o,c=s?o:new r(g),l=this._target(),u=l._bitField;s||(c._propagateFrom(this,3),c._captureStackTrace(),void 0===i&&0!=(2097152&this._bitField)&&(i=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo));var h=a();if(0!=(50397184&u)){var f,p,d=l._settlePromiseCtx;0!=(33554432&u)?(p=l._rejectionHandler0,f=t):0!=(16777216&u)?(p=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,p=new m("late cancellation observer"),l._attachExtraTrace(p),f=e),_.invoke(d,l,{handler:null===h?f:"function"==typeof f&&h.bind(f),promise:c,receiver:i,value:p})}else l._addCallbacks(t,e,c,i,h);return c},r.prototype._length=function(){return 65535&this._bitField},r.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},r.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},r.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},r.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField},r.prototype._setRejected=function(){this._bitField=16777216|this._bitField},r.prototype._setFollowing=function(){this._bitField=67108864|this._bitField},r.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},r.prototype._isFinal=function(){return(4194304&this._bitField)>0},r.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},r.prototype._setCancelled=function(){this._bitField=65536|this._bitField},r.prototype._setAsyncGuaranteed=function(){this._bitField=134217728|this._bitField},r.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},r.prototype._promiseAt=function(t){return this[4*t-4+2]},r.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},r.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},r.prototype._boundValue=function(){},r.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)},r.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)},r.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:i.bind(t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:i.bind(e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:i.bind(t)),"function"==typeof e&&(this[s+1]=null===i?e:i.bind(e))}return this._setLength(o+1),o},r.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},r.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=A(t,this);if(!(n instanceof r))return this._fulfill(t);e&&this._propagateFrom(n,2);var i=n._target(),o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;s>a;++a)i._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(i)}else if(0!=(33554432&o))this._fulfill(i._value());else if(0!=(16777216&o))this._reject(i._reason());else{var l=new m("late cancellation observer");i._attachExtraTrace(l),this._reject(l)}}},r.prototype._rejectCallback=function(t,e){var n=f.ensureErrorObject(t),r=n===t;if(!r&&x.warnings()){var i="a promise was rejected with a non-error: "+f.classString(t);this._warn(i,!0)}this._attachExtraTrace(n,!!e&&r),this._reject(t)},r.prototype._resolveFromExecutor=function(t){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)},r.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0==(65536&i)){var o;r._pushContext(),e===b?n&&"number"==typeof n.length?o=R(t).apply(this._boundValue(),n):(o=P).e=new y("cannot .spread() a non-array: "+f.classString(n)):o=R(t).call(e,n);var s=r._popContext();if(0==(65536&(i=r._bitField)))if(o===w)r._reject(n);else if(o===P||o===r){var a=o===r?c():o.e;r._rejectCallback(a,!1)}else void 0===o&&s>0&&x.longStackTraces()&&x.warnings()&&r._warn("a promise was created in a handler but none were returned from it",!0),r._resolveCallback(o)}},r.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},r.prototype._followee=function(){return this._rejectionHandler0},r.prototype._setFollowee=function(t){this._rejectionHandler0=t},r.prototype._settlePromise=function(t,n,i,o){var s=t instanceof r,a=this._bitField,c=0!=(134217728&a);0!=(65536&a)?(s&&t._invokeInternalOnCancel(),n===F?(i.cancelPromise=t,R(n).call(i,o)===P&&t._reject(P.e)):n===l?t._fulfill(l.call(i)):i instanceof e?i._promiseCancelled(t):s||t instanceof C?t._cancel():i.cancel()):"function"==typeof n?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(n,i,o,t)):n.call(i,o,t):i instanceof e?i._isResolved()||(0!=(33554432&a)?i._promiseFulfilled(o,t):i._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!=(33554432&a)?t._fulfill(o):t._reject(o))},r.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,i=t.receiver,o=t.value;"function"==typeof e?n instanceof r?this._settlePromiseFromHandler(e,i,o,n):e.call(i,o,n):n instanceof r&&n._reject(o)},r.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},r.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)},r.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},r.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():_.settlePromises(this))}},r.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?_.fatalError(t,f.isNode):void((65535&e)>0?0!=(134217728&e)?this._settlePromises():_.settlePromises(this):this._ensurePossibleRejectionHandled())},r.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)}},r.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)}},r.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()},r.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},r.defer=r.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new r(g),resolve:i,reject:o}},f.notEnumerableProp(r,"_makeSelfResolutionError",c),t("./method")(r,g,A,u,x),t("./bind")(r,g,A,x),t("./cancel")(r,C,u,x),t("./direct_resolve")(r),t("./synchronous_inspection")(r),t("./join")(r,C,A,g,x),r.Promise=r,t("./map.js")(r,C,u,A,g,x),t("./using.js")(r,u,A,j,g,x),t("./timers.js")(r,g),t("./generators.js")(r,u,g,A,e,x),t("./nodeify.js")(r),t("./call_get.js")(r),t("./props.js")(r,C,A,u),t("./race.js")(r,g,A,u),t("./reduce.js")(r,C,u,A,g,x),t("./settle.js")(r,C,x),t("./some.js")(r,C,u),t("./promisify.js")(r,g),t("./any.js")(r),t("./each.js")(r,g),t("./filter.js")(r,g),f.toFastProperties(r),f.toFastProperties(r.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new r(g)),x.setBounds(d.firstLineError,f.lastLineError),r}},{"./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){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 a=t("./util");return a.isArray,a.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,o){var s=r(this._values,this._promise);if(s instanceof e){var c=(s=s._target())._bitField;if(this._values=s,0==(50397184&c))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,o);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))return 0===s.length?void(-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{}}}(o))):void this._iterate(s);var l=i("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(l,!1)},s.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?s=(c=c._target())._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()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise.isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nu;u+=2){var f=a[u],p=a[u+1],d=f+e;if(r===g)t[d]=g(f,c,f,p,e,i);else{var _=r(p,function(){return g(f,c,f,p,e,i)});l.notEnumerableProp(_,"__isPromisified__",!0),t[d]=_}}return l.toFastProperties(t),t}var c={},l=t("./util"),u=t("./nodeback"),h=l.withAppended,f=l.maybeWrapAsError,p=l.canEvaluate,d=t("./errors").TypeError,_={__isPromisified__:!0},v=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),y=function(t){return l.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},m=function(t){return t.replace(/([$])/,"\\$")},g=p?void 0:function(t,r,i,o,s,a){function p(){var i=r;r===c&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof _&&this!==d?this[_]:t,l=u(o,a);try{s.apply(i,h(arguments,l))}catch(t){o._rejectCallback(f(t),!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var d=function(){return this}(),_=t;return"string"==typeof _&&(t=o),l.notEnumerableProp(p,"__isPromisified__",!0),p};e.promisify=function(t,e){if("function"!=typeof t)throw new d("expecting a function but got "+l.classString(t));if(i(t))return t;var n=function(t,e,n){return g(t,e,void 0,t,null,n)}(t,void 0===(e=Object(e)).context?c:e.context,!!e.multiArgs);return l.copyDescriptors(t,n,r),n},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new d("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var n=!!(e=Object(e)).multiArgs,r=e.suffix;"string"!=typeof r&&(r="Async");var i=e.filter;"function"!=typeof i&&(i=y);var o=e.promisifier;if("function"!=typeof o&&(o=g),!l.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=l.inheritedDataKeys(t),c=0;co;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,-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 h=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}}();c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){var n;if(this._isMap)n=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}(this._values);else{n={};for(var r=this.length(),i=0,o=this.length();o>i;++i)n[this._values[i+r]]=this._values[i]}return this._resolve(n),!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){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacityo;++o)n[o+r]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},e.exports=r},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(null===(t=s.asArray(t)))return i("expecting an array or an iterable object but got "+s.classString(t));var l=new e(n);void 0!==o&&l._propagateFrom(o,3);for(var u=l._fulfill,h=l._reject,f=0,p=t.length;p>f;++f){var d=t[f];(void 0!==d||f in t)&&e.cast(d)._then(u,h,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=f();this._fn=null===s?n:s.bind(n),void 0!==r&&(r=e.resolve(r))._attachCancellationCallback(this),this._initialValue=r,this._currentCancellable=null,this._eachValues=i===o?[]: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){return"function"!=typeof e?r("expecting a function but got "+p.classString(e)):new a(t,e,n,i).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(h,void 0,void 0,this,void 0)):h.call(this,n)}function h(t){var n,r=this.array,i=r._promise,o=d(r._fn);i._pushContext(),(n=void 0!==r._eachValues?o.call(i._boundValue(),t,this.index,this.length):o.call(i._boundValue(),this.accum,t,this.index,this.length))instanceof e&&(r._currentCancellable=n);var a=i._popContext();return s.checkForgottenReturns(n,a,void 0!==r._eachValues?"Promise.each":"Promise.reduce",i),n}var f=e._getDomain,p=t("./util"),d=p.tryCatch;p.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return 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,o){"use strict";var s,a=t("./util");if(a.isNode&&"undefined"==typeof MutationObserver){var c=i.setImmediate,l=n.nextTick;s=a.isRecentNode?function(t){c.call(i,t)}:function(t){l.call(n,t)}}else"undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&window.navigator.standalone?s=void 0!==r?function(t){r(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:(s=function(t){var e=document.createElement("div");return new MutationObserver(t).observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}}).isStatic=!0;e.exports=s},{"./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;t("./util").inherits(i,n),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},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)},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=t.prototype._isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype.isCancelled=function(){return this._target()._isCancelled()},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,s){var a=new e(n),c=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var l=!0,u=i.tryCatch(r).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,l),a=null)});return l=!1,a&&u===o&&(a._rejectCallback(u.e,!0),a=null),c}var i=t("./util"),o=i.errorObj,s=i.isObject,a={}.hasOwnProperty;return function(t,i){if(s(t)){if(t instanceof e)return t;var c=function(t){try{return function(t){return t.then}(t)}catch(t){return o.e=t,o}}(t);if(c===o){i&&i._pushContext();var l=e.reject(c.e);return i&&i._popContext(),l}if("function"==typeof c)return function(t){return a.call(t,"_promise0")}(t)?(l=new e(n),t._then(l._fulfill,l._reject,void 0,l,null),l):r(t,c,i)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util"),s=e.TimeoutError,a=function(t,e){var n;t.isPending()&&(n="string"!=typeof e?e instanceof Error?e:new s("operation timed out"):new s(e),o.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n))},c=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,r){var i;return void 0!==r?i=e.resolve(r)._then(c,null,null,t,void 0):(i=new e(n),setTimeout(function(){i._fulfill()},+t)),i._setAsyncGuaranteed(),i};e.prototype.delay=function(t){return l(t,this)},e.prototype.timeout=function(t,e){t=+t;var n=this.then(),o=setTimeout(function(){a(n,e)},t);return n._then(r,i,void 0,o,void 0)}}},{"./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,n){var i=0,s=t.length,c=new e(o);return function o(){if(i>=s)return c._fulfill();var l=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(l instanceof e&&l._isDisposable()){try{l=r(l._getDisposer().tryDispose(n),t.promise)}catch(t){return a(t)}if(l instanceof e)return l._then(o,a,null,null,null)}o()}(),c}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function u(t,e,n){this.constructor$(t,e,n)}function h(t){return l.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 p=t("./util"),d=t("./errors").TypeError,_=t("./util").inherits,v=p.errorObj,y=p.tryCatch;l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=null!==e?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},_(u,l),u.prototype.doDispose=function(t,e){return this.data().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 "+p.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(t=(o=arguments[0]).length,a=!1):(o=arguments,t--);for(var u=new f(t),d=0;t>d;++d){var _=o[d];if(l.isDisposer(_)){var m=_;(_=_.promise())._setDisposable(m)}else{var g=r(_);g instanceof e&&(_=g._then(h,null,null,{resources:u,index:d},void 0))}u[d]=_}var b=new Array(u.length);for(d=0;d0},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 u(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,r){"use strict";function i(){try{var t=u;return u=null,t.apply(this,arguments)}catch(t){return p.e=t,p}}function o(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function s(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return h.defineProperty(t,e,r),t}function a(t){try{return t+""}catch(t){return"[no string representation]"}}function c(t){return t instanceof Error&&h.propertyIsWritable(t,"stack")}function l(t){return{}.toString.call(t)}var u,h=t("./es5"),f="undefined"==typeof navigator,p={e:{}},d=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=_.test(t+"")&&h.names(t).length>0;if(n||r||i)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return v.test(t)},inheritedDataKeys:d,getDataPropertyOrDefault:function(t,e,n){if(!h.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},thrower:function(t){throw t},isArray:h.isArray,asArray:m,notEnumerableProp:s,isPrimitive:o,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},canEvaluate:f,errorObj:p,tryCatch:function(t){return u=t,i},inherits:function(t,e){function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(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},maybeWrapAsError:function(t){return o(t)?new Error(a(t)):t},toFastProperties:function(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t},filledRange:function(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r},toString:a,canAttachTrace:c,ensureErrorObject:y,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{s(t,"isOperational",!0)}catch(t){}},classString:l,copyDescriptors:function(t,e,n){for(var r=h.names(t),i=0;i10||t[0]>0}(),w.isNode&&w.toFastProperties(n);try{throw new Error}catch(t){w.lastLineError=t}e.exports=w},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,i("_process"),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(t,e,n){function r(){u=!1,a.length?l=a.concat(l):h=-1,l.length&&i()}function i(){if(!u){var t=setTimeout(r);u=!0;for(var e=l.length;e;){for(a=l,l=[];++h1)for(var n=1;nu&&0!==p;)h|=t[e++]<u)break;var v=h&l;if(h>>=c,u-=c,v!==o){if(v===s)break;for(var y=a>v?v:_,m=0,g=y;g>o;)g=d[g]>>8,++m;var b=g;if(f+m+(y!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[f++]=b;var w=f+=m;for(y!==v&&(n[f++]=b),g=y;m--;)g=d[g],n[--w]=255&g,g>>=8;null!==_&&4096>a&&(d[a++]=_<<8|b,a>=l+1&&12>c&&(++c,l=l<<1|1)),_=v}else a=s+1,l=(1<<(c=i+1))-1,_=null}return f!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(t,e,n,r){function i(t){var e=t.length;if(2>e||e>256||e&e-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return e}var o=0,s=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(0>=e||0>=n||e>65535||n>65535)throw"Width/Height invalid.";t[o++]=71,t[o++]=73,t[o++]=70,t[o++]=56,t[o++]=57,t[o++]=97;var c=0,l=0;if(null!==a){for(var u=i(a);u>>=1;)++c;if(u=1<=u)throw"Background index out of range.";if(0===l)throw"Background index explicitly passed as 0."}}if(t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=(null!==a?128:0)|c,t[o++]=l,t[o++]=0,null!==a)for(var h=0,f=a.length;f>h;++h){var p=a[h];t[o++]=p>>16&255,t[o++]=p>>8&255,t[o++]=255&p}if(null!==s){if(0>s||s>65535)throw"Loop count invalid.";t[o++]=33,t[o++]=255,t[o++]=11,t[o++]=78,t[o++]=69,t[o++]=84,t[o++]=83,t[o++]=67,t[o++]=65,t[o++]=80,t[o++]=69,t[o++]=50,t[o++]=46,t[o++]=48,t[o++]=3,t[o++]=1,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=0}var d=!1;this.addFrame=function(e,n,r,s,c,l){if(!0===d&&(--o,d=!1),l=void 0===l?{}:l,0>e||0>n||e>65535||n>65535)throw"x/y invalid.";if(0>=r||0>=s||r>65535||s>65535)throw"Width/Height invalid.";if(c.length>=1;)++p;f=1<v||v>3)throw"Disposal out of range.";var y=!1,m=0;if(void 0!==l.transparent&&null!==l.transparent&&(y=!0,0>(m=l.transparent)||m>=f))throw"Transparent color index.";if((0!==v||y||0!==_)&&(t[o++]=33,t[o++]=249,t[o++]=4,t[o++]=v<<2|(!0===y?1:0),t[o++]=255&_,t[o++]=_>>8&255,t[o++]=m,t[o++]=0),t[o++]=44,t[o++]=255&e,t[o++]=e>>8&255,t[o++]=255&n,t[o++]=n>>8&255,t[o++]=255&r,t[o++]=r>>8&255,t[o++]=255&s,t[o++]=s>>8&255,t[o++]=!0===u?128|p-1:0,!0===u)for(var g=0,b=h.length;b>g;++g){var w=h[g];t[o++]=w>>16&255,t[o++]=w>>8&255,t[o++]=255&w}o=function(t,e,n,r){function i(n){for(;f>=n;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++)}function o(t){p|=t<v;++v){var m=r[v]&c,g=d<<8|m,b=_[g];if(void 0===b){for(p|=d<=8;)t[e++]=255&p,p>>=8,f-=8,e===s+256&&(t[s]=255,s=e++);4096===u?(o(a),u=l+1,h=n+1,_={}):(u>=1<p?2:p,c)},this.end=function(){return!1===d&&(t[o++]=59,d=!0),o}},n.GifReader=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw"Invalid GIF 87a/89a header.";var n=t[e++]|t[e++]<<8,i=t[e++]|t[e++]<<8,o=t[e++],s=o>>7,a=1<<1+(7&o);t[e++],t[e++];var c=null;s&&(c=e,e+=3*a);var l=!0,u=[],h=0,f=null,p=0,d=null;for(this.width=n,this.height=i;l&&e>2&7,e++;break;case 254:for(;0!==(j=t[e++]);)e+=j;break;default:throw"Unknown graphic control label: 0x"+t[e-1].toString(16)}break;case 44:var v=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,m=t[e++]|t[e++]<<8,g=t[e++]|t[e++]<<8,b=t[e++],w=b>>6&1,A=c,C=!1;b>>7&&(C=!0,A=e,e+=3*(1<<1+(7&b)));var k=e;for(e++;;){var j;if(0===(j=t[e++]))break;e+=j}u.push({x:v,y:y,width:m,height:g,has_local_palette:C,palette_offset:A,data_offset:k,data_length:e-k,transparent_index:f,interlaced:!!w,delay:h,disposal:p});break;case 59:l=!1;break;default:throw"Unknown gif block: 0x"+t[e-1].toString(16)}this.numFrames=function(){return u.length},this.loopCount=function(){return d},this.frameInfo=function(t){if(0>t||t>=u.length)throw"Frame index out of range.";return u[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=C,i[_++]=A,i[_++]=w,i[_++]=255}--f}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,a=new Uint8Array(s);r(t,o.data_offset,a,s);var c=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var u=o.width,h=n-u,f=u,p=4*(o.y*n+o.x),d=4*((o.y+o.height)*n+o.x),_=p,v=4*h;!0===o.interlaced&&(v+=4*n*7);for(var y=8,m=0,g=a.length;g>m;++m){var b=a[m];if(0===f&&(f=u,(_+=v)>=d&&(v=4*h+4*n*(y-1),_=p+(u+h)*(y<<1),y>>=1)),b===l)_+=4;else{var w=t[c+3*b],A=t[c+3*b+1],C=t[c+3*b+2];i[_++]=w,i[_++]=A,i[_++]=C,i[_++]=255}--f}}}}catch(t){}},{}]},{},[1])}).call(this,n(0),n(4).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(5),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,c=1,l={},u=!1,h=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){d(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){d(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(d,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&d(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n{console.warn=function(){},e.data.marker.id==t&&(o.gifLoaded||(o.gif=gifler(o.contentProps.src).animate(o.textureCanvas),o.gifLoaded=!0),o.gifPlaying=!0,r.needsUpdate=!0)}),console.log("Initialized marker ",t,this.textureCanvas)}get3DMarker(t,e){return e.arController.threePatternMarkers[t]}create3DMarker(t,e){let n=e.createThreeMarker(t),r=this.create3DPlane();return n.add(r),n}create3DPlane(){let t=new THREE.PlaneGeometry,e=new THREE.Mesh(t,this.material),n=this.contentProps;return e.scale.set(n.scale.x,n.scale.y,n.scale.z),e.position.set(n.position.x,n.position.y,n.position.z),e.rotation.set(n.rotation.x,n.rotation.y,n.rotation.z),e}stringToVec3(t){let e=t.split(" ");return{x:e[0]||0,y:e[1]||0,z:e[2]||0}}static get observedAttributes(){return["gif-playing"]}attributeChangedCallback(t,e,n){switch(t){case"gif-playing":"true"==e&&"false"==n?this.gif.then(t=>{t.stop()}):"false"==e&&"true"==n&&this.gif.then(t=>{t.reset(),t.start()})}}set markerId(t){this.setAttribute("marker-id",t)}get markerId(){return this.getAttribute("marker-id")}set canvasTexture(t){this.setAttribute("canvas-texture",t)}get canvasTexture(){this.getAttribute("canvas-texture")}set gifPlaying(t){this.setAttribute("gif-playing",t)}get gifPlaying(){return this.getAttribute("gif-playing")}set patt(t){this.setAttribute("patt",t)}get patt(){return this.getAttribute("patt")}set content(t){this.setAttribute("content",t)}get content(){return this.getAttribute("content")}set mult(t){this.setAttribute("mult",t)}get mult(){return this.hasAttribute("mult")}});var r=n(1),i=n.n(r);function o(t){let e,n;return"portrait"===t?(e=window.innerHeight,n=window.innerWidth):(e=window.innerWidth,n=window.innerHeight),{width:e,height:n}}var s={x:0,y:0,w:640,h:480};customElements.define("ar-scene",class extends HTMLElement{constructor(){super(),this.htmlMarkers=[],this.threeMarkers={},this.renderer={},this.croppedRenderer={}}connectedCallback(){this.htmlMarkers=Array.from(this.children).filter(t=>"AR-MARKER"==t.tagName),this.init(),window.ARController&&ARController.getUserMediaThreeScene&&ARThreeOnLoad()}init(){console.log("AR-GIF version 0.0.4"),window.ARThreeOnLoad=(()=>{ARController.getUserMediaThreeScene({maxARVideoSize:640,cameraParam:i.a,facingMode:"environment",onSuccess:(t,e,n)=>{console.log("Initialized ar-scene"),this.registerMarkers(t,e),window.arController=e;let{renderer:r,croppedRenderer:i}=this.createRenderers(e);this.renderer=r,this.croppedRenderer=i,document.body.appendChild(this.croppedRenderer),this.resizeWindow(),window.addEventListener("resize",this.resizeWindow),window.addEventListener("onorientationchange orientationchange load",this.resizeWindow);let o=()=>{t.process(),t.renderOn(this.renderer),this.drawCroppedImage(this.renderer.domElement,this.croppedRenderer),this.updateMarkersState(e),requestAnimationFrame(o)};o()}})})}drawCroppedImage(t,e){const n=s;e.getContext("2d").drawImage(t,n.x,n.y,n.w,n.h,0,0,e.width,e.height)}registerMarkers(t,e){const n=this;this.htmlMarkers.map(r=>{r.mult?console.log("mult marker"):(console.log("Registering marker ",r.patt),e.loadMarker(r.patt,i=>{r.init(i,t,e),n.threeMarkers[i]=r}))})}updateMarkersState(t){Object.keys(t.threePatternMarkers).map((e,n)=>{let r=t.threePatternMarkers[e];r.visible?(r.children[0].material.needsUpdate=!0,r.children[0].material.map.needsUpdate=!0):r.markerTracker.inPrevious&&!r.markerTracker.inCurrent&&(this.threeMarkers[e].gifPlaying=!1)})}createRenderers(t){let e=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0});e.setSize(640,480),e.domElement.setAttribute("id","arCanvas");let n=document.createElement("canvas");n.setAttribute("id","drawingCanvas");let{width:r,height:i}=o(t.orientation);return n.width=r,n.height=i,"portrait"===t.orientation&&(n.style.transform="rotate(-90deg) translateX(-100%)",n.style.transformOrigin="0 0"),{renderer:e,croppedRenderer:n}}resizeWindow(){let{width:t,height:e}=o(window.arController.orientation);const n=document.getElementById("drawingCanvas");let r,i,a,c;n.width=t,n.height=e,t/e<640/480?(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)?"landscape"===window.arController.orientation?(c=640*t/e,a=480):(c=480,a=640*t/(.7*e)):(c=480,a=480*t/e),r=640-a,i=0):(r=0,a=640,i=480-(c=640*e/t)),s={x:r,y:i,w:a,h:c}}set arScene(t){this.setAttribute("arScene",t)}get arScene(){return this.getAttribute("arScene")}set arController(t){this.setAttribute("arController",t)}get arController(){return this.getAttribute("arController")}});n(7)}]); \ No newline at end of file