_pinia-D4felSvJ.js 3.6 KB

12345
  1. import{Y as H,b as J,X as M,aj as Z,J as $,a as T,G as tt,S as x,ak as B,a5 as et,al as st,g as nt,o as ot,n as ct,V as rt,j as ut}from"./__vendor-DQKyNF9L.js";/*!
  2. * pinia v2.2.2
  3. * (c) 2024 Eduardo San Martin Morote
  4. * @license MIT
  5. */let D;const E=t=>D=t,K=Symbol();function I(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 yt(){const t=H(!0),c=t.run(()=>J({}));let s=[],e=[];const r=M({install(u){E(r),r._a=u,u.provide(K,r),u.config.globalProperties.$pinia=r,e.forEach(f=>s.push(f)),e=[]},use(u){return!this._a&&!Z?e.push(u):s.push(u),this},_p:s,_a:null,_e:t,_s:new Map,state:c});return r}const X=()=>{};function F(t,c,s,e=X){t.push(c);const r=()=>{const u=t.indexOf(c);u>-1&&(t.splice(u,1),e())};return!s&&nt()&&ot(r),r}function P(t,...c){t.slice().forEach(s=>{s(...c)})}const at=t=>t(),A=Symbol(),k=Symbol();function L(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];I(r)&&I(e)&&t.hasOwnProperty(s)&&!x(e)&&!B(e)?t[s]=L(r,e):t[s]=e}return t}const ft=Symbol();function it(t){return!I(t)||!t.hasOwnProperty(ft)}const{assign:S}=Object;function lt(t){return!!(x(t)&&t.effect)}function ht(t,c,s,e){const{state:r,actions:u,getters:f}=c,a=s.state.value[t];let C;function b(){a||(s.state.value[t]=r?r():{});const y=rt(s.state.value[t]);return S(y,u,Object.keys(f||{}).reduce((v,d)=>(v[d]=M(ut(()=>{E(s);const _=s._s.get(t);return f[d].call(_,_)})),v),{}))}return C=Y(t,b,c,s,e,!0),C}function Y(t,c,s={},e,r,u){let f;const a=S({actions:{}},s),C={deep:!0};let b,y,v=[],d=[],_;const m=e.state.value[t];!u&&!m&&(e.state.value[t]={}),J({});let W;function N(o){let n;b=y=!1,typeof o=="function"?(o(e.state.value[t]),n={type:w.patchFunction,storeId:t,events:_}):(L(e.state.value[t],o),n={type:w.patchObject,payload:o,storeId:t,events:_});const i=W=Symbol();ct().then(()=>{W===i&&(b=!0)}),y=!0,P(v,n,e.state.value[t])}const q=u?function(){const{state:n}=s,i=n?n():{};this.$patch(j=>{S(j,i)})}:X;function z(){f.stop(),v=[],d=[],e._s.delete(t)}const V=(o,n="")=>{if(A in o)return o[k]=n,o;const i=function(){E(e);const j=Array.from(arguments),g=[],R=[];function Q(l){g.push(l)}function U(l){R.push(l)}P(d,{args:j,name:i[k],store:h,after:Q,onError:U});let p;try{p=o.apply(this&&this.$id===t?this:h,j)}catch(l){throw P(R,l),l}return p instanceof Promise?p.then(l=>(P(g,l),l)).catch(l=>(P(R,l),Promise.reject(l))):(P(g,p),p)};return i[A]=!0,i[k]=n,i},G={_p:e,$id:t,$onAction:F.bind(null,d),$patch:N,$reset:q,$subscribe(o,n={}){const i=F(v,o,n.detached,()=>j()),j=f.run(()=>T(()=>e.state.value[t],g=>{(n.flush==="sync"?y:b)&&o({storeId:t,type:w.direct,events:_},g)},S({},C,n)));return i},$dispose:z},h=tt(G);e._s.set(t,h);const O=(e._a&&e._a.runWithContext||at)(()=>e._e.run(()=>(f=H()).run(()=>c({action:V}))));for(const o in O){const n=O[o];if(x(n)&&!lt(n)||B(n))u||(m&&it(n)&&(x(n)?n.value=m[o]:L(n,m[o])),e.state.value[t][o]=n);else if(typeof n=="function"){const i=V(n,o);O[o]=i,a.actions[o]=n}}return S(h,O),S(et(h),O),Object.defineProperty(h,"$state",{get:()=>e.state.value[t],set:o=>{N(n=>{S(n,o)})}}),e._p.forEach(o=>{S(h,f.run(()=>o({store:h,app:e._a,pinia:e,options:a})))}),m&&u&&s.hydrate&&s.hydrate(h.$state,m),b=!0,y=!0,h}function vt(t,c,s){let e,r;const u=typeof c=="function";e=t,r=u?s:c;function f(a,C){const b=st();return a=a||(b?$(K,null):null),a&&E(a),a=D,a._s.has(e)||(u?Y(e,c,r,a):ht(e,r,a)),a._s.get(e)}return f.$id=e,f}export{yt as c,vt as d};