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