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.
21 lines • 51.7 kB
JavaScript
(function(_,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],m):(_=typeof globalThis<"u"?globalThis:_||self,m(_.Epps={},_.Pinia))})(this,function(_,m){"use strict";var Vr=Object.defineProperty;var Ar=(_,m,V)=>m in _?Vr(_,m,{enumerable:!0,configurable:!0,writable:!0,value:V}):_[m]=V;var l=(_,m,V)=>Ar(_,typeof m!="symbol"?m+"":m,V);class V{constructor(t,s){l(this,"_storeConstructor");l(this,"_id");this._storeConstructor=s,this._id=t}get id(){return this._id}build(t){return t=t?`${t.substring(0,1)}${t.substring(1)}`:"",this._storeConstructor(`${this._id}${t}`)}}const G=class G{constructor(t){l(this,"_encoder",new TextEncoder);l(this,"_key");l(this,"_materialKey");this._key=t}async getKey(t){return await crypto.subtle.deriveKey({name:"PBKDF2",salt:this._encoder.encode("salt"),iterations:1e5,hash:"SHA-256"},this._materialKey,{name:"AES-GCM",length:256},!1,[t])}async setKeyMaterial(t){this._materialKey=await crypto.subtle.importKey("raw",this._encoder.encode(t),{name:"PBKDF2"},!1,["deriveKey"])}async decrypt(t){const[s,r]=t.split(":"),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:Uint8Array.from(atob(s),i=>i.charCodeAt(0))},await this.getKey(G.DECRYPT),Uint8Array.from(atob(r),i=>i.charCodeAt(0)));return new TextDecoder().decode(n)}async encrypt(t){const s=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},await this.getKey(G.ENCRYPT),this._encoder.encode(t));return btoa(String.fromCharCode(...new Uint8Array(s)))+":"+btoa(String.fromCharCode(...new Uint8Array(r)))}async init(){this._materialKey||await this.setKeyMaterial(this._key)}};l(G,"DECRYPT","decrypt"),l(G,"ENCRYPT","encrypt");let ot=G;const He="Epps!",Jt=(e,t="white")=>`background-color: ${e}; color: ${t}; padding: 1px; margin-right: 5px; font-size: 12px`;function We(e,t,s){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e,s)}function vt(e,t,s){const r=s?Jt(s.bgColor,s.color):Jt("#ffec73","green");e=` [${(s==null?void 0:s.icon)??"🍍⚡"} ${He} plugin] - ${e} `,We(e,r,t)}function $(e,t){vt(e,t,{bgColor:"#d24545",color:"white",icon:"🍍⚠️"})}class Be{constructor(t){l(this,"_storage");this._storage=t==="localStorage"?localStorage:sessionStorage}clear(){this._storage.clear()}async getItem(t){return new Promise((s,r)=>{const n=this._storage.getItem(t.toString());s(n?JSON.parse(n):void 0)})}removeItem(t){this._storage.removeItem(t.toString())}removeItems(t){for(let s=0;s<this._storage.length;s++){const r=this._storage.key(s);r&&(!t||!t.includes(r))&&this._storage.removeItem(r)}}setItem(t,s){this._storage.setItem(s,JSON.stringify(t))}}let Yt=class{constructor(t,s,r){l(this,"_db");l(this,"_localStorageVersionKey","IDBVersion");l(this,"_name","persistStore");l(this,"_objectStore");l(this,"_objectStoreOptions");l(this,"_objectStoreName");l(this,"_transactionMode","readwrite");l(this,"_version");this._objectStoreName=t,this._version=this.getStoredVersionNumber(),s&&(this._objectStoreOptions=s),r&&(this._transactionMode=r)}clear(){const t=()=>{if(this._objectStore){const s=this._objectStore.clear();this.requestEventsHandler(s,{error:()=>this.onError(s.error)})}};this.open({success:t})}createObjectStore(){this._db&&!this._db.objectStoreNames.contains(this._objectStoreName)&&this._db.createObjectStore(this._objectStoreName,this._objectStoreOptions)}deleteObjectStore(){const t=()=>{var s;(s=this._db)==null||s.deleteObjectStore(this._objectStoreName)};this.open({success:t})}async getItem(t){return new Promise(s=>{const r=()=>{if(this._objectStore){const n=this._objectStore.get(t);this.requestEventsHandler(n,{error:()=>this.onError(n.error,()=>s(void 0)),success:()=>s(n.result)})}};this.open({success:r})})}async getObjectStoreItem(t,s){return new Promise(r=>{const n=()=>{if(this._objectStore){const o=this._objectStore.index(t).get(s);this.requestEventsHandler(o,{error:()=>r(void 0),success:()=>r(o.result)})}};this.open({success:n})})}getStoredVersionNumber(){if(!localStorage)return 1;const t=localStorage.getItem(this._localStorageVersionKey);return t?parseInt(t):1}handleDeleteRequest(t,s){t.onerror=()=>$(`IndexedDB - Item "${s}" remove`,t.error)}onError(t,s){s&&s(t)}open(t){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){$("indexedDB - transaction error",[c])}};if(t!=null&&t.success){const o=t.success;t.success=()=>n(o)}if(t!=null&&t.upgrade){const o=t.upgrade.bind(this);t.upgrade=()=>{r(),o()}}const i=()=>{const o=c=>{if((c==null?void 0:c.name)==="VersionError"){this._version++,this.saveVersion(),this.open(t);return}t!=null&&t.error&&t.error(c)};this.onError(s.error,o)};return t&&this.openRequestEventsHandler(s,{...t,error:i}),s}openRequestEventsHandler(t,s){this.requestEventsHandler(t,s),s.upgrade&&(t.onupgradeneeded=s.upgrade)}removeItem(t){const s=()=>{if(this._objectStore){const r=this._objectStore.delete(t);this.handleDeleteRequest(r,t)}};this.open({success:s})}removeItems(t){const s=()=>{if(this._objectStore){const r=this._objectStore.getAllKeys(),n=()=>{r.result.forEach(c=>{if(this._objectStore&&(!t||!t.includes(c))){const u=this._objectStore.delete(c);this.handleDeleteRequest(u,c)}})},i=()=>$("IndexedDB - removeItems",[r.error]);this.requestEventsHandler(r,{error:i,success:n})}};this.open({success:s})}requestEventsHandler(t,s){const{error:r,success:n}=s;r&&(t.onerror=r),n&&(t.onsuccess=n)}saveVersion(){localStorage&&localStorage.setItem(this._localStorageVersionKey,this._version.toString())}setItem(t,s){const r=()=>{if(this._objectStore){const i=this._objectStore.add(t);if(s){const o=()=>{s.forEach(u=>{var f;(f=this._objectStore)==null||f.createIndex(u,u,{unique:!0}),vt(`"${u}" index created`)})},c=()=>this.onError(i.error);this.requestEventsHandler(i,{error:c,success:o})}}},n=this.createObjectStore;this.open({success:r,upgrade:n})}updateItem(t){const s=()=>{if(this._objectStore){const r=this._objectStore.put(t);r.onerror=()=>$("update item",[r.error,t])}};this.open({success:s})}};class ct{constructor(t){l(this,"_db");l(this,"_db_options");if(!t)throw new Error("DbOptions is required");this._db_options=t,this._db=this.defineDb()}get dbName(){return this._db_options.name}defineDb(){const{keyPath:t,name:s}=this._db_options;return s==="localStorage"||s==="sessionStorage"?new Be(s):new Yt(s,{keyPath:t})}getItem(t){return new Promise((s,r)=>{try{return this._db.getItem(t).then(n=>s(n))}catch(n){r(n)}})}removeItem(t){this._db.removeItem(t)}setItem(t,s){if(this._db instanceof Yt)try{this._db.getItem(t).then(r=>{r?this._db.updateItem(r):this._db.setItem({storeName:t,...s})})}catch(r){$("Persister - setItem Error",r),this._db.setItem({storename:t,...s})}else this._db.setItem(s,t)}}/**
* @vue/shared v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**//*! #__NO_SIDE_EFFECTS__ */function qe(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const Nt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Gt=()=>{},Ue=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),F=Object.assign,ze=Object.prototype.hasOwnProperty,Ot=(e,t)=>ze.call(e,t),S=Array.isArray,Q=e=>Qt(e)==="[object Map]",T=e=>typeof e=="function",I=e=>typeof e=="string",X=e=>typeof e=="symbol",E=e=>e!==null&&typeof e=="object",Je=Object.prototype.toString,Qt=e=>Je.call(e),Xt=e=>Qt(e).slice(8,-1),Rt=e=>I(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ye=(e=>{const t=Object.create(null);return s=>t[s]||(t[s]=e(s))})(e=>e.charAt(0).toUpperCase()+e.slice(1)),H=(e,t)=>!Object.is(e,t);let Zt;const at=()=>Zt||(Zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Tt(e){if(S(e)){const t={};for(let s=0;s<e.length;s++){const r=e[s],n=I(r)?Ze(r):Tt(r);if(n)for(const i in n)t[i]=n[i]}return t}else if(I(e)||E(e))return e}const Ge=/;(?![^(]*\))/g,Qe=/:([^]+)/,Xe=/\/\*[^]*?\*\//g;function Ze(e){const t={};return e.replace(Xe,"").split(Ge).forEach(s=>{if(s){const r=s.split(Qe);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function It(e){let t="";if(I(e))t=e;else if(S(e))for(let s=0;s<e.length;s++){const r=It(e[s]);r&&(t+=r+" ")}else if(E(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}/**
* @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function W(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let g,kt=0,Z,k;function ke(e,t=!1){if(e.flags|=8,t){e.next=k,k=e;return}e.next=Z,Z=e}function Dt(){kt++}function Pt(){if(--kt>0)return;if(k){let t=k;for(k=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Z;){let t=Z;for(Z=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=s}}if(e)throw e}function ts(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function es(e){let t,s=e.depsTail,r=s;for(;r;){const n=r.prevDep;r.version===-1?(r===s&&(s=n),ee(r),rs(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}e.deps=t,e.depsTail=s}function ss(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(te(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function te(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===tt)||(e.globalVersion=tt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ss(e))))return;e.flags|=2;const t=e.dep,s=g,r=A;g=e,A=!0;try{ts(e);const n=e.fn(e._value);(t.version===0||H(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(n){throw t.version++,n}finally{g=s,A=r,es(e),e.flags&=-3}}function ee(e,t=!1){const{dep:s,prevSub:r,nextSub:n}=e;if(r&&(r.nextSub=n,e.prevSub=void 0),n&&(n.prevSub=r,e.nextSub=void 0),process.env.NODE_ENV!=="production"&&s.subsHead===e&&(s.subsHead=n),s.subs===e&&(s.subs=r,!r&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)ee(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function rs(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let A=!0;const se=[];function ut(){se.push(A),A=!1}function lt(){const e=se.pop();A=e===void 0?!0:e}let tt=0;class ns{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xt{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(t){if(!g||!A||g===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==g)s=this.activeLink=new ns(g,this),g.deps?(s.prevDep=g.depsTail,g.depsTail.nextDep=s,g.depsTail=s):g.deps=g.depsTail=s,re(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(F({effect:g},t)),s}trigger(t){this.version++,tt++,this.notify(t)}notify(t){Dt();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(F({effect:s.sub},t));for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{Pt()}}}function re(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)re(r)}const s=e.dep.subs;s!==e&&(e.prevSub=s,s&&(s.nextSub=e)),process.env.NODE_ENV!=="production"&&e.dep.subsHead===void 0&&(e.dep.subsHead=e),e.dep.subs=e}}const ft=new WeakMap,M=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Vt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),et=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function y(e,t,s){if(A&&g){let r=ft.get(e);r||ft.set(e,r=new Map);let n=r.get(s);n||(r.set(s,n=new xt),n.map=r,n.key=s),process.env.NODE_ENV!=="production"?n.track({target:e,type:t,key:s}):n.track()}}function j(e,t,s,r,n,i){const o=ft.get(e);if(!o){tt++;return}const c=u=>{u&&(process.env.NODE_ENV!=="production"?u.trigger({target:e,type:t,key:s,newValue:r,oldValue:n,oldTarget:i}):u.trigger())};if(Dt(),t==="clear")o.forEach(c);else{const u=S(e),f=u&&Rt(s);if(u&&s==="length"){const d=Number(r);o.forEach((a,p)=>{(p==="length"||p===et||!X(p)&&p>=d)&&c(a)})}else switch((s!==void 0||o.has(void 0))&&c(o.get(s)),f&&c(o.get(et)),t){case"add":u?f&&c(o.get("length")):(c(o.get(M)),Q(e)&&c(o.get(Vt)));break;case"delete":u||(c(o.get(M)),Q(e)&&c(o.get(Vt)));break;case"set":Q(e)&&c(o.get(M));break}}Pt()}function is(e,t){const s=ft.get(e);return s&&s.get(t)}function B(e){const t=h(e);return t===e?t:(y(t,"iterate",et),N(e)?t:t.map(b))}function At(e){return y(e=h(e),"iterate",et),e}const os={__proto__:null,[Symbol.iterator](){return jt(this,Symbol.iterator,b)},concat(...e){return B(this).concat(...e.map(t=>S(t)?B(t):t))},entries(){return jt(this,"entries",e=>(e[1]=b(e[1]),e))},every(e,t){return D(this,"every",e,t,void 0,arguments)},filter(e,t){return D(this,"filter",e,t,s=>s.map(b),arguments)},find(e,t){return D(this,"find",e,t,b,arguments)},findIndex(e,t){return D(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return D(this,"findLast",e,t,b,arguments)},findLastIndex(e,t){return D(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return D(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ct(this,"includes",e)},indexOf(...e){return Ct(this,"indexOf",e)},join(e){return B(this).join(e)},lastIndexOf(...e){return Ct(this,"lastIndexOf",e)},map(e,t){return D(this,"map",e,t,void 0,arguments)},pop(){return st(this,"pop")},push(...e){return st(this,"push",e)},reduce(e,...t){return ne(this,"reduce",e,t)},reduceRight(e,...t){return ne(this,"reduceRight",e,t)},shift(){return st(this,"shift")},some(e,t){return D(this,"some",e,t,void 0,arguments)},splice(...e){return st(this,"splice",e)},toReversed(){return B(this).toReversed()},toSorted(e){return B(this).toSorted(e)},toSpliced(...e){return B(this).toSpliced(...e)},unshift(...e){return st(this,"unshift",e)},values(){return jt(this,"values",b)}};function jt(e,t,s){const r=At(e),n=r[t]();return r!==e&&!N(e)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.value&&(i.value=s(i.value)),i}),n}const cs=Array.prototype;function D(e,t,s,r,n,i){const o=At(e),c=o!==e&&!N(e),u=o[t];if(u!==cs[t]){const a=u.apply(e,i);return c?b(a):a}let f=s;o!==e&&(c?f=function(a,p){return s.call(this,b(a),p,e)}:s.length>2&&(f=function(a,p){return s.call(this,a,p,e)}));const d=u.call(o,f,r);return c&&n?n(d):d}function ne(e,t,s,r){const n=At(e);let i=s;return n!==e&&(N(e)?s.length>3&&(i=function(o,c,u){return s.call(this,o,c,u,e)}):i=function(o,c,u){return s.call(this,o,b(c),u,e)}),n[t](i,...r)}function Ct(e,t,s){const r=h(e);y(r,"iterate",et);const n=r[t](...s);return(n===-1||n===!1)&&dt(s[0])?(s[0]=h(s[0]),r[t](...s)):n}function st(e,t,s=[]){ut(),Dt();const r=h(e)[t].apply(e,s);return Pt(),lt(),r}const as=qe("__proto__,__v_isRef,__isVue"),ie=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(X));function us(e){X(e)||(e=String(e));const t=h(this);return y(t,"has",e),t.hasOwnProperty(e)}class oe{constructor(t=!1,s=!1){this._isReadonly=t,this._isShallow=s}get(t,s,r){if(s==="__v_skip")return t.__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?bs:le:i?Ss:ue).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=S(t);if(!n){let u;if(o&&(u=os[s]))return u;if(s==="hasOwnProperty")return us}const c=Reflect.get(t,s,O(t)?t:r);return(X(s)?ie.has(s):as(s))||(n||y(t,"get",s),i)?c:O(c)?o&&Rt(s)?c:c.value:E(c)?n?he(c):fe(c):c}}class ls extends oe{constructor(t=!1){super(!1,t)}set(t,s,r,n){let i=t[s];if(!this._isShallow){const u=P(i);if(!N(r)&&!P(r)&&(i=h(i),r=h(r)),!S(t)&&O(i)&&!O(r))return u?!1:(i.value=r,!0)}const o=S(t)&&Rt(s)?Number(s)<t.length:Ot(t,s),c=Reflect.set(t,s,r,O(t)?t:n);return t===h(n)&&(o?H(r,i)&&j(t,"set",s,r,i):j(t,"add",s,r)),c}deleteProperty(t,s){const r=Ot(t,s),n=t[s],i=Reflect.deleteProperty(t,s);return i&&r&&j(t,"delete",s,void 0,n),i}has(t,s){const r=Reflect.has(t,s);return(!X(s)||!ie.has(s))&&y(t,"has",s),r}ownKeys(t){return y(t,"iterate",S(t)?"length":M),Reflect.ownKeys(t)}}class fs extends oe{constructor(t=!1){super(!0,t)}set(t,s){return process.env.NODE_ENV!=="production"&&W(`Set operation on key "${String(s)}" failed: target is readonly.`,t),!0}deleteProperty(t,s){return process.env.NODE_ENV!=="production"&&W(`Delete operation on key "${String(s)}" failed: target is readonly.`,t),!0}}const hs=new ls,ps=new fs,$t=e=>e,ht=e=>Reflect.getPrototypeOf(e);function ds(e,t,s){return function(...r){const n=this.__v_raw,i=h(n),o=Q(i),c=e==="entries"||e===Symbol.iterator&&o,u=e==="keys"&&o,f=n[e](...r),d=s?$t:t?Ft:b;return!t&&y(i,"iterate",u?Vt:M),{next(){const{value:a,done:p}=f.next();return p?{value:a,done:p}:{value:c?[d(a[0]),d(a[1])]:d(a),done:p}},[Symbol.iterator](){return this}}}}function pt(e){return function(...t){if(process.env.NODE_ENV!=="production"){const s=t[0]?`on key "${t[0]}" `:"";W(`${Ye(e)} operation ${s}failed: target is readonly.`,h(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function _s(e,t){const s={get(n){const i=this.__v_raw,o=h(i),c=h(n);e||(H(n,c)&&y(o,"get",n),y(o,"get",c));const{has:u}=ht(o),f=t?$t:e?Ft:b;if(u.call(o,n))return f(i.get(n));if(u.call(o,c))return f(i.get(c));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!e&&y(h(n),"iterate",M),Reflect.get(n,"size",n)},has(n){const i=this.__v_raw,o=h(i),c=h(n);return e||(H(n,c)&&y(o,"has",n),y(o,"has",c)),n===c?i.has(n):i.has(n)||i.has(c)},forEach(n,i){const o=this,c=o.__v_raw,u=h(c),f=t?$t:e?Ft:b;return!e&&y(u,"iterate",M),c.forEach((d,a)=>n.call(i,f(d),f(a),o))}};return F(s,e?{add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear")}:{add(n){!t&&!N(n)&&!P(n)&&(n=h(n));const i=h(this);return ht(i).has.call(i,n)||(i.add(n),j(i,"add",n,n)),this},set(n,i){!t&&!N(i)&&!P(i)&&(i=h(i));const o=h(this),{has:c,get:u}=ht(o);let f=c.call(o,n);f?process.env.NODE_ENV!=="production"&&ae(o,c,n):(n=h(n),f=c.call(o,n));const d=u.call(o,n);return o.set(n,i),f?H(i,d)&&j(o,"set",n,i,d):j(o,"add",n,i),this},delete(n){const i=h(this),{has:o,get:c}=ht(i);let u=o.call(i,n);u?process.env.NODE_ENV!=="production"&&ae(i,o,n):(n=h(n),u=o.call(i,n));const f=c?c.call(i,n):void 0,d=i.delete(n);return u&&j(i,"delete",n,void 0,f),d},clear(){const n=h(this),i=n.size!==0,o=process.env.NODE_ENV!=="production"?Q(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]=ds(n,e,t)}),s}function ce(e,t){const s=_s(e,t);return(r,n,i)=>n==="__v_isReactive"?!e:n==="__v_isReadonly"?e:n==="__v_raw"?r:Reflect.get(Ot(s,n)&&n in r?s:r,n,i)}const gs={get:ce(!1,!1)},ms={get:ce(!0,!1)};function ae(e,t,s){const r=h(s);if(r!==s&&t.call(e,r)){const n=Xt(e);W(`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 ue=new WeakMap,Ss=new WeakMap,le=new WeakMap,bs=new WeakMap;function ys(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Es(e){return e.__v_skip||!Object.isExtensible(e)?0:ys(Xt(e))}function fe(e){return P(e)?e:pe(e,!1,hs,gs,ue)}function he(e){return pe(e,!0,ps,ms,le)}function pe(e,t,s,r,n){if(!E(e))return process.env.NODE_ENV!=="production"&&W(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=Es(e);if(i===0)return e;const o=n.get(e);if(o)return o;const c=new Proxy(e,i===2?r:s);return n.set(e,c),c}function de(e){return P(e)?de(e.__v_raw):!!(e&&e.__v_isReactive)}function P(e){return!!(e&&e.__v_isReadonly)}function N(e){return!!(e&&e.__v_isShallow)}function dt(e){return e?!!e.__v_raw:!1}function h(e){const t=e&&e.__v_raw;return t?h(t):e}const b=e=>E(e)?fe(e):e,Ft=e=>E(e)?he(e):e;function O(e){return e?e.__v_isRef===!0:!1}function _t(e){return ws(e,!1)}function ws(e,t){return O(e)?e:new vs(e,t)}class vs{constructor(t,s){this.dep=new xt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?t:h(t),this._value=s?t:b(t),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(t){const s=this._rawValue,r=this.__v_isShallow||N(t)||P(t);t=r?t:h(t),H(t,s)&&(this._rawValue=t,this._value=r?t:b(t),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:t,oldValue:s}):this.dep.trigger())}}class Ns{constructor(t,s,r){this._object=t,this._key=s,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const t=this._object[this._key];return this._value=t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return is(h(this._object),this._key)}}class Os{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function _e(e,t,s){return O(e)?e:T(e)?new Os(e):E(e)&&arguments.length>1?Rs(e,t,s):_t(e)}function Rs(e,t,s){const r=e[t];return O(r)?r:new Ns(e,t,s)}class Ts{constructor(t,s,r){this.fn=t,this.setter=s,this._value=void 0,this.dep=new xt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=tt-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 ke(this,!0),!0;process.env.NODE_ENV}get value(){const t=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return te(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter?this.setter(t):process.env.NODE_ENV!=="production"&&W("Write operation failed: computed value is readonly")}}function Is(e,t,s=!1){let r,n;T(e)?r=e:(r=e.get,n=e.set);const i=new Ts(r,n,s);return process.env.NODE_ENV,i}/**
* @vue/runtime-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/const K=[];function Ds(e){K.push(e)}function Ps(){K.pop()}let Mt=!1;function q(e,...t){if(Mt)return;Mt=!0,ut();const s=K.length?K[K.length-1].component:null,r=s&&s.appContext.config.warnHandler,n=xs();if(r)Kt(r,s,11,[e+t.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 <${Ae(s,i.type)}>`).join(`
`),n]);else{const i=[`[Vue warn]: ${e}`,...t];n.length&&i.push(`
`,...Vs(n)),console.warn(...i)}lt(),Mt=!1}function xs(){let e=K[K.length-1];if(!e)return[];const t=[];for(;e;){const s=t[0];s&&s.vnode===e?s.recurseCount++:t.push({vnode:e,recurseCount:0});const r=e.component&&e.component.parent;e=r&&r.vnode}return t}function Vs(e){const t=[];return e.forEach((s,r)=>{t.push(...r===0?[]:[`
`],...As(s))}),t}function As({vnode:e,recurseCount:t}){const s=t>0?`... (${t} recursive calls)`:"",r=e.component?e.component.parent==null:!1,n=` at <${Ae(e.component,e.type,r)}`,i=">"+s;return e.props?[n,...js(e.props),i]:[n+i]}function js(e){const t=[],s=Object.keys(e);return s.slice(0,3).forEach(r=>{t.push(...ge(r,e[r]))}),s.length>3&&t.push(" ..."),t}function ge(e,t,s){return I(t)?(t=JSON.stringify(t),s?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?s?t:[`${e}=${t}`]:O(t)?(t=ge(e,h(t.value),!0),s?t:[`${e}=Ref<`,t,">"]):T(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=h(t),s?t:[`${e}=`,t])}const me={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 Kt(e,t,s,r){try{return r?e(...r):e()}catch(n){Se(n,t,s)}}function Se(e,t,s,r=!0){const n=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||Nt;if(t){let c=t.parent;const u=t.proxy,f=process.env.NODE_ENV!=="production"?me[s]:`https://vuejs.org/error-reference/#runtime-${s}`;for(;c;){const d=c.ec;if(d){for(let a=0;a<d.length;a++)if(d[a](e,u,f)===!1)return}c=c.parent}if(i){ut(),Kt(i,null,10,[e,u,f]),lt();return}}Cs(e,s,n,r,o)}function Cs(e,t,s,r=!0,n=!1){if(process.env.NODE_ENV!=="production"){const i=me[t];if(s&&Ds(s),q(`Unhandled error${i?` during execution of ${i}`:""}`),s&&Ps(),r)throw e;console.error(e)}else{if(n)throw e;console.error(e)}}const w=[];let x=-1;const U=[];let C=null,z=0;const $s=Promise.resolve();let Lt=null;const Fs=100;function Ms(e){let t=x+1,s=w.length;for(;t<s;){const r=t+s>>>1,n=w[r],i=rt(n);i<e||i===e&&n.flags&2?t=r+1:s=r}return t}function Ks(e){if(!(e.flags&1)){const t=rt(e),s=w[w.length-1];!s||!(e.flags&2)&&t>=rt(s)?w.push(e):w.splice(Ms(t),0,e),e.flags|=1,be()}}function be(){Lt||(Lt=$s.then(ye))}function Ls(e){S(e)?U.push(...e):C&&e.id===-1?C.splice(z+1,0,e):e.flags&1||(U.push(e),e.flags|=1),be()}function Hs(e){if(U.length){const t=[...new Set(U)].sort((s,r)=>rt(s)-rt(r));if(U.length=0,C){C.push(...t);return}for(C=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),z=0;z<C.length;z++){const s=C[z];process.env.NODE_ENV!=="production"&&Ee(e,s)||(s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2)}C=null,z=0}}const rt=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ye(e){process.env.NODE_ENV!=="production"&&(e=e||new Map);const t=process.env.NODE_ENV!=="production"?s=>Ee(e,s):Gt;try{for(x=0;x<w.length;x++){const s=w[x];if(s&&!(s.flags&8)){if(process.env.NODE_ENV!=="production"&&t(s))continue;s.flags&4&&(s.flags&=-2),Kt(s,s.i,s.i?15:14),s.flags&4||(s.flags&=-2)}}}finally{for(;x<w.length;x++){const s=w[x];s&&(s.flags&=-2)}x=-1,w.length=0,Hs(e),Lt=null,(w.length||U.length)&&ye(e)}}function Ee(e,t){const s=e.get(t)||0;if(s>Fs){const r=t.i,n=r&&Ve(r.type);return Se(`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 e.set(t,s+1),!1}const Ht=new Map;process.env.NODE_ENV!=="production"&&(at().__VUE_HMR_RUNTIME__={createRecord:Wt(Ws),rerender:Wt(Bs),reload:Wt(qs)});const gt=new Map;function Ws(e,t){return gt.has(e)?!1:(gt.set(e,{initialDef:mt(t),instances:new Set}),!0)}function mt(e){return je(e)?e.__vccOpts:e}function Bs(e,t){const s=gt.get(e);s&&(s.initialDef.render=t,[...s.instances].forEach(r=>{t&&(r.render=t,mt(r.type).render=t),r.renderCache=[],r.update()}))}function qs(e,t){const s=gt.get(e);if(!s)return;t=mt(t),we(s.initialDef,t);const r=[...s.instances];for(let n=0;n<r.length;n++){const i=r[n],o=mt(i.type);let c=Ht.get(o);c||(o!==s.initialDef&&we(o,t),Ht.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(t.styles),c.delete(i)):i.parent?Ks(()=>{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)}Ls(()=>{Ht.clear()})}function we(e,t){F(e,t);for(const s in e)s!=="__file"&&!(s in t)&&delete e[s]}function Wt(e){return(t,s)=>{try{return e(t,s)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let J,St=[];function ve(e,t){var s,r;J=e,J?(J.enabled=!0,St.forEach(({event:n,args:i})=>J.emit(n,...i)),St=[]):typeof window<"u"&&window.HTMLElement&&!((r=(s=window.navigator)==null?void 0:s.userAgent)!=null&&r.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{ve(i,t)}),setTimeout(()=>{J||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,St=[])},3e3)):St=[]}let nt=null,Us=null;const zs=e=>e.__isTeleport;function Ne(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ne(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}at().requestIdleCallback,at().cancelIdleCallback;const Js=Symbol.for("v-ndc"),Ys={};process.env.NODE_ENV!=="production"&&(Ys.ownKeys=e=>(q("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(e)));const Gs={},Oe=e=>Object.getPrototypeOf(e)===Gs,Qs=e=>e.__isSuspense,Re=Symbol.for("v-fgt"),Xs=Symbol.for("v-txt"),Zs=Symbol.for("v-cmt");function ks(e){return e?e.__v_isVNode===!0:!1}const tr=(...e)=>Ie(...e),Te=({key:e})=>e??null,bt=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?I(e)||O(e)||T(e)?{i:nt,r:e,k:t,f:!!s}:e:null);function er(e,t=null,s=null,r=0,n=null,i=e===Re?0:1,o=!1,c=!1){const u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Te(t),ref:t&&bt(t),scopeId:Us,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:nt};return c?(Bt(u,s),i&128&&e.normalize(u)):s&&(u.shapeFlag|=I(s)?8:16),process.env.NODE_ENV!=="production"&&u.key!==u.key&&q("VNode created with invalid key (NaN). VNode type:",u.type),u}const sr=process.env.NODE_ENV!=="production"?tr:Ie;function Ie(e,t=null,s=null,r=0,n=null,i=!1){if((!e||e===Js)&&(process.env.NODE_ENV!=="production"&&!e&&q(`Invalid vnode type when creating vnode: ${e}.`),e=Zs),ks(e)){const c=yt(e,t,!0);return s&&Bt(c,s),c.patchFlag=-2,c}if(je(e)&&(e=e.__vccOpts),t){t=rr(t);let{class:c,style:u}=t;c&&!I(c)&&(t.class=It(c)),E(u)&&(dt(u)&&!S(u)&&(u=F({},u)),t.style=Tt(u))}const o=I(e)?1:Qs(e)?128:zs(e)?64:E(e)?4:T(e)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&dt(e)&&(e=h(e),q("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: `,e)),er(e,t,s,r,n,o,i,!0)}function rr(e){return e?dt(e)||Oe(e)?F({},e):e:null}function yt(e,t,s=!1,r=!1){const{props:n,ref:i,patchFlag:o,children:c,transition:u}=e,f=t?ir(n||{},t):n,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&Te(f),ref:t&&t.ref?s&&i?S(i)?i.concat(bt(t)):[i,bt(t)]:bt(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&S(c)?c.map(De):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Re?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:u,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&yt(e.ssContent),ssFallback:e.ssFallback&&yt(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return u&&r&&Ne(d,u.clone(d)),d}function De(e){const t=yt(e);return S(e.children)&&(t.children=e.children.map(De)),t}function nr(e=" ",t=0){return sr(Xs,null,e,t)}function Bt(e,t){let s=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(S(t))s=16;else if(typeof t=="object")if(r&65){const n=t.default;n&&(n._c&&(n._d=!1),Bt(e,n()),n._c&&(n._d=!0));return}else s=32,!t._&&!Oe(t)&&(t._ctx=nt);else T(t)?(t={default:t,_ctx:nt},s=32):(t=String(t),r&64?(s=16,t=[nr(t)]):s=8);e.children=t,e.shapeFlag|=s}function ir(...e){const t={};for(let s=0;s<e.length;s++){const r=e[s];for(const n in r)if(n==="class")t.class!==r.class&&(t.class=It([t.class,r.class]));else if(n==="style")t.style=Tt([t.style,r.style]);else if(Ue(n)){const i=t[n],o=r[n];o&&i!==o&&!(S(i)&&i.includes(o))&&(t[n]=i?[].concat(i,o):o)}else n!==""&&(t[n]=r[n])}return t}let Pe=null;const or=()=>Pe||nt;{const e=at(),t=(s,r)=>{let n;return(n=e[s])||(n=e[s]=[]),n.push(r),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};t("__VUE_INSTANCE_SETTERS__",s=>Pe=s),t("__VUE_SSR_SETTERS__",s=>xe=s)}let xe=!1;process.env.NODE_ENV;const cr=/(?:^|[-_])(\w)/g,ar=e=>e.replace(cr,t=>t.toUpperCase()).replace(/[-_]/g,"");function Ve(e,t=!0){return T(e)?e.displayName||e.name:e.name||t&&e.__name}function Ae(e,t,s=!1){let r=Ve(t);if(!r&&t.__file){const n=t.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&e&&e.parent){const n=i=>{for(const o in i)if(i[o]===t)return o};r=n(e.components||e.parent.type.components)||n(e.appContext.components)}return r?ar(r):s?"App":"Anonymous"}function je(e){return T(e)&&"__vccOpts"in e}const ur=(e,t)=>{const s=Is(e,t,xe);if(process.env.NODE_ENV!=="production"){const r=or();r&&r.appContext.config.warnRecursiveComputed&&(s._warnRecursive=!0)}return s};function lr(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},s={style:"color:#f5222d"},r={style:"color:#eb2f96"},n={__vue_custom_formatter:!0,header(a){if(!E(a))return null;if(a.__isVue)return["div",e,"VueInstance"];if(O(a)){ut();const p=a.value;return lt(),["div",{},["span",e,d(a)],"<",c(p),">"]}else{if(de(a))return["div",{},["span",e,N(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${P(a)?" (readonly)":""}`];if(P(a))return["div",{},["span",e,N(a)?"ShallowReadonly":"Readonly"],"<",c(a),">"]}return null},hasBody(a){return a&&a.__isVue},body(a){if(a&&a.__isVue)return["div",{},...i(a.$)]}};function i(a){const p=[];a.type.props&&a.props&&p.push(o("props",h(a.props))),a.setupState!==Nt&&p.push(o("setup",a.setupState)),a.data!==Nt&&p.push(o("data",h(a.data)));const v=u(a,"computed");v&&p.push(o("computed",v));const R=u(a,"inject");return R&&p.push(o("injected",R)),p.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),p}function o(a,p){return p=F({},p),Object.keys(p).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},a],["div",{style:"padding-left:1.25em"},...Object.keys(p).map(v=>["div",{},["span",r,v+": "],c(p[v],!1)])]]:["span",{}]}function c(a,p=!0){return typeof a=="number"?["span",t,a]:typeof a=="string"?["span",s,JSON.stringify(a)]:typeof a=="boolean"?["span",r,a]:E(a)?["object",{object:p?h(a):a}]:["span",s,String(a)]}function u(a,p){const v=a.type;if(T(v))return;const R={};for(const it in a.ctx)f(v,it,p)&&(R[it]=a.ctx[it]);return R}function f(a,p,v){const R=a[v];if(S(R)&&R.includes(p)||E(R)&&p in R||a.extends&&f(a.extends,p,v)||a.mixins&&a.mixins.some(it=>f(it,p,v)))return!0}function d(a){return N(a)?"ShallowRef":a.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.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function fr(){lr()}process.env.NODE_ENV!=="production"&&fr();function L(e){return e?Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:typeof e=="string"?e.trim()==="":!1:!(typeof e=="boolean"||typeof e=="number")}class Ce{constructor(t,s,r){l(this,"_childStore");l(this,"_store");l(this,"_flowsOnAction",new Map);l(this,"_flows");this._childStore=r,this._flows=s,this._store=t}addFlowOnAction(t,s){const r=this.getOnActionFlowName(t,s);this._flowsOnAction.set(r,!0),setTimeout(()=>{this._flowsOnAction.set(r,!1)},250)}getOnActionFlowName(t,s){return t+JSON.stringify(s)}invokeFlow(t,s,r,n){return r?(L(n)||(t={args:t,result:n}),typeof r=="function"?r(t):typeof r=="string"&&(this._childStore&&typeof this._childStore[r]=="function"?this._childStore[r](t):typeof this._store[r]=="function"&&this._store[r](t)),this.addFlowOnAction(s,t),!0):!1}onAction(){this._flows&&this._store.$onAction(({after:t,args:s,name:r})=>{if(!this._flows[r]||this._flowsOnAction.get(this.getOnActionFlowName(r,s)))return;const{after:n,before:i}=this._flows[r];this.invokeFlow(s,r,i),t(o=>this.invokeFlow(s,r,n,o))})}}const Et=new Map,qt=typeof FinalizationRegistry<"u"?new FinalizationRegistry(e=>Et.delete(e)):void 0;function hr(e){typeof WeakRef<"u"?(Et.set(e.$id,new WeakRef(e)),qt==null||qt.register(e,e.$id)):Et.set(e.$id,{deref:()=>e})}function $e(e){var s;const t=Et.get(e);return(s=t==null?void 0:t.deref)==null?void 0:s.call(t)}class wt{constructor(t){l(this,"_actionFlows");l(this,"_actionsToExtends");l(this,"_actionsToRename");l(this,"_childId");l(this,"_mutationCallback");l(this,"_persist");l(this,"_parentsStores");l(this,"_parentsStoresBuilded");l(this,"_propertiesToRename");this._actionFlows=t.actionFlows,this._actionsToExtends=t.actionsToExtends,this._actionsToRename=t.actionsToRename,this._mutationCallback=t.mutationCallback,this._parentsStores=t.parentsStores,this._persist=t.persist,this._propertiesToRename=t.propertiesToRename}get actionFlows(){return this._actionFlows}get actionsToExtends(){return this._actionsToExtends}get actionsToRename(){return this._actionsToRename}get childId(){return this._childId}set actionFlows(t){this._actionFlows=t}set childId(t){this._childId=t}get persist(){return this._persist}get propertiesToRename(){return this._propertiesToRename}buildStores(t){var s;!this._childId&&!t||(this._parentsStoresBuilded=(s=this._parentsStores)==null?void 0:s.map(r=>r.build(t??this.childId)))}hasCustomDb(){var t;return!!(typeof this._persist=="object"&&((t=this._persist)!=null&&t.dbName))}parentsStores(t){return this.buildStores(t),this._parentsStoresBuilded}}const pr=new Set(["_","$"]);class Fe{constructor(t,s,r=!1){l(this,"_debug",!1);l(this,"_deniedFirstChar",pr);l(this,"_options");l(this,"_store");this._debug=r,this._options=(s==null?void 0:s.eppsOptions)??s,this._store=t}get debug(){return this._debug}set debug(t){this._debug=t}get options(){return this._options}get parentsStores(){var t;return this.debugLog(`Store.parentsStore - ${this.getStoreName()}`,this.options),this.options instanceof wt||typeof((t=this.options)==null?void 0:t.buildStores)=="function"?(this.options.childId=this.store.$id,this.debugLog(`Store.parentsStore EppsOptions - ${this.getStoreName()}`,[this.options.childId,this.options.parentsStores(),this.options]),this.options.parentsStores()):typeof this.store.parentsStores=="function"&&this.store.parentsStores()}get state(){return this._store.$state}set state(t){this._store.$state=t}get store(){return this._store}addPropertiesToState(t,s){t.forEach(r=>this.addToState(r,s?s[r]:void 0))}addToState(t,s){this.isOptionApi()||s!=null&&s.value||(s=_t(s)),this.state[t]=s,this.store[t]=_e(this.state,t)}debugLog(t,s){this._debug&&vt(t,s)}hasDeniedFirstChar(t){return this._deniedFirstChar.has(t[0])}getOption(t){return this.options&&this.options[t]}getStatePropertyValue(t){return this.getValue(this.state[t])}getStoreName(){return this.store.hasOwnProperty("getStoreName")?this.store.getStoreName():this.store.$id}getValue(t){return t!=null&&t.__v_isRef?t.value:t}isOptionApi(){return this.store._isOptionsAPI}stateHas(t){return this.state.hasOwnProperty(t)}storeHas(t){return this.store.hasOwnProperty(t)}}const dr=["removePersistedState","watch","$reset"];class _r extends Fe{constructor(s,r,n=!1){var i;super(s,r,n);l(this,"_extendedActions");this._extendedActions=new Set([...dr,...((i=this.options)==null?void 0:i.actionsToExtends)??[]]),this.extendsStore()}get extendedActions(){return this._extendedActions}get actionsToRename(){return this.options.actionsToRename}get propertiesToRename(){return this.options.propertiesToRename}addToCustomProperties(s){}createComputed(s,r){const n=typeof s[r]=="object";return ur({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){Object.keys(s).forEach(r=>{if(this.hasDeniedFirstChar(r[0])&&r!=="$reset")return;const n=typeof s[r];if(this.storeHas(r))this.extendedActions.has(r)&&n==="function"&&this.extendsAction(s,r);else if(n==="function"){const i=this.getActionNameForChildStore(r);this.store[i]=s[r],this.addToCustomProperties(i)}else n==="object"&&!Array.isArray(s[r])&&(this.store[r]=this.createComputed(s,r),this.addToCustomProperties(r))})}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=>{if(!this.stateHas(r)&&!this.hasDeniedFirstChar(r[0])){const n=this.getPropertyNameForChildState(r);this.store[n]=this.state[n]=_e(s.$state,r),this.addToCustomProperties(n)}})}extendsStore(){var r;const s=(r=this.options)==null?void 0:r.actionFlows;if(new Ce(this.store,s).onAction(),this.parentsStores){const n=this.parentsStores;if(!n||!n.length)return;n.forEach(i=>{i!=null&&i.$state&&(this.duplicateStore(i),this.extendsState(i),new Ce(i,s,this.store).onAction())}),hr(this.store)}}getActionNameForChildStore(s){return(this.actionsToRename&&this.actionsToRename[s])??s}getPropertyNameForChildState(s){return(this.propertiesToRename&&this.propertiesToRename[s])??s}}const gr=["@context","activeLink","computed","dep","excludedKeys","fn","isEncrypted","isLoading","subs","version"];class mr extends Fe{constructor(s,r,n,i,o,c=!1){var u;super(s,r,c);l(this,"_crypt");l(this,"_excludedKeys");l(this,"_persister");l(this,"_propertiesToEncrypt");l(this,"_watchedStore");this._excludedKeys=this.initExcludedKeys(),this._persister=n,this._propertiesToEncrypt=new Set(this.getPropertiesToEncrypt()),this._watchedStore=i,o&&(this._crypt=o,(u=this.options)!=null&&u.persist&&(this.options.persist.isEncrypted=!1)),this.hasPersistProperty()&&(this.augmentStore(),this.remember(),this.debugLog("StorePersister constructor",[this.toBeWatched(),i,n,this.options,s]),this.toBeWatched()&&this.storeSubscription())}augmentStore(){var s;if((s=this.options)!=null&&s.persist){const{persist:r}=this.options,{isEncrypted:n,persistedPropertiesToEncrypt:i,watchMutation:o}=typeof r=="object"?r:{};n===void 0&&(this.options.persist.isEncrypted=!1),i===void 0&&(this.options.persist.persistedPropertiesToEncrypt=[]),o===void 0&&(this.options.persist.watchMutation=!1)}this.stateHas("isLoading")||this.addToState("isLoading",!1),this.store.persistState=async()=>await this.persist(),this.store.remember=async()=>await this.remember(),this.store.removePersistedState=()=>this._persister.removeItem(this.getStoreName()),this.store.watch=()=>{var r;this.toBeWatched()&&((r=this.options)!=null&&r.persist?this.options.persist.watchMutation=!0:this.addToState("watchMutation",!0),this.storeSubscription())},this.store.stopWatch=()=>this.stopWatch()}async cryptProperty(s,r,n=!1){return n?await s.decrypt(r):await s.encrypt(r)}async cryptState(s,r=!1){return await new Promise(async n=>{var u;const i=this._crypt,o=this.getPropertiesToEncrypt(),c=this.isEncrypted(s);if(this.debugLog(`cryptState - ${this.getStoreName()} ${r?"decrypt":"crypt"}`,["can",this._propertiesToEncrypt.size>0&&c===r&&!!i,i,s]),this._propertiesToEncrypt.size>0&&i){const f={};for(const d of o){const a=this.getValue(s[d]);a&&(f[d]=await this.cryptProperty(i,a,r))}this.debugLog(`cryptState - ${this.getStoreName()}`,["encryptedState",f]),L(f)||(s={...s,...f},(u=this.options)!=null&&u.persist&&(this.options.persist.isEncrypted=!r))}n(s)})}isEncrypted(s){var r;return(((r=this.options)==null?void 0:r.persist)&&this.options.persist.isEncrypted)??this.getValue(s?s.isEncrypted:this.state.isEncrypted)}getPropertiesToEncrypt(){var s,r;return(((s=this.options)==null?void 0:s.persist)&&((r=this.options.persist)==null?void 0:r.persistedPropertiesToEncrypt))??[]}async getPersistedState(s=!0){var n;const r=this.getStoreName();try{let i=await this._persister.getItem(r);return s&&this.toBeCrypted()&&i&&(await((n=this._crypt)==null?void 0:n.init()),i=await this.cryptState({...h(this.state),...i},!0)),this.debugLog(`getPersistedState ${r}`,[i,this.state]),i}catch(i){$("getPersistedState Error",[r,i])}}async getStateToPersist(){const s=this._excludedKeys,r=this.state,n=this._propertiesToEncrypt.size>0,i=this._crypt;n&&await i.init();const o={};for(const c of Object.keys(r))if(!this.hasDeniedFirstChar(c[0])&&!s.has(c)){const u=r[c];L(u)||(n&&this._propertiesToEncrypt.has(c)?o[c]=await this.cryptProperty(i,u,!1):o[c]=h(u))}return o}getWatchMutation(){var s;return((s=this.options)==null?void 0:s.persist)&&this.options.persist.watchMutation}hasPersistProperty(){return!!(this.options&&this.options.persist)}initExcludedKeys(){var s;return new Set([...gr,...(((s=this.options)==null?void 0:s.persist)&&this.options.persist.excludedKeys)??this.getStatePropertyValue("excludedKeys")??[]])}async persist(){const s=await this.getStateToPersist();L(s)||this._persister.setItem(this.getStoreName(),s)}propertyShouldBePersisted(s){return!this._excludedKeys.has(s)}async remember(){return this.state.isLoading=!0,new Promise(async s=>{let r=await this.getPersistedState();return r&&!this.stateIsEmpty(r)&&this.store.$patch(r),this.state.isLoading=!1,s(!0)})}shouldBePersisted(){return this.hasPersistProperty()}stateIsEmpty(s){var r,n;return((r=this.store)==null?void 0:r.stateIsEmpty)&&((n=this.store)==null?void 0:n.stateIsEmpty(s))}stopWatch(){var s,r;(s=this.options)!=null&&s.persist&&((r=this.options.persist)!=null&&r.watchMutation)&&(this.options.persist.watchMutation=!1)}storeSubscription(){this.debugLog(`storeSubscription ${this.getStoreName()}`,[this.toBeWatched(),this.state,this.store]),this.toBeWatched()&&(this._watchedStore.add(this.getStoreName()),this.store.$subscribe(s=>{this.debugLog(`store.$subscribe ${this.getStoreName()}`,[s.type!=="patch object",this.getWatchMutation(),s,this.state,this.store]),s.type!=="patch object"&&this.getWatchMutation()&&this.persist().then(()=>{this.store.mutationCallback&&this.store.mutationCallback(this.state,s)})}))}toBeCrypted(){return!!(this._crypt&&this.getPropertiesToEncrypt())}toBeWatched(){return this.shouldBePersisted()&&!this._watchedStore.has(this.getStoreName())}}class Ut{constructor(t,s,r=!1){l(this,"_db");l(this,"_debug",!1);l(this,"_crypt");l(this,"_watchedStore",new Set);this._db=t,this._debug=r,this._crypt=s}get db(){return this._db}get crypt(){return this._crypt}getEppsOptions(t){return t==null?void 0:t.eppsOptions}getStoreDb(t){try{if(!window)return this.db;const s=this.getEppsOptions(t);if(typeof(s==null?void 0:s.persist)=="object"&&s.persist.dbName)return new ct({name:s.persist.dbName,keyPath:"storeName"})}catch{}return this.db}plugin({store:t,options:s}){try{new _r(t,s,this._debug);const r=this.getStoreDb(s);r instanceof ct&&new mr(t,s,r,this._watchedStore,this._crypt,this._debug),this.rewriteResetStore({store:t},Object.assign({},t.$state))}catch(r){$("plugin()",[r,t,s])}}rewriteResetStore({store:t},s){t.$reset=()=>{typeof(t==null?void 0:t.removePersistedState)=="function"&&t.removePersistedState(),Object.keys(s).forEach(r=>{t[r]=s[r]}),t.$patch(JSON.parse(JSON.stringify(s)))}}}function Sr(e,t,s=!1){const{db:r,crypt:n}=br(e,t);typeof s!="boolean"&&(s=!1);const i=new Ut(r,n,s);return i.plugin.bind(i)}function br(e,t){let s,r;try{if(window)return!L(e)&&e&&(s=new ct({name:e,keyPath:"storeName"})),t&&(r=new ot(t)),{db:s,crypt:r}}catch{}return{db:s,crypt:r}}class yr{constructor(){l(this,"_store",new Map)}clear(){this._store.clear()}keyToString(t){return typeof t=="number"?t.toString():t}async getItem(t){return this._store.get(this.keyToString(t))}removeItem(t){this._store.delete(this.keyToString(t))}removeItems(t){if(t)for(const s of this._store.keys())t.includes(s)||this._store.delete(s);else this._store.clear()}setItem(t,s){this._store.set(s,t)}}let Y={};const Er={clear:()=>Y={},getItem:async e=>new Promise(t=>t(Y[e])),removeItem:e=>delete Y[e],removeItems:e=>e?e.forEach(t=>delete Y[t]):Y={},setItem:(e,t)=>{Y[t]=e}};class wr extends ct{defineDb(){return this.dbName==="localStorage"||this.dbName==="sessionStorage"?Er:new yr}}function vr(e,t){let s;t&&(s=new ot(t));const r=new Ut(new wr({name:e}),s);return r.plugin.bind(r)}function zt(e,t,s){return s&&(s={eppsOptions:s instanceof wt?s:new wt(s)}),typeof t=="function"?Nr(e,t,s):Or(e,t,s)}function Nr(e,t,s){return m.defineStore(e,t,s)}function Or(e,t,s){return s&&(t={...t,...s??{}}),m.defineStore(e,t)}function Rr(e,t){return`${e}-${t}`}const Tr={">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t};function Ir(e,t,s="strict"){return e.filter(r=>Object.keys(t).every(n=>{if(typeof t[n]=="string"){const i=typeof r[n]=="string"?r[n].toLowerCase():r[n],o=t[n].toLowerCase();return s==="strict"?i===o:i.includes(o)}return typeof t[n]=="number"&&s!=="strict"&&s!=="partial"?Tr[s](r[n],t[n]):t[n]==r[n]}))}function Dr(e,t){return e.find(s=>Object.keys(t).every(r=>s[r]===t[r]))}function Me(e){return e.id?{id:e.id}:{"@id":e["@id"]}}const Ke=e=>m.defineStore(e??"collectionStore",{state:()=>({items:[]}),actions:{addItem(t){let s;if((t.id||t["@id"])&&(s=this.getItem(Me(t)),s)){this.updateItem(t,s);re