uni-ticket-system/node_modules/pinia/dist/pinia.iife.prod.js

7 lines
5.7 KiB
JavaScript
Raw Normal View History

2023-12-05 02:11:10 +00:00
/*!
* pinia v2.0.33
* (c) 2023 Eduardo San Martin Morote
* @license MIT
*/
var Pinia=function(t,e){"use strict";let n;const i=t=>n=t,s=Symbol();function r(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var o;t.MutationType=void 0,(o=t.MutationType||(t.MutationType={})).direct="direct",o.patchObject="patch object",o.patchFunction="patch function";const c="undefined"!=typeof window;const a=()=>{};function u(t,n,i,s=a){t.push(n);const r=()=>{const e=t.indexOf(n);e>-1&&(t.splice(e,1),s())};return!i&&e.getCurrentScope()&&e.onScopeDispose(r),r}function p(t,...e){t.slice().forEach((t=>{t(...e)}))}function f(t,n){t instanceof Map&&n instanceof Map&&n.forEach(((e,n)=>t.set(n,e))),t instanceof Set&&n instanceof Set&&n.forEach(t.add,t);for(const i in n){if(!n.hasOwnProperty(i))continue;const s=n[i],o=t[i];t[i]=r(o)&&r(s)&&t.hasOwnProperty(i)&&!e.isRef(s)&&!e.isReactive(s)?f(o,s):s}return t}const h=Symbol(),l=new WeakMap;const{assign:d}=Object;function y(n,s,o={},c,y,v){let $;const b=d({actions:{}},o),_={deep:!0};let j,O,g,m=e.markRaw([]),R=e.markRaw([]);const S=c.state.value[n];let P;function w(i){let s;j=O=!1,"function"==typeof i?(i(c.state.value[n]),s={type:t.MutationType.patchFunction,storeId:n,events:g}):(f(c.state.value[n],i),s={type:t.MutationType.patchObject,payload:i,storeId:n,events:g});const r=P=Symbol();e.nextTick().then((()=>{P===r&&(j=!0)})),O=!0,p(m,s,c.state.value[n])}v||S||(e.isVue2?e.set(c.state.value,n,{}):c.state.value[n]={}),e.ref({});const V=v?function(){const{state:t}=o,e=t?t():{};this.$patch((t=>{d(t,e)}))}:a;function M(t,e){return function(){i(c);const s=Array.from(arguments),r=[],o=[];function a(t){r.push(t)}function u(t){o.push(t)}let f;p(R,{args:s,name:t,store:A,after:a,onError:u});try{f=e.apply(this&&this.$id===n?this:A,s)}catch(t){throw p(o,t),t}return f instanceof Promise?f.then((t=>(p(r,t),t))).catch((t=>(p(o,t),Promise.reject(t)))):(p(r,f),f)}}const k={_p:c,$id:n,$onAction:u.bind(null,R),$patch:w,$reset:V,$subscribe(i,s={}){const r=u(m,i,s.detached,(()=>o())),o=$.run((()=>e.watch((()=>c.state.value[n]),(e=>{("sync"===s.flush?O:j)&&i({storeId:n,type:t.MutationType.direct,events:g},e)}),d({},_,s))));return r},$dispose:function(){$.stop(),m=[],R=[],c._s.delete(n)}};e.isVue2&&(k._r=!1);const A=e.reactive(k);c._s.set(n,A);const T=c._e.run((()=>($=e.effectScope(),$.run((()=>s())))));for(const t in T){const i=T[t];if(e.isRef(i)&&(!e.isRef(I=i)||!I.effect)||e.isReactive(i))v||(!S||(E=i,e.isVue2?l.has(E):r(E)&&E.hasOwnProperty(h))||(e.isRef(i)?i.value=S[t]:f(i,S[t])),e.isVue2?e.set(c.state.value[n],t,i):c.state.value[n][t]=i);else if("function"==typeof i){const n=M(t,i);e.isVue2?e.set(T,t,n):T[t]=n,b.actions[t]=i}}var E,I;return e.isVue2?Object.keys(T).forEach((t=>{e.set(A,t,T[t])})):(d(A,T),d(e.toRaw(A),T)),Object.defineProperty(A,"$state",{get:()=>c.state.value[n],set:t=>{w((e=>{d(e,t)}))}}),e.isVue2&&(A._r=!0),c._p.forEach((t=>{d(A,$.run((()=>t({store:A,app:c._a,pinia:c,options:b}))))})),S&&v&&o.hydrate&&o.hydrate(A.$state,S),j=!0,O=!0,A}let v="Store";function $(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(){return t(this.$pinia)[n]},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(){const n=t(this.$pinia),s=e[i];return"function"==typeof s?s.call(this,n):n[s]},n)),{})}const b=$;return t.PiniaVuePlugin=function(t){t.mixin({beforeCreate(){const t=this.$options;if(t.pinia){const e=t.pinia;if(!this._provided){const t={};Object.defineProperty(this,"_provided",{get:()=>t,set:e=>Object.assign(t,e)})}this._provided[s]=e,this.$pinia||(this.$pinia=e),e._a=this,c&&i(e)}else!this.$pinia&&t.parent&&t.parent.$pinia&&(this.$pinia=t.parent.$pinia)},destroyed(){delete this._pStores}})},t.acceptHMRUpdate=function(t,e){return()=>{}},t.createPinia=function(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let r=[],o=[];const c=e.markRaw({install(t){i(c),e.isVue2||(c._a=t,t.provide(s,c),t.config.globalProperties.$pinia=c,o.forEach((t=>r.push(t))),o=[])},use(t){return this._a||e.isVue2?r.push(t):o.push(t),this},_p:r,_a:null,_e:t,_s:new Map,state:n});return c},t.defineStore=function(t,r,o){let c,a;const u="func