pinia-plugin-subscription 0.1.3 → 0.1.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- (function(d,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],F):(d=typeof globalThis<"u"?globalThis:d||self,F(d["pinia-plugin-subscription"]={},d.Pinia))})(this,(function(d,F){"use strict";class Se{_console;_createInstance;_name;_pluginOptions;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;get console(){return this._console??console}get name(){return this._name}get pluginOptions(){return this._pluginOptions??{}}set pluginOptions(e){this._pluginOptions=e}get resetStoreCallback(){return this._resetStoreCallback}get storeOnActionSubscription(){return this._storeOnActionSubscription}get storeMutationSubscription(){return this._storeMutationSubscription}get subscriptions(){return this._subscriptions}set subscriptions(e){this._subscriptions=e}constructor(e,n,r){this._name=e,this._createInstance=n,r&&(this._console=r)}invoke({store:e,options:n},r){return this._storeInstance=this._createInstance(e,{...n,...this.pluginOptions},r,this.console),this._storeInstance?(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(e),!0):!1}}class xt{_console;_debug=!1;get console(){return this._console??console}set console(e){this._console=e}get debug(){return this._debug}set debug(e){this._debug=e}constructor(e,n){this._debug=e,n&&(this._console=n)}debugLog(...e){this._debug&&(Array.isArray(e)&&(e[0]=`${this._className} - ${e[0]}`),this.console.log(...e))}logError(...e){this.console.error(...e)}}const ht="pinia-plugin-subscription",ye=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function Ee(t,e){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e.shift(),...e)}class Tt{_bgColor="#ffec73";_color="green";_icon="🍍⚡";_errorBgColor="#d24545";_errorColor="white";_errorIcon="🍍⚠️";_styles={error:{bgColor:this._errorBgColor,color:this._errorColor,icon:this._errorIcon},info:{bgColor:this._bgColor,color:this._color,icon:this._icon}};formatMessage(e,n){return` [${n} ${ht}] - ${e} `}generateStyle(e){return ye(e.bgColor,e.color)}getStyleDefinition(e){return this._styles[e??"info"]}log(...e){this.useLog(this.getStyleDefinition(),e)}error(...e){this.useLog(this.getStyleDefinition("error"),e)}rebuildArgs(e,n){if(typeof e=="string")return[this.formatMessage(e,n)];if(Array.isArray(e))return[this.formatMessage(e.shift(),n),...e??[]]}useLog(e,n){Ee(this.generateStyle(e),this.rebuildArgs(n,e.icon))}}class Oe extends Tt{_pluginName=ht}const we=new Oe;function Q(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 Mt="PluginSubscription";class Pt extends xt{_className=Mt;_pluginDebug;_resetStoreCallback=[];_subscribers=[];_subscribersDelivered=new Set;_subscriptions=[];_subscriptionsDelivered=new Set;set subscribers(e){this._subscribers=e}get subscriptions(){if(!Q(this._subscriptions))return this._subscriptions}constructor(e,n){super(Array.isArray(n)&&!!n?.includes(Mt),we),this._pluginDebug=Array.isArray(n)?n:void 0,this._subscribers=e}addResetStoreCallback(e){this._resetStoreCallback.push(e)}definePluginDebug(e){return!!this._pluginDebug?.includes(e.name)}executeResetStoreCallbacks(e){this._resetStoreCallback.forEach(n=>n(e))}plugin({store:e,options:n}){if(this._subscribers.length){this.debugLog(`plugin() - ${e.$id}`,["subscriber:",this._subscribers,"store:",e,"options:",n]);try{this._subscribers.forEach(r=>{this._subscribersDelivered.has(`${r.name}-${e.$id}`)||r.invoke({store:e,options:n},this.definePluginDebug(r))&&(this._subscribersDelivered.add(`${r.name}-${e.$id}`),r.subscriptions&&this.subscriptionDelivery({store:e,options:n},r.subscriptions),r.storeMutationSubscription&&this.storeMutationSubscription(r.storeMutationSubscription),r.storeOnActionSubscription&&this.storeOnActionSubscription(r.storeOnActionSubscription),r.resetStoreCallback&&this.addResetStoreCallback(r.resetStoreCallback))}),this.rewriteResetStore({store:e},JSON.stringify(e.$state),Object.assign({},e))}catch(r){this.logError(r,e,n)}}}rewriteResetStore({store:e},n,r){e.$reset=()=>{this.debugLog("rewriteResetStore()",{initState:n,store:e,customStore:r}),this.executeResetStoreCallbacks(e),e.$patch(JSON.parse(n))}}storeOnActionSubscription(e){const{store:n,callback:r}=e();n.$onAction(({after:s,args:i,name:o})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,{after:s,args:i,name:o,store:n}),r({after:s,args:i,name:o})})}storeMutationSubscription(e){const{store:n,callback:r}=e();n.$subscribe(s=>{this.debugLog(`$subscribe ${n.$id}`,{mutation:s,store:n}),r(s)})}subscriptionDelivery({store:e,options:n},r){Object.entries(r).forEach(([s,i])=>{try{if(this._subscriptionsDelivered.has(`${s}-${e.$id}`))return;const{subscription:o,subscriptionOptions:c,stores:u}=i;this.debugLog(`subscriptionDelivery() - store: ${e.$id}`,["pluginName:",s,"subscription:",o,"options:",i,"stores:",u]);const a={storeOptions:{...n?.storeOptions??{},...c}};o.invoke({store:e,options:{...n,...a}},this.debug),this._subscriptionsDelivered.add(`${s}-${e.$id}`),Q(u)||u?.forEach(h=>o.invoke({store:h,options:{...n,...a,...h?.storeOptions??{}}},this.debug))}catch(o){this.logError("subscriptionDelivery()",o,e,n)}})}}function Ne(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const dt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Ft=()=>{},ve=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Re=t=>t.startsWith("onUpdate:"),V=Object.assign,Ce=Object.prototype.hasOwnProperty,_t=(t,e)=>Ce.call(t,e),_=Array.isArray,z=t=>kt(t)==="[object Map]",I=t=>typeof t=="function",v=t=>typeof t=="string",x=t=>typeof t=="symbol",b=t=>t!==null&&typeof t=="object",Ae=Object.prototype.toString,kt=t=>Ae.call(t),jt=t=>kt(t).slice(8,-1),X=t=>v(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Ie=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),T=(t,e)=>!Object.is(t,e);let Kt;const Z=()=>Kt||(Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function gt(t){if(_(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],s=v(r)?xe(r):gt(r);if(s)for(const i in s)e[i]=s[i]}return e}else if(v(t)||b(t))return t}const $e=/;(?![^(]*\))/g,De=/:([^]+)/,Ve=/\/\*[^]*?\*\//g;function xe(t){const e={};return t.replace(Ve,"").split($e).forEach(n=>{if(n){const r=n.split(De);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function bt(t){let e="";if(v(t))e=t;else if(_(t))for(let n=0;n<t.length;n++){const r=bt(t[n]);r&&(e+=r+" ")}else if(b(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function k(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Te,Ht=0,mt;function St(){Ht++}function yt(){if(--Ht>0)return;let t;for(;mt;){let e=mt;for(mt=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}let tt=!0;const Lt=[];function et(){Lt.push(tt),tt=!1}function nt(){const t=Lt.pop();tt=t===void 0?!0:t}class Wt{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,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){}trigger(e){this.version++,this.notify(e)}notify(e){St();try{if(process.env.NODE_ENV!=="production")for(let n=this.subsHead;n;n=n.nextSub)n.sub.onTrigger&&!(n.sub.flags&8)&&n.sub.onTrigger(V({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{yt()}}}const st=new WeakMap,M=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Et=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),U=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function g(t,e,n){if(tt&&Te){let r=st.get(t);r||st.set(t,r=new Map);let s=r.get(n);s||(r.set(n,s=new Wt),s.map=r,s.key=n),process.env.NODE_ENV!=="production"?s.track({target:t,type:e,key:n}):s.track()}}function $(t,e,n,r,s,i){const o=st.get(t);if(!o)return;const c=u=>{u&&(process.env.NODE_ENV!=="production"?u.trigger({target:t,type:e,key:n,newValue:r,oldValue:s,oldTarget:i}):u.trigger())};if(St(),e==="clear")o.forEach(c);else{const u=_(t),a=u&&X(n);if(u&&n==="length"){const h=Number(r);o.forEach((l,f)=>{(f==="length"||f===U||!x(f)&&f>=h)&&c(l)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),a&&c(o.get(U)),e){case"add":u?a&&c(o.get("length")):(c(o.get(M)),z(t)&&c(o.get(Et)));break;case"delete":u||(c(o.get(M)),z(t)&&c(o.get(Et)));break;case"set":z(t)&&c(o.get(M));break}}yt()}function Me(t,e){const n=st.get(t);return n&&n.get(e)}function j(t){const e=p(t);return e===t?e:(g(e,"iterate",U),S(t)?e:e.map(C))}function Ot(t){return g(t=p(t),"iterate",U),t}function O(t,e){return w(t)?J(Ct(t)?C(e):e):C(e)}const Pe={__proto__:null,[Symbol.iterator](){return wt(this,Symbol.iterator,t=>O(this,t))},concat(...t){return j(this).concat(...t.map(e=>_(e)?j(e):e))},entries(){return wt(this,"entries",t=>(t[1]=O(this,t[1]),t))},every(t,e){return R(this,"every",t,e,void 0,arguments)},filter(t,e){return R(this,"filter",t,e,n=>n.map(r=>O(this,r)),arguments)},find(t,e){return R(this,"find",t,e,n=>O(this,n),arguments)},findIndex(t,e){return R(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return R(this,"findLast",t,e,n=>O(this,n),arguments)},findLastIndex(t,e){return R(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return R(this,"forEach",t,e,void 0,arguments)},includes(...t){return Nt(this,"includes",t)},indexOf(...t){return Nt(this,"indexOf",t)},join(t){return j(this).join(t)},lastIndexOf(...t){return Nt(this,"lastIndexOf",t)},map(t,e){return R(this,"map",t,e,void 0,arguments)},pop(){return q(this,"pop")},push(...t){return q(this,"push",t)},reduce(t,...e){return zt(this,"reduce",t,e)},reduceRight(t,...e){return zt(this,"reduceRight",t,e)},shift(){return q(this,"shift")},some(t,e){return R(this,"some",t,e,void 0,arguments)},splice(...t){return q(this,"splice",t)},toReversed(){return j(this).toReversed()},toSorted(t){return j(this).toSorted(t)},toSpliced(...t){return j(this).toSpliced(...t)},unshift(...t){return q(this,"unshift",t)},values(){return wt(this,"values",t=>O(this,t))}};function wt(t,e,n){const r=Ot(t),s=r[e]();return r!==t&&!S(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const Fe=Array.prototype;function R(t,e,n,r,s,i){const o=Ot(t),c=o!==t&&!S(t),u=o[e];if(u!==Fe[e]){const l=u.apply(t,i);return c?C(l):l}let a=n;o!==t&&(c?a=function(l,f){return n.call(this,O(t,l),f,t)}:n.length>2&&(a=function(l,f){return n.call(this,l,f,t)}));const h=u.call(o,a,r);return c&&s?s(h):h}function zt(t,e,n,r){const s=Ot(t),i=s!==t&&!S(t);let o=n,c=!1;s!==t&&(i?(c=r.length===0,o=function(a,h,l){return c&&(c=!1,a=O(t,a)),n.call(this,a,O(t,h),l,t)}):n.length>3&&(o=function(a,h,l){return n.call(this,a,h,l,t)}));const u=s[e](o,...r);return c?O(t,u):u}function Nt(t,e,n){const r=p(t);g(r,"iterate",U);const s=r[e](...n);return(s===-1||s===!1)&&B(n[0])?(n[0]=p(n[0]),r[e](...n)):s}function q(t,e,n=[]){et(),St();const r=p(t)[e].apply(t,n);return yt(),nt(),r}const ke=Ne("__proto__,__v_isRef,__isVue"),Ut=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(x));function je(t){x(t)||(t=String(t));const e=p(this);return g(e,"has",t),e.hasOwnProperty(t)}class qt{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Ye:Gt:i?Je:Yt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=_(e);if(!s){let u;if(o&&(u=Pe[n]))return u;if(n==="hasOwnProperty")return je}const c=Reflect.get(e,n,m(e)?e:r);if((x(n)?Ut.has(n):ke(n))||(s||g(e,"get",n),i))return c;if(m(c)){const u=o&&X(n)?c:c.value;return s&&b(u)?Rt(u):u}return b(c)?s?Rt(c):Qt(c):c}}class Ke extends qt{constructor(e=!1){super(!1,e)}set(e,n,r,s){let i=e[n];const o=_(e)&&X(n);if(!this._isShallow){const a=w(i);if(!S(r)&&!w(r)&&(i=p(i),r=p(r)),!o&&m(i)&&!m(r))return a?(process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=r,!0)}const c=o?Number(n)<e.length:_t(e,n),u=Reflect.set(e,n,r,m(e)?e:s);return e===p(s)&&u&&(c?T(r,i)&&$(e,"set",n,r,i):$(e,"add",n,r)),u}deleteProperty(e,n){const r=_t(e,n),s=e[n],i=Reflect.deleteProperty(e,n);return i&&r&&$(e,"delete",n,void 0,s),i}has(e,n){const r=Reflect.has(e,n);return(!x(n)||!Ut.has(n))&&g(e,"has",n),r}ownKeys(e){return g(e,"iterate",_(e)?"length":M),Reflect.ownKeys(e)}}class He extends qt{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&k(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const Le=new Ke,We=new He,vt=t=>t,rt=t=>Reflect.getPrototypeOf(t);function ze(t,e,n){return function(...r){const s=this.__v_raw,i=p(s),o=z(i),c=t==="entries"||t===Symbol.iterator&&o,u=t==="keys"&&o,a=s[t](...r),h=n?vt:e?J:C;return!e&&g(i,"iterate",u?Et:M),V(Object.create(a),{next(){const{value:l,done:f}=a.next();return f?{value:l,done:f}:{value:c?[h(l[0]),h(l[1])]:h(l),done:f}}})}}function it(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";k(`${Ie(t)} operation ${n}failed: target is readonly.`,p(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function Ue(t,e){const n={get(s){const i=this.__v_raw,o=p(i),c=p(s);t||(T(s,c)&&g(o,"get",s),g(o,"get",c));const{has:u}=rt(o),a=e?vt:t?J:C;if(u.call(o,s))return a(i.get(s));if(u.call(o,c))return a(i.get(c));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!t&&g(p(s),"iterate",M),s.size},has(s){const i=this.__v_raw,o=p(i),c=p(s);return t||(T(s,c)&&g(o,"has",s),g(o,"has",c)),s===c?i.has(s):i.has(s)||i.has(c)},forEach(s,i){const o=this,c=o.__v_raw,u=p(c),a=e?vt:t?J:C;return!t&&g(u,"iterate",M),c.forEach((h,l)=>s.call(i,a(h),a(l),o))}};return V(n,t?{add:it("add"),set:it("set"),delete:it("delete"),clear:it("clear")}:{add(s){const i=p(this),o=rt(i),c=p(s),u=!e&&!S(s)&&!w(s)?c:s;return o.has.call(i,u)||T(s,u)&&o.has.call(i,s)||T(c,u)&&o.has.call(i,c)||(i.add(u),$(i,"add",u,u)),this},set(s,i){!e&&!S(i)&&!w(i)&&(i=p(i));const o=p(this),{has:c,get:u}=rt(o);let a=c.call(o,s);a?process.env.NODE_ENV!=="production"&&Jt(o,c,s):(s=p(s),a=c.call(o,s));const h=u.call(o,s);return o.set(s,i),a?T(i,h)&&$(o,"set",s,i,h):$(o,"add",s,i),this},delete(s){const i=p(this),{has:o,get:c}=rt(i);let u=o.call(i,s);u?process.env.NODE_ENV!=="production"&&Jt(i,o,s):(s=p(s),u=o.call(i,s));const a=c?c.call(i,s):void 0,h=i.delete(s);return u&&$(i,"delete",s,void 0,a),h},clear(){const s=p(this),i=s.size!==0,o=process.env.NODE_ENV!=="production"?z(s)?new Map(s):new Set(s):void 0,c=s.clear();return i&&$(s,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=ze(s,t,e)}),n}function Bt(t,e){const n=Ue(t,e);return(r,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?r:Reflect.get(_t(n,s)&&s in r?n:r,s,i)}const qe={get:Bt(!1,!1)},Be={get:Bt(!0,!1)};function Jt(t,e,n){const r=p(n);if(r!==n&&e.call(t,r)){const s=jt(t);k(`Reactive ${s} contains both the raw and reactive versions of the same object${s==="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 Yt=new WeakMap,Je=new WeakMap,Gt=new WeakMap,Ye=new WeakMap;function Ge(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Qt(t){return w(t)?t:Xt(t,!1,Le,qe,Yt)}function Rt(t){return Xt(t,!0,We,Be,Gt)}function Xt(t,e,n,r,s){if(!b(t))return process.env.NODE_ENV!=="production"&&k(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const i=s.get(t);if(i)return i;const o=Ge(jt(t));if(o===0)return t;const c=new Proxy(t,o===2?r:n);return s.set(t,c),c}function Ct(t){return w(t)?Ct(t.__v_raw):!!(t&&t.__v_isReactive)}function w(t){return!!(t&&t.__v_isReadonly)}function S(t){return!!(t&&t.__v_isShallow)}function B(t){return t?!!t.__v_raw:!1}function p(t){const e=t&&t.__v_raw;return e?p(e):t}const C=t=>b(t)?Qt(t):t,J=t=>b(t)?Rt(t):t;function m(t){return t?t.__v_isRef===!0:!1}function Zt(t){return Qe(t,!1)}function Qe(t,e){return m(t)?t:new Xe(t,e)}class Xe{constructor(e,n){this.dep=new Wt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:p(e),this._value=n?e:C(e),this.__v_isShallow=n}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 n=this._rawValue,r=this.__v_isShallow||S(e)||w(e);e=r?e:p(e),T(e,n)&&(this._rawValue=e,this._value=r?e:C(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function Ze(t){return m(t)?t.value:t}class tn{constructor(e,n,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=x(n)?n:String(n),this._raw=p(e);let s=!0,i=e;if(!_(e)||x(this._key)||!X(this._key))do s=!B(i)||S(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=Ze(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&m(this._raw[this._key])){const n=this._object[this._key];if(m(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return Me(this._raw,this._key)}}class en{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 nn(t,e,n){return m(t)?t:I(t)?new en(t):b(t)&&arguments.length>1?sn(t,e,n):Zt(t)}function sn(t,e,n){return new tn(t,e,n)}const P=[];function rn(t){P.push(t)}function on(){P.pop()}let At=!1;function K(t,...e){if(At)return;At=!0,et();const n=P.length?P[P.length-1].component:null,r=n&&n.appContext.config.warnHandler,s=cn();if(r)It(r,n,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(""),n&&n.proxy,s.map(({vnode:i})=>`at <${_e(n,i.type)}>`).join(`
1
+ (function(d,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],F):(d=typeof globalThis<"u"?globalThis:d||self,F(d["pinia-plugin-subscription"]={},d.Pinia))})(this,(function(d,F){"use strict";class Ee{_console;_createInstance;_name;_pluginOptions;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;get console(){return this._console??console}get name(){return this._name}get pluginOptions(){return this._pluginOptions??{}}set pluginOptions(e){this._pluginOptions=e}get resetStoreCallback(){return this._resetStoreCallback}get storeOnActionSubscription(){return this._storeOnActionSubscription}get storeMutationSubscription(){return this._storeMutationSubscription}get subscriptions(){return this._subscriptions}set subscriptions(e){this._subscriptions=e}constructor(e,n,r){this._name=e,this._createInstance=n,r&&(this._console=r)}invoke({store:e,options:n},r){return this._storeInstance=this._createInstance(e,{...n,...this.pluginOptions},r,this.console),this._storeInstance?(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(e),!0):!1}}class xt{_console;_debug=!1;get console(){return this._console??console}set console(e){this._console=e}get debug(){return this._debug}set debug(e){this._debug=e}constructor(e,n){this._debug=e,n&&(this._console=n)}debugLog(...e){this._debug&&(Array.isArray(e)&&(e[0]=`${this._className} - ${e[0]}`),this.console.log(...e))}logError(...e){this.console.error(...e)}}const pt="pinia-plugin-subscription",Oe=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function we(t,e){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e.shift(),...e)}class Tt{_bgColor="#ffec73";_color="green";_icon="🍍⚡";_errorBgColor="#d24545";_errorColor="white";_errorIcon="🍍⚠️";_styles={error:{bgColor:this._errorBgColor,color:this._errorColor,icon:this._errorIcon},info:{bgColor:this._bgColor,color:this._color,icon:this._icon}};formatMessage(e,n){return` [${n} ${pt}] - ${e} `}generateStyle(e){return Oe(e.bgColor,e.color)}getStyleDefinition(e){return this._styles[e??"info"]}log(...e){this.useLog(this.getStyleDefinition(),e)}error(...e){this.useLog(this.getStyleDefinition("error"),e)}rebuildArgs(e,n){if(typeof e=="string")return[this.formatMessage(e,n)];if(Array.isArray(e))return[this.formatMessage(e.shift(),n),...e??[]]}useLog(e,n){we(this.generateStyle(e),this.rebuildArgs(n,e.icon))}}class Ne extends Tt{_pluginName=pt}const ve=new Ne;function Q(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 Mt="PluginSubscription";class Pt extends xt{_className=Mt;_pluginDebug;_resetStoreCallback=[];_subscribers=[];_subscribersDelivered=new Set;_subscriptions=[];_subscriptionsDelivered=new Set;set subscribers(e){this._subscribers=e}get subscriptions(){if(!Q(this._subscriptions))return this._subscriptions}constructor(e,n){super(Array.isArray(n)&&!!n?.includes(Mt),ve),this._pluginDebug=Array.isArray(n)?n:void 0,this._subscribers=e}addResetStoreCallback(e){this._resetStoreCallback.push(e)}definePluginDebug(e){return!!this._pluginDebug?.includes(e.name)}executeResetStoreCallbacks(e){this._resetStoreCallback.forEach(n=>n(e))}plugin({store:e,options:n}){if(this._subscribers.length){this.debugLog(`plugin() - ${e.$id}`,["subscriber:",this._subscribers,"store:",e,"options:",n]);try{this._subscribers.forEach(r=>{this._subscribersDelivered.has(`${r.name}-${e.$id}`)||r.invoke({store:e,options:n},this.definePluginDebug(r))&&(this._subscribersDelivered.add(`${r.name}-${e.$id}`),r.subscriptions&&this.subscriptionDelivery({store:e,options:n},r.subscriptions),r.storeMutationSubscription&&this.storeMutationSubscription(r.storeMutationSubscription),r.storeOnActionSubscription&&this.storeOnActionSubscription(r.storeOnActionSubscription),r.resetStoreCallback&&this.addResetStoreCallback(r.resetStoreCallback))}),this.rewriteResetStore({store:e},JSON.stringify(e.$state),Object.assign({},e))}catch(r){this.logError(r,e,n)}}}rewriteResetStore({store:e},n,r){e.$reset=()=>{this.debugLog("rewriteResetStore()",{initState:n,store:e,customStore:r}),this.executeResetStoreCallbacks(e),e.$patch(JSON.parse(n))}}storeOnActionSubscription(e){const{store:n,callback:r}=e();n.$onAction(({after:s,args:i,name:o})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,{after:s,args:i,name:o,store:n}),r({after:s,args:i,name:o})})}storeMutationSubscription(e){const{store:n,callback:r}=e();n.$subscribe(s=>{this.debugLog(`$subscribe ${n.$id}`,{mutation:s,store:n}),r(s)})}subscriptionDelivery({store:e,options:n},r){Object.entries(r).forEach(([s,i])=>{try{if(this._subscriptionsDelivered.has(`${s}-${e.$id}`))return;const{subscription:o,subscriptionOptions:c,stores:l}=i;this.debugLog(`subscriptionDelivery() - store: ${e.$id}`,["pluginName:",s,"subscription:",o,"options:",i,"stores:",l]);const u={storeOptions:{...n?.storeOptions??{},...c}};o.invoke({store:e,options:{...n,...u}},this.debug),this._subscriptionsDelivered.add(`${s}-${e.$id}`),Q(l)||l?.forEach(p=>o.invoke({store:p,options:{...n,...u,...p?.storeOptions??{}}},this.debug))}catch(o){this.logError("subscriptionDelivery()",o,e,n)}})}}function Re(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const dt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Ft=()=>{},Ce=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Ae=t=>t.startsWith("onUpdate:"),V=Object.assign,Ie=Object.prototype.hasOwnProperty,_t=(t,e)=>Ie.call(t,e),_=Array.isArray,z=t=>kt(t)==="[object Map]",I=t=>typeof t=="function",v=t=>typeof t=="string",x=t=>typeof t=="symbol",b=t=>t!==null&&typeof t=="object",$e=Object.prototype.toString,kt=t=>$e.call(t),jt=t=>kt(t).slice(8,-1),X=t=>v(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,De=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),T=(t,e)=>!Object.is(t,e);let Kt;const Z=()=>Kt||(Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function gt(t){if(_(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],s=v(r)?Me(r):gt(r);if(s)for(const i in s)e[i]=s[i]}return e}else if(v(t)||b(t))return t}const Ve=/;(?![^(]*\))/g,xe=/:([^]+)/,Te=/\/\*[^]*?\*\//g;function Me(t){const e={};return t.replace(Te,"").split(Ve).forEach(n=>{if(n){const r=n.split(xe);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function bt(t){let e="";if(v(t))e=t;else if(_(t))for(let n=0;n<t.length;n++){const r=bt(t[n]);r&&(e+=r+" ")}else if(b(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function k(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Pe,Ht=0,mt;function St(){Ht++}function yt(){if(--Ht>0)return;let t;for(;mt;){let e=mt;for(mt=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}let tt=!0;const Lt=[];function et(){Lt.push(tt),tt=!1}function nt(){const t=Lt.pop();tt=t===void 0?!0:t}class Wt{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,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){}trigger(e){this.version++,this.notify(e)}notify(e){St();try{if(process.env.NODE_ENV!=="production")for(let n=this.subsHead;n;n=n.nextSub)n.sub.onTrigger&&!(n.sub.flags&8)&&n.sub.onTrigger(V({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{yt()}}}const st=new WeakMap,M=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Et=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),U=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function g(t,e,n){if(tt&&Pe){let r=st.get(t);r||st.set(t,r=new Map);let s=r.get(n);s||(r.set(n,s=new Wt),s.map=r,s.key=n),process.env.NODE_ENV!=="production"?s.track({target:t,type:e,key:n}):s.track()}}function $(t,e,n,r,s,i){const o=st.get(t);if(!o)return;const c=l=>{l&&(process.env.NODE_ENV!=="production"?l.trigger({target:t,type:e,key:n,newValue:r,oldValue:s,oldTarget:i}):l.trigger())};if(St(),e==="clear")o.forEach(c);else{const l=_(t),u=l&&X(n);if(l&&n==="length"){const p=Number(r);o.forEach((a,f)=>{(f==="length"||f===U||!x(f)&&f>=p)&&c(a)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),u&&c(o.get(U)),e){case"add":l?u&&c(o.get("length")):(c(o.get(M)),z(t)&&c(o.get(Et)));break;case"delete":l||(c(o.get(M)),z(t)&&c(o.get(Et)));break;case"set":z(t)&&c(o.get(M));break}}yt()}function Fe(t,e){const n=st.get(t);return n&&n.get(e)}function j(t){const e=h(t);return e===t?e:(g(e,"iterate",U),S(t)?e:e.map(C))}function Ot(t){return g(t=h(t),"iterate",U),t}function O(t,e){return w(t)?J(Ct(t)?C(e):e):C(e)}const ke={__proto__:null,[Symbol.iterator](){return wt(this,Symbol.iterator,t=>O(this,t))},concat(...t){return j(this).concat(...t.map(e=>_(e)?j(e):e))},entries(){return wt(this,"entries",t=>(t[1]=O(this,t[1]),t))},every(t,e){return R(this,"every",t,e,void 0,arguments)},filter(t,e){return R(this,"filter",t,e,n=>n.map(r=>O(this,r)),arguments)},find(t,e){return R(this,"find",t,e,n=>O(this,n),arguments)},findIndex(t,e){return R(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return R(this,"findLast",t,e,n=>O(this,n),arguments)},findLastIndex(t,e){return R(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return R(this,"forEach",t,e,void 0,arguments)},includes(...t){return Nt(this,"includes",t)},indexOf(...t){return Nt(this,"indexOf",t)},join(t){return j(this).join(t)},lastIndexOf(...t){return Nt(this,"lastIndexOf",t)},map(t,e){return R(this,"map",t,e,void 0,arguments)},pop(){return q(this,"pop")},push(...t){return q(this,"push",t)},reduce(t,...e){return zt(this,"reduce",t,e)},reduceRight(t,...e){return zt(this,"reduceRight",t,e)},shift(){return q(this,"shift")},some(t,e){return R(this,"some",t,e,void 0,arguments)},splice(...t){return q(this,"splice",t)},toReversed(){return j(this).toReversed()},toSorted(t){return j(this).toSorted(t)},toSpliced(...t){return j(this).toSpliced(...t)},unshift(...t){return q(this,"unshift",t)},values(){return wt(this,"values",t=>O(this,t))}};function wt(t,e,n){const r=Ot(t),s=r[e]();return r!==t&&!S(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const je=Array.prototype;function R(t,e,n,r,s,i){const o=Ot(t),c=o!==t&&!S(t),l=o[e];if(l!==je[e]){const a=l.apply(t,i);return c?C(a):a}let u=n;o!==t&&(c?u=function(a,f){return n.call(this,O(t,a),f,t)}:n.length>2&&(u=function(a,f){return n.call(this,a,f,t)}));const p=l.call(o,u,r);return c&&s?s(p):p}function zt(t,e,n,r){const s=Ot(t),i=s!==t&&!S(t);let o=n,c=!1;s!==t&&(i?(c=r.length===0,o=function(u,p,a){return c&&(c=!1,u=O(t,u)),n.call(this,u,O(t,p),a,t)}):n.length>3&&(o=function(u,p,a){return n.call(this,u,p,a,t)}));const l=s[e](o,...r);return c?O(t,l):l}function Nt(t,e,n){const r=h(t);g(r,"iterate",U);const s=r[e](...n);return(s===-1||s===!1)&&B(n[0])?(n[0]=h(n[0]),r[e](...n)):s}function q(t,e,n=[]){et(),St();const r=h(t)[e].apply(t,n);return yt(),nt(),r}const Ke=Re("__proto__,__v_isRef,__isVue"),Ut=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(x));function He(t){x(t)||(t=String(t));const e=h(this);return g(e,"has",t),e.hasOwnProperty(t)}class qt{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Qe:Gt:i?Ge:Yt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=_(e);if(!s){let l;if(o&&(l=ke[n]))return l;if(n==="hasOwnProperty")return He}const c=Reflect.get(e,n,m(e)?e:r);if((x(n)?Ut.has(n):Ke(n))||(s||g(e,"get",n),i))return c;if(m(c)){const l=o&&X(n)?c:c.value;return s&&b(l)?Rt(l):l}return b(c)?s?Rt(c):Qt(c):c}}class Le extends qt{constructor(e=!1){super(!1,e)}set(e,n,r,s){let i=e[n];const o=_(e)&&X(n);if(!this._isShallow){const u=w(i);if(!S(r)&&!w(r)&&(i=h(i),r=h(r)),!o&&m(i)&&!m(r))return u?(process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=r,!0)}const c=o?Number(n)<e.length:_t(e,n),l=Reflect.set(e,n,r,m(e)?e:s);return e===h(s)&&l&&(c?T(r,i)&&$(e,"set",n,r,i):$(e,"add",n,r)),l}deleteProperty(e,n){const r=_t(e,n),s=e[n],i=Reflect.deleteProperty(e,n);return i&&r&&$(e,"delete",n,void 0,s),i}has(e,n){const r=Reflect.has(e,n);return(!x(n)||!Ut.has(n))&&g(e,"has",n),r}ownKeys(e){return g(e,"iterate",_(e)?"length":M),Reflect.ownKeys(e)}}class We extends qt{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&k(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const ze=new Le,Ue=new We,vt=t=>t,rt=t=>Reflect.getPrototypeOf(t);function qe(t,e,n){return function(...r){const s=this.__v_raw,i=h(s),o=z(i),c=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,u=s[t](...r),p=n?vt:e?J:C;return!e&&g(i,"iterate",l?Et:M),V(Object.create(u),{next(){const{value:a,done:f}=u.next();return f?{value:a,done:f}:{value:c?[p(a[0]),p(a[1])]:p(a),done:f}}})}}function it(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";k(`${De(t)} operation ${n}failed: target is readonly.`,h(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function Be(t,e){const n={get(s){const i=this.__v_raw,o=h(i),c=h(s);t||(T(s,c)&&g(o,"get",s),g(o,"get",c));const{has:l}=rt(o),u=e?vt:t?J:C;if(l.call(o,s))return u(i.get(s));if(l.call(o,c))return u(i.get(c));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!t&&g(h(s),"iterate",M),s.size},has(s){const i=this.__v_raw,o=h(i),c=h(s);return t||(T(s,c)&&g(o,"has",s),g(o,"has",c)),s===c?i.has(s):i.has(s)||i.has(c)},forEach(s,i){const o=this,c=o.__v_raw,l=h(c),u=e?vt:t?J:C;return!t&&g(l,"iterate",M),c.forEach((p,a)=>s.call(i,u(p),u(a),o))}};return V(n,t?{add:it("add"),set:it("set"),delete:it("delete"),clear:it("clear")}:{add(s){const i=h(this),o=rt(i),c=h(s),l=!e&&!S(s)&&!w(s)?c:s;return o.has.call(i,l)||T(s,l)&&o.has.call(i,s)||T(c,l)&&o.has.call(i,c)||(i.add(l),$(i,"add",l,l)),this},set(s,i){!e&&!S(i)&&!w(i)&&(i=h(i));const o=h(this),{has:c,get:l}=rt(o);let u=c.call(o,s);u?process.env.NODE_ENV!=="production"&&Jt(o,c,s):(s=h(s),u=c.call(o,s));const p=l.call(o,s);return o.set(s,i),u?T(i,p)&&$(o,"set",s,i,p):$(o,"add",s,i),this},delete(s){const i=h(this),{has:o,get:c}=rt(i);let l=o.call(i,s);l?process.env.NODE_ENV!=="production"&&Jt(i,o,s):(s=h(s),l=o.call(i,s));const u=c?c.call(i,s):void 0,p=i.delete(s);return l&&$(i,"delete",s,void 0,u),p},clear(){const s=h(this),i=s.size!==0,o=process.env.NODE_ENV!=="production"?z(s)?new Map(s):new Set(s):void 0,c=s.clear();return i&&$(s,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=qe(s,t,e)}),n}function Bt(t,e){const n=Be(t,e);return(r,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?r:Reflect.get(_t(n,s)&&s in r?n:r,s,i)}const Je={get:Bt(!1,!1)},Ye={get:Bt(!0,!1)};function Jt(t,e,n){const r=h(n);if(r!==n&&e.call(t,r)){const s=jt(t);k(`Reactive ${s} contains both the raw and reactive versions of the same object${s==="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 Yt=new WeakMap,Ge=new WeakMap,Gt=new WeakMap,Qe=new WeakMap;function Xe(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Qt(t){return w(t)?t:Xt(t,!1,ze,Je,Yt)}function Rt(t){return Xt(t,!0,Ue,Ye,Gt)}function Xt(t,e,n,r,s){if(!b(t))return process.env.NODE_ENV!=="production"&&k(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const i=s.get(t);if(i)return i;const o=Xe(jt(t));if(o===0)return t;const c=new Proxy(t,o===2?r:n);return s.set(t,c),c}function Ct(t){return w(t)?Ct(t.__v_raw):!!(t&&t.__v_isReactive)}function w(t){return!!(t&&t.__v_isReadonly)}function S(t){return!!(t&&t.__v_isShallow)}function B(t){return t?!!t.__v_raw:!1}function h(t){const e=t&&t.__v_raw;return e?h(e):t}const C=t=>b(t)?Qt(t):t,J=t=>b(t)?Rt(t):t;function m(t){return t?t.__v_isRef===!0:!1}function Zt(t){return Ze(t,!1)}function Ze(t,e){return m(t)?t:new tn(t,e)}class tn{constructor(e,n){this.dep=new Wt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:h(e),this._value=n?e:C(e),this.__v_isShallow=n}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 n=this._rawValue,r=this.__v_isShallow||S(e)||w(e);e=r?e:h(e),T(e,n)&&(this._rawValue=e,this._value=r?e:C(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function en(t){return m(t)?t.value:t}class nn{constructor(e,n,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=x(n)?n:String(n),this._raw=h(e);let s=!0,i=e;if(!_(e)||x(this._key)||!X(this._key))do s=!B(i)||S(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=en(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&m(this._raw[this._key])){const n=this._object[this._key];if(m(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return Fe(this._raw,this._key)}}class sn{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 rn(t,e,n){return m(t)?t:I(t)?new sn(t):b(t)&&arguments.length>1?on(t,e,n):Zt(t)}function on(t,e,n){return new nn(t,e,n)}const P=[];function cn(t){P.push(t)}function an(){P.pop()}let At=!1;function K(t,...e){if(At)return;At=!0,et();const n=P.length?P[P.length-1].component:null,r=n&&n.appContext.config.warnHandler,s=ln();if(r)It(r,n,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(""),n&&n.proxy,s.map(({vnode:i})=>`at <${_e(n,i.type)}>`).join(`
2
2
  `),s]);else{const i=[`[Vue warn]: ${t}`,...e];s.length&&i.push(`
3
- `,...ln(s)),console.warn(...i)}nt(),At=!1}function cn(){let t=P[P.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function ln(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
4
- `],...un(n))}),e}function un({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,s=` at <${_e(t.component,t.type,r)}`,i=">"+n;return t.props?[s,...an(t.props),i]:[s+i]}function an(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...te(r,t[r]))}),n.length>3&&e.push(" ..."),e}function te(t,e,n){return v(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:m(e)?(e=te(t,p(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):I(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=p(e),n?e:[`${t}=`,e])}const ee={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 It(t,e,n,r){try{return r?t(...r):t()}catch(s){ne(s,e,n)}}function ne(t,e,n,r=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||dt;if(e){let c=e.parent;const u=e.proxy,a=process.env.NODE_ENV!=="production"?ee[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const h=c.ec;if(h){for(let l=0;l<h.length;l++)if(h[l](t,u,a)===!1)return}c=c.parent}if(i){et(),It(i,null,10,[t,u,a]),nt();return}}fn(t,n,s,r,o)}function fn(t,e,n,r=!0,s=!1){if(process.env.NODE_ENV!=="production"){const i=ee[e];if(n&&rn(n),K(`Unhandled error${i?` during execution of ${i}`:""}`),n&&on(),r)throw t;console.error(t)}else{if(s)throw t;console.error(t)}}const y=[];let A=-1;const H=[];let D=null,L=0;const pn=Promise.resolve();let $t=null;const hn=100;function dn(t){let e=A+1,n=y.length;for(;e<n;){const r=e+n>>>1,s=y[r],i=Y(s);i<t||i===t&&s.flags&2?e=r+1:n=r}return e}function _n(t){if(!(t.flags&1)){const e=Y(t),n=y[y.length-1];!n||!(t.flags&2)&&e>=Y(n)?y.push(t):y.splice(dn(e),0,t),t.flags|=1,se()}}function se(){$t||($t=pn.then(re))}function gn(t){_(t)?H.push(...t):D&&t.id===-1?D.splice(L+1,0,t):t.flags&1||(H.push(t),t.flags|=1),se()}function bn(t){if(H.length){const e=[...new Set(H)].sort((n,r)=>Y(n)-Y(r));if(H.length=0,D){D.push(...e);return}for(D=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),L=0;L<D.length;L++){const n=D[L];process.env.NODE_ENV!=="production"&&ie(t,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}D=null,L=0}}const Y=t=>t.id==null?t.flags&2?-1:1/0:t.id;function re(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?n=>ie(t,n):Ft;try{for(A=0;A<y.length;A++){const n=y[A];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&e(n))continue;n.flags&4&&(n.flags&=-2),It(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;A<y.length;A++){const n=y[A];n&&(n.flags&=-2)}A=-1,y.length=0,bn(t),$t=null,(y.length||H.length)&&re(t)}}function ie(t,e){const n=t.get(e)||0;if(n>hn){const r=e.i,s=r&&de(r.type);return ne(`Maximum recursive updates exceeded${s?` in component <${s}>`:""}. 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,n+1),!1}const Dt=new Map;process.env.NODE_ENV!=="production"&&(Z().__VUE_HMR_RUNTIME__={createRecord:Vt(mn),rerender:Vt(Sn),reload:Vt(yn)});const ot=new Map;function mn(t,e){return ot.has(t)?!1:(ot.set(t,{initialDef:ct(e),instances:new Set}),!0)}function ct(t){return ge(t)?t.__vccOpts:t}function Sn(t,e){const n=ot.get(t);n&&(n.initialDef.render=e,[...n.instances].forEach(r=>{e&&(r.render=e,ct(r.type).render=e),r.renderCache=[],r.job.flags&8||r.update()}))}function yn(t,e){const n=ot.get(t);if(!n)return;e=ct(e),oe(n.initialDef,e);const r=[...n.instances];for(let s=0;s<r.length;s++){const i=r[s],o=ct(i.type);let c=Dt.get(o);c||(o!==n.initialDef&&oe(o,e),Dt.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?_n(()=>{i.job.flags&8||(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)}gn(()=>{Dt.clear()})}function oe(t,e){V(t,e);for(const n in t)n!=="__file"&&!(n in e)&&delete t[n]}function Vt(t){return(e,n)=>{try{return t(e,n)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let W,lt=[];function ce(t,e){var n,r;W=t,W?(W.enabled=!0,lt.forEach(({event:s,args:i})=>W.emit(s,...i)),lt=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{ce(i,e)}),setTimeout(()=>{W||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,lt=[])},3e3)):lt=[]}let ut=null,En=null;const On=t=>t.__isTeleport;function le(t,e){t.shapeFlag&6&&t.component?(t.transition=e,le(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}Z().requestIdleCallback,Z().cancelIdleCallback;const wn=Symbol.for("v-ndc"),Nn={};process.env.NODE_ENV!=="production"&&(Nn.ownKeys=t=>(K("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 vn={},ue=t=>Object.getPrototypeOf(t)===vn,Rn=t=>t.__isSuspense,ae=Symbol.for("v-fgt"),Cn=Symbol.for("v-txt"),An=Symbol.for("v-cmt");function In(t){return t?t.__v_isVNode===!0:!1}const $n=(...t)=>pe(...t),fe=({key:t})=>t??null,at=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?v(t)||m(t)||I(t)?{i:ut,r:t,k:e,f:!!n}:t:null);function Dn(t,e=null,n=null,r=0,s=null,i=t===ae?0:1,o=!1,c=!1){const u={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&fe(e),ref:e&&at(e),scopeId:En,slotScopeIds:null,children:n,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:s,dynamicChildren:null,appContext:null,ctx:ut};return c?(pt(u,n),i&128&&t.normalize(u)):n&&(u.shapeFlag|=v(n)?8:16),process.env.NODE_ENV!=="production"&&u.key!==u.key&&K("VNode created with invalid key (NaN). VNode type:",u.type),u}const Vn=process.env.NODE_ENV!=="production"?$n:pe;function pe(t,e=null,n=null,r=0,s=null,i=!1){if((!t||t===wn)&&(process.env.NODE_ENV!=="production"&&!t&&K(`Invalid vnode type when creating vnode: ${t}.`),t=An),In(t)){const c=ft(t,e,!0);return n&&pt(c,n),c.patchFlag=-2,c}if(ge(t)&&(t=t.__vccOpts),e){e=xn(e);let{class:c,style:u}=e;c&&!v(c)&&(e.class=bt(c)),b(u)&&(B(u)&&!_(u)&&(u=V({},u)),e.style=gt(u))}const o=v(t)?1:Rn(t)?128:On(t)?64:b(t)?4:I(t)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&B(t)&&(t=p(t),K("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`.",`
5
- Component that was made reactive: `,t)),Dn(t,e,n,r,s,o,i,!0)}function xn(t){return t?B(t)||ue(t)?V({},t):t:null}function ft(t,e,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:c,transition:u}=t,a=e?Mn(s||{},e):s,h={__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&fe(a),ref:e&&e.ref?n&&i?_(i)?i.concat(at(e)):[i,at(e)]:at(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&_(c)?c.map(he):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ae?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:u,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&ft(t.ssContent),ssFallback:t.ssFallback&&ft(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return u&&r&&le(h,u.clone(h)),h}function he(t){const e=ft(t);return _(t.children)&&(e.children=t.children.map(he)),e}function Tn(t=" ",e=0){return Vn(Cn,null,t,e)}function pt(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(_(e))n=16;else if(typeof e=="object")if(r&65){const s=e.default;s&&(s._c&&(s._d=!1),pt(t,s()),s._c&&(s._d=!0));return}else n=32,!e._&&!ue(e)&&(e._ctx=ut);else if(I(e)){if(r&65){pt(t,{default:e});return}e={default:e,_ctx:ut},n=32}else e=String(e),r&64?(n=16,e=[Tn(e)]):n=8;t.children=e,t.shapeFlag|=n}function Mn(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const s in r)if(s==="class")e.class!==r.class&&(e.class=bt([e.class,r.class]));else if(s==="style")e.style=gt([e.style,r.style]);else if(ve(s)){const i=e[s],o=r[s];o&&i!==o&&!(_(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Re(s)&&(e[s]=o)}else s!==""&&(e[s]=r[s])}return e}{const t=Z(),e=(n,r)=>{let s;return(s=t[n])||(s=t[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};e("__VUE_INSTANCE_SETTERS__",n=>n),e("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const Pn=/(?:^|[-_])\w/g,Fn=t=>t.replace(Pn,e=>e.toUpperCase()).replace(/[-_]/g,"");function de(t,e=!0){return I(t)?t.displayName||t.name:t.name||e&&t.__name}function _e(t,e,n=!1){let r=de(e);if(!r&&e.__file){const s=e.__file.match(/([^/\\]+)\.\w+$/);s&&(r=s[1])}if(!r&&t){const s=i=>{for(const o in i)if(i[o]===e)return o};r=s(t.components)||t.parent&&s(t.parent.type.components)||s(t.appContext.components)}return r?Fn(r):n?"App":"Anonymous"}function ge(t){return I(t)&&"__vccOpts"in t}function kn(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},s={__vue_custom_formatter:!0,header(l){if(!b(l))return null;if(l.__isVue)return["div",t,"VueInstance"];if(m(l)){et();const f=l.value;return nt(),["div",{},["span",t,h(l)],"<",c(f),">"]}else{if(Ct(l))return["div",{},["span",t,S(l)?"ShallowReactive":"Reactive"],"<",c(l),`>${w(l)?" (readonly)":""}`];if(w(l))return["div",{},["span",t,S(l)?"ShallowReadonly":"Readonly"],"<",c(l),">"]}return null},hasBody(l){return l&&l.__isVue},body(l){if(l&&l.__isVue)return["div",{},...i(l.$)]}};function i(l){const f=[];l.type.props&&l.props&&f.push(o("props",p(l.props))),l.setupState!==dt&&f.push(o("setup",l.setupState)),l.data!==dt&&f.push(o("data",p(l.data)));const E=u(l,"computed");E&&f.push(o("computed",E));const N=u(l,"inject");return N&&f.push(o("injected",N)),f.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:l}]]),f}function o(l,f){return f=V({},f),Object.keys(f).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},l],["div",{style:"padding-left:1.25em"},...Object.keys(f).map(E=>["div",{},["span",r,E+": "],c(f[E],!1)])]]:["span",{}]}function c(l,f=!0){return typeof l=="number"?["span",e,l]:typeof l=="string"?["span",n,JSON.stringify(l)]:typeof l=="boolean"?["span",r,l]:b(l)?["object",{object:f?p(l):l}]:["span",n,String(l)]}function u(l,f){const E=l.type;if(I(E))return;const N={};for(const G in l.ctx)a(E,G,f)&&(N[G]=l.ctx[G]);return N}function a(l,f,E){const N=l[E];if(_(N)&&N.includes(f)||b(N)&&f in N||l.extends&&a(l.extends,f,E)||l.mixins&&l.mixins.some(G=>a(G,f,E)))return!0}function h(l){return S(l)?"ShallowRef":l.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(s):window.devtoolsFormatters=[s]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function jn(){kn()}process.env.NODE_ENV!=="production"&&jn();const be=new WeakMap,me=new Map;function Kn(t,e,n){const r=n?{storeOptions:n}:{};return typeof e=="function"?Hn(t,e,r):Ln(t,e,r)}function Hn(t,e,n){const r={id:t,extensions:{}};me.set(t,r);const s=F.defineStore(t,()=>e(r),n);return Object.assign(((...i)=>{const o=s(...i);return be.set(o,r),o}),s)}function Ln(t,e,n){return n&&(e={...e,...n??{}}),F.defineStore(t,e)}const Wn=new Set(["_","$"]);function zn(t){return Wn.has(t[0])}function Un(t){return be.get(t)??(typeof t?.$id=="string"?me.get(t.$id):void 0)}function qn(t){return t.extensions.extending}class Bn extends xt{_className="Store";_onAction;_options;_store;_subscriptions={};_storeSubscribe;static _requiredKeys;get onAction(){if(this._onAction)return()=>({store:this.store,callback:this._onAction})}set onAction(e){this._onAction=e}get options(){return this._options}get state(){return this._store.$state}set state(e){this._store.$state=e}get store(){return this._store}get storeSubscribe(){if(this._storeSubscribe)return()=>({store:this.store,callback:this._storeSubscribe})}set storeSubscribe(e){this._storeSubscribe=e}constructor(e,n,r=!1,s){super(r,s),this._options=n.storeOptions,this._store=e}addToState(e,n){this.isOptionApi()||n?.value||(n=Zt(n)),this.state[e]=n,this.store[e]=nn(this.state,e)}addSubscription(e,n,r){this._subscriptions[e]={subscription:n,...r??{}}}static customizeStore(e,n,r=!1,s){if(n.storeOptions&&this.hasRequiredKeys(n.storeOptions))return new this(e,n,r,s)}hasDeniedFirstChar(e){return zn(e[0])}static hasRequiredKeys(e){return this._requiredKeys!==void 0&&this._requiredKeys?.every(n=>!!e[n])}getOption(e){return this.options&&this.options[e]}getStatePropertyValue(e){return this.getValue(this.state[e])}getSubscriptions(){if(!Q(this._subscriptions))return this._subscriptions}getValue(e){return 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)}}function Jn(t,e){const n=new Pt(t,e);return n.plugin.bind(n)}d.CustomConsole=Tt,d.PLUGIN_NAME=ht,d.PluginSubscriber=Se,d.PluginSubscription=Pt,d.Store=Bn,d.createPlugin=Jn,d.defineAStore=Kn,d.getDefineAStoreSetupContext=Un,d.getExtendingStore=qn,d.isEmpty=Q,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
3
+ `,...un(s)),console.warn(...i)}nt(),At=!1}function ln(){let t=P[P.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function un(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
4
+ `],...fn(n))}),e}function fn({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,s=` at <${_e(t.component,t.type,r)}`,i=">"+n;return t.props?[s,...hn(t.props),i]:[s+i]}function hn(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...te(r,t[r]))}),n.length>3&&e.push(" ..."),e}function te(t,e,n){return v(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:m(e)?(e=te(t,h(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):I(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=h(e),n?e:[`${t}=`,e])}const ee={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 It(t,e,n,r){try{return r?t(...r):t()}catch(s){ne(s,e,n)}}function ne(t,e,n,r=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||dt;if(e){let c=e.parent;const l=e.proxy,u=process.env.NODE_ENV!=="production"?ee[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const p=c.ec;if(p){for(let a=0;a<p.length;a++)if(p[a](t,l,u)===!1)return}c=c.parent}if(i){et(),It(i,null,10,[t,l,u]),nt();return}}pn(t,n,s,r,o)}function pn(t,e,n,r=!0,s=!1){if(process.env.NODE_ENV!=="production"){const i=ee[e];if(n&&cn(n),K(`Unhandled error${i?` during execution of ${i}`:""}`),n&&an(),r)throw t;console.error(t)}else{if(s)throw t;console.error(t)}}const y=[];let A=-1;const H=[];let D=null,L=0;const dn=Promise.resolve();let $t=null;const _n=100;function gn(t){let e=A+1,n=y.length;for(;e<n;){const r=e+n>>>1,s=y[r],i=Y(s);i<t||i===t&&s.flags&2?e=r+1:n=r}return e}function bn(t){if(!(t.flags&1)){const e=Y(t),n=y[y.length-1];!n||!(t.flags&2)&&e>=Y(n)?y.push(t):y.splice(gn(e),0,t),t.flags|=1,se()}}function se(){$t||($t=dn.then(re))}function mn(t){_(t)?H.push(...t):D&&t.id===-1?D.splice(L+1,0,t):t.flags&1||(H.push(t),t.flags|=1),se()}function Sn(t){if(H.length){const e=[...new Set(H)].sort((n,r)=>Y(n)-Y(r));if(H.length=0,D){D.push(...e);return}for(D=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),L=0;L<D.length;L++){const n=D[L];process.env.NODE_ENV!=="production"&&ie(t,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}D=null,L=0}}const Y=t=>t.id==null?t.flags&2?-1:1/0:t.id;function re(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?n=>ie(t,n):Ft;try{for(A=0;A<y.length;A++){const n=y[A];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&e(n))continue;n.flags&4&&(n.flags&=-2),It(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;A<y.length;A++){const n=y[A];n&&(n.flags&=-2)}A=-1,y.length=0,Sn(t),$t=null,(y.length||H.length)&&re(t)}}function ie(t,e){const n=t.get(e)||0;if(n>_n){const r=e.i,s=r&&de(r.type);return ne(`Maximum recursive updates exceeded${s?` in component <${s}>`:""}. 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,n+1),!1}const Dt=new Map;process.env.NODE_ENV!=="production"&&(Z().__VUE_HMR_RUNTIME__={createRecord:Vt(yn),rerender:Vt(En),reload:Vt(On)});const ot=new Map;function yn(t,e){return ot.has(t)?!1:(ot.set(t,{initialDef:ct(e),instances:new Set}),!0)}function ct(t){return ge(t)?t.__vccOpts:t}function En(t,e){const n=ot.get(t);n&&(n.initialDef.render=e,[...n.instances].forEach(r=>{e&&(r.render=e,ct(r.type).render=e),r.renderCache=[],r.job.flags&8||r.update()}))}function On(t,e){const n=ot.get(t);if(!n)return;e=ct(e),oe(n.initialDef,e);const r=[...n.instances];for(let s=0;s<r.length;s++){const i=r[s],o=ct(i.type);let c=Dt.get(o);c||(o!==n.initialDef&&oe(o,e),Dt.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?bn(()=>{i.job.flags&8||(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)}mn(()=>{Dt.clear()})}function oe(t,e){V(t,e);for(const n in t)n!=="__file"&&!(n in e)&&delete t[n]}function Vt(t){return(e,n)=>{try{return t(e,n)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let W,at=[];function ce(t,e){var n,r;W=t,W?(W.enabled=!0,at.forEach(({event:s,args:i})=>W.emit(s,...i)),at=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{ce(i,e)}),setTimeout(()=>{W||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,at=[])},3e3)):at=[]}let lt=null,wn=null;const Nn=t=>t.__isTeleport;function ae(t,e){t.shapeFlag&6&&t.component?(t.transition=e,ae(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}Z().requestIdleCallback,Z().cancelIdleCallback;const vn=Symbol.for("v-ndc"),Rn={};process.env.NODE_ENV!=="production"&&(Rn.ownKeys=t=>(K("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 Cn={},le=t=>Object.getPrototypeOf(t)===Cn,An=t=>t.__isSuspense,ue=Symbol.for("v-fgt"),In=Symbol.for("v-txt"),$n=Symbol.for("v-cmt");function Dn(t){return t?t.__v_isVNode===!0:!1}const Vn=(...t)=>he(...t),fe=({key:t})=>t??null,ut=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?v(t)||m(t)||I(t)?{i:lt,r:t,k:e,f:!!n}:t:null);function xn(t,e=null,n=null,r=0,s=null,i=t===ue?0:1,o=!1,c=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&fe(e),ref:e&&ut(e),scopeId:wn,slotScopeIds:null,children:n,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:s,dynamicChildren:null,appContext:null,ctx:lt};return c?(ht(l,n),i&128&&t.normalize(l)):n&&(l.shapeFlag|=v(n)?8:16),process.env.NODE_ENV!=="production"&&l.key!==l.key&&K("VNode created with invalid key (NaN). VNode type:",l.type),l}const Tn=process.env.NODE_ENV!=="production"?Vn:he;function he(t,e=null,n=null,r=0,s=null,i=!1){if((!t||t===vn)&&(process.env.NODE_ENV!=="production"&&!t&&K(`Invalid vnode type when creating vnode: ${t}.`),t=$n),Dn(t)){const c=ft(t,e,!0);return n&&ht(c,n),c.patchFlag=-2,c}if(ge(t)&&(t=t.__vccOpts),e){e=Mn(e);let{class:c,style:l}=e;c&&!v(c)&&(e.class=bt(c)),b(l)&&(B(l)&&!_(l)&&(l=V({},l)),e.style=gt(l))}const o=v(t)?1:An(t)?128:Nn(t)?64:b(t)?4:I(t)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&B(t)&&(t=h(t),K("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`.",`
5
+ Component that was made reactive: `,t)),xn(t,e,n,r,s,o,i,!0)}function Mn(t){return t?B(t)||le(t)?V({},t):t:null}function ft(t,e,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:c,transition:l}=t,u=e?Fn(s||{},e):s,p={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&fe(u),ref:e&&e.ref?n&&i?_(i)?i.concat(ut(e)):[i,ut(e)]:ut(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&_(c)?c.map(pe):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ue?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&ft(t.ssContent),ssFallback:t.ssFallback&&ft(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&ae(p,l.clone(p)),p}function pe(t){const e=ft(t);return _(t.children)&&(e.children=t.children.map(pe)),e}function Pn(t=" ",e=0){return Tn(In,null,t,e)}function ht(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(_(e))n=16;else if(typeof e=="object")if(r&65){const s=e.default;s&&(s._c&&(s._d=!1),ht(t,s()),s._c&&(s._d=!0));return}else n=32,!e._&&!le(e)&&(e._ctx=lt);else if(I(e)){if(r&65){ht(t,{default:e});return}e={default:e,_ctx:lt},n=32}else e=String(e),r&64?(n=16,e=[Pn(e)]):n=8;t.children=e,t.shapeFlag|=n}function Fn(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const s in r)if(s==="class")e.class!==r.class&&(e.class=bt([e.class,r.class]));else if(s==="style")e.style=gt([e.style,r.style]);else if(Ce(s)){const i=e[s],o=r[s];o&&i!==o&&!(_(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Ae(s)&&(e[s]=o)}else s!==""&&(e[s]=r[s])}return e}{const t=Z(),e=(n,r)=>{let s;return(s=t[n])||(s=t[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};e("__VUE_INSTANCE_SETTERS__",n=>n),e("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const kn=/(?:^|[-_])\w/g,jn=t=>t.replace(kn,e=>e.toUpperCase()).replace(/[-_]/g,"");function de(t,e=!0){return I(t)?t.displayName||t.name:t.name||e&&t.__name}function _e(t,e,n=!1){let r=de(e);if(!r&&e.__file){const s=e.__file.match(/([^/\\]+)\.\w+$/);s&&(r=s[1])}if(!r&&t){const s=i=>{for(const o in i)if(i[o]===e)return o};r=s(t.components)||t.parent&&s(t.parent.type.components)||s(t.appContext.components)}return r?jn(r):n?"App":"Anonymous"}function ge(t){return I(t)&&"__vccOpts"in t}function Kn(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},s={__vue_custom_formatter:!0,header(a){if(!b(a))return null;if(a.__isVue)return["div",t,"VueInstance"];if(m(a)){et();const f=a.value;return nt(),["div",{},["span",t,p(a)],"<",c(f),">"]}else{if(Ct(a))return["div",{},["span",t,S(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${w(a)?" (readonly)":""}`];if(w(a))return["div",{},["span",t,S(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 f=[];a.type.props&&a.props&&f.push(o("props",h(a.props))),a.setupState!==dt&&f.push(o("setup",a.setupState)),a.data!==dt&&f.push(o("data",h(a.data)));const E=l(a,"computed");E&&f.push(o("computed",E));const N=l(a,"inject");return N&&f.push(o("injected",N)),f.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),f}function o(a,f){return f=V({},f),Object.keys(f).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},a],["div",{style:"padding-left:1.25em"},...Object.keys(f).map(E=>["div",{},["span",r,E+": "],c(f[E],!1)])]]:["span",{}]}function c(a,f=!0){return typeof a=="number"?["span",e,a]:typeof a=="string"?["span",n,JSON.stringify(a)]:typeof a=="boolean"?["span",r,a]:b(a)?["object",{object:f?h(a):a}]:["span",n,String(a)]}function l(a,f){const E=a.type;if(I(E))return;const N={};for(const G in a.ctx)u(E,G,f)&&(N[G]=a.ctx[G]);return N}function u(a,f,E){const N=a[E];if(_(N)&&N.includes(f)||b(N)&&f in N||a.extends&&u(a.extends,f,E)||a.mixins&&a.mixins.some(G=>u(G,f,E)))return!0}function p(a){return S(a)?"ShallowRef":a.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(s):window.devtoolsFormatters=[s]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Hn(){Kn()}process.env.NODE_ENV!=="production"&&Hn();const be=new WeakMap,me=new Map;function Ln(t,e,n){const r=n?{storeOptions:n}:{};return typeof e=="function"?Se(t,e,r):zn(t,e,r)}function Wn(t,e,n){return Se(t,e,n?{storeOptions:n}:{})}function Se(t,e,n){const r={id:t,extensions:{}};me.set(t,r);const s=F.defineStore(t,()=>e(r),n);return Object.assign(((...i)=>{const o=s(...i);return be.set(o,r),o}),s)}function zn(t,e,n){return n&&(e={...e,...n??{}}),F.defineStore(t,e)}const Un=new Set(["_","$"]);function qn(t){return Un.has(t[0])}function Bn(t){return be.get(t)??(typeof t?.$id=="string"?me.get(t.$id):void 0)}function ye(t){const e=t.extensions.enhancedStore??t.extensions.extending;if(!e)throw new Error(`${t.id}Store - getEnhancedStore - Error: enhanced store is required`);return e}function Jn(t,e){t.extensions.enhancedStore=e,t.extensions.extending=e}function Yn(t){return ye(t)}class Gn extends xt{_className="Store";_onAction;_options;_store;_subscriptions={};_storeSubscribe;static _requiredKeys;get onAction(){if(this._onAction)return()=>({store:this.store,callback:this._onAction})}set onAction(e){this._onAction=e}get options(){return this._options}get state(){return this._store.$state}set state(e){this._store.$state=e}get store(){return this._store}get storeSubscribe(){if(this._storeSubscribe)return()=>({store:this.store,callback:this._storeSubscribe})}set storeSubscribe(e){this._storeSubscribe=e}constructor(e,n,r=!1,s){super(r,s),this._options=n.storeOptions,this._store=e}addToState(e,n){this.isOptionApi()||n?.value||(n=Zt(n)),this.state[e]=n,this.store[e]=rn(this.state,e)}addSubscription(e,n,r){this._subscriptions[e]={subscription:n,...r??{}}}static customizeStore(e,n,r=!1,s){if(n.storeOptions&&this.hasRequiredKeys(n.storeOptions))return new this(e,n,r,s)}hasDeniedFirstChar(e){return qn(e[0])}static hasRequiredKeys(e){return this._requiredKeys!==void 0&&this._requiredKeys?.every(n=>!!e[n])}getOption(e){return this.options&&this.options[e]}getStatePropertyValue(e){return this.getValue(this.state[e])}getSubscriptions(){if(!Q(this._subscriptions))return this._subscriptions}getValue(e){return 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)}}function Qn(t,e){const n=new Pt(t,e);return n.plugin.bind(n)}d.CustomConsole=Tt,d.PLUGIN_NAME=pt,d.PluginSubscriber=Ee,d.PluginSubscription=Pt,d.Store=Gn,d.createPlugin=Qn,d.defineAStore=Ln,d.defineAStoreCtx=Wn,d.getDefineAStoreSetupContext=Bn,d.getEnhancedStore=ye,d.getExtendingStore=Yn,d.isEmpty=Q,d.setEnhancedStore=Jn,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
@@ -1,7 +1,7 @@
1
1
  import type { DefineStoreOptions, PiniaCustomProperties, PiniaPlugin, PiniaPluginContext, StateTree, Store as PiniaStore, SubscriptionCallbackMutation, StoreDefinition } from "pinia";
2
2
  import type { Ref } from "vue";
3
3
  export interface AnyObject {
4
- [key: number | string | symbol]: any;
4
+ [key: number | string | symbol]: OptionBaseProperty | OptionBaseProperty[] | ObjectBaseProperty | ObjectBaseProperty[];
5
5
  }
6
6
  export interface SearchCollectionCriteria {
7
7
  [key: number | string | symbol]: boolean | number | string;
@@ -10,10 +10,6 @@ export interface Console {
10
10
  log(...args: any): void;
11
11
  error(...args: any): void;
12
12
  }
13
- export interface DefineAStoreSetupContext {
14
- id: string;
15
- extensions: Record<string, unknown>;
16
- }
17
13
  export type LogType = 'error' | 'info';
18
14
  export type StyleDefinitionKeys = 'bgColor' | 'color' | 'icon';
19
15
  export type StyleDefinition = Record<StyleDefinitionKeys, string>;
@@ -28,9 +24,17 @@ export type CustomStore<TStore, TState> = PiniaStore & TStore & TState & PiniaCu
28
24
  export interface PluginStoreOptions {
29
25
  storeOptions: StoreOptions;
30
26
  }
31
- export interface DefineAStoreSetupContext {
27
+ export type EmptyExtensions = Record<never, never>;
28
+ export interface DefineAStoreSetupExtensions<TEnhancedStore> {
29
+ /**
30
+ * @deprecated Use enhancedStore instead.
31
+ */
32
+ extending?: TEnhancedStore;
33
+ enhancedStore?: TEnhancedStore;
34
+ }
35
+ export interface DefineAStoreSetupContext<TEnhancedStore, TExtraExtensions extends Record<string, unknown> = EmptyExtensions> {
32
36
  id: string;
33
- extensions: Record<string, unknown>;
37
+ extensions: DefineAStoreSetupExtensions<TEnhancedStore> & TExtraExtensions;
34
38
  }
35
39
  export type StatePropertyValue = StdStatePropertyValue | Ref<StdStatePropertyValue> | StdStatePropertyValue[] | Ref<StdStatePropertyValue[]> | Ref<StdStatePropertyValue>[];
36
40
  export type StoreOptions = Record<string, StoreOptionsPropertyValue>;
@@ -67,11 +71,16 @@ export type StoreMutationSubscription = NativePiniaSubscription<StoreMutationSub
67
71
  export declare const PLUGIN_NAME: string;
68
72
  export declare function createPlugin(subscribers: PluginSubscriberInterface[], debug?: string[]): PiniaPlugin;
69
73
  export declare function defineAStore<Sto, Sta>(id: string, storeDefinition: Omit<DefineStoreOptions<string, StateTree & Sta, AnyObject, Partial<Sto>>, 'id'>, options?: StoreOptions): StoreDefinition & Sta & Sto;
70
- export declare function defineAStore<Sto, Sta>(id: string, storeDefinition: (ctx?: DefineAStoreSetupContext) => AnyObject, options?: StoreOptions): StoreDefinition & Sta & Sto;
71
- export declare function getDefineAStoreSetupContext(store: AnyObject): DefineAStoreSetupContext | undefined;
72
- export declare function getExtendingStore<Sta, Sto>(ctx: {
73
- extensions: Record<string, Sta & Sto>;
74
- }): Sta & Sto;
74
+ export declare function defineAStore<Sto, Sta>(id: string, storeDefinition: (ctx?: DefineAStoreSetupContext<AnyObject>) => AnyObject, options?: StoreOptions): StoreDefinition & Sta & Sto;
75
+ export declare function defineAStoreCtx<Sto, Sta>(id: string, storeDefinition: (ctx: DefineAStoreSetupContext<Sto & Sta>) => AnyObject, options?: StoreOptions): StoreDefinition & Sta & Sto;
76
+ export declare function defineAStoreCtx<Sto, Sta, TExtraExtensions extends Record<string, unknown>>(id: string, storeDefinition: (ctx: DefineAStoreSetupContext<Sto & Sta, TExtraExtensions>) => AnyObject, options?: StoreOptions): StoreDefinition & Sta & Sto;
77
+ export declare function getDefineAStoreSetupContext(store: AnyObject): DefineAStoreSetupContext<AnyObject> | undefined;
78
+ export declare function getEnhancedStore<TEnhancedStore>(ctx: DefineAStoreSetupContext<TEnhancedStore>): TEnhancedStore;
79
+ export declare function setEnhancedStore<TEnhancedStore>(ctx: DefineAStoreSetupContext<TEnhancedStore>, store: TEnhancedStore): void;
80
+ /**
81
+ * @deprecated Use getEnhancedStore instead.
82
+ */
83
+ export declare function getExtendingStore<TEnhancedStore>(ctx: DefineAStoreSetupContext<TEnhancedStore>): TEnhancedStore;
75
84
  export declare function isEmpty(value: any): boolean;
76
85
  export declare abstract class Debug {
77
86
  protected abstract _className: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-plugin-subscription",
3
- "version": "0.1.3",
3
+ "version": "0.1.4-beta.0",
4
4
  "description": "Pinia plugin for Vue.js that helps building Pinia plugins by centralizing subscriber registration and providing a Store base class for store helpers.",
5
5
  "type": "module",
6
6
  "sideEffects": false,