import{e as t,r as n,m as e,t as s,c as o,i as c,a,b as r,d as i,g as u,o as f,w as p,n as l,f as h,h as d,j as y}from"./vendor-BXdGExd0.js";let b;const v=t=>b=t,_=Symbol();function j(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var g,m;function O(){const s=t(!0),o=s.run(()=>n({}));let c=[],a=[];const r=e({install(t){v(r),r._a=t,t.provide(_,r),t.config.globalProperties.$pinia=r,a.forEach(t=>c.push(t)),a=[]},use(t){return this._a?c.push(t):a.push(t),this},_p:c,_a:null,_e:s,_s:new Map,state:o});return r}(m=g||(g={})).direct="direct",m.patchObject="patch object",m.patchFunction="patch function";const $=()=>{};function S(t,n,e,s=$){t.push(n);const o=()=>{const e=t.indexOf(n);e>-1&&(t.splice(e,1),s())};return!e&&u()&&f(o),o}function P(t,...n){t.slice().forEach(t=>{t(...n)})}const w=t=>t(),E=Symbol(),x=Symbol();function I(t,n){t instanceof Map&&n instanceof Map?n.forEach((n,e)=>t.set(e,n)):t instanceof Set&&n instanceof Set&&n.forEach(t.add,t);for(const e in n){if(!n.hasOwnProperty(e))continue;const s=n[e],o=t[e];j(o)&&j(s)&&t.hasOwnProperty(e)&&!c(s)&&!a(s)?t[e]=I(o,s):t[e]=s}return t}const M=Symbol();function A(t){return!j(t)||!t.hasOwnProperty(M)}const{assign:F}=Object;function k(t){return!(!c(t)||!t.effect)}function C(e,o,r={},u,f,h){let d;const y=F({actions:{}},r),b={deep:!0};let _,j,m,O=[],M=[];const C=u.state.value[e];let J;function N(t){let n;_=j=!1,"function"==typeof t?(t(u.state.value[e]),n={type:g.patchFunction,storeId:e,events:m}):(I(u.state.value[e],t),n={type:g.patchObject,payload:t,storeId:e,events:m});const s=J=Symbol();l().then(()=>{J===s&&(_=!0)}),j=!0,P(O,n,u.state.value[e])}h||C||(u.state.value[e]={}),n({});const W=h?function(){const{state:t}=r,n=t?t():{};this.$patch(t=>{F(t,n)})}:$;const q=(t,n="")=>{if(E in t)return t[x]=n,t;const s=function(){v(u);const n=Array.from(arguments),o=[],c=[];let a;P(M,{args:n,name:s[x],store:B,after:function(t){o.push(t)},onError:function(t){c.push(t)}});try{a=t.apply(this&&this.$id===e?this:B,n)}catch(r){throw P(c,r),r}return a instanceof Promise?a.then(t=>(P(o,t),t)).catch(t=>(P(c,t),Promise.reject(t))):(P(o,a),a)};return s[E]=!0,s[x]=n,s},z={_p:u,$id:e,$onAction:S.bind(null,M),$patch:N,$reset:W,$subscribe(t,n={}){const s=S(O,t,n.detached,()=>o()),o=d.run(()=>p(()=>u.state.value[e],s=>{("sync"===n.flush?j:_)&&t({storeId:e,type:g.direct,events:m},s)},F({},b,n)));return s},$dispose:function(){d.stop(),O=[],M=[],u._s.delete(e)}},B=i(z);u._s.set(e,B);const D=(u._a&&u._a.runWithContext||w)(()=>u._e.run(()=>(d=t()).run(()=>o({action:q}))));for(const t in D){const n=D[t];if(c(n)&&!k(n)||a(n))h||(C&&A(n)&&(c(n)?n.value=C[t]:I(n,C[t])),u.state.value[e][t]=n);else if("function"==typeof n){const e=q(n,t);D[t]=e,y.actions[t]=n}}return F(B,D),F(s(B),D),Object.defineProperty(B,"$state",{get:()=>u.state.value[e],set:t=>{N(n=>{F(n,t)})}}),u._p.forEach(t=>{F(B,d.run(()=>t({store:B,app:u._a,pinia:u,options:y})))}),C&&h&&r.hydrate&&r.hydrate(B.$state,C),_=!0,j=!0,B}function J(t,n,s){let c,a;const r="function"==typeof n;function i(t,s){const i=y();(t=t||(i?d(_,null):null))&&v(t),(t=b)._s.has(c)||(r?C(c,n,a,t):function(t,n,s){const{state:c,actions:a,getters:r}=n,i=s.state.value[t];let u;u=C(t,function(){i||(s.state.value[t]=c?c():{});const n=h(s.state.value[t]);return F(n,a,Object.keys(r||{}).reduce((n,c)=>(n[c]=e(o(()=>{v(s);const n=s._s.get(t);return r[c].call(n,n)})),n),{}))},n,s,0,!0)}(c,a,t));return t._s.get(c)}return"string"==typeof t?(c=t,a=r?s:n):(a=t,c=t.id),i.$id=c,i}function N(t){{const n=s(t),e={};for(const s in n){const i=n[s];i.effect?e[s]=o({get:()=>t[s],set(n){t[s]=n}}):(c(i)||a(i))&&(e[s]=r(t,s))}return e}}export{O as c,J as d,N as s};
