You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
14 KiB
1 lines
14 KiB
var Vuex=function(l){"use strict";var n="store";function o(){return"undefined"!=typeof navigator?window:"undefined"!=typeof global?global:{}}function f(e,n){if(void 0===n&&(n=[]),null===e||"object"!=typeof e)return e;var t=n.filter(function(t){return t.original===e})[0];if(t)return t.copy;var o=Array.isArray(e)?[]:{};return n.push({original:e,copy:o}),Object.keys(e).forEach(function(t){o[t]=f(e[t],n)}),o}function p(e,n){Object.keys(e).forEach(function(t){return n(e[t],t)})}function r(t){return null!==t&&"object"==typeof t}function i(e,n,t){return n.indexOf(e)<0&&(t&&t.prepend?n.unshift(e):n.push(e)),function(){var t=n.indexOf(e);-1<t&&n.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 n=t.state;h(t,n,[],t._modules.root,!0),s(t,n,e)}function s(r,t,e){var n,o=r._state,i=r._scope,a=(r.getters={},r._makeLocalGettersCache=Object.create(null),r._wrappedGetters),c={},s={},u=l.effectScope(!0);u.run(function(){p(a,function(t,e){var n,o;c[e]=(n=t,o=r,function(){return n(o)}),s[e]=l.computed(function(){return c[e]()}),Object.defineProperty(r.getters,e,{get:function(){return s[e].value},enumerable:!0})})}),r._state=l.reactive({data:t}),r._scope=u,r.strict&&(n=r,l.watch(function(){return n._state.data},function(){},{deep:!0,flush:"sync"})),o&&e&&r._withCommit(function(){o.data=null}),i&&i.stop()}function h(i,n,o,t,r){var e,a,c,s,u,l,f=!o.length,p=i._modules.getNamespace(o),d=(t.namespaced&&(i._modulesNamespaceMap[p],i._modulesNamespaceMap[p]=t),f||r||(e=g(n,o.slice(0,-1)),a=o[o.length-1],i._withCommit(function(){e[a]=t.state})),t.context=(c=i,u=o,l={dispatch:(f=""===(s=p))?c.dispatch:function(t,e,n){t=v(t,e,n),e=t.payload,n=t.options,t=t.type;return n&&n.root||(t=s+t),c.dispatch(t,e)},commit:f?c.commit:function(t,e,n){t=v(t,e,n),e=t.payload,n=t.options,t=t.type;n&&n.root||(t=s+t),c.commit(t,e,n)}},Object.defineProperties(l,{getters:{get:f?function(){return c.getters}:function(){return m(c,s)}},state:{get:function(){return g(c.state,u)}}}),l));t.forEachMutation(function(t,e){var n,o,r;e=p+e,o=t,r=d,((n=i)._mutations[e]||(n._mutations[e]=[])).push(function(t){o.call(n,r.state,t)})}),t.forEachAction(function(t,e){var n,o,r,e=t.root?e:p+e,t=t.handler||t;o=t,r=d,((n=i)._actions[e]||(n._actions[e]=[])).push(function(t){t=o.call(n,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:n.getters,rootState:n.state},t);return t&&"function"==typeof t.then||(t=Promise.resolve(t)),n._devtoolHook?t.catch(function(t){throw n._devtoolHook.emit("vuex:error",t),t}):t})}),t.forEachGetter(function(t,e){var n,o;e=p+e,n=t,o=d,(t=i)._wrappedGetters[e]||(t._wrappedGetters[e]=function(t){return n(o.state,o.getters,t.state,t.getters)})}),t.forEachChild(function(t,e){h(i,n,o.concat(e),t,r)})}function m(n,o){var r,i;return n._makeLocalGettersCache[o]||(r={},i=o.length,Object.keys(n.getters).forEach(function(t){var e;t.slice(0,i)===o&&(e=t.slice(i),Object.defineProperty(r,e,{get:function(){return n.getters[t]},enumerable:!0}))}),n._makeLocalGettersCache[o]=r),n._makeLocalGettersCache[o]}function g(t,e){return e.reduce(function(t,e){return t[e]},t)}function v(t,e,n){return r(t)&&t.type&&(n=e,t=(e=t).type),{type:t,payload:e,options:n}}var c="vuex:mutations",d="vuex:actions",y="vuex",_=0;function P(u,l){var t,e,n;t={id:"org.vuejs.vuex",app:u,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:["vuex bindings"]},e=function(r){r.addTimelineLayer({id:c,label:"Vuex Mutations",color:b}),r.addTimelineLayer({id:d,label:"Vuex Actions",color:b}),r.addInspector({id:y,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),r.on.getInspectorTree(function(t){var e;t.app===u&&t.inspectorId===y&&(t.filter?(function e(n,o,r,i){i.includes(r)&&n.push({id:i||"root",label:i.endsWith("/")?i.slice(0,i.length-1):i||"Root",tags:o.namespaced?[w]:[]}),Object.keys(o._children).forEach(function(t){e(n,o._children[t],r,i+t+"/")})}(e=[],l._modules.root,t.filter,""),t.rootNodes=e):t.rootNodes=[function e(n,o){return{id:o||"root",label:E(o),tags:n.namespaced?[w]:[],children:Object.keys(n._children).map(function(t){return e(n._children[t],o+t+"/")})}}(l._modules.root,"")])}),r.on.getInspectorState(function(t){var e,n,r,i,o,a,c,s;t.app===u&&t.inspectorId===y&&(o=t.nodeId,m(l,o),t.state=(t=l._modules,e=(s=(c=o).split("/").filter(function(t){return t})).reduce(function(t,e,n){t=t[e];if(t)return n===s.length-1?t:t._children;throw new Error('Missing module "'+e+'" for path "'+c+'".')},"root"===c?t:t.root._children),t="root"===o?l.getters:l._makeLocalGettersCache,t="root"===o?t:t[o],o=Object.keys(t),a={state:Object.keys(e.state).map(function(t){return{key:t,editable:!0,value:e.state[t]}})},o.length&&(r=t,i={},Object.keys(r).forEach(function(t){var e,n,o=t.split("/");1<o.length?(e=i,n=o.pop(),o.forEach(function(t){e[t]||(e[t]={_custom:{value:{},display:t,tooltip:"Module",abstract:!0}}),e=e[t]._custom.value}),e[n]=O(function(){return r[t]})):i[t]=O(function(){return r[t]})}),n=i,a.getters=Object.keys(n).map(function(t){return{key:t.endsWith("/")?E(t):t,editable:!1,value:O(function(){return n[t]})}})),a))}),r.on.editInspectorState(function(t){var e,n;t.app===u&&t.inspectorId===y&&(e=t.nodeId,n=t.path,"root"!==e&&(n=e.split("/").filter(Boolean).concat(n)),l._withCommit(function(){t.set(l._state.data,n,t.state.value)}))}),l.subscribe(function(t,e){var n={};t.payload&&(n.payload=t.payload),n.state=e,r.notifyComponentUpdate(),r.sendInspectorTree(y),r.sendInspectorState(y),r.addTimelineEvent({layerId:c,event:{time:Date.now(),title:t.type,data:n}})}),l.subscribeAction({before:function(t,e){var n={};t.payload&&(n.payload=t.payload),t._id=_++,t._time=Date.now(),n.state=e,r.addTimelineEvent({layerId:d,event:{time:t._time,title:t.type,groupId:t._id,subtitle:"start",data:n}})},after:function(t,e){var n={},o=Date.now()-t._time;n.duration={_custom:{type:"duration",display:o+"ms",tooltip:"Action duration",value:o}},t.payload&&(n.payload=t.payload),n.state=e,r.addTimelineEvent({layerId:d,event:{time:Date.now(),title:t.type,groupId:t._id,subtitle:"end",data:n}})}})},(n=o().__VUE_DEVTOOLS_GLOBAL_HOOK__)?n.emit("devtools-plugin:setup",t,e):((n=o()).__VUE_DEVTOOLS_PLUGINS__=n.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e})}var b=8702998,w={label:"namespaced",textColor:16777215,backgroundColor:6710886};function E(t){return t&&"root"!==t?t.split("/").slice(-2,-1)[0]:"Root"}function O(t){try{return t()}catch(t){return t}}function u(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 t={namespaced:{configurable:!0}};t.namespaced.get=function(){return!!this._rawModule.namespaced},u.prototype.addChild=function(t,e){this._children[t]=e},u.prototype.removeChild=function(t){delete this._children[t]},u.prototype.getChild=function(t){return this._children[t]},u.prototype.hasChild=function(t){return t in this._children},u.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)},u.prototype.forEachChild=function(t){p(this._children,t)},u.prototype.forEachGetter=function(t){this._rawModule.getters&&p(this._rawModule.getters,t)},u.prototype.forEachAction=function(t){this._rawModule.actions&&p(this._rawModule.actions,t)},u.prototype.forEachMutation=function(t){this._rawModule.mutations&&p(this._rawModule.mutations,t)},Object.defineProperties(u.prototype,t);j.prototype.get=function(t){return t.reduce(function(t,e){return t.getChild(e)},this.root)},j.prototype.getNamespace=function(t){var n=this.root;return t.reduce(function(t,e){return t+((n=n.getChild(e)).namespaced?e+"/":"")},"")},j.prototype.update=function(t){!function t(e,n,o){if(n.update(o),o.modules)for(var r in o.modules){if(!n.getChild(r))return;t(e.concat(r),n.getChild(r),o.modules[r])}}([],this.root,t)},j.prototype.register=function(n,t,o){var r=this,e=new u(t,o=void 0===o?!0:o);0===n.length?this.root=e:this.get(n.slice(0,-1)).addChild(n[n.length-1],e),t.modules&&p(t.modules,function(t,e){r.register(n.concat(e),t,o)})},j.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),t=t[t.length-1],n=e.getChild(t);n&&n.runtime&&e.removeChild(t)},j.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),t=t[t.length-1];return!!e&&e.hasChild(t)};function e(t){var e=this,n=(t=void 0===t?{}:t).plugins,o=(void 0===n&&(n=[]),t.strict),r=(void 0===o&&(o=!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,c=this.commit,t=(this.dispatch=function(t,e){return a.call(i,t,e)},this.commit=function(t,e,n){return c.call(i,t,e,n)},this.strict=o,this._modules.root.state);h(this,t,[],this._modules.root),s(this,t),n.forEach(function(t){return t(e)})}var t={state:{configurable:!0}},C=(e.prototype.install=function(t,e){t.provide(e||n,this),void 0!==(t.config.globalProperties.$store=this)._devtools&&this._devtools&&P(t,this)},t.state.get=function(){return this._state.data},t.state.set=function(t){},e.prototype.commit=function(t,e,n){var o=this,t=v(t,e,n),e=t.type,r=t.payload,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,o.state)}))},e.prototype.dispatch=function(t,e){var n=this,e=v(t,e),o=e.type,r=e.payload,i={type:o,payload:r},e=this._actions[o];if(e){try{this._actionSubscribers.slice().filter(function(t){return t.before}).forEach(function(t){return t.before(i,n.state)})}catch(t){}var a=1<e.length?Promise.all(e.map(function(t){return t(r)})):e[0](r);return new Promise(function(e,t){a.then(function(t){try{n._actionSubscribers.filter(function(t){return t.after}).forEach(function(t){return t.after(i,n.state)})}catch(t){}e(t)},function(e){try{n._actionSubscribers.filter(function(t){return t.error}).forEach(function(t){return t.error(i,n.state,e)})}catch(e){}t(e)})})}},e.prototype.subscribe=function(t,e){return i(t,this._subscribers,e)},e.prototype.subscribeAction=function(t,e){return i("function"==typeof t?{before:t}:t,this._actionSubscribers,e)},e.prototype.watch=function(t,e,n){var o=this;return l.watch(function(){return t(o.state,o.getters)},e,Object.assign({},n))},e.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._state.data=t})},e.prototype.registerModule=function(t,e,n){void 0===n&&(n={}),this._modules.register(t="string"==typeof t?[t]:t,e),h(this,this.state,t,this._modules.get(t),n.preserveState),s(this,this.state)},e.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit(function(){delete g(e.state,t.slice(0,-1))[t[t.length-1]]}),a(this)},e.prototype.hasModule=function(t){return this._modules.isRegistered(t="string"==typeof t?[t]:t)},e.prototype.hotUpdate=function(t){this._modules.update(t),a(this,!0)},e.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(e.prototype,t),A(function(r,t){var n={};return S(t).forEach(function(t){var e=t.key,o=t.val;n[e]=function(){var t=this.$store.state,e=this.$store.getters;if(r){var n=G(this.$store,0,r);if(!n)return;t=n.context.state,e=n.context.getters}return"function"==typeof o?o.call(this,t,e):t[o]},n[e].vuex=!0}),n})),M=A(function(i,t){var n={};return S(t).forEach(function(t){var e=t.key,r=t.val;n[e]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=this.$store.commit;if(i){var o=G(this.$store,0,i);if(!o)return;n=o.context.commit}return"function"==typeof r?r.apply(this,[n].concat(t)):n.apply(this.$store,[r].concat(t))}}),n}),k=A(function(o,t){var r={};return S(t).forEach(function(t){var e=t.key,n=t.val,n=o+n;r[e]=function(){if(!o||G(this.$store,0,o))return this.$store.getters[n]},r[e].vuex=!0}),r}),x=A(function(i,t){var n={};return S(t).forEach(function(t){var e=t.key,r=t.val;n[e]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=this.$store.dispatch;if(i){var o=G(this.$store,0,i);if(!o)return;n=o.context.dispatch}return"function"==typeof r?r.apply(this,[n].concat(t)):n.apply(this.$store,[r].concat(t))}}),n});function S(e){return t=e,Array.isArray(t)||r(t)?Array.isArray(e)?e.map(function(t){return{key:t,val:t}}):Object.keys(e).map(function(t){return{key:t,val:e[t]}}):[];var t}function A(n){return function(t,e){return"string"!=typeof t?(e=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),n(t,e)}}function G(t,e,n){return t._modulesNamespaceMap[n]}function I(t,e,n){var o=n?t.groupCollapsed:t.group;try{o.call(t,e)}catch(n){t.log(e)}}function L(e){try{e.groupEnd()}catch(t){e.log("—— log end ——")}}function N(){var t=new Date;return" @ "+T(t.getHours(),2)+":"+T(t.getMinutes(),2)+":"+T(t.getSeconds(),2)+"."+T(t.getMilliseconds(),3)}function T(t,e){return e=e-t.toString().length,new Array(1+e).join("0")+t}return{version:"4.1.0",Store:e,storeKey:n,createStore:function(t){return new e(t)},useStore:function(t){return l.inject(null!==(t=void 0===t?null:t)?t:n)},mapState:C,mapMutations:M,mapGetters:k,mapActions:x,createNamespacedHelpers:function(t){return{mapState:C.bind(null,t),mapGetters:k.bind(null,t),mapMutations:M.bind(null,t),mapActions:x.bind(null,t)}},createLogger:function(t){var i=(t=void 0===t?{}:t).collapsed,a=(void 0===i&&(i=!0),t.filter),c=(void 0===a&&(a=function(t,e,n){return!0}),t.transformer),s=(void 0===c&&(c=function(t){return t}),t.mutationTransformer),o=(void 0===s&&(s=function(t){return t}),t.actionFilter),u=(void 0===o&&(o=function(t,e){return!0}),t.actionTransformer),e=(void 0===u&&(u=function(t){return t}),t.logMutations),n=(void 0===e&&(e=!0),t.logActions),l=(void 0===n&&(n=!0),t.logger);return void 0===l&&(l=console),function(t){var r=f(t.state);void 0!==l&&(e&&t.subscribe(function(t,e){var n,o,e=f(e);a(t,r,e)&&(n=N(),o=s(t),t="mutation "+t.type+n,I(l,t,i),l.log("%c prev state","color: #9E9E9E; font-weight: bold",c(r)),l.log("%c mutation","color: #03A9F4; font-weight: bold",o),l.log("%c next state","color: #4CAF50; font-weight: bold",c(e)),L(l)),r=e}),n&&t.subscribeAction(function(t,e){var n;o(t,e)&&(e=N(),n=u(t),t="action "+t.type+e,I(l,t,i),l.log("%c action","color: #03A9F4; font-weight: bold",n),L(l))}))}}}}(Vue); |