epps
Version:
Enhances Pinia stores with advanced features such as persistence, encryption, and store extension. Simplifies state management and ensures data security for Vue.js and Nuxt applications.
22 lines (21 loc) • 46 kB
JavaScript
(function(_,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("crypto-js"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","crypto-js","pinia"],m):(_=typeof globalThis<"u"?globalThis:_||self,m(_.Epps={},_.CryptoJS,_.Pinia))})(this,function(_,m,C){"use strict";var Or=Object.defineProperty;var Pr=(_,m,C)=>m in _?Or(_,m,{enumerable:!0,configurable:!0,writable:!0,value:C}):_[m]=C;var h=(_,m,C)=>Pr(_,typeof m!="symbol"?m+"":m,C);class Bt{constructor(e,s){h(this,"_key");h(this,"_iv");this._key=m.enc.Utf8.parse(e),this._iv=m.enc.Utf8.parse(s)}decrypt(e){let s=m.lib.CipherParams.create({ciphertext:m.enc.Base64.parse(e)});return m.AES.decrypt(s,this._key,{iv:this._iv}).toString(m.enc.Utf8)}encrypt(e){return m.AES.encrypt(e,this._key,{iv:this._iv}).toString()}}class Ce{constructor(e){h(this,"_storage");this._storage=e==="localStorage"?localStorage:sessionStorage}clear(){this._storage.clear()}async getItem(e){return new Promise((s,r)=>{const n=this._storage.getItem(e.toString());s(n?JSON.parse(n):void 0)})}removeItem(e){this._storage.removeItem(e.toString())}removeItems(e){for(let s=0;s<this._storage.length;s++){const r=this._storage.key(s);r&&(!e||!e.includes(r))&&this._storage.removeItem(r)}}setItem(e,s){this._storage.setItem(s,JSON.stringify(e))}}const Me="Epps!",Wt=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function St(t,e,s){const r=s?Wt(s.bgColor,s.color):Wt("#ffec73","green");t=` [${(s==null?void 0:s.icon)??"🍍⚡"} ${Me} plugin] - ${t} `,console.log("%c%s",r,t,e)}function M(t,e){St(t,e,{bgColor:"#ffa653",color:"white",icon:"🍍⚠️"})}class Ut{constructor(e,s,r){h(this,"_db");h(this,"_localStorageVersionKey","IDBVersion");h(this,"_name","persistStore");h(this,"_objectStore");h(this,"_objectStoreOptions");h(this,"_objectStoreName");h(this,"_transactionMode","readwrite");h(this,"_version");this._objectStoreName=e,this._version=this.getStoredVersionNumber(),s&&(this._objectStoreOptions=s),r&&(this._transactionMode=r)}clear(){const e=()=>{if(this._objectStore){const s=this._objectStore.clear();this.requestEventsHandler(s,{error:()=>this.onError(s.error)})}};this.open({success:e})}createObjectStore(){this._db&&!this._db.objectStoreNames.contains(this._objectStoreName)&&this._db.createObjectStore(this._objectStoreName,this._objectStoreOptions)}deleteObjectStore(){const e=()=>{var s;(s=this._db)==null||s.deleteObjectStore(this._objectStoreName)};this.open({success:e})}async getItem(e){return new Promise(s=>{const r=()=>{if(this._objectStore){const n=this._objectStore.get(e);this.requestEventsHandler(n,{error:()=>this.onError(n.error,()=>s(void 0)),success:()=>s(n.result)})}};this.open({success:r})})}async getObjectStoreItem(e,s){return new Promise(r=>{const n=()=>{if(this._objectStore){const o=this._objectStore.index(e).get(s);this.requestEventsHandler(o,{error:()=>r(void 0),success:()=>r(o.result)})}};this.open({success:n})})}getStoredVersionNumber(){if(!localStorage)return 1;const e=localStorage.getItem(this._localStorageVersionKey);return e?parseInt(e):1}handleDeleteRequest(e,s){e.onerror=()=>M(`IndexedDB - Item "${s}" remove`,e.error)}onError(e,s){s&&s(e)}open(e){const s=indexedDB.open(this._name,this._version),r=()=>{this._db=s.result},n=o=>{try{if(r(),!this._db)return;const c=this._db.transaction(this._objectStoreName,this._transactionMode);c.onerror=()=>this.onError(c.error),this._objectStore=c.objectStore(this._objectStoreName),this._objectStore&&o()}catch(c){M("indexedDB - transaction error",[c])}};if(e!=null&&e.success){const o=e.success;e.success=()=>n(o)}if(e!=null&&e.upgrade){const o=e.upgrade.bind(this);e.upgrade=()=>{r(),o()}}const i=()=>{const o=c=>{if((c==null?void 0:c.name)==="VersionError"){this._version++,this.saveVersion(),this.open(e);return}e!=null&&e.error&&e.error(c)};this.onError(s.error,o)};return e&&this.openRequestEventsHandler(s,{...e,error:i}),s}openRequestEventsHandler(e,s){this.requestEventsHandler(e,s),s.upgrade&&(e.onupgradeneeded=s.upgrade)}removeItem(e){const s=()=>{if(this._objectStore){const r=this._objectStore.delete(e);this.handleDeleteRequest(r,e)}};this.open({success:s})}removeItems(e){const s=()=>{if(this._objectStore){const r=this._objectStore.getAllKeys(),n=()=>{r.result.forEach(c=>{if(this._objectStore&&(!e||!e.includes(c))){const a=this._objectStore.delete(c);this.handleDeleteRequest(a,c)}})},i=()=>M("IndexedDB - removeItems",[r.error]);this.requestEventsHandler(r,{error:i,success:n})}};this.open({success:s})}requestEventsHandler(e,s){const{error:r,success:n}=s;r&&(e.onerror=r),n&&(e.onsuccess=n)}saveVersion(){localStorage&&localStorage.setItem(this._localStorageVersionKey,this._version.toString())}setItem(e,s){const r=()=>{if(this._objectStore){const i=this._objectStore.add(e);if(s){const o=()=>{s.forEach(a=>{var l;(l=this._objectStore)==null||l.createIndex(a,a,{unique:!0}),St(`"${a}" index created`)})},c=()=>this.onError(i.error);this.requestEventsHandler(i,{error:c,success:o})}}},n=this.createObjectStore;this.open({success:r,upgrade:n})}updateItem(e){const s=()=>{if(this._objectStore){const r=this._objectStore.put(e);r.onerror=()=>M("update item",[r.error,e])}};this.open({success:s})}}class yt{constructor(e){h(this,"_db");h(this,"_db_options");if(!e)throw new Error("DbOptions is required");this._db_options=e,this._db=this.defineDb()}defineDb(){let{keyPath:e,name:s}=this._db_options,r;switch(s){case"localStorage":case"sessionStorage":r=new Ce(s);break;default:e||(e="storeName"),r=new Ut(s,{keyPath:e})}return r}getItem(e){return new Promise((s,r)=>{if(!this._db)return r("No db found");try{return this._db.getItem(e).then(n=>s(n))}catch(n){r(n)}})}removeItem(e){this._db.removeItem(e)}setItem(e,s){if(this._db instanceof Ut)try{this._db.getItem(e).then(r=>{r?this._db.updateItem(r):this._db.setItem({storeName:e,...s})})}catch(r){M("Persister - setItem Error",r),this._db.setItem({storename:e,...s})}else this._db.setItem(s,e)}}/**
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**//*! #__NO_SIDE_EFFECTS__ */function He(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const bt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const zt=()=>{},Fe=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),H=Object.assign,Ke=Object.prototype.hasOwnProperty,Et=(t,e)=>Ke.call(t,e),S=Array.isArray,G=t=>Yt(t)==="[object Map]",I=t=>typeof t=="function",R=t=>typeof t=="string",Q=t=>typeof t=="symbol",E=t=>t!==null&&typeof t=="object",Le=Object.prototype.toString,Yt=t=>Le.call(t),Jt=t=>Yt(t).slice(8,-1),vt=t=>R(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,qe=(t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),L=(t,e)=>!Object.is(t,e);let Gt;const ct=()=>Gt||(Gt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function wt(t){if(S(t)){const e={};for(let s=0;s<t.length;s++){const r=t[s],n=R(r)?ze(r):wt(r);if(n)for(const i in n)e[i]=n[i]}return e}else if(R(t)||E(t))return t}const Be=/;(?![^(]*\))/g,We=/:([^]+)/,Ue=/\/\*[^]*?\*\//g;function ze(t){const e={};return t.replace(Ue,"").split(Be).forEach(s=>{if(s){const r=s.split(We);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Nt(t){let e="";if(R(t))e=t;else if(S(t))for(let s=0;s<t.length;s++){const r=Nt(t[s]);r&&(e+=r+" ")}else if(E(t))for(const s in t)t[s]&&(e+=s+" ");return e.trim()}/**
* /reactivity v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* MIT
**/function q(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let g,Qt=0,X,Z;function Ye(t,e=!1){if(t.flags|=8,e){t.next=Z,Z=t;return}t.next=X,X=t}function Ot(){Qt++}function Pt(){if(--Qt>0)return;if(Z){let e=Z;for(Z=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;X;){let e=X;for(X=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=s}}if(t)throw t}function Je(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ge(t){let e,s=t.depsTail,r=s;for(;r;){const n=r.prevDep;r.version===-1?(r===s&&(s=n),Zt(r),Xe(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=s}function Qe(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Xt(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Xt(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===k))return;t.globalVersion=k;const e=t.dep;if(t.flags|=2,e.version>0&&!t.isSSR&&t.deps&&!Qe(t)){t.flags&=-3;return}const s=g,r=A;g=t,A=!0;try{Je(t);const n=t.fn(t._value);(e.version===0||L(n,t._value))&&(t._value=n,e.version++)}catch(n){throw e.version++,n}finally{g=s,A=r,Ge(t),t.flags&=-3}}function Zt(t,e=!1){const{dep:s,prevSub:r,nextSub:n}=t;if(r&&(r.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=r,t.nextSub=void 0),process.env.NODE_ENV!=="production"&&s.subsHead===t&&(s.subsHead=n),s.subs===t&&(s.subs=r,!r&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)Zt(i,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function Xe(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let A=!0;const kt=[];function xt(){kt.push(A),A=!1}function It(){const t=kt.pop();A=t===void 0?!0:t}let k=0;class Ze{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Rt{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!g||!A||g===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==g)s=this.activeLink=new Ze(g,this),g.deps?(s.prevDep=g.depsTail,g.depsTail.nextDep=s,g.depsTail=s):g.deps=g.depsTail=s,te(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const r=s.nextDep;r.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=r),s.prevDep=g.depsTail,s.nextDep=void 0,g.depsTail.nextDep=s,g.depsTail=s,g.deps===s&&(g.deps=r)}return process.env.NODE_ENV!=="production"&&g.onTrack&&g.onTrack(H({effect:g},e)),s}trigger(e){this.version++,k++,this.notify(e)}notify(e){Ot();try{if(process.env.NODE_ENV!=="production")for(let s=this.subsHead;s;s=s.nextSub)s.sub.onTrigger&&!(s.sub.flags&8)&&s.sub.onTrigger(H({effect:s.sub},e));for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{Pt()}}}function te(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)te(r)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),process.env.NODE_ENV!=="production"&&t.dep.subsHead===void 0&&(t.dep.subsHead=t),t.dep.subs=t}}const at=new WeakMap,F=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Tt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),tt=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function b(t,e,s){if(A&&g){let r=at.get(t);r||at.set(t,r=new Map);let n=r.get(s);n||(r.set(s,n=new Rt),n.map=r,n.key=s),process.env.NODE_ENV!=="production"?n.track({target:t,type:e,key:s}):n.track()}}function j(t,e,s,r,n,i){const o=at.get(t);if(!o){k++;return}const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:t,type:e,key:s,newValue:r,oldValue:n,oldTarget:i}):a.trigger())};if(Ot(),e==="clear")o.forEach(c);else{const a=S(t),l=a&&vt(s);if(a&&s==="length"){const p=Number(r);o.forEach((u,d)=>{(d==="length"||d===tt||!Q(d)&&d>=p)&&c(u)})}else switch((s!==void 0||o.has(void 0))&&c(o.get(s)),l&&c(o.get(tt)),e){case"add":a?l&&c(o.get("length")):(c(o.get(F)),G(t)&&c(o.get(Tt)));break;case"delete":a||(c(o.get(F)),G(t)&&c(o.get(Tt)));break;case"set":G(t)&&c(o.get(F));break}}Pt()}function ke(t,e){const s=at.get(t);return s&&s.get(e)}function B(t){const e=f(t);return e===t?e:(b(e,"iterate",tt),N(t)?e:e.map(y))}function Vt(t){return b(t=f(t),"iterate",tt),t}const ts={__proto__:null,[Symbol.iterator](){return Dt(this,Symbol.iterator,y)},concat(...t){return B(this).concat(...t.map(e=>S(e)?B(e):e))},entries(){return Dt(this,"entries",t=>(t[1]=y(t[1]),t))},every(t,e){return T(this,"every",t,e,void 0,arguments)},filter(t,e){return T(this,"filter",t,e,s=>s.map(y),arguments)},find(t,e){return T(this,"find",t,e,y,arguments)},findIndex(t,e){return T(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return T(this,"findLast",t,e,y,arguments)},findLastIndex(t,e){return T(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return T(this,"forEach",t,e,void 0,arguments)},includes(...t){return At(this,"includes",t)},indexOf(...t){return At(this,"indexOf",t)},join(t){return B(this).join(t)},lastIndexOf(...t){return At(this,"lastIndexOf",t)},map(t,e){return T(this,"map",t,e,void 0,arguments)},pop(){return et(this,"pop")},push(...t){return et(this,"push",t)},reduce(t,...e){return ee(this,"reduce",t,e)},reduceRight(t,...e){return ee(this,"reduceRight",t,e)},shift(){return et(this,"shift")},some(t,e){return T(this,"some",t,e,void 0,arguments)},splice(...t){return et(this,"splice",t)},toReversed(){return B(this).toReversed()},toSorted(t){return B(this).toSorted(t)},toSpliced(...t){return B(this).toSpliced(...t)},unshift(...t){return et(this,"unshift",t)},values(){return Dt(this,"values",y)}};function Dt(t,e,s){const r=Vt(t),n=r[e]();return r!==t&&!N(t)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.value&&(i.value=s(i.value)),i}),n}const es=Array.prototype;function T(t,e,s,r,n,i){const o=Vt(t),c=o!==t&&!N(t),a=o[e];if(a!==es[e]){const u=a.apply(t,i);return c?y(u):u}let l=s;o!==t&&(c?l=function(u,d){return s.call(this,y(u),d,t)}:s.length>2&&(l=function(u,d){return s.call(this,u,d,t)}));const p=a.call(o,l,r);return c&&n?n(p):p}function ee(t,e,s,r){const n=Vt(t);let i=s;return n!==t&&(N(t)?s.length>3&&(i=function(o,c,a){return s.call(this,o,c,a,t)}):i=function(o,c,a){return s.call(this,o,y(c),a,t)}),n[e](i,...r)}function At(t,e,s){const r=f(t);b(r,"iterate",tt);const n=r[e](...s);return(n===-1||n===!1)&&ft(s[0])?(s[0]=f(s[0]),r[e](...s)):n}function et(t,e,s=[]){xt(),Ot();const r=f(t)[e].apply(t,s);return Pt(),It(),r}const ss=He("__proto__,__v_isRef,__isVue"),se=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Q));function rs(t){Q(t)||(t=String(t));const e=f(this);return b(e,"has",t),e.hasOwnProperty(t)}class re{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,r){if(s==="__v_skip")return e.__v_skip;const n=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!n;if(s==="__v_isReadonly")return n;if(s==="__v_isShallow")return i;if(s==="__v_raw")return r===(n?i?ps:ce:i?ds:oe).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=S(e);if(!n){let a;if(o&&(a=ts[s]))return a;if(s==="hasOwnProperty")return rs}const c=Reflect.get(e,s,O(e)?e:r);return(Q(s)?se.has(s):ss(s))||(n||b(e,"get",s),i)?c:O(c)?o&&vt(s)?c:c.value:E(c)?n?ue(c):ae(c):c}}class ns extends re{constructor(e=!1){super(!1,e)}set(e,s,r,n){let i=e[s];if(!this._isShallow){const a=V(i);if(!N(r)&&!V(r)&&(i=f(i),r=f(r)),!S(e)&&O(i)&&!O(r))return a?!1:(i.value=r,!0)}const o=S(e)&&vt(s)?Number(s)<e.length:Et(e,s),c=Reflect.set(e,s,r,O(e)?e:n);return e===f(n)&&(o?L(r,i)&&j(e,"set",s,r,i):j(e,"add",s,r)),c}deleteProperty(e,s){const r=Et(e,s),n=e[s],i=Reflect.deleteProperty(e,s);return i&&r&&j(e,"delete",s,void 0,n),i}has(e,s){const r=Reflect.has(e,s);return(!Q(s)||!se.has(s))&&b(e,"has",s),r}ownKeys(e){return b(e,"iterate",S(e)?"length":F),Reflect.ownKeys(e)}}class is extends re{constructor(e=!1){super(!0,e)}set(e,s){return process.env.NODE_ENV!=="production"&&q(`Set operation on key "${String(s)}" failed: target is readonly.`,e),!0}deleteProperty(e,s){return process.env.NODE_ENV!=="production"&&q(`Delete operation on key "${String(s)}" failed: target is readonly.`,e),!0}}const os=new ns,cs=new is,jt=t=>t,ut=t=>Reflect.getPrototypeOf(t);function as(t,e,s){return function(...r){const n=this.__v_raw,i=f(n),o=G(i),c=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,l=n[t](...r),p=s?jt:e?$t:y;return!e&&b(i,"iterate",a?Tt:F),{next(){const{value:u,done:d}=l.next();return d?{value:u,done:d}:{value:c?[p(u[0]),p(u[1])]:p(u),done:d}},[Symbol.iterator](){return this}}}}function lt(t){return function(...e){if(process.env.NODE_ENV!=="production"){const s=e[0]?`on key "${e[0]}" `:"";q(`${qe(t)} operation ${s}failed: target is readonly.`,f(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function us(t,e){const s={get(n){const i=this.__v_raw,o=f(i),c=f(n);t||(L(n,c)&&b(o,"get",n),b(o,"get",c));const{has:a}=ut(o),l=e?jt:t?$t:y;if(a.call(o,n))return l(i.get(n));if(a.call(o,c))return l(i.get(c));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!t&&b(f(n),"iterate",F),Reflect.get(n,"size",n)},has(n){const i=this.__v_raw,o=f(i),c=f(n);return t||(L(n,c)&&b(o,"has",n),b(o,"has",c)),n===c?i.has(n):i.has(n)||i.has(c)},forEach(n,i){const o=this,c=o.__v_raw,a=f(c),l=e?jt:t?$t:y;return!t&&b(a,"iterate",F),c.forEach((p,u)=>n.call(i,l(p),l(u),o))}};return H(s,t?{add:lt("add"),set:lt("set"),delete:lt("delete"),clear:lt("clear")}:{add(n){!e&&!N(n)&&!V(n)&&(n=f(n));const i=f(this);return ut(i).has.call(i,n)||(i.add(n),j(i,"add",n,n)),this},set(n,i){!e&&!N(i)&&!V(i)&&(i=f(i));const o=f(this),{has:c,get:a}=ut(o);let l=c.call(o,n);l?process.env.NODE_ENV!=="production"&&ie(o,c,n):(n=f(n),l=c.call(o,n));const p=a.call(o,n);return o.set(n,i),l?L(i,p)&&j(o,"set",n,i,p):j(o,"add",n,i),this},delete(n){const i=f(this),{has:o,get:c}=ut(i);let a=o.call(i,n);a?process.env.NODE_ENV!=="production"&&ie(i,o,n):(n=f(n),a=o.call(i,n));const l=c?c.call(i,n):void 0,p=i.delete(n);return a&&j(i,"delete",n,void 0,l),p},clear(){const n=f(this),i=n.size!==0,o=process.env.NODE_ENV!=="production"?G(n)?new Map(n):new Set(n):void 0,c=n.clear();return i&&j(n,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(n=>{s[n]=as(n,t,e)}),s}function ne(t,e){const s=us(t,e);return(r,n,i)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(Et(s,n)&&n in r?s:r,n,i)}const ls={get:ne(!1,!1)},fs={get:ne(!0,!1)};function ie(t,e,s){const r=f(s);if(r!==s&&e.call(t,r)){const n=Jt(t);q(`Reactive ${n} contains both the raw and reactive versions of the same object${n==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const oe=new WeakMap,ds=new WeakMap,ce=new WeakMap,ps=new WeakMap;function hs(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function _s(t){return t.__v_skip||!Object.isExtensible(t)?0:hs(Jt(t))}function ae(t){return V(t)?t:le(t,!1,os,ls,oe)}function ue(t){return le(t,!0,cs,fs,ce)}function le(t,e,s,r,n){if(!E(t))return process.env.NODE_ENV!=="production"&&q(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=n.get(t);if(i)return i;const o=_s(t);if(o===0)return t;const c=new Proxy(t,o===2?r:s);return n.set(t,c),c}function fe(t){return V(t)?fe(t.__v_raw):!!(t&&t.__v_isReactive)}function V(t){return!!(t&&t.__v_isReadonly)}function N(t){return!!(t&&t.__v_isShallow)}function ft(t){return t?!!t.__v_raw:!1}function f(t){const e=t&&t.__v_raw;return e?f(e):t}const y=t=>E(t)?ae(t):t,$t=t=>E(t)?ue(t):t;function O(t){return t?t.__v_isRef===!0:!1}function P(t){return gs(t,!1)}function gs(t,e){return O(t)?t:new ms(t,e)}class ms{constructor(e,s){this.dep=new Rt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:f(e),this._value=s?e:y(e),this.__v_isShallow=s}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const s=this._rawValue,r=this.__v_isShallow||N(e)||V(e);e=r?e:f(e),L(e,s)&&(this._rawValue=e,this._value=r?e:y(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:s}):this.dep.trigger())}}class Ss{constructor(e,s,r){this._object=e,this._key=s,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return ke(f(this._object),this._key)}}class ys{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function de(t,e,s){return O(t)?t:I(t)?new ys(t):E(t)&&arguments.length>1?bs(t,e,s):P(t)}function bs(t,e,s){const r=t[e];return O(r)?r:new Ss(t,e,s)}class Es{constructor(e,s,r){this.fn=e,this.setter=s,this._value=void 0,this.dep=new Rt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=k-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&g!==this)return Ye(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return Xt(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&q("Write operation failed: computed value is readonly")}}function vs(t,e,s=!1){let r,n;I(t)?r=t:(r=t.get,n=t.set);const i=new Es(r,n,s);return process.env.NODE_ENV,i}/**
* @vue/runtime-core v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/const K=[];function ws(t){K.push(t)}function Ns(){K.pop()}let Ct=!1;function W(t,...e){if(Ct)return;Ct=!0,xt();const s=K.length?K[K.length-1].component:null,r=s&&s.appContext.config.warnHandler,n=Os();if(r)Mt(r,s,11,[t+e.map(i=>{var o,c;return(c=(o=i.toString)==null?void 0:o.call(i))!=null?c:JSON.stringify(i)}).join(""),s&&s.proxy,n.map(({vnode:i})=>`at <${Te(s,i.type)}>`).join(`
`),n]);else{const i=[`[Vue warn]: ${t}`,...e];n.length&&i.push(`
`,...Ps(n)),console.warn(...i)}It(),Ct=!1}function Os(){let t=K[K.length-1];if(!t)return[];const e=[];for(;t;){const s=e[0];s&&s.vnode===t?s.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function Ps(t){const e=[];return t.forEach((s,r)=>{e.push(...r===0?[]:[`
`],...xs(s))}),e}function xs({vnode:t,recurseCount:e}){const s=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,n=` at <${Te(t.component,t.type,r)}`,i=">"+s;return t.props?[n,...Is(t.props),i]:[n+i]}function Is(t){const e=[],s=Object.keys(t);return s.slice(0,3).forEach(r=>{e.push(...pe(r,t[r]))}),s.length>3&&e.push(" ..."),e}function pe(t,e,s){return R(e)?(e=JSON.stringify(e),s?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?s?e:[`${t}=${e}`]:O(e)?(e=pe(t,f(e.value),!0),s?e:[`${t}=Ref<`,e,">"]):I(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=f(e),s?e:[`${t}=`,e])}const he={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Mt(t,e,s,r){try{return r?t(...r):t()}catch(n){_e(n,e,s)}}function _e(t,e,s,r=!0){const n=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||bt;if(e){let c=e.parent;const a=e.proxy,l=process.env.NODE_ENV!=="production"?he[s]:`https://vuejs.org/error-reference/#runtime-${s}`;for(;c;){const p=c.ec;if(p){for(let u=0;u<p.length;u++)if(p[u](t,a,l)===!1)return}c=c.parent}if(i){xt(),Mt(i,null,10,[t,a,l]),It();return}}Rs(t,s,n,r,o)}function Rs(t,e,s,r=!0,n=!1){if(process.env.NODE_ENV!=="production"){const i=he[e];if(s&&ws(s),W(`Unhandled error${i?` during execution of ${i}`:""}`),s&&Ns(),r)throw t;console.error(t)}else{if(n)throw t;console.error(t)}}const v=[];let D=-1;const U=[];let $=null,z=0;const Ts=Promise.resolve();let Ht=null;const Vs=100;function Ds(t){let e=D+1,s=v.length;for(;e<s;){const r=e+s>>>1,n=v[r],i=st(n);i<t||i===t&&n.flags&2?e=r+1:s=r}return e}function As(t){if(!(t.flags&1)){const e=st(t),s=v[v.length-1];!s||!(t.flags&2)&&e>=st(s)?v.push(t):v.splice(Ds(e),0,t),t.flags|=1,ge()}}function ge(){Ht||(Ht=Ts.then(me))}function js(t){S(t)?U.push(...t):$&&t.id===-1?$.splice(z+1,0,t):t.flags&1||(U.push(t),t.flags|=1),ge()}function $s(t){if(U.length){const e=[...new Set(U)].sort((s,r)=>st(s)-st(r));if(U.length=0,$){$.push(...e);return}for($=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),z=0;z<$.length;z++){const s=$[z];process.env.NODE_ENV!=="production"&&Se(t,s)||(s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2)}$=null,z=0}}const st=t=>t.id==null?t.flags&2?-1:1/0:t.id;function me(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?s=>Se(t,s):zt;try{for(D=0;D<v.length;D++){const s=v[D];if(s&&!(s.flags&8)){if(process.env.NODE_ENV!=="production"&&e(s))continue;s.flags&4&&(s.flags&=-2),Mt(s,s.i,s.i?15:14),s.flags&4||(s.flags&=-2)}}}finally{for(;D<v.length;D++){const s=v[D];s&&(s.flags&=-2)}D=-1,v.length=0,$s(t),Ht=null,(v.length||U.length)&&me(t)}}function Se(t,e){const s=t.get(e)||0;if(s>Vs){const r=e.i,n=r&&Re(r.type);return _e(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return t.set(e,s+1),!1}const Ft=new Map;process.env.NODE_ENV!=="production"&&(ct().__VUE_HMR_RUNTIME__={createRecord:Kt(Cs),rerender:Kt(Ms),reload:Kt(Hs)});const dt=new Map;function Cs(t,e){return dt.has(t)?!1:(dt.set(t,{initialDef:pt(e),instances:new Set}),!0)}function pt(t){return Ve(t)?t.__vccOpts:t}function Ms(t,e){const s=dt.get(t);s&&(s.initialDef.render=e,[...s.instances].forEach(r=>{e&&(r.render=e,pt(r.type).render=e),r.renderCache=[],r.update()}))}function Hs(t,e){const s=dt.get(t);if(!s)return;e=pt(e),ye(s.initialDef,e);const r=[...s.instances];for(let n=0;n<r.length;n++){const i=r[n],o=pt(i.type);let c=Ft.get(o);c||(o!==s.initialDef&&ye(o,e),Ft.set(o,c=new Set)),c.add(i),i.appContext.propsCache.delete(i.type),i.appContext.emitsCache.delete(i.type),i.appContext.optionsCache.delete(i.type),i.ceReload?(c.add(i),i.ceReload(e.styles),c.delete(i)):i.parent?As(()=>{i.parent.update(),c.delete(i)}):i.appContext.reload?i.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),i.root.ce&&i!==i.root&&i.root.ce._removeChildStyle(o)}js(()=>{Ft.clear()})}function ye(t,e){H(t,e);for(const s in t)s!=="__file"&&!(s in e)&&delete t[s]}function Kt(t){return(e,s)=>{try{return t(e,s)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let Y,ht=[];function be(t,e){var s,r;Y=t,Y?(Y.enabled=!0,ht.forEach(({event:n,args:i})=>Y.emit(n,...i)),ht=[]):typeof window<"u"&&window.HTMLElement&&!((r=(s=window.navigator)==null?void 0:s.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{be(i,e)}),setTimeout(()=>{Y||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ht=[])},3e3)):ht=[]}let rt=null,Fs=null;const Ks=t=>t.__isTeleport;function Ee(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Ee(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}ct().requestIdleCallback,ct().cancelIdleCallback;const Ls=Symbol.for("v-ndc"),qs={};process.env.NODE_ENV!=="production"&&(qs.ownKeys=t=>(W("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(t)));const Bs={},ve=t=>Object.getPrototypeOf(t)===Bs,Ws=t=>t.__isSuspense,we=Symbol.for("v-fgt"),Us=Symbol.for("v-txt"),zs=Symbol.for("v-cmt");function Ys(t){return t?t.__v_isVNode===!0:!1}const Js=(...t)=>Oe(...t),Ne=({key:t})=>t??null,_t=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?R(t)||O(t)||I(t)?{i:rt,r:t,k:e,f:!!s}:t:null);function Gs(t,e=null,s=null,r=0,n=null,i=t===we?0:1,o=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Ne(e),ref:e&&_t(e),scopeId:Fs,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:rt};return c?(Lt(a,s),i&128&&t.normalize(a)):s&&(a.shapeFlag|=R(s)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&W("VNode created with invalid key (NaN). VNode type:",a.type),a}const Qs=process.env.NODE_ENV!=="production"?Js:Oe;function Oe(t,e=null,s=null,r=0,n=null,i=!1){if((!t||t===Ls)&&(process.env.NODE_ENV!=="production"&&!t&&W(`Invalid vnode type when creating vnode: ${t}.`),t=zs),Ys(t)){const c=gt(t,e,!0);return s&&Lt(c,s),c.patchFlag=-2,c}if(Ve(t)&&(t=t.__vccOpts),e){e=Xs(e);let{class:c,style:a}=e;c&&!R(c)&&(e.class=Nt(c)),E(a)&&(ft(a)&&!S(a)&&(a=H({},a)),e.style=wt(a))}const o=R(t)?1:Ws(t)?128:Ks(t)?64:E(t)?4:I(t)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&ft(t)&&(t=f(t),W("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
Component that was made reactive: `,t)),Gs(t,e,s,r,n,o,i,!0)}function Xs(t){return t?ft(t)||ve(t)?H({},t):t:null}function gt(t,e,s=!1,r=!1){const{props:n,ref:i,patchFlag:o,children:c,transition:a}=t,l=e?ks(n||{},e):n,p={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Ne(l),ref:e&&e.ref?s&&i?S(i)?i.concat(_t(e)):[i,_t(e)]:_t(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&S(c)?c.map(Pe):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==we?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&>(t.ssContent),ssFallback:t.ssFallback&>(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&r&&Ee(p,a.clone(p)),p}function Pe(t){const e=gt(t);return S(t.children)&&(e.children=t.children.map(Pe)),e}function Zs(t=" ",e=0){return Qs(Us,null,t,e)}function Lt(t,e){let s=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(S(e))s=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),Lt(t,n()),n._c&&(n._d=!0));return}else s=32,!e._&&!ve(e)&&(e._ctx=rt);else I(e)?(e={default:e,_ctx:rt},s=32):(e=String(e),r&64?(s=16,e=[Zs(e)]):s=8);t.children=e,t.shapeFlag|=s}function ks(...t){const e={};for(let s=0;s<t.length;s++){const r=t[s];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=Nt([e.class,r.class]));else if(n==="style")e.style=wt([e.style,r.style]);else if(Fe(n)){const i=e[n],o=r[n];o&&i!==o&&!(S(i)&&i.includes(o))&&(e[n]=i?[].concat(i,o):o)}else n!==""&&(e[n]=r[n])}return e}let xe=null;const tr=()=>xe||rt;{const t=ct(),e=(s,r)=>{let n;return(n=t[s])||(n=t[s]=[]),n.push(r),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};e("__VUE_INSTANCE_SETTERS__",s=>xe=s),e("__VUE_SSR_SETTERS__",s=>Ie=s)}let Ie=!1;process.env.NODE_ENV;const er=/(?:^|[-_])(\w)/g,sr=t=>t.replace(er,e=>e.toUpperCase()).replace(/[-_]/g,"");function Re(t,e=!0){return I(t)?t.displayName||t.name:t.name||e&&t.__name}function Te(t,e,s=!1){let r=Re(e);if(!r&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&t&&t.parent){const n=i=>{for(const o in i)if(i[o]===e)return o};r=n(t.components||t.parent.type.components)||n(t.appContext.components)}return r?sr(r):s?"App":"Anonymous"}function Ve(t){return I(t)&&"__vccOpts"in t}const rr=(t,e)=>{const s=vs(t,e,Ie);if(process.env.NODE_ENV!=="production"){const r=tr();r&&r.appContext.config.warnRecursiveComputed&&(s._warnRecursive=!0)}return s};function nr(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},s={style:"color:#f5222d"},r={style:"color:#eb2f96"},n={__vue_custom_formatter:!0,header(u){return E(u)?u.__isVue?["div",t,"VueInstance"]:O(u)?["div",{},["span",t,p(u)],"<",c("_value"in u?u._value:u),">"]:fe(u)?["div",{},["span",t,N(u)?"ShallowReactive":"Reactive"],"<",c(u),`>${V(u)?" (readonly)":""}`]:V(u)?["div",{},["span",t,N(u)?"ShallowReadonly":"Readonly"],"<",c(u),">"]:null:null},hasBody(u){return u&&u.__isVue},body(u){if(u&&u.__isVue)return["div",{},...i(u.$)]}};function i(u){const d=[];u.type.props&&u.props&&d.push(o("props",f(u.props))),u.setupState!==bt&&d.push(o("setup",u.setupState)),u.data!==bt&&d.push(o("data",f(u.data)));const w=a(u,"computed");w&&d.push(o("computed",w));const x=a(u,"inject");return x&&d.push(o("injected",x)),d.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:u}]]),d}function o(u,d){return d=H({},d),Object.keys(d).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},u],["div",{style:"padding-left:1.25em"},...Object.keys(d).map(w=>["div",{},["span",r,w+": "],c(d[w],!1)])]]:["span",{}]}function c(u,d=!0){return typeof u=="number"?["span",e,u]:typeof u=="string"?["span",s,JSON.stringify(u)]:typeof u=="boolean"?["span",r,u]:E(u)?["object",{object:d?f(u):u}]:["span",s,String(u)]}function a(u,d){const w=u.type;if(I(w))return;const x={};for(const ot in u.ctx)l(w,ot,d)&&(x[ot]=u.ctx[ot]);return x}function l(u,d,w){const x=u[w];if(S(x)&&x.includes(d)||E(x)&&d in x||u.extends&&l(u.extends,d,w)||u.mixins&&u.mixins.some(ot=>l(ot,d,w)))return!0}function p(u){return N(u)?"ShallowRef":u.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(n):window.devtoolsFormatters=[n]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;/**
* vue v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function ir(){nr()}process.env.NODE_ENV!=="production"&&ir();class De{constructor(e,s=!1){h(this,"_debug",!1);h(this,"_store");h(this,"_watchedStore");this._debug=s,this._store=e}get debug(){return this._debug}set debug(e){this._debug=e}get parentsStores(){return typeof this.store.parentsStores=="function"&&this.store.parentsStores()}get state(){return this._store.$state}set state(e){this._store.$state=e}get store(){return this._store}addPropertiesToState(e,s){e.forEach(r=>this.addToState(r,s?s[r]:void 0))}addToState(e,s){this.isOptionApi()||s!=null&&s.value||(s=P(s)),this.state[e]=s,this.store[e]=de(this.state,e)}debugLog(e,s){this._debug&&St(e,s)}getStatePropertyValue(e){return this.getValue(this.state[e])}getStoreName(){return this.store.hasOwnProperty("getStoreName")?this.store.getStoreName():this.store.$id}getValue(e){return e!=null&&e.__v_isRef?e.value:e}isOptionApi(){return this.store._isOptionsAPI}stateHas(e){return this.state.hasOwnProperty(e)}storeHas(e){return this.store.hasOwnProperty(e)}}class or extends De{constructor(s,r=!1){super(s,r);h(this,"_extendedActions",["removePersistedState","watch","$reset"]);this.extendsStore()}get extendedActions(){return[...this._extendedActions,...this.getStatePropertyValue("actionsToExtends")??[]]}addToCustomProperties(s){}createComputed(s,r){const n=typeof s[r]=="object";return rr({get:()=>this.getValue(s[r]),set:i=>{var o;n&&((o=s[r])!=null&&o.value)?s[r].value=i:s[r]=i}})}duplicateStore(s){const r=["$","_"];Object.keys(s).forEach(n=>{if(r.includes(n[0])&&n!=="$reset")return;const i=typeof s[n];i==="function"?this.storeHas(n)?this.extendedActions.includes(n)&&this.extendsAction(s,n):(this.store[n]=s[n],this.addToCustomProperties(n)):!this.storeHas(n)&&(i==="undefined"||i==="object")&&(this.store[n]=this.createComputed(s,n),this.addToCustomProperties(n))})}extendsAction(s,r){const n=this.store[r];this.isOptionApi()?this.store[r]=function(...i){s[r].apply(this,i),n.apply(this,i)}:this.store[r]=(...i)=>{s[r](...i),n(...i)}}extendsState(s){Object.keys(s.$state).forEach(r=>{this.stateHas(r)||(this.store[r]=this.state[r]=de(s.$state,r),this.addToCustomProperties(r))})}extendsStore(){if(this.storeHas("parentsStores")){const s=this.parentsStores;if(!s||!s.length)return;s.forEach(r=>{r!=null&&r.$state&&(this.duplicateStore(r),this.extendsState(r))}),this.addToState("isExtended",!0)}}}function nt(t){return t?Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:typeof t=="string"?t.trim()==="":!1:!(typeof t=="boolean"||typeof t=="number")}const it=(t,e,s)=>{const r=Object.keys(t),n=e&&Object.keys(e);return!e||!n||!s&&r.length!==n.length||s&&r.filter(i=>!s.includes(i)).length!==n.filter(i=>!s.includes(i)).length?!1:Object.keys(t).reduce((i,o)=>{var c;return i&&(!s||!s.includes(o))&&(!t[o]||!e[o]?i=t[o]===e[o]:Array.isArray(t[o])?(i=t[o].length===((c=e[o])==null?void 0:c.length),i&&t[o].forEach((a,l)=>{if(!i)return i;typeof a=="object"?i=!nt(e[o][l])&&it(a,e[o][l],s):a!==e[o][l]&&(i=!1)})):typeof t[o]=="object"?i=it(t[o],e[o],s):i=t[o]===e[o]),i},!0)};class cr extends De{constructor(s,r,n,i,o=!1){if(!(r instanceof yt))throw new Error("StorePersister must be instanciated with a Persister");super(s,o);h(this,"_crypt");h(this,"_persister");h(this,"_statePropertiesNotToPersist",["@context","activeLink","computed","dep","excludedKeys","fn","isEncrypted","isLoading","persist","persistedPropertiesToEncrypt","subs","version","watchMutation"]);this._persister=r,this._watchedStore=n??[],i&&(this._crypt=i),this.hasPersistProperty()&&(this.augmentStore(),this.remember(),this.toBeWatched()&&this.storeSubscription())}augmentStore(){this.stateHas("isEncrypted")||this.addToState("isEncrypted",!1),this.stateHas("persist")||this.addToState("persist",!1),this.stateHas("persistedPropertiesToEncrypt")||this.addToState("persistedPropertiesToEncrypt",[]),this.stateHas("watchMutation")||this.addToState("watchMutation",!1),this.store.persistState=()=>this.persist(),this.store.remember=async()=>this.remember(),this.store.removePersistedState=()=>this._persister.removeItem(this.getStoreName()),this.store.watch=()=>{this.toBeWatched()&&(this.addToState("watchMutation",!0),this.storeSubscription())},this.store.stopWatch=()=>this.stopWatch()}cryptState(s,r=!1){const n=this._crypt,i=this.getValue(s.persistedPropertiesToEncrypt),o=this.getValue(s.isEncrypted);if(this.debugLog(`cryptState - ${this.getStoreName()} ${r?"decrypt":"crypt"}`,["can",Array.isArray(i)&&i.length>0&&o===r&&!!n,[Array.isArray(i)&&i.length>0,n],s]),Array.isArray(i)&&i.length>0&&n){const c={};i.forEach(a=>{if(!nt(s[a])){const l=this.getValue(s[a]);c[a]=r?n.decrypt(l):n.encrypt(l)}}),nt(c)||(s={...s,...c,isEncrypted:!r})}return s}async getPersistedState(){const s=this.getStoreName();try{let r=await this._persister.getItem(s);return this.toBeCrypted()&&r&&(r=this.cryptState({...f(this.state),...r},!0)),this.debugLog(`getPersistedState ${s}`,[r,this.state]),r}catch(r){M("getPersistedState Error",[s,r])}}getStatePropertyToNotPersist(){return[...this._statePropertiesNotToPersist,...this.getStatePropertyValue("excludedKeys")??[]]}hasPersistProperty(){return this.state.hasOwnProperty("persist")}async persist(){let s=await this.getPersistedState(),r=this.state;this.toBeCrypted()&&(r=this.cryptState(r));const n=this.populateState(r,s);this.debugLog(`persistStore persist ${this.getStoreName()}`,["toBeCrypted",this.toBeCrypted(),"areIdentical",it(n,s??{},this.getStatePropertyToNotPersist()),"newState",n,"persistedState",s,"state",r,"store",this.store,"Crypt",this._crypt]),!(nt(n)||this.stateIsEmpty(n))&&(!s||!it(n,s,this.getStatePropertyToNotPersist()))&&this._persister.setItem(this.getStoreName(),n)}populateState(s,r){const n=this.getStatePropertyToNotPersist(),i=["_","$"];return Object.keys(s).reduce((o,c)=>{if(!i.includes(c[0])&&!n.includes(c)){const a=this.getValue(s[c]),l=r&&this.getValue(r[c]);nt(a)&&l?o[c]=l:Array.isArray(a)?o[c]=a.map(p=>typeof p=="object"?this.populateState(p):f(p)):typeof a=="object"?o[c]=this.populateState(a,l):o[c]=f(a??l)}return o},{})}propertyShouldBePersisted(s){return!this.getStatePropertyToNotPersist().includes(s)}async remember(){return new Promise(async s=>{let r=await this.getPersistedState();return r&&!this.stateIsEmpty(r)&&this.store.$patch(r),s(!0)})}shouldBePersisted(){return this.hasPersistProperty()&&this.getStatePropertyValue("persist")}stateIsEmpty(s){var r,n;return((r=this.store)==null?void 0:r.stateIsEmpty)&&((n=this.store)==null?void 0:n.stateIsEmpty(s))}stopWatch(){this.getStatePropertyValue("watchMutation")&&this.addToState("watchMutation",!1)}storeSubscription(){this.toBeWatched()&&(this._watchedStore.push(this.getStoreName()),this.store.$subscribe((s,r)=>{if(s.type!=="patch object"&&(s!=null&&s.events)&&this.getStatePropertyValue("watchMutation")){const{newValue:n,oldValue:i}=s.events;if(!n||typeof n=="function"||n==="excludedKeys")return;this.persist(),(typeof n=="object"?!it(n,i):n!==i)&&typeof this.store.mutationCallback=="function"&&this.store.mutationCallback(s)}}))}toBeCrypted(){return!!(this._crypt&&this.state.hasOwnProperty("persistedPropertiesToEncrypt"))}toBeWatched(){return this.shouldBePersisted()&&!this._watchedStore.includes(this.getStoreName())}}class qt{constructor(e,s,r=!1){h(this,"_db");h(this,"_debug",!1);h(this,"_crypt");h(this,"_watchedStore",[]);this._db=e,this._debug=r,s&&(this._crypt=s)}get db(){return this._db}get crypt(){return this._crypt}plugin(e){try{const{store:s}=e;new or(s,this._debug),new cr(s,this._db,this._watchedStore,this._crypt,this._debug),this.rewriteResetStore(e,Object.assign({},s.$state))}catch(s){M("plugin()",[s,e])}}rewriteResetStore({store:e},s){e.$reset=()=>{e.$state.persist&&e.removePersistedState();const r=typeof e.parentsStores=="function"&&e.parentsStores();Array.isArray(r)&&r.length&&r.forEach(n=>n.$reset()),e.$patch(Object.assign({},s))}}}function ar(t,e,s,r=!1){if(window){const n=new yt({name:t,keyPath:"storeName"});let i;e&&s&&(i=new Bt(s,e));const o=new qt(n,i,r);return o.plugin.bind(o)}return()=>({})}let J={};const ur={clear:()=>J={},getItem:async t=>new Promise(e=>e(J[t])),removeItem:t=>delete J[t],removeItems:t=>t?t.forEach(e=>delete J[e]):J={},setItem:(t,e)=>{J[e]=t}};class lr extends yt{defineDb(){return ur}}function fr(t,e,s){let r;e&&s&&(r=new Bt(s,e));const n=new qt(new lr({name:t}),r);return n.plugin.bind(n)}const dr=(t=!0,e,s,r=!1)=>({excludedKeys:s,isEncrypted:r,persist:t,persistedPropertiesToEncrypt:e});function pr(t,e){return C.defineStore(t,e)}function hr(t,e){return`${t}-${e}`}const _r={actionsToExtends:[],isOptionApi:!1},mt=["actionsToExtends","isExtended","isOptionApi","parentsStores"],Ae={excludedKeys:mt,isEncrypted:!1,persist:!0,persistedPropertiesToEncrypt:[],watchMutation:!1},gr={excludedKeys:P(mt),isEncrypted:P(!1),persist:P(!0),persistedPropertiesToEncrypt:P([]),watchMutation:P(!1)},mr=(t,e)=>{var c;let{actionsToExtends:s,isExtended:r,isOptionApi:n,persist:i}={..._r,...e};const o=()=>t;if(i)if(n)Array.isArray(i.excludedKeys)&&(i.excludedKeys=[...mt,...i.excludedKeys]),i={...Ae,...i};else{if(i.excludedKeys&&typeof i.excludedKeys=="object"){const l=Array.isArray(i.excludedKeys)?[]:(c=i.excludedKeys)==null?void 0:c.value;i.excludedKeys=P([...mt,...l])}i={...n?Ae:gr,...i}}return n?{...i,actionsToExtends:s,isExtended:r,isOptionApi:n,parentsStores:o}:{...i,actionsToExtends:P(s),isExtended:P(r),isOptionApi:P(n),parentsStores:o}};function je(t,e){let s;return typeof t=="string"?s=Sr(t,e):typeof t=="number"&&(s=yr(t,e)),s}function Sr(t,e){return e.find(s=>s.$id===t)}function yr(t,e){return e[t]}function br(t,e,s){if(s&&((typeof e=="string"||typeof e=="number")&&(e=s&&je(e,s)),typeof e=="object"))return e[t]}function Er(t,e,s){if(s&&((typeof e=="string"||typeof e=="number")&&(e=s&&je(e,s)),typeof e=="object")){const r=e[t];if(typeof r=="function")return r}return()=>{}}function vr(t,e,s=!0){return t.filter(r=>Object.keys(e).every(n=>{let i=r[n];typeof i==="string"&&(i=i.toLowerCase());const c=typeof e[n]=="string"?e[n].toLowerCase():e[n];return s?i==c:i.indexOf(c)>=0}))}function wr(t,e){return t.find(s=>Object.keys(e).every(r=>s[r]===e[r]))}function $e(t){return t.id?{id:t.id}:{"@id":t["@id"]}}const Nr=t=>C.defineStore(t,{state:()=>({items:[]}),actions:{addItem(e){let s;if((e.id||e["@id"])&&(s=this.getItem($e(e)),s)){this.updateItem(e,s);return}this.items.push(e)},getItem(e){return wr(this.items,e)},getItems(e){return e?vr(this.items,e):this.items},removeItem(e){this.items=this.items.filter(s=>s.id!==e.id)},setItems(e){Array.isArray(e)&&(this.items=e)},stateIsEmpty(e){var s;return e?!((s=e==null?void 0:e.items)!=null&&s.length):!this.items.length},updateItem(e,s){s||(s=this.getItem($e(e))),s&&Object.assign(s,e)}}})();_.Epps=qt,_.createPlugin=ar,_.createPluginMock=fr,_.defineEppsStore=pr,_.defineStoreId=hr,_.extendedState=mr,_.getParentStoreMethod=Er,_.getParentStorePropertyValue=br,_.persistedState=dr,_.useCollectionStore=Nr,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});