6 lines
3.5 KiB
JavaScript
6 lines
3.5 KiB
JavaScript
import{a5 as U,$ as X,n as Y,w as Z,A as G}from"./@vue/runtime-core-C0pg79pw.js";import{B,a as R,n as K,t as T,C as tt,F as et,r as st,o as nt,m as M,K as ot}from"./@vue/reactivity-BIbyPIZJ.js";/*!
|
|
* pinia v2.3.1
|
|
* (c) 2025 Eduardo San Martin Morote
|
|
* @license MIT
|
|
*/let V;const x=t=>V=t,$=Symbol();function F(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var w;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(w||(w={}));function bt(){const t=B(!0),c=t.run(()=>nt({}));let s=[],e=[];const r=M({install(a){x(r),r._a=a,a.provide($,r),a.config.globalProperties.$pinia=r,e.forEach(u=>s.push(u)),e=[]},use(a){return this._a?s.push(a):e.push(a),this},_p:s,_a:null,_e:t,_s:new Map,state:c});return r}const ct=()=>{};function N(t,c,s,e=ct){t.push(c);const r=()=>{const a=t.indexOf(c);a>-1&&(t.splice(a,1),e())};return!s&&tt()&&et(r),r}function p(t,...c){t.slice().forEach(s=>{s(...c)})}const rt=t=>t(),A=Symbol(),O=Symbol();function D(t,c){t instanceof Map&&c instanceof Map?c.forEach((s,e)=>t.set(e,s)):t instanceof Set&&c instanceof Set&&c.forEach(t.add,t);for(const s in c){if(!c.hasOwnProperty(s))continue;const e=c[s],r=t[s];F(r)&&F(e)&&t.hasOwnProperty(s)&&!R(e)&&!K(e)?t[s]=D(r,e):t[s]=e}return t}const{assign:h}=Object;function ut(t){return!!(R(t)&&t.effect)}function at(t,c,s,e){const{state:r,actions:a,getters:u}=c,j=s.state.value[t];let S;function b(){j||(s.state.value[t]=r?r():{});const v=ot(s.state.value[t]);return h(v,a,Object.keys(u||{}).reduce((y,m)=>(y[m]=M(G(()=>{x(s);const _=s._s.get(t);return u[m].call(_,_)})),y),{}))}return S=ft(t,b,c,s,e,!0),S}function ft(t,c,s={},e,r,a){let u;const j=h({actions:{}},s),S={deep:!0};let b,v,y=[],m=[],_;const I=e.state.value[t];let k;function L(n){let o;b=v=!1,typeof n=="function"?(n(e.state.value[t]),o={type:w.patchFunction,storeId:t,events:_}):(D(e.state.value[t],n),o={type:w.patchObject,payload:n,storeId:t,events:_});const f=k=Symbol();Y().then(()=>{k===f&&(b=!0)}),v=!0,p(y,o,e.state.value[t])}const J=function(){const{state:o}=s,f=o?o():{};this.$patch(d=>{h(d,f)})};function q(){u.stop(),y=[],m=[],e._s.delete(t)}const W=(n,o="")=>{if(A in n)return n[O]=o,n;const f=function(){x(e);const d=Array.from(arguments),P=[],E=[];function H(i){P.push(i)}function Q(i){E.push(i)}p(m,{args:d,name:f[O],store:l,after:H,onError:Q});let g;try{g=n.apply(this&&this.$id===t?this:l,d)}catch(i){throw p(E,i),i}return g instanceof Promise?g.then(i=>(p(P,i),i)).catch(i=>(p(E,i),Promise.reject(i))):(p(P,g),g)};return f[A]=!0,f[O]=o,f},z={_p:e,$id:t,$onAction:N.bind(null,m),$patch:L,$reset:J,$subscribe(n,o={}){const f=N(y,n,o.detached,()=>d()),d=u.run(()=>Z(()=>e.state.value[t],P=>{(o.flush==="sync"?v:b)&&n({storeId:t,type:w.direct,events:_},P)},h({},S,o)));return f},$dispose:q},l=st(z);e._s.set(t,l);const C=(e._a&&e._a.runWithContext||rt)(()=>e._e.run(()=>(u=B()).run(()=>c({action:W}))));for(const n in C){const o=C[n];if(!(R(o)&&!ut(o)||K(o))){if(typeof o=="function"){const f=W(o,n);C[n]=f,j.actions[n]=o}}}return h(l,C),h(T(l),C),Object.defineProperty(l,"$state",{get:()=>e.state.value[t],set:n=>{L(o=>{h(o,n)})}}),e._p.forEach(n=>{h(l,u.run(()=>n({store:l,app:e._a,pinia:e,options:j})))}),I&&a&&s.hydrate&&s.hydrate(l.$state,I),b=!0,v=!0,l}/*! #__NO_SIDE_EFFECTS__ */function St(t,c,s){let e,r;typeof t=="string"?(e=t,r=c):(r=t,e=t.id);function a(u,j){const S=X();return u=u||(S?U($,null):null),u&&x(u),u=V,u._s.has(e)||at(e,r,u),u._s.get(e)}return a.$id=e,a}export{bt as c,St as d};
|