-
Notifications
You must be signed in to change notification settings - Fork 490
/
Copy path4.1.0_dist_vuex.min.js
1 lines (1 loc) · 17.5 KB
/
4.1.0_dist_vuex.min.js
1
var Vuex=function(l){"use strict";var o="store";function n(){return"undefined"!=typeof navigator?window:"undefined"!=typeof global?global:{}}var T="devtools-plugin:setup";function $(t,e){var o=n().__VUE_DEVTOOLS_GLOBAL_HOOK__;o?o.emit(T,t,e):((o=n()).__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e})}function p(e,o){if(void 0===o&&(o=[]),null===e||"object"!=typeof e)return e;t=function(t){return t.original===e};var t=o.filter(t)[0];if(t)return t.copy;var n=Array.isArray(e)?[]:{};return o.push({original:e,copy:n}),Object.keys(e).forEach(function(t){n[t]=p(e[t],o)}),n}function f(e,o){Object.keys(e).forEach(function(t){return o(e[t],t)})}function r(t){return null!==t&&"object"==typeof t}function d(t,e){if(!t)throw new Error("[vuex] "+e)}function i(e,o,t){return o.indexOf(e)<0&&(t&&t.prepend?o.unshift(e):o.push(e)),function(){var t=o.indexOf(e);-1<t&&o.splice(t,1)}}function a(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var o=t.state;h(t,o,[],t._modules.root,!0),c(t,o,e)}function c(r,t,e){var o,n=r._state,i=r._scope,a=(r.getters={},r._makeLocalGettersCache=Object.create(null),r._wrappedGetters),s={},c={},u=l.effectScope(!0);u.run(function(){f(a,function(t,e){var o,n;s[e]=(o=t,n=r,function(){return o(n)}),c[e]=l.computed(function(){return s[e]()}),Object.defineProperty(r.getters,e,{get:function(){return c[e].value},enumerable:!0})})}),r._state=l.reactive({data:t}),r._scope=u,r.strict&&(o=r,l.watch(function(){return o._state.data},function(){d(o._committing,"do not mutate vuex store state outside mutation handlers.")},{deep:!0,flush:"sync"})),n&&e&&r._withCommit(function(){n.data=null}),i&&i.stop()}function h(i,o,n,t,r){var e,a,s,c,u,l,p=!n.length,f=i._modules.getNamespace(n),d=(t.namespaced&&(i._modulesNamespaceMap[f]&&console.error("[vuex] duplicate namespace "+f+" for the namespaced module "+n.join("/")),i._modulesNamespaceMap[f]=t),p||r||(e=v(o,n.slice(0,-1)),a=n[n.length-1],i._withCommit(function(){a in e&&console.warn('[vuex] state field "'+a+'" was overridden by a module with the same name at "'+n.join(".")+'"'),e[a]=t.state})),t.context=(s=i,u=n,l={dispatch:(p=""===(c=f))?s.dispatch:function(t,e,o){var t=y(t,e,o),e=t.payload,o=t.options,n=t.type;if(o&&o.root||s._actions[n=c+n])return s.dispatch(n,e);console.error("[vuex] unknown local action type: "+t.type+", global type: "+n)},commit:p?s.commit:function(t,e,o){var t=y(t,e,o),e=t.payload,o=t.options,n=t.type;o&&o.root||s._mutations[n=c+n]?s.commit(n,e,o):console.error("[vuex] unknown local mutation type: "+t.type+", global type: "+n)}},Object.defineProperties(l,{getters:{get:p?function(){return s.getters}:function(){return m(s,c)}},state:{get:function(){return v(s.state,u)}}}),l));t.forEachMutation(function(t,e){var o,n,r;e=f+e,n=t,r=d,((o=i)._mutations[e]||(o._mutations[e]=[])).push(function(t){n.call(o,r.state,t)})}),t.forEachAction(function(t,e){var o,n,r,e=t.root?e:f+e,t=t.handler||t;e=e,n=t,r=d,((o=i)._actions[e]||(o._actions[e]=[])).push(function(t){var e,t=n.call(o,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:o.getters,rootState:o.state},t);return(e=t)&&"function"==typeof e.then||(t=Promise.resolve(t)),o._devtoolHook?t.catch(function(t){throw o._devtoolHook.emit("vuex:error",t),t}):t})}),t.forEachGetter(function(t,e){var o,n;e=f+e,o=t,n=d,(t=i)._wrappedGetters[e]?console.error("[vuex] duplicate getter key: "+e):t._wrappedGetters[e]=function(t){return o(n.state,n.getters,t.state,t.getters)}}),t.forEachChild(function(t,e){h(i,o,n.concat(e),t,r)})}function m(o,n){var r,i;return o._makeLocalGettersCache[n]||(r={},i=n.length,Object.keys(o.getters).forEach(function(t){var e;t.slice(0,i)===n&&(e=t.slice(i),Object.defineProperty(r,e,{get:function(){return o.getters[t]},enumerable:!0}))}),o._makeLocalGettersCache[n]=r),o._makeLocalGettersCache[n]}function v(t,e){return e.reduce(function(t,e){return t[e]},t)}function y(t,e,o){return r(t)&&t.type&&(o=e,t=(e=t).type),d("string"==typeof t,"expects string as the type, but found "+typeof t+"."),{type:t,payload:e,options:o}}var s="vuex:mutations",u="vuex:actions",g="vuex",V=0;function D(i,a){$({id:"org.vuejs.vuex",app:i,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:["vuex bindings"]},function(r){r.addTimelineLayer({id:s,label:"Vuex Mutations",color:t}),r.addTimelineLayer({id:u,label:"Vuex Actions",color:t}),r.addInspector({id:g,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),r.on.getInspectorTree(function(t){var e;t.app===i&&t.inspectorId===g&&(t.filter?(function e(o,n,r,i){i.includes(r)&&o.push({id:i||"root",label:i.endsWith("/")?i.slice(0,i.length-1):i||"Root",tags:n.namespaced?[_]:[]});Object.keys(n._children).forEach(function(t){e(o,n._children[t],r,i+t+"/")})}(e=[],a._modules.root,t.filter,""),t.rootNodes=e):t.rootNodes=[function e(o,n){return{id:n||"root",label:b(n),tags:o.namespaced?[_]:[],children:Object.keys(o._children).map(function(t){return e(o._children[t],n+t+"/")})}}(a._modules.root,"")])}),r.on.getInspectorState(function(t){var e,n,r;t.app===i&&t.inspectorId===g&&(e=t.nodeId,m(a,e),t.state=function(e,t,o){t="root"===o?t:t[o];var o=Object.keys(t),n={state:Object.keys(e.state).map(function(t){return{key:t,editable:!0,value:e.state[t]}})};{var r;o.length&&(r=function(r){var i={};return Object.keys(r).forEach(function(t){var e,o,n=t.split("/");1<n.length?(e=i,o=n.pop(),n.forEach(function(t){e[t]||(e[t]={_custom:{value:{},display:t,tooltip:"Module",abstract:!0}}),e=e[t]._custom.value}),e[o]=w(function(){return r[t]})):i[t]=w(function(){return r[t]})}),i}(t),n.getters=Object.keys(r).map(function(t){return{key:t.endsWith("/")?b(t):t,editable:!1,value:w(function(){return r[t]})}}))}return n}((t=a._modules,(r=(n=e).split("/").filter(function(t){return t})).reduce(function(t,e,o){t=t[e];if(t)return o===r.length-1?t:t._children;throw new Error('Missing module "'+e+'" for path "'+n+'".')},"root"===n?t:t.root._children)),"root"===e?a.getters:a._makeLocalGettersCache,e))}),r.on.editInspectorState(function(t){var e,o;t.app===i&&t.inspectorId===g&&(e=t.nodeId,o=t.path,"root"!==e&&(o=e.split("/").filter(Boolean).concat(o)),a._withCommit(function(){t.set(a._state.data,o,t.state.value)}))}),a.subscribe(function(t,e){var o={};t.payload&&(o.payload=t.payload),o.state=e,r.notifyComponentUpdate(),r.sendInspectorTree(g),r.sendInspectorState(g),r.addTimelineEvent({layerId:s,event:{time:Date.now(),title:t.type,data:o}})}),a.subscribeAction({before:function(t,e){var o={};t.payload&&(o.payload=t.payload),t._id=V++,t._time=Date.now(),o.state=e,r.addTimelineEvent({layerId:u,event:{time:t._time,title:t.type,groupId:t._id,subtitle:"start",data:o}})},after:function(t,e){var o={},n=Date.now()-t._time;o.duration={_custom:{type:"duration",display:n+"ms",tooltip:"Action duration",value:n}},t.payload&&(o.payload=t.payload),o.state=e,r.addTimelineEvent({layerId:u,event:{time:Date.now(),title:t.type,groupId:t._id,subtitle:"end",data:o}})}})})}var t=8702998,_={label:"namespaced",textColor:16777215,backgroundColor:6710886};function b(t){return t&&"root"!==t?t.split("/").slice(-2,-1)[0]:"Root"}function w(t){try{return t()}catch(t){return t}}function x(t,e){this.runtime=e,this._children=Object.create(null),e=(this._rawModule=t).state,this.state=("function"==typeof e?e():e)||{}}function j(t){this.register([],t,!1)}var e={namespaced:{configurable:!0}};e.namespaced.get=function(){return!!this._rawModule.namespaced},x.prototype.addChild=function(t,e){this._children[t]=e},x.prototype.removeChild=function(t){delete this._children[t]},x.prototype.getChild=function(t){return this._children[t]},x.prototype.hasChild=function(t){return t in this._children},x.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},x.prototype.forEachChild=function(t){f(this._children,t)},x.prototype.forEachGetter=function(t){this._rawModule.getters&&f(this._rawModule.getters,t)},x.prototype.forEachAction=function(t){this._rawModule.actions&&f(this._rawModule.actions,t)},x.prototype.forEachMutation=function(t){this._rawModule.mutations&&f(this._rawModule.mutations,t)},Object.defineProperties(x.prototype,e);j.prototype.get=function(t){return t.reduce(function(t,e){return t.getChild(e)},this.root)},j.prototype.getNamespace=function(t){var o=this.root;return t.reduce(function(t,e){return t+((o=o.getChild(e)).namespaced?e+"/":"")},"")},j.prototype.update=function(t){!function t(e,o,n){E(e,n);o.update(n);if(n.modules)for(var r in n.modules){if(!o.getChild(r))return void console.warn("[vuex] trying to add a new module '"+r+"' on hot reloading, manual reload is needed");t(e.concat(r),o.getChild(r),n.modules[r])}}([],this.root,t)},j.prototype.register=function(o,t,n){var r=this,e=(void 0===n&&(n=!0),E(o,t),new x(t,n));0===o.length?this.root=e:this.get(o.slice(0,-1)).addChild(o[o.length-1],e),t.modules&&f(t.modules,function(t,e){r.register(o.concat(e),t,n)})},j.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),t=t[t.length-1],o=e.getChild(t);o?o.runtime&&e.removeChild(t):console.warn("[vuex] trying to unregister module '"+t+"', which is not registered")},j.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),t=t[t.length-1];return!!e&&e.hasChild(t)};var e={assert:function(t){return"function"==typeof t},expected:"function"},O={getters:e,mutations:e,actions:{assert:function(t){return"function"==typeof t||"object"==typeof t&&"function"==typeof t.handler},expected:'function or object with "handler" function'}};function E(r,t){Object.keys(O).forEach(function(o){var n;t[o]&&(n=O[o],f(t[o],function(t,e){d(n.assert(t),function(t,e,o,n,r){r=e+" should be "+r+' but "'+e+"."+o+'"';0<t.length&&(r+=' in module "'+t.join(".")+'"');return r+=" is "+JSON.stringify(n)+"."}(r,o,e,t,n.expected))}))})}function A(t){var e=this,o=(void 0===t&&(t={}),d("undefined"!=typeof Promise,"vuex requires a Promise polyfill in this browser."),d(this instanceof A,"store must be called with the new operator."),t.plugins),n=(void 0===o&&(o=[]),t.strict),r=(void 0===n&&(n=!1),t.devtools),i=(this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new j(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._scope=null,this._devtools=r,this),a=this.dispatch,s=this.commit,t=(this.dispatch=function(t,e){return a.call(i,t,e)},this.commit=function(t,e,o){return s.call(i,t,e,o)},this.strict=n,this._modules.root.state);h(this,t,[],this._modules.root),c(this,t),o.forEach(function(t){return t(e)})}var e={state:{configurable:!0}},k=(A.prototype.install=function(t,e){t.provide(e||o,this),void 0!==(t.config.globalProperties.$store=this)._devtools&&!this._devtools||D(t,this)},e.state.get=function(){return this._state.data},e.state.set=function(t){d(!1,"use store.replaceState() to explicit replace store state.")},A.prototype.commit=function(t,e,o){var n=this,t=y(t,e,o),e=t.type,r=t.payload,o=t.options,i={type:e,payload:r},a=this._mutations[e];a?(this._withCommit(function(){a.forEach(function(t){t(r)})}),this._subscribers.slice().forEach(function(t){return t(i,n.state)}),o&&o.silent&&console.warn("[vuex] mutation type: "+e+". Silent option has been removed. Use the filter functionality in the vue-devtools")):console.error("[vuex] unknown mutation type: "+e)},A.prototype.dispatch=function(t,e){var o=this,t=y(t,e),e=t.type,n=t.payload,r={type:e,payload:n},t=this._actions[e];if(t){try{this._actionSubscribers.slice().filter(function(t){return t.before}).forEach(function(t){return t.before(r,o.state)})}catch(t){console.warn("[vuex] error in before action subscribers: "),console.error(t)}var i=1<t.length?Promise.all(t.map(function(t){return t(n)})):t[0](n);return new Promise(function(e,t){i.then(function(t){try{o._actionSubscribers.filter(function(t){return t.after}).forEach(function(t){return t.after(r,o.state)})}catch(t){console.warn("[vuex] error in after action subscribers: "),console.error(t)}e(t)},function(e){try{o._actionSubscribers.filter(function(t){return t.error}).forEach(function(t){return t.error(r,o.state,e)})}catch(t){console.warn("[vuex] error in error action subscribers: "),console.error(t)}t(e)})})}console.error("[vuex] unknown action type: "+e)},A.prototype.subscribe=function(t,e){return i(t,this._subscribers,e)},A.prototype.subscribeAction=function(t,e){return i("function"==typeof t?{before:t}:t,this._actionSubscribers,e)},A.prototype.watch=function(t,e,o){var n=this;return d("function"==typeof t,"store.watch only accepts a function."),l.watch(function(){return t(n.state,n.getters)},e,Object.assign({},o))},A.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._state.data=t})},A.prototype.registerModule=function(t,e,o){void 0===o&&(o={}),"string"==typeof t&&(t=[t]),d(Array.isArray(t),"module path must be a string or an Array."),d(0<t.length,"cannot register the root module by using registerModule."),this._modules.register(t,e),h(this,this.state,t,this._modules.get(t),o.preserveState),c(this,this.state)},A.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),d(Array.isArray(t),"module path must be a string or an Array."),this._modules.unregister(t),this._withCommit(function(){delete v(e.state,t.slice(0,-1))[t[t.length-1]]}),a(this)},A.prototype.hasModule=function(t){return"string"==typeof t&&(t=[t]),d(Array.isArray(t),"module path must be a string or an Array."),this._modules.isRegistered(t)},A.prototype.hotUpdate=function(t){this._modules.update(t),a(this,!0)},A.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(A.prototype,e),L(function(r,t){var o={};return I(t)||console.error("[vuex] mapState: mapper parameter must be either an Array or an Object"),G(t).forEach(function(t){var e=t.key,n=t.val;o[e]=function(){var t=this.$store.state,e=this.$store.getters;if(r){var o=N(this.$store,"mapState",r);if(!o)return;t=o.context.state,e=o.context.getters}return"function"==typeof n?n.call(this,t,e):t[n]},o[e].vuex=!0}),o})),M=L(function(i,t){var o={};return I(t)||console.error("[vuex] mapMutations: mapper parameter must be either an Array or an Object"),G(t).forEach(function(t){var e=t.key,r=t.val;o[e]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var o=this.$store.commit;if(i){var n=N(this.$store,"mapMutations",i);if(!n)return;o=n.context.commit}return"function"==typeof r?r.apply(this,[o].concat(t)):o.apply(this.$store,[r].concat(t))}}),o}),C=L(function(n,t){var r={};return I(t)||console.error("[vuex] mapGetters: mapper parameter must be either an Array or an Object"),G(t).forEach(function(t){var e=t.key,o=t.val,o=n+o;r[e]=function(){if(!n||N(this.$store,"mapGetters",n)){if(o in this.$store.getters)return this.$store.getters[o];console.error("[vuex] unknown getter: "+o)}},r[e].vuex=!0}),r}),S=L(function(i,t){var o={};return I(t)||console.error("[vuex] mapActions: mapper parameter must be either an Array or an Object"),G(t).forEach(function(t){var e=t.key,r=t.val;o[e]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var o=this.$store.dispatch;if(i){var n=N(this.$store,"mapActions",i);if(!n)return;o=n.context.dispatch}return"function"==typeof r?r.apply(this,[o].concat(t)):o.apply(this.$store,[r].concat(t))}}),o});function G(e){return I(e)?Array.isArray(e)?e.map(function(t){return{key:t,val:t}}):Object.keys(e).map(function(t){return{key:t,val:e[t]}}):[]}function I(t){return Array.isArray(t)||r(t)}function L(o){return function(t,e){return"string"!=typeof t?(e=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),o(t,e)}}function N(t,e,o){t=t._modulesNamespaceMap[o];return t||console.error("[vuex] module namespace not found in "+e+"(): "+o),t}function U(e,o,t){t=t?e.groupCollapsed:e.group;try{t.call(e,o)}catch(t){e.log(o)}}function F(e){try{e.groupEnd()}catch(t){e.log("—— log end ——")}}function H(){var t=new Date;return" @ "+P(t.getHours(),2)+":"+P(t.getMinutes(),2)+":"+P(t.getSeconds(),2)+"."+P(t.getMilliseconds(),3)}function P(t,e){return o="0",e=e-t.toString().length,new Array(e+1).join(o)+t;var o}return{version:"4.1.0",Store:A,storeKey:o,createStore:function(t){return new A(t)},useStore:function(t){return l.inject(null!==(t=void 0===t?null:t)?t:o)},mapState:k,mapMutations:M,mapGetters:C,mapActions:S,createNamespacedHelpers:function(t){return{mapState:k.bind(null,t),mapGetters:C.bind(null,t),mapMutations:M.bind(null,t),mapActions:S.bind(null,t)}},createLogger:function(t){var i=(t=void 0===t?{}:t).collapsed,a=(void 0===i&&(i=!0),t.filter),s=(void 0===a&&(a=function(t,e,o){return!0}),t.transformer),c=(void 0===s&&(s=function(t){return t}),t.mutationTransformer),n=(void 0===c&&(c=function(t){return t}),t.actionFilter),u=(void 0===n&&(n=function(t,e){return!0}),t.actionTransformer),e=(void 0===u&&(u=function(t){return t}),t.logMutations),o=(void 0===e&&(e=!0),t.logActions),l=(void 0===o&&(o=!0),t.logger);return void 0===l&&(l=console),function(t){var r=p(t.state);void 0!==l&&(e&&t.subscribe(function(t,e){var o,n,e=p(e);a(t,r,e)&&(o=H(),n=c(t),t="mutation "+t.type+o,U(l,t,i),l.log("%c prev state","color: #9E9E9E; font-weight: bold",s(r)),l.log("%c mutation","color: #03A9F4; font-weight: bold",n),l.log("%c next state","color: #4CAF50; font-weight: bold",s(e)),F(l)),r=e}),o&&t.subscribeAction(function(t,e){var o;n(t,e)&&(e=H(),o=u(t),t="action "+t.type+e,U(l,t,i),l.log("%c action","color: #03A9F4; font-weight: bold",o),F(l))}))}}}}(Vue);