function e(e,r){if(null==e)return;let t=e;for(let i=0;i1&&(t=r("object"==typeof e&&null!==e&&Object.prototype.hasOwnProperty.call(e,n)?e[n]:Number.isInteger(Number(i[1]))?[]:{},t,Array.prototype.slice.call(i,1))),Number.isInteger(Number(n))&&Array.isArray(e)?e.slice()[n]:Object.assign({},e,{[n]:t})}function t(e,i){if(null==e||0===i.length)return e;if(1===i.length){if(null==e)return e;if(Number.isInteger(i[0])&&Array.isArray(e))return Array.prototype.slice.call(e,0).splice(i[0],1);const r={};for(const t in e)r[t]=e[t];return delete r[i[0]],r}if(null==e[i[0]]){if(Number.isInteger(i[0])&&Array.isArray(e))return Array.prototype.concat.call([],e);const r={};for(const t in e)r[t]=e[t];return r}return r(e,t(e[i[0]],Array.prototype.slice.call(i,1)),[i[0]])}function i(t,i){return i.map(e=>e.split(".")).map(r=>[r,e(t,r)]).filter(e=>void 0!==e[1]).reduce((e,t)=>r(e,t[1],t[0]),{})}function n(e,r){return r.map(e=>e.split(".")).reduce((e,r)=>t(e,r),e)}function o(e,{storage:r,serializer:t,key:o,debug:a,pick:s,omit:l,beforeHydrate:u,afterHydrate:c},f,y=!0){try{y&&(null==u||u(f));const a=r.getItem(o);if(a){const r=t.deserialize(a),o=s?i(r,s):r,u=l?n(o,l):o;e.$patch(u)}y&&(null==c||c(f))}catch(p){}}function a(e,{storage:r,serializer:t,key:o,debug:a,pick:s,omit:l}){try{const a=s?i(e,s):e,u=l?n(a,l):a,c=t.serialize(u);r.setItem(o,c)}catch(u){}}var s=function(e={}){return function(r){!function(e,r,t){const{pinia:i,store:n,options:{persist:s=t}}=e;if(!s)return; // v8 ignore if -- @preserve if(!(n.$id in i.state.value)){const e=i._s.get(n.$id.replace("__hot:",""));return void(e&&Promise.resolve().then(()=>e.$persist()))}const l=(Array.isArray(s)?s:!0===s?[{}]:[s]).map(r);n.$hydrate=({runHooks:r=!0}={})=>{l.forEach(t=>{o(n,t,e,r)})},n.$persist=()=>{l.forEach(e=>{a(n.$state,e)})},l.forEach(r=>{o(n,r,e),n.$subscribe((e,t)=>a(t,r),{detached:!0})})}(r,t=>{const i=(n=t.key,o=r.store.$id,"function"==typeof n?n(o):"string"==typeof n?n:o);var n,o;return{key:(e.key?e.key:e=>e)(i),debug:t.debug??e.debug??!1,serializer:t.serializer??e.serializer??{serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},storage:t.storage??e.storage??window.localStorage,beforeHydrate:t.beforeHydrate??e.beforeHydrate,afterHydrate:t.afterHydrate??e.afterHydrate,pick:t.pick,omit:t.omit}},e.auto??!1)}}();export{s};