Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / snippet / 3.12.1 / scripts / vendor-transition.js
1 "use strict";(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["vendor-transition"],{"./node_modules/@uirouter/core/lib-esm/transition/transition.js":(t,e,r)=>{r.d(e,{u:()=>C});var o=r("./node_modules/@uirouter/core/lib-esm/common/trace.js"),n=r("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),i=r("./node_modules/@uirouter/core/lib-esm/common/strings.js"),s=r("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=r("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),u=r("./node_modules/@uirouter/core/lib-esm/common/hof.js"),c=r("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),h=r("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),p=r("./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"),m=r("./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"),d=r("./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"),l=r("./node_modules/@uirouter/core/lib-esm/params/param.js"),f=r("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),g=r("./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"),v=r("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),_=r("./node_modules/@uirouter/core/lib-esm/common/index.js"),y=(0,u.vg)("self"),C=function(){function t(t,e,r){var o=this;if(this._deferred=n.u.$q.defer(),this.promise=this._deferred.promise,this._registeredHooks={},this._hookBuilder=new m.A(this),this.isActive=function(){return o.router.globals.transition===o},this.router=r,this._targetState=e,!e.valid())throw new Error(e.error());this._options=(0,s.l7)({current:(0,u.P0)(this)},e.options()),this.$id=r.transitionService._transitionCount++;var i=d.C.buildToPath(t,e);this._treeChanges=d.C.treeChanges(t,i,this._options.reloadState),this.createTransitionHookRegFns();var a=this._hookBuilder.buildHooksForPhase(c.k.CREATE);h.I.invokeHooks(a,(function(){return null})),this.applyViewConfigs(r)}return t.prototype.onBefore=function(t,e,r){},t.prototype.onStart=function(t,e,r){},t.prototype.onExit=function(t,e,r){},t.prototype.onRetain=function(t,e,r){},t.prototype.onEnter=function(t,e,r){},t.prototype.onFinish=function(t,e,r){},t.prototype.onSuccess=function(t,e,r){},t.prototype.onError=function(t,e,r){},t.prototype.createTransitionHookRegFns=function(){var t=this;this.router.transitionService._pluginapi._getEvents().filter((function(t){return t.hookPhase!==c.k.CREATE})).forEach((function(e){return(0,p.BU)(t,t.router.transitionService,e)}))},t.prototype.getHooks=function(t){return this._registeredHooks[t]},t.prototype.applyViewConfigs=function(t){var e=this._treeChanges.entering.map((function(t){return t.state}));d.C.applyViewConfigs(t.transitionService.$view,this._treeChanges.to,e)},t.prototype.$from=function(){return(0,s.Gb)(this._treeChanges.from).state},t.prototype.$to=function(){return(0,s.Gb)(this._treeChanges.to).state},t.prototype.from=function(){return this.$from().self},t.prototype.to=function(){return this.$to().self},t.prototype.targetState=function(){return this._targetState},t.prototype.is=function(e){return e instanceof t?this.is({to:e.$to().name,from:e.$from().name}):!(e.to&&!(0,p.cN)(this.$to(),e.to,this)||e.from&&!(0,p.cN)(this.$from(),e.from,this))},t.prototype.params=function(t){return void 0===t&&(t="to"),Object.freeze(this._treeChanges[t].map((0,u.vg)("paramValues")).reduce(s.LQ,{}))},t.prototype.paramsChanged=function(){var t=this.params("from"),e=this.params("to"),r=[].concat(this._treeChanges.to).concat(this._treeChanges.from).map((function(t){return t.paramSchema})).reduce(_.FN,[]).reduce(_.v_,[]);return l.d.changed(r,t,e).reduce((function(t,r){return t[r.id]=e[r.id],t}),{})},t.prototype.injector=function(t,e){void 0===e&&(e="to");var r=this._treeChanges[e];return t&&(r=d.C.subPath(r,(function(e){return e.state===t||e.state.name===t}))),new g.l(r).injector()},t.prototype.getResolveTokens=function(t){return void 0===t&&(t="to"),new g.l(this._treeChanges[t]).getTokens()},t.prototype.addResolvable=function(t,e){void 0===e&&(e=""),t=(0,u.is)(f.X)(t)?t:new f.X(t);var r="string"==typeof e?e:e.name,o=this._treeChanges.to,n=(0,s.sE)(o,(function(t){return t.state.name===r}));new g.l(o).addResolvables([t],n.state)},t.prototype.redirectedFrom=function(){return this._options.redirectedFrom||null},t.prototype.originalTransition=function(){var t=this.redirectedFrom();return t&&t.originalTransition()||this},t.prototype.options=function(){return this._options},t.prototype.entering=function(){return(0,s.UI)(this._treeChanges.entering,(0,u.vg)("state")).map(y)},t.prototype.exiting=function(){return(0,s.UI)(this._treeChanges.exiting,(0,u.vg)("state")).map(y).reverse()},t.prototype.retained=function(){return(0,s.UI)(this._treeChanges.retained,(0,u.vg)("state")).map(y)},t.prototype.views=function(t,e){void 0===t&&(t="entering");var r=this._treeChanges[t];return(r=e?r.filter((0,u.OH)("state",e)):r).map((0,u.vg)("views")).filter(s.yR).reduce(s.M7,[])},t.prototype.treeChanges=function(t){return t?this._treeChanges[t]:this._treeChanges},t.prototype.redirect=function(t){for(var e=1,r=this;null!=(r=r.redirectedFrom());)if(++e>20)throw new Error("Too many consecutive Transition redirects (20+)");var o={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(o.location="replace");var n=(0,s.l7)({},this.options(),t.options(),o);t=t.withOptions(n,!0);var i,a=this.router.transitionService.create(this._treeChanges.from,t),c=this._treeChanges.entering,h=a._treeChanges.entering;return d.C.matching(h,c,d.C.nonDynamicParams).filter((0,u.ff)((i=t.options().reloadState,function(t){return i&&t.state.includes[i.name]}))).forEach((function(t,e){t.resolvables=c[e].resolvables})),a},t.prototype._changedParams=function(){var t=this._treeChanges;if(!(this._options.reload||t.exiting.length||t.entering.length||t.to.length!==t.from.length||(0,s.ym)(t.to,t.from).map((function(t){return t[0].state!==t[1].state})).reduce(s.o8,!1))){var e=t.to.map((function(t){return t.paramSchema})),r=[t.to,t.from].map((function(t){return t.map((function(t){return t.paramValues}))})),o=r[0],n=r[1];return(0,s.ym)(e,o,n).map((function(t){var e=t[0],r=t[1],o=t[2];return l.d.changed(e,r,o)})).reduce(s.M7,[])}},t.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map((function(t){return t.dynamic})).reduce(s.o8,!1)},t.prototype.ignored=function(){return!!this._ignoredReason()},t.prototype._ignoredReason=function(){var t=this.router.globals.transition,e=this._options.reloadState,r=function(t,r){if(t.length!==r.length)return!1;var o=d.C.matching(t,r);return t.length===o.filter((function(t){return!e||!t.state.includes[e.name]})).length},o=this.treeChanges(),n=t&&t.treeChanges();return n&&r(n.to,o.to)&&r(n.exiting,o.exiting)?"SameAsPending":0===o.exiting.length&&0===o.entering.length&&r(o.from,o.to)?"SameAsCurrent":void 0},t.prototype.run=function(){var t=this,e=h.I.runAllHooks,r=function(e){return t._hookBuilder.buildHooksForPhase(e)},i=r(c.k.BEFORE);return h.I.invokeHooks(i,(function(){var e=t.router.globals;return e.lastStartedTransitionId=t.$id,e.transition=t,e.transitionHistory.enqueue(t),o.g4.traceTransitionStart(t),n.u.$q.when(void 0)})).then((function(){var t=r(c.k.RUN);return h.I.invokeHooks(t,(function(){return n.u.$q.when(void 0)}))})).then((function(){o.g4.traceSuccess(t.$to(),t),t.success=!0,t._deferred.resolve(t.to()),e(r(c.k.SUCCESS))}),(function(n){o.g4.traceError(n,t),t.success=!1,t._deferred.reject(n),t._error=n,e(r(c.k.ERROR))})),this.promise},t.prototype.valid=function(){return!this.error()||void 0!==this.success},t.prototype.abort=function(){(0,a.o8)(this.success)&&(this._aborted=!0)},t.prototype.error=function(){var t=this.$to();if(t.self.abstract)return v.i.invalid("Cannot transition to abstract state '"+t.name+"'");var e=t.parameters(),r=this.params(),o=e.filter((function(t){return!t.validates(r[t.id])}));if(o.length){var n=o.map((function(t){return"["+t.id+":"+(0,i.Pz)(r[t.id])+"]"})).join(", "),s="The following parameter values are not valid for state '"+t.name+"': "+n;return v.i.invalid(s)}return!1===this.success?this._error:void 0},t.prototype.toString=function(){var t=this.from(),e=this.to(),r=function(t){return null!==t["#"]&&void 0!==t["#"]?t:(0,s.CE)(t,["#"])};return"Transition#"+this.$id+"( '"+((0,a.Kn)(t)?t.name:t)+"'"+(0,i.Pz)(r(this._treeChanges.from.map((0,u.vg)("paramValues")).reduce(s.LQ,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+((0,a.Kn)(e)?e.name:e)+"'"+(0,i.Pz)(r(this.params()))+" )"},t.diToken=t,t}()}}]);
2 //# sourceMappingURL=vendor-transition.js.map