pinia-plugin-subscription 0.0.0-beta.2 → 0.0.0-beta.21

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(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_["pinia-plugin-subscription"]={},_.Pinia))})(this,(function(_,x){"use strict";class fe{_createInstance;_name;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;get name(){return this._name}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){this._name=e,this._createInstance=n}invoke({store:e,options:n},s){this._storeInstance=this._createInstance(e,n,s),this._storeInstance&&(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(e))}}const pe="pinia-plugin-subscription",Ct=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function de(t,e,n){if(!e)throw new Error("Style instructions are required");console.log("%c%s",e,t,n)}function H(t,e,n){const s=n?Ct(n.bgColor,n.color):Ct("#ffec73","green");t=` [${n?.icon??"🍍⚡"} ${pe} plugin] - ${t} `,de(t,s,e)}function It(t,e){H(t,e,{bgColor:"#d24545",color:"white",icon:"🍍⚠️"})}function he(t,e,n){const s=n?{storeOptions:n}:{};return typeof e=="function"?_e(t,e,s):ge(t,e,s)}function _e(t,e,n){return x.defineStore(t,e,n)}function ge(t,e,n){return n&&(e={...e,...n??{}}),x.defineStore(t,e)}const be=new Set(["_","$"]);function Vt(t){return be.has(t[0])}function B(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")}class me{_debug=!1;_resetStoreCallback=[];_subscribers=[];_subscriptions=[];set debug(e){this._debug=e}set subscribers(e){this._subscribers=e}get subscriptions(){if(!B(this._subscriptions))return this._subscriptions}addResetStoreCallback(e){this._resetStoreCallback.push(e)}addSubscriber(e){this._subscribers.push(e)}addSubscriptions(e){e&&(this._subscriptions=[...this._subscriptions,e])}executeResetStoreCallbacks(e){this._resetStoreCallback.forEach(n=>n(e))}findPluginSubscriptions(e){return this._subscriptions.filter(n=>n&&n[e])}plugin({store:e,options:n}){if(this._subscribers.length)try{this._subscribers.forEach(s=>{s.invoke({store:e,options:n},this._debug),this.addSubscriptions(s.subscriptions),s.resetStoreCallback&&this.addResetStoreCallback(s.resetStoreCallback)}),this.subscriptionDelivery({store:e,options:n}),this.rewriteResetStore({store:e},Object.assign({},e.$state),Object.assign({},e))}catch(s){It("plugin()",[s,e,n])}}rewriteResetStore({store:e},n,s){e.$reset=()=>{this.executeResetStoreCallbacks(e),Object.keys(s).forEach(r=>{Vt(r)||(e[r]=n[r]??s[r])}),e.$patch(JSON.parse(JSON.stringify(n)))}}storeOnActionSubscription(e){const{store:n,callback:s}=e();n.$onAction(({after:r,args:o,name:i})=>{this._debug&&H(`store.$subscribe ${n.$id}`,[r,o,i,n]),s({after:r,args:o,name:i})})}storeMutationSubscription(e){const{store:n,callback:s}=e();n.$subscribe(r=>{this._debug&&H(`store.$subscribe ${n.$id}`,[r,n]),s(r)})}subscriptionDelivery({store:e,options:n}){this._subscribers.forEach(s=>{const r=this.findPluginSubscriptions(s.name);B(r)||r?.forEach(o=>{o[s.name]?.(e)?.forEach(c=>{s.invoke({store:c,options:n},this._debug)})}),s.storeMutationSubscription&&this.storeMutationSubscription(s.storeMutationSubscription),s.storeOnActionSubscription&&this.storeOnActionSubscription(s.storeOnActionSubscription)})}}const K=new me;function Se(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const it=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const At=()=>{},ye=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),$=Object.assign,Ee=Object.prototype.hasOwnProperty,ct=(t,e)=>Ee.call(t,e),h=Array.isArray,L=t=>Tt(t)==="[object Map]",C=t=>typeof t=="function",O=t=>typeof t=="string",z=t=>typeof t=="symbol",g=t=>t!==null&&typeof t=="object",we=Object.prototype.toString,Tt=t=>we.call(t),xt=t=>Tt(t).slice(8,-1),G=t=>O(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Oe=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),at=(t,e)=>!Object.is(t,e);let $t;const Q=()=>$t||($t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ut(t){if(h(t)){const e={};for(let n=0;n<t.length;n++){const s=t[n],r=O(s)?Ce(s):ut(s);if(r)for(const o in r)e[o]=r[o]}return e}else if(O(t)||g(t))return t}const Ne=/;(?![^(]*\))/g,ve=/:([^]+)/,Re=/\/\*[^]*?\*\//g;function Ce(t){const e={};return t.replace(Re,"").split(Ne).forEach(n=>{if(n){const s=n.split(ve);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function lt(t){let e="";if(O(t))e=t;else if(h(t))for(let n=0;n<t.length;n++){const s=lt(t[n]);s&&(e+=s+" ")}else if(g(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function D(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let Dt=0,ft;function pt(){Dt++}function dt(){if(--Dt>0)return;let t;for(;ft;){let e=ft;for(ft=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){t||(t=s)}e=n}}if(t)throw t}class Ie{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){pt();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($({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{dt()}}}const Pt=new WeakMap,ht=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Mt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Ft=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function jn(t,e,n){}function I(t,e,n,s,r,o){const i=Pt.get(t);if(!i)return;const c=u=>{u&&(process.env.NODE_ENV!=="production"?u.trigger({target:t,type:e,key:n,newValue:s,oldValue:r,oldTarget:o}):u.trigger())};if(pt(),e==="clear")i.forEach(c);else{const u=h(t),f=u&&G(n);if(u&&n==="length"){const d=Number(s);i.forEach((a,p)=>{(p==="length"||p===Ft||!z(p)&&p>=d)&&c(a)})}else switch((n!==void 0||i.has(void 0))&&c(i.get(n)),f&&c(i.get(Ft)),e){case"add":u?f&&c(i.get("length")):(c(i.get(ht)),L(t)&&c(i.get(Mt)));break;case"delete":u||(c(i.get(ht)),L(t)&&c(i.get(Mt)));break;case"set":L(t)&&c(i.get(ht));break}}dt()}function Ve(t,e){const n=Pt.get(t);return n&&n.get(e)}function P(t){const e=l(t);return e===t||m(t)?e:e.map(v)}function _t(t){return t=l(t),t}function V(t,e){return E(t)?yt(t)?J(v(e)):J(e):v(e)}const Ae={__proto__:null,[Symbol.iterator](){return gt(this,Symbol.iterator,t=>V(this,t))},concat(...t){return P(this).concat(...t.map(e=>h(e)?P(e):e))},entries(){return gt(this,"entries",t=>(t[1]=V(this,t[1]),t))},every(t,e){return N(this,"every",t,e,void 0,arguments)},filter(t,e){return N(this,"filter",t,e,n=>n.map(s=>V(this,s)),arguments)},find(t,e){return N(this,"find",t,e,n=>V(this,n),arguments)},findIndex(t,e){return N(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return N(this,"findLast",t,e,n=>V(this,n),arguments)},findLastIndex(t,e){return N(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return N(this,"forEach",t,e,void 0,arguments)},includes(...t){return bt(this,"includes",t)},indexOf(...t){return bt(this,"indexOf",t)},join(t){return P(this).join(t)},lastIndexOf(...t){return bt(this,"lastIndexOf",t)},map(t,e){return N(this,"map",t,e,void 0,arguments)},pop(){return W(this,"pop")},push(...t){return W(this,"push",t)},reduce(t,...e){return jt(this,"reduce",t,e)},reduceRight(t,...e){return jt(this,"reduceRight",t,e)},shift(){return W(this,"shift")},some(t,e){return N(this,"some",t,e,void 0,arguments)},splice(...t){return W(this,"splice",t)},toReversed(){return P(this).toReversed()},toSorted(t){return P(this).toSorted(t)},toSpliced(...t){return P(this).toSpliced(...t)},unshift(...t){return W(this,"unshift",t)},values(){return gt(this,"values",t=>V(this,t))}};function gt(t,e,n){const s=_t(t),r=s[e]();return s!==t&&!m(t)&&(r._next=r.next,r.next=()=>{const o=r._next();return o.done||(o.value=n(o.value)),o}),r}const Te=Array.prototype;function N(t,e,n,s,r,o){const i=_t(t),c=i!==t&&!m(t),u=i[e];if(u!==Te[e]){const a=u.apply(t,o);return c?v(a):a}let f=n;i!==t&&(c?f=function(a,p){return n.call(this,V(t,a),p,t)}:n.length>2&&(f=function(a,p){return n.call(this,a,p,t)}));const d=u.call(i,f,s);return c&&r?r(d):d}function jt(t,e,n,s){const r=_t(t);let o=n;return r!==t&&(m(t)?n.length>3&&(o=function(i,c,u){return n.call(this,i,c,u,t)}):o=function(i,c,u){return n.call(this,i,V(t,c),u,t)}),r[e](o,...s)}function bt(t,e,n){const s=l(t),r=s[e](...n);return(r===-1||r===!1)&&U(n[0])?(n[0]=l(n[0]),s[e](...n)):r}function W(t,e,n=[]){pt();const s=l(t)[e].apply(t,n);return dt(),s}const xe=Se("__proto__,__v_isRef,__isVue"),kt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(z));function $e(t){return z(t)||(t=String(t)),l(this).hasOwnProperty(t)}class Ht{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,s){if(n==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?ze:Wt:o?Le:zt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const i=h(e);if(!r){let u;if(i&&(u=Ae[n]))return u;if(n==="hasOwnProperty")return $e}const c=Reflect.get(e,n,b(e)?e:s);if((z(n)?kt.has(n):xe(n))||o)return c;if(b(c)){const u=i&&G(n)?c:c.value;return r&&g(u)?St(u):u}return g(c)?r?St(c):Ut(c):c}}class De extends Ht{constructor(e=!1){super(!1,e)}set(e,n,s,r){let o=e[n];const i=h(e)&&G(n);if(!this._isShallow){const f=E(o);if(!m(s)&&!E(s)&&(o=l(o),s=l(s)),!i&&b(o)&&!b(s))return f?(process.env.NODE_ENV!=="production"&&D(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(o.value=s,!0)}const c=i?Number(n)<e.length:ct(e,n),u=Reflect.set(e,n,s,b(e)?e:r);return e===l(r)&&(c?at(s,o)&&I(e,"set",n,s,o):I(e,"add",n,s)),u}deleteProperty(e,n){const s=ct(e,n),r=e[n],o=Reflect.deleteProperty(e,n);return o&&s&&I(e,"delete",n,void 0,r),o}has(e,n){const s=Reflect.has(e,n);return!z(n)||kt.has(n),s}ownKeys(e){return Reflect.ownKeys(e)}}class Pe extends Ht{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&D(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&D(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const Me=new De,Fe=new Pe,mt=t=>t,X=t=>Reflect.getPrototypeOf(t);function je(t,e,n){return function(...s){const r=this.__v_raw,o=l(r),i=L(o),c=t==="entries"||t===Symbol.iterator&&i,u=r[t](...s),f=n?mt:e?J:v;return{next(){const{value:d,done:a}=u.next();return a?{value:d,done:a}:{value:c?[f(d[0]),f(d[1])]:f(d),done:a}},[Symbol.iterator](){return this}}}}function Z(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";D(`${Oe(t)} operation ${n}failed: target is readonly.`,l(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function ke(t,e){const n={get(r){const o=this.__v_raw,i=l(o),c=l(r),{has:u}=X(i),f=e?mt:t?J:v;if(u.call(i,r))return f(o.get(r));if(u.call(i,c))return f(o.get(c));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!t&&(l(r),void 0),r.size},has(r){const o=this.__v_raw;l(o);const i=l(r);return r===i?o.has(r):o.has(r)||o.has(i)},forEach(r,o){const i=this,c=i.__v_raw;l(c);const u=e?mt:t?J:v;return c.forEach((f,d)=>r.call(o,u(f),u(d),i))}};return $(n,t?{add:Z("add"),set:Z("set"),delete:Z("delete"),clear:Z("clear")}:{add(r){!e&&!m(r)&&!E(r)&&(r=l(r));const o=l(this);return X(o).has.call(o,r)||(o.add(r),I(o,"add",r,r)),this},set(r,o){!e&&!m(o)&&!E(o)&&(o=l(o));const i=l(this),{has:c,get:u}=X(i);let f=c.call(i,r);f?process.env.NODE_ENV!=="production"&&Lt(i,c,r):(r=l(r),f=c.call(i,r));const d=u.call(i,r);return i.set(r,o),f?at(o,d)&&I(i,"set",r,o,d):I(i,"add",r,o),this},delete(r){const o=l(this),{has:i,get:c}=X(o);let u=i.call(o,r);u?process.env.NODE_ENV!=="production"&&Lt(o,i,r):(r=l(r),u=i.call(o,r));const f=c?c.call(o,r):void 0,d=o.delete(r);return u&&I(o,"delete",r,void 0,f),d},clear(){const r=l(this),o=r.size!==0,i=process.env.NODE_ENV!=="production"?L(r)?new Map(r):new Set(r):void 0,c=r.clear();return o&&I(r,"clear",void 0,void 0,i),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=je(r,t,e)}),n}function Kt(t,e){const n=ke(t,e);return(s,r,o)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?s:Reflect.get(ct(n,r)&&r in s?n:s,r,o)}const He={get:Kt(!1,!1)},Ke={get:Kt(!0,!1)};function Lt(t,e,n){const s=l(n);if(s!==n&&e.call(t,s)){const r=xt(t);D(`Reactive ${r} contains both the raw and reactive versions of the same object${r==="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 zt=new WeakMap,Le=new WeakMap,Wt=new WeakMap,ze=new WeakMap;function We(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ue(t){return t.__v_skip||!Object.isExtensible(t)?0:We(xt(t))}function Ut(t){return E(t)?t:Jt(t,!1,Me,He,zt)}function St(t){return Jt(t,!0,Fe,Ke,Wt)}function Jt(t,e,n,s,r){if(!g(t))return process.env.NODE_ENV!=="production"&&D(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=Ue(t);if(o===0)return t;const i=r.get(t);if(i)return i;const c=new Proxy(t,o===2?s:n);return r.set(t,c),c}function yt(t){return E(t)?yt(t.__v_raw):!!(t&&t.__v_isReactive)}function E(t){return!!(t&&t.__v_isReadonly)}function m(t){return!!(t&&t.__v_isShallow)}function U(t){return t?!!t.__v_raw:!1}function l(t){const e=t&&t.__v_raw;return e?l(e):t}const v=t=>g(t)?Ut(t):t,J=t=>g(t)?St(t):t;function b(t){return t?t.__v_isRef===!0:!1}function Yt(t){return Je(t,!1)}function Je(t,e){return b(t)?t:new Ye(t,e)}class Ye{constructor(e,n){this.dep=new Ie,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:l(e),this._value=n?e:v(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,s=this.__v_isShallow||m(e)||E(e);e=s?e:l(e),at(e,n)&&(this._rawValue=e,this._value=s?e:v(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function qe(t){return b(t)?t.value:t}class Be{constructor(e,n,s){this._object=e,this._key=n,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._raw=l(e);let r=!0,o=e;if(!h(e)||!G(String(n)))do r=!U(o)||m(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=qe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&b(this._raw[this._key])){const n=this._object[this._key];if(b(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return Ve(this._raw,this._key)}}class Ge{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 Qe(t,e,n){return b(t)?t:C(t)?new Ge(t):g(t)&&arguments.length>1?Xe(t,e,n):Yt(t)}function Xe(t,e,n){return new Be(t,e,n)}const T=[];function Ze(t){T.push(t)}function tn(){T.pop()}let Et=!1;function M(t,...e){if(Et)return;Et=!0;const n=T.length?T[T.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=en();if(s)wt(s,n,11,[t+e.map(o=>{var i,c;return(c=(i=o.toString)==null?void 0:i.call(o))!=null?c:JSON.stringify(o)}).join(""),n&&n.proxy,r.map(({vnode:o})=>`at <${ue(n,o.type)}>`).join(`
2
- `),r]);else{const o=[`[Vue warn]: ${t}`,...e];r.length&&o.push(`
3
- `,...nn(r)),console.warn(...o)}Et=!1}function en(){let t=T[T.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 s=t.component&&t.component.parent;t=s&&s.vnode}return e}function nn(t){const e=[];return t.forEach((n,s)=>{e.push(...s===0?[]:[`
4
- `],...rn(n))}),e}function rn({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",s=t.component?t.component.parent==null:!1,r=` at <${ue(t.component,t.type,s)}`,o=">"+n;return t.props?[r,...sn(t.props),o]:[r+o]}function sn(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(s=>{e.push(...qt(s,t[s]))}),n.length>3&&e.push(" ..."),e}function qt(t,e,n){return O(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:b(e)?(e=qt(t,l(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):C(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=l(e),n?e:[`${t}=`,e])}const Bt={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 wt(t,e,n,s){try{return s?t(...s):t()}catch(r){Gt(r,e,n)}}function Gt(t,e,n,s=!0){const r=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=e&&e.appContext.config||it;if(e){let c=e.parent;const u=e.proxy,f=process.env.NODE_ENV!=="production"?Bt[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const d=c.ec;if(d){for(let a=0;a<d.length;a++)if(d[a](t,u,f)===!1)return}c=c.parent}if(o){wt(o,null,10,[t,u,f]);return}}on(t,n,r,s,i)}function on(t,e,n,s=!0,r=!1){if(process.env.NODE_ENV!=="production"){const o=Bt[e];if(n&&Ze(n),M(`Unhandled error${o?` during execution of ${o}`:""}`),n&&tn(),s)throw t;console.error(t)}else{if(r)throw t;console.error(t)}}const S=[];let R=-1;const F=[];let A=null,j=0;const cn=Promise.resolve();let Ot=null;const an=100;function un(t){let e=R+1,n=S.length;for(;e<n;){const s=e+n>>>1,r=S[s],o=Y(r);o<t||o===t&&r.flags&2?e=s+1:n=s}return e}function ln(t){if(!(t.flags&1)){const e=Y(t),n=S[S.length-1];!n||!(t.flags&2)&&e>=Y(n)?S.push(t):S.splice(un(e),0,t),t.flags|=1,Qt()}}function Qt(){Ot||(Ot=cn.then(Xt))}function fn(t){h(t)?F.push(...t):A&&t.id===-1?A.splice(j+1,0,t):t.flags&1||(F.push(t),t.flags|=1),Qt()}function pn(t){if(F.length){const e=[...new Set(F)].sort((n,s)=>Y(n)-Y(s));if(F.length=0,A){A.push(...e);return}for(A=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),j=0;j<A.length;j++){const n=A[j];process.env.NODE_ENV!=="production"&&Zt(t,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}A=null,j=0}}const Y=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Xt(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?n=>Zt(t,n):At;try{for(R=0;R<S.length;R++){const n=S[R];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&e(n))continue;n.flags&4&&(n.flags&=-2),wt(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;R<S.length;R++){const n=S[R];n&&(n.flags&=-2)}R=-1,S.length=0,pn(t),Ot=null,(S.length||F.length)&&Xt(t)}}function Zt(t,e){const n=t.get(e)||0;if(n>an){const s=e.i,r=s&&ae(s.type);return Gt(`Maximum recursive updates exceeded${r?` in component <${r}>`:""}. 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 Nt=new Map;process.env.NODE_ENV!=="production"&&(Q().__VUE_HMR_RUNTIME__={createRecord:vt(dn),rerender:vt(hn),reload:vt(_n)});const tt=new Map;function dn(t,e){return tt.has(t)?!1:(tt.set(t,{initialDef:et(e),instances:new Set}),!0)}function et(t){return le(t)?t.__vccOpts:t}function hn(t,e){const n=tt.get(t);n&&(n.initialDef.render=e,[...n.instances].forEach(s=>{e&&(s.render=e,et(s.type).render=e),s.renderCache=[],s.job.flags&8||s.update()}))}function _n(t,e){const n=tt.get(t);if(!n)return;e=et(e),te(n.initialDef,e);const s=[...n.instances];for(let r=0;r<s.length;r++){const o=s[r],i=et(o.type);let c=Nt.get(i);c||(i!==n.initialDef&&te(i,e),Nt.set(i,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(e.styles),c.delete(o)):o.parent?ln(()=>{o.job.flags&8||(o.parent.update(),c.delete(o))}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(i)}fn(()=>{Nt.clear()})}function te(t,e){$(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(s){console.error(s),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let k,nt=[];function ee(t,e){var n,s;k=t,k?(k.enabled=!0,nt.forEach(({event:r,args:o})=>k.emit(r,...o)),nt=[]):typeof window<"u"&&window.HTMLElement&&!((s=(n=window.navigator)==null?void 0:n.userAgent)!=null&&s.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{ee(o,e)}),setTimeout(()=>{k||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,nt=[])},3e3)):nt=[]}let rt=null,gn=null;const bn=t=>t.__isTeleport;function ne(t,e){t.shapeFlag&6&&t.component?(t.transition=e,ne(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}Q().requestIdleCallback,Q().cancelIdleCallback;const mn=Symbol.for("v-ndc"),Sn={};process.env.NODE_ENV!=="production"&&(Sn.ownKeys=t=>(M("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 yn={},re=t=>Object.getPrototypeOf(t)===yn,En=t=>t.__isSuspense,se=Symbol.for("v-fgt"),wn=Symbol.for("v-txt"),On=Symbol.for("v-cmt");function Nn(t){return t?t.__v_isVNode===!0:!1}const vn=(...t)=>ie(...t),oe=({key:t})=>t??null,st=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?O(t)||b(t)||C(t)?{i:rt,r:t,k:e,f:!!n}:t:null);function Rn(t,e=null,n=null,s=0,r=null,o=t===se?0:1,i=!1,c=!1){const u={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&oe(e),ref:e&&st(e),scopeId:gn,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:o,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:rt};return c?(Rt(u,n),o&128&&t.normalize(u)):n&&(u.shapeFlag|=O(n)?8:16),process.env.NODE_ENV!=="production"&&u.key!==u.key&&M("VNode created with invalid key (NaN). VNode type:",u.type),u}const Cn=process.env.NODE_ENV!=="production"?vn:ie;function ie(t,e=null,n=null,s=0,r=null,o=!1){if((!t||t===mn)&&(process.env.NODE_ENV!=="production"&&!t&&M(`Invalid vnode type when creating vnode: ${t}.`),t=On),Nn(t)){const c=ot(t,e,!0);return n&&Rt(c,n),c.patchFlag=-2,c}if(le(t)&&(t=t.__vccOpts),e){e=In(e);let{class:c,style:u}=e;c&&!O(c)&&(e.class=lt(c)),g(u)&&(U(u)&&!h(u)&&(u=$({},u)),e.style=ut(u))}const i=O(t)?1:En(t)?128:bn(t)?64:g(t)?4:C(t)?2:0;return process.env.NODE_ENV!=="production"&&i&4&&U(t)&&(t=l(t),M("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)),Rn(t,e,n,s,r,i,o,!0)}function In(t){return t?U(t)||re(t)?$({},t):t:null}function ot(t,e,n=!1,s=!1){const{props:r,ref:o,patchFlag:i,children:c,transition:u}=t,f=e?An(r||{},e):r,d={__v_isVNode:!0,__v_skip:!0,type:t.type,props:f,key:f&&oe(f),ref:e&&e.ref?n&&o?h(o)?o.concat(st(e)):[o,st(e)]:st(e):o,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&i===-1&&h(c)?c.map(ce):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==se?i===-1?16:i|16:i,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:u,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&ot(t.ssContent),ssFallback:t.ssFallback&&ot(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return u&&s&&ne(d,u.clone(d)),d}function ce(t){const e=ot(t);return h(t.children)&&(e.children=t.children.map(ce)),e}function Vn(t=" ",e=0){return Cn(wn,null,t,e)}function Rt(t,e){let n=0;const{shapeFlag:s}=t;if(e==null)e=null;else if(h(e))n=16;else if(typeof e=="object")if(s&65){const r=e.default;r&&(r._c&&(r._d=!1),Rt(t,r()),r._c&&(r._d=!0));return}else n=32,!e._&&!re(e)&&(e._ctx=rt);else C(e)?(e={default:e,_ctx:rt},n=32):(e=String(e),s&64?(n=16,e=[Vn(e)]):n=8);t.children=e,t.shapeFlag|=n}function An(...t){const e={};for(let n=0;n<t.length;n++){const s=t[n];for(const r in s)if(r==="class")e.class!==s.class&&(e.class=lt([e.class,s.class]));else if(r==="style")e.style=ut([e.style,s.style]);else if(ye(r)){const o=e[r],i=s[r];i&&o!==i&&!(h(o)&&o.includes(i))&&(e[r]=o?[].concat(o,i):i)}else r!==""&&(e[r]=s[r])}return e}{const t=Q(),e=(n,s)=>{let r;return(r=t[n])||(r=t[n]=[]),r.push(s),o=>{r.length>1?r.forEach(i=>i(o)):r[0](o)}};e("__VUE_INSTANCE_SETTERS__",n=>n),e("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const Tn=/(?:^|[-_])\w/g,xn=t=>t.replace(Tn,e=>e.toUpperCase()).replace(/[-_]/g,"");function ae(t,e=!0){return C(t)?t.displayName||t.name:t.name||e&&t.__name}function ue(t,e,n=!1){let s=ae(e);if(!s&&e.__file){const r=e.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&t){const r=o=>{for(const i in o)if(o[i]===e)return i};s=r(t.components)||t.parent&&r(t.parent.type.components)||r(t.appContext.components)}return s?xn(s):n?"App":"Anonymous"}function le(t){return C(t)&&"__vccOpts"in t}function $n(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},s={style:"color:#eb2f96"},r={__vue_custom_formatter:!0,header(a){if(!g(a))return null;if(a.__isVue)return["div",t,"VueInstance"];if(b(a)){const p=a.value;return["div",{},["span",t,d(a)],"<",c(p),">"]}else{if(yt(a))return["div",{},["span",t,m(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${E(a)?" (readonly)":""}`];if(E(a))return["div",{},["span",t,m(a)?"ShallowReadonly":"Readonly"],"<",c(a),">"]}return null},hasBody(a){return a&&a.__isVue},body(a){if(a&&a.__isVue)return["div",{},...o(a.$)]}};function o(a){const p=[];a.type.props&&a.props&&p.push(i("props",l(a.props))),a.setupState!==it&&p.push(i("setup",a.setupState)),a.data!==it&&p.push(i("data",l(a.data)));const y=u(a,"computed");y&&p.push(i("computed",y));const w=u(a,"inject");return w&&p.push(i("injected",w)),p.push(["div",{},["span",{style:s.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),p}function i(a,p){return p=$({},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(y=>["div",{},["span",s,y+": "],c(p[y],!1)])]]:["span",{}]}function c(a,p=!0){return typeof a=="number"?["span",e,a]:typeof a=="string"?["span",n,JSON.stringify(a)]:typeof a=="boolean"?["span",s,a]:g(a)?["object",{object:p?l(a):a}]:["span",n,String(a)]}function u(a,p){const y=a.type;if(C(y))return;const w={};for(const q in a.ctx)f(y,q,p)&&(w[q]=a.ctx[q]);return w}function f(a,p,y){const w=a[y];if(h(w)&&w.includes(p)||g(w)&&p in w||a.extends&&f(a.extends,p,y)||a.mixins&&a.mixins.some(q=>f(q,p,y)))return!0}function d(a){return m(a)?"ShallowRef":a.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(r):window.devtoolsFormatters=[r]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Dn(){$n()}process.env.NODE_ENV!=="production"&&Dn();class Pn{_debug=!1;_onAction;_options;_store;_subscriptions={};_storeSubscribe;get debug(){return this._debug}set debug(e){this._debug=e}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,s=!1){this._debug=s,this._options=n.storeOptions,this._store=e}addToState(e,n){this.isOptionApi()||n?.value||(n=Yt(n)),this.state[e]=n,this.store[e]=Qe(this.state,e)}addSubscription(e,n){this._subscriptions[e]=n}static customizeStore(e,n,s=!1){if(n.storeOptions)return new this(e,n,s)}debugLog(e,n){this._debug&&H(e,n)}hasDeniedFirstChar(e){return Vt(e[0])}getOption(e){return this.options&&this.options[e]}getStatePropertyValue(e){return this.getValue(this.state[e])}getSubscriptions(){if(!B(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 Mn(t,e=!1){return typeof e!="boolean"&&(e=!1),K.debug=e,K.subscribers=t,K.plugin.bind(K)}_.PluginSubscriber=fe,_.PluginSubscription=K,_.Store=Pn,_.createPlugin=Mn,_.defineAStore=he,_.eppsLog=H,_.eppsLogError=It,_.isEmpty=B,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(_,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],V):(_=typeof globalThis<"u"?globalThis:_||self,V(_["pinia-plugin-subscription"]={},_.Pinia))})(this,(function(_,V){"use strict";class fe{_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,s){this._name=e,this._createInstance=n,s&&(this._console=s)}invoke({store:e,options:n},s){return this._storeInstance=this._createInstance(e,{...n,...this.pluginOptions},s,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 Rt{_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 st="pinia-plugin-subscription",he=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function pe(t,e){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e.shift(),...e)}class Ct{_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} ${st}] - ${e} `}generateStyle(e){return he(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){pe(this.generateStyle(e),this.rebuildArgs(n,e.icon))}}class de extends Ct{_pluginName=st}const _e=new de;function J(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 At="PluginSubscription";class It extends Rt{_className=At;_pluginDebug;_resetStoreCallback=[];_subscribers=[];_subscribersDelivered=new Set;_subscriptions=[];_subscriptionsDelivered=new Set;set subscribers(e){this._subscribers=e}get subscriptions(){if(!J(this._subscriptions))return this._subscriptions}constructor(e,n){super(Array.isArray(n)&&!!n?.includes(At),_e),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(s=>{this._subscribersDelivered.has(`${s.name}-${e.$id}`)||s.invoke({store:e,options:n},this.definePluginDebug(s))&&(this._subscribersDelivered.add(`${s.name}-${e.$id}`),s.subscriptions&&this.subscriptionDelivery({store:e,options:n},s.subscriptions),s.storeMutationSubscription&&this.storeMutationSubscription(s.storeMutationSubscription),s.storeOnActionSubscription&&this.storeOnActionSubscription(s.storeOnActionSubscription),s.resetStoreCallback&&this.addResetStoreCallback(s.resetStoreCallback))}),this.rewriteResetStore({store:e},JSON.stringify(e.$state),Object.assign({},e))}catch(s){this.logError(s,e,n)}}}rewriteResetStore({store:e},n,s){e.$reset=()=>{this.debugLog("rewriteResetStore()",{initState:n,store:e,customStore:s}),this.executeResetStoreCallbacks(e),e.$patch(JSON.parse(n))}}storeOnActionSubscription(e){const{store:n,callback:s}=e();n.$onAction(({after:r,args:i,name:o})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,{after:r,args:i,name:o,store:n}),s({after:r,args:i,name:o})})}storeMutationSubscription(e){const{store:n,callback:s}=e();n.$subscribe(r=>{this.debugLog(`$subscribe ${n.$id}`,{mutation:r,store:n}),s(r)})}subscriptionDelivery({store:e,options:n},s){Object.entries(s).forEach(([r,i])=>{try{if(this._subscriptionsDelivered.has(`${r}-${e.$id}`))return;const{subscription:o,subscriptionOptions:c,stores:u}=i;this.debugLog(`subscriptionDelivery() - store: ${e.$id}`,["pluginName:",r,"subscription:",o,"options:",i,"stores:",u]);const a={storeOptions:{...n?.storeOptions??{},...c}};o.invoke({store:e,options:{...n,...a}},this.debug),this._subscriptionsDelivered.add(`${r}-${e.$id}`),J(u)||u?.forEach(p=>o.invoke({store:p,options:{...n,...a,...p?.storeOptions??{}}},this.debug))}catch(o){this.logError("subscriptionDelivery()",o,e,n)}})}}function ge(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const it=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const $t=()=>{},be=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),T=Object.assign,me=Object.prototype.hasOwnProperty,ot=(t,e)=>me.call(t,e),d=Array.isArray,K=t=>Dt(t)==="[object Map]",C=t=>typeof t=="function",w=t=>typeof t=="string",H=t=>typeof t=="symbol",g=t=>t!==null&&typeof t=="object",ye=Object.prototype.toString,Dt=t=>ye.call(t),Vt=t=>Dt(t).slice(8,-1),B=t=>w(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Se=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),ct=(t,e)=>!Object.is(t,e);let Tt;const Y=()=>Tt||(Tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function lt(t){if(d(t)){const e={};for(let n=0;n<t.length;n++){const s=t[n],r=w(s)?Ne(s):lt(s);if(r)for(const i in r)e[i]=r[i]}return e}else if(w(t)||g(t))return t}const Ee=/;(?![^(]*\))/g,Oe=/:([^]+)/,we=/\/\*[^]*?\*\//g;function Ne(t){const e={};return t.replace(we,"").split(Ee).forEach(n=>{if(n){const s=n.split(Oe);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function ut(t){let e="";if(w(t))e=t;else if(d(t))for(let n=0;n<t.length;n++){const s=ut(t[n]);s&&(e+=s+" ")}else if(g(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function x(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let xt=0,at;function ft(){xt++}function ht(){if(--xt>0)return;let t;for(;at;){let e=at;for(at=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){t||(t=s)}e=n}}if(t)throw t}class ve{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){ft();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(T({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ht()}}}const Pt=new WeakMap,pt=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Mt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Ft=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function Kn(t,e,n){}function A(t,e,n,s,r,i){const o=Pt.get(t);if(!o)return;const c=u=>{u&&(process.env.NODE_ENV!=="production"?u.trigger({target:t,type:e,key:n,newValue:s,oldValue:r,oldTarget:i}):u.trigger())};if(ft(),e==="clear")o.forEach(c);else{const u=d(t),a=u&&B(n);if(u&&n==="length"){const p=Number(s);o.forEach((l,h)=>{(h==="length"||h===Ft||!H(h)&&h>=p)&&c(l)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),a&&c(o.get(Ft)),e){case"add":u?a&&c(o.get("length")):(c(o.get(pt)),K(t)&&c(o.get(Mt)));break;case"delete":u||(c(o.get(pt)),K(t)&&c(o.get(Mt)));break;case"set":K(t)&&c(o.get(pt));break}}ht()}function Re(t,e){const n=Pt.get(t);return n&&n.get(e)}function P(t){const e=f(t);return e===t||m(t)?e:e.map(v)}function dt(t){return t=f(t),t}function I(t,e){return E(t)?yt(t)?U(v(e)):U(e):v(e)}const Ce={__proto__:null,[Symbol.iterator](){return _t(this,Symbol.iterator,t=>I(this,t))},concat(...t){return P(this).concat(...t.map(e=>d(e)?P(e):e))},entries(){return _t(this,"entries",t=>(t[1]=I(this,t[1]),t))},every(t,e){return N(this,"every",t,e,void 0,arguments)},filter(t,e){return N(this,"filter",t,e,n=>n.map(s=>I(this,s)),arguments)},find(t,e){return N(this,"find",t,e,n=>I(this,n),arguments)},findIndex(t,e){return N(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return N(this,"findLast",t,e,n=>I(this,n),arguments)},findLastIndex(t,e){return N(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return N(this,"forEach",t,e,void 0,arguments)},includes(...t){return gt(this,"includes",t)},indexOf(...t){return gt(this,"indexOf",t)},join(t){return P(this).join(t)},lastIndexOf(...t){return gt(this,"lastIndexOf",t)},map(t,e){return N(this,"map",t,e,void 0,arguments)},pop(){return L(this,"pop")},push(...t){return L(this,"push",t)},reduce(t,...e){return kt(this,"reduce",t,e)},reduceRight(t,...e){return kt(this,"reduceRight",t,e)},shift(){return L(this,"shift")},some(t,e){return N(this,"some",t,e,void 0,arguments)},splice(...t){return L(this,"splice",t)},toReversed(){return P(this).toReversed()},toSorted(t){return P(this).toSorted(t)},toSpliced(...t){return P(this).toSpliced(...t)},unshift(...t){return L(this,"unshift",t)},values(){return _t(this,"values",t=>I(this,t))}};function _t(t,e,n){const s=dt(t),r=s[e]();return s!==t&&!m(t)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const Ae=Array.prototype;function N(t,e,n,s,r,i){const o=dt(t),c=o!==t&&!m(t),u=o[e];if(u!==Ae[e]){const l=u.apply(t,i);return c?v(l):l}let a=n;o!==t&&(c?a=function(l,h){return n.call(this,I(t,l),h,t)}:n.length>2&&(a=function(l,h){return n.call(this,l,h,t)}));const p=u.call(o,a,s);return c&&r?r(p):p}function kt(t,e,n,s){const r=dt(t);let i=n;return r!==t&&(m(t)?n.length>3&&(i=function(o,c,u){return n.call(this,o,c,u,t)}):i=function(o,c,u){return n.call(this,o,I(t,c),u,t)}),r[e](i,...s)}function gt(t,e,n){const s=f(t),r=s[e](...n);return(r===-1||r===!1)&&z(n[0])?(n[0]=f(n[0]),s[e](...n)):r}function L(t,e,n=[]){ft();const s=f(t)[e].apply(t,n);return ht(),s}const Ie=ge("__proto__,__v_isRef,__isVue"),jt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(H));function $e(t){return H(t)||(t=String(t)),f(this).hasOwnProperty(t)}class Kt{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,s){if(n==="__v_skip")return e.__v_skip;const r=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return i;if(n==="__v_raw")return s===(r?i?Ke:Ut:i?je:zt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=d(e);if(!r){let u;if(o&&(u=Ce[n]))return u;if(n==="hasOwnProperty")return $e}const c=Reflect.get(e,n,b(e)?e:s);if((H(n)?jt.has(n):Ie(n))||i)return c;if(b(c)){const u=o&&B(n)?c:c.value;return r&&g(u)?mt(u):u}return g(c)?r?mt(c):Wt(c):c}}class De extends Kt{constructor(e=!1){super(!1,e)}set(e,n,s,r){let i=e[n];const o=d(e)&&B(n);if(!this._isShallow){const a=E(i);if(!m(s)&&!E(s)&&(i=f(i),s=f(s)),!o&&b(i)&&!b(s))return a?(process.env.NODE_ENV!=="production"&&x(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=s,!0)}const c=o?Number(n)<e.length:ot(e,n),u=Reflect.set(e,n,s,b(e)?e:r);return e===f(r)&&(c?ct(s,i)&&A(e,"set",n,s,i):A(e,"add",n,s)),u}deleteProperty(e,n){const s=ot(e,n),r=e[n],i=Reflect.deleteProperty(e,n);return i&&s&&A(e,"delete",n,void 0,r),i}has(e,n){const s=Reflect.has(e,n);return!H(n)||jt.has(n),s}ownKeys(e){return Reflect.ownKeys(e)}}class Ve extends Kt{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&x(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&x(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const Te=new De,xe=new Ve,bt=t=>t,G=t=>Reflect.getPrototypeOf(t);function Pe(t,e,n){return function(...s){const r=this.__v_raw,i=f(r),o=K(i),c=t==="entries"||t===Symbol.iterator&&o,u=r[t](...s),a=n?bt:e?U:v;return{next(){const{value:p,done:l}=u.next();return l?{value:p,done:l}:{value:c?[a(p[0]),a(p[1])]:a(p),done:l}},[Symbol.iterator](){return this}}}}function Q(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";x(`${Se(t)} operation ${n}failed: target is readonly.`,f(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function Me(t,e){const n={get(r){const i=this.__v_raw,o=f(i),c=f(r),{has:u}=G(o),a=e?bt:t?U:v;if(u.call(o,r))return a(i.get(r));if(u.call(o,c))return a(i.get(c));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!t&&(f(r),void 0),r.size},has(r){const i=this.__v_raw;f(i);const o=f(r);return r===o?i.has(r):i.has(r)||i.has(o)},forEach(r,i){const o=this,c=o.__v_raw;f(c);const u=e?bt:t?U:v;return c.forEach((a,p)=>r.call(i,u(a),u(p),o))}};return T(n,t?{add:Q("add"),set:Q("set"),delete:Q("delete"),clear:Q("clear")}:{add(r){!e&&!m(r)&&!E(r)&&(r=f(r));const i=f(this);return G(i).has.call(i,r)||(i.add(r),A(i,"add",r,r)),this},set(r,i){!e&&!m(i)&&!E(i)&&(i=f(i));const o=f(this),{has:c,get:u}=G(o);let a=c.call(o,r);a?process.env.NODE_ENV!=="production"&&Lt(o,c,r):(r=f(r),a=c.call(o,r));const p=u.call(o,r);return o.set(r,i),a?ct(i,p)&&A(o,"set",r,i,p):A(o,"add",r,i),this},delete(r){const i=f(this),{has:o,get:c}=G(i);let u=o.call(i,r);u?process.env.NODE_ENV!=="production"&&Lt(i,o,r):(r=f(r),u=o.call(i,r));const a=c?c.call(i,r):void 0,p=i.delete(r);return u&&A(i,"delete",r,void 0,a),p},clear(){const r=f(this),i=r.size!==0,o=process.env.NODE_ENV!=="production"?K(r)?new Map(r):new Set(r):void 0,c=r.clear();return i&&A(r,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=Pe(r,t,e)}),n}function Ht(t,e){const n=Me(t,e);return(s,r,i)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?s:Reflect.get(ot(n,r)&&r in s?n:s,r,i)}const Fe={get:Ht(!1,!1)},ke={get:Ht(!0,!1)};function Lt(t,e,n){const s=f(n);if(s!==n&&e.call(t,s)){const r=Vt(t);x(`Reactive ${r} contains both the raw and reactive versions of the same object${r==="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 zt=new WeakMap,je=new WeakMap,Ut=new WeakMap,Ke=new WeakMap;function He(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Le(t){return t.__v_skip||!Object.isExtensible(t)?0:He(Vt(t))}function Wt(t){return E(t)?t:qt(t,!1,Te,Fe,zt)}function mt(t){return qt(t,!0,xe,ke,Ut)}function qt(t,e,n,s,r){if(!g(t))return process.env.NODE_ENV!=="production"&&x(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Le(t);if(i===0)return t;const o=r.get(t);if(o)return o;const c=new Proxy(t,i===2?s:n);return r.set(t,c),c}function yt(t){return E(t)?yt(t.__v_raw):!!(t&&t.__v_isReactive)}function E(t){return!!(t&&t.__v_isReadonly)}function m(t){return!!(t&&t.__v_isShallow)}function z(t){return t?!!t.__v_raw:!1}function f(t){const e=t&&t.__v_raw;return e?f(e):t}const v=t=>g(t)?Wt(t):t,U=t=>g(t)?mt(t):t;function b(t){return t?t.__v_isRef===!0:!1}function Jt(t){return ze(t,!1)}function ze(t,e){return b(t)?t:new Ue(t,e)}class Ue{constructor(e,n){this.dep=new ve,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:f(e),this._value=n?e:v(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,s=this.__v_isShallow||m(e)||E(e);e=s?e:f(e),ct(e,n)&&(this._rawValue=e,this._value=s?e:v(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function We(t){return b(t)?t.value:t}class qe{constructor(e,n,s){this._object=e,this._key=n,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._raw=f(e);let r=!0,i=e;if(!d(e)||!B(String(n)))do r=!z(i)||m(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=We(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&b(this._raw[this._key])){const n=this._object[this._key];if(b(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return Re(this._raw,this._key)}}class Je{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 Be(t,e,n){return b(t)?t:C(t)?new Je(t):g(t)&&arguments.length>1?Ye(t,e,n):Jt(t)}function Ye(t,e,n){return new qe(t,e,n)}const D=[];function Ge(t){D.push(t)}function Qe(){D.pop()}let St=!1;function M(t,...e){if(St)return;St=!0;const n=D.length?D[D.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=Xe();if(s)Et(s,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,r.map(({vnode:i})=>`at <${ue(n,i.type)}>`).join(`
2
+ `),r]);else{const i=[`[Vue warn]: ${t}`,...e];r.length&&i.push(`
3
+ `,...Ze(r)),console.warn(...i)}St=!1}function Xe(){let t=D[D.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 s=t.component&&t.component.parent;t=s&&s.vnode}return e}function Ze(t){const e=[];return t.forEach((n,s)=>{e.push(...s===0?[]:[`
4
+ `],...tn(n))}),e}function tn({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",s=t.component?t.component.parent==null:!1,r=` at <${ue(t.component,t.type,s)}`,i=">"+n;return t.props?[r,...en(t.props),i]:[r+i]}function en(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(s=>{e.push(...Bt(s,t[s]))}),n.length>3&&e.push(" ..."),e}function Bt(t,e,n){return w(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:b(e)?(e=Bt(t,f(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):C(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=f(e),n?e:[`${t}=`,e])}const Yt={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 Et(t,e,n,s){try{return s?t(...s):t()}catch(r){Gt(r,e,n)}}function Gt(t,e,n,s=!0){const r=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||it;if(e){let c=e.parent;const u=e.proxy,a=process.env.NODE_ENV!=="production"?Yt[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const p=c.ec;if(p){for(let l=0;l<p.length;l++)if(p[l](t,u,a)===!1)return}c=c.parent}if(i){Et(i,null,10,[t,u,a]);return}}nn(t,n,r,s,o)}function nn(t,e,n,s=!0,r=!1){if(process.env.NODE_ENV!=="production"){const i=Yt[e];if(n&&Ge(n),M(`Unhandled error${i?` during execution of ${i}`:""}`),n&&Qe(),s)throw t;console.error(t)}else{if(r)throw t;console.error(t)}}const y=[];let R=-1;const F=[];let $=null,k=0;const rn=Promise.resolve();let Ot=null;const sn=100;function on(t){let e=R+1,n=y.length;for(;e<n;){const s=e+n>>>1,r=y[s],i=W(r);i<t||i===t&&r.flags&2?e=s+1:n=s}return e}function cn(t){if(!(t.flags&1)){const e=W(t),n=y[y.length-1];!n||!(t.flags&2)&&e>=W(n)?y.push(t):y.splice(on(e),0,t),t.flags|=1,Qt()}}function Qt(){Ot||(Ot=rn.then(Xt))}function ln(t){d(t)?F.push(...t):$&&t.id===-1?$.splice(k+1,0,t):t.flags&1||(F.push(t),t.flags|=1),Qt()}function un(t){if(F.length){const e=[...new Set(F)].sort((n,s)=>W(n)-W(s));if(F.length=0,$){$.push(...e);return}for($=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),k=0;k<$.length;k++){const n=$[k];process.env.NODE_ENV!=="production"&&Zt(t,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}$=null,k=0}}const W=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Xt(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?n=>Zt(t,n):$t;try{for(R=0;R<y.length;R++){const n=y[R];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&e(n))continue;n.flags&4&&(n.flags&=-2),Et(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;R<y.length;R++){const n=y[R];n&&(n.flags&=-2)}R=-1,y.length=0,un(t),Ot=null,(y.length||F.length)&&Xt(t)}}function Zt(t,e){const n=t.get(e)||0;if(n>sn){const s=e.i,r=s&&le(s.type);return Gt(`Maximum recursive updates exceeded${r?` in component <${r}>`:""}. 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 wt=new Map;process.env.NODE_ENV!=="production"&&(Y().__VUE_HMR_RUNTIME__={createRecord:Nt(an),rerender:Nt(fn),reload:Nt(hn)});const X=new Map;function an(t,e){return X.has(t)?!1:(X.set(t,{initialDef:Z(e),instances:new Set}),!0)}function Z(t){return ae(t)?t.__vccOpts:t}function fn(t,e){const n=X.get(t);n&&(n.initialDef.render=e,[...n.instances].forEach(s=>{e&&(s.render=e,Z(s.type).render=e),s.renderCache=[],s.job.flags&8||s.update()}))}function hn(t,e){const n=X.get(t);if(!n)return;e=Z(e),te(n.initialDef,e);const s=[...n.instances];for(let r=0;r<s.length;r++){const i=s[r],o=Z(i.type);let c=wt.get(o);c||(o!==n.initialDef&&te(o,e),wt.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?cn(()=>{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)}ln(()=>{wt.clear()})}function te(t,e){T(t,e);for(const n in t)n!=="__file"&&!(n in e)&&delete t[n]}function Nt(t){return(e,n)=>{try{return t(e,n)}catch(s){console.error(s),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let j,tt=[];function ee(t,e){var n,s;j=t,j?(j.enabled=!0,tt.forEach(({event:r,args:i})=>j.emit(r,...i)),tt=[]):typeof window<"u"&&window.HTMLElement&&!((s=(n=window.navigator)==null?void 0:n.userAgent)!=null&&s.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{ee(i,e)}),setTimeout(()=>{j||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,tt=[])},3e3)):tt=[]}let et=null,pn=null;const dn=t=>t.__isTeleport;function ne(t,e){t.shapeFlag&6&&t.component?(t.transition=e,ne(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}Y().requestIdleCallback,Y().cancelIdleCallback;const _n=Symbol.for("v-ndc"),gn={};process.env.NODE_ENV!=="production"&&(gn.ownKeys=t=>(M("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 bn={},re=t=>Object.getPrototypeOf(t)===bn,mn=t=>t.__isSuspense,se=Symbol.for("v-fgt"),yn=Symbol.for("v-txt"),Sn=Symbol.for("v-cmt");function En(t){return t?t.__v_isVNode===!0:!1}const On=(...t)=>oe(...t),ie=({key:t})=>t??null,nt=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?w(t)||b(t)||C(t)?{i:et,r:t,k:e,f:!!n}:t:null);function wn(t,e=null,n=null,s=0,r=null,i=t===se?0:1,o=!1,c=!1){const u={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&ie(e),ref:e&&nt(e),scopeId:pn,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:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:et};return c?(vt(u,n),i&128&&t.normalize(u)):n&&(u.shapeFlag|=w(n)?8:16),process.env.NODE_ENV!=="production"&&u.key!==u.key&&M("VNode created with invalid key (NaN). VNode type:",u.type),u}const Nn=process.env.NODE_ENV!=="production"?On:oe;function oe(t,e=null,n=null,s=0,r=null,i=!1){if((!t||t===_n)&&(process.env.NODE_ENV!=="production"&&!t&&M(`Invalid vnode type when creating vnode: ${t}.`),t=Sn),En(t)){const c=rt(t,e,!0);return n&&vt(c,n),c.patchFlag=-2,c}if(ae(t)&&(t=t.__vccOpts),e){e=vn(e);let{class:c,style:u}=e;c&&!w(c)&&(e.class=ut(c)),g(u)&&(z(u)&&!d(u)&&(u=T({},u)),e.style=lt(u))}const o=w(t)?1:mn(t)?128:dn(t)?64:g(t)?4:C(t)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&z(t)&&(t=f(t),M("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)),wn(t,e,n,s,r,o,i,!0)}function vn(t){return t?z(t)||re(t)?T({},t):t:null}function rt(t,e,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:c,transition:u}=t,a=e?Cn(r||{},e):r,p={__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&ie(a),ref:e&&e.ref?n&&i?d(i)?i.concat(nt(e)):[i,nt(e)]:nt(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&d(c)?c.map(ce):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==se?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&&rt(t.ssContent),ssFallback:t.ssFallback&&rt(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return u&&s&&ne(p,u.clone(p)),p}function ce(t){const e=rt(t);return d(t.children)&&(e.children=t.children.map(ce)),e}function Rn(t=" ",e=0){return Nn(yn,null,t,e)}function vt(t,e){let n=0;const{shapeFlag:s}=t;if(e==null)e=null;else if(d(e))n=16;else if(typeof e=="object")if(s&65){const r=e.default;r&&(r._c&&(r._d=!1),vt(t,r()),r._c&&(r._d=!0));return}else n=32,!e._&&!re(e)&&(e._ctx=et);else C(e)?(e={default:e,_ctx:et},n=32):(e=String(e),s&64?(n=16,e=[Rn(e)]):n=8);t.children=e,t.shapeFlag|=n}function Cn(...t){const e={};for(let n=0;n<t.length;n++){const s=t[n];for(const r in s)if(r==="class")e.class!==s.class&&(e.class=ut([e.class,s.class]));else if(r==="style")e.style=lt([e.style,s.style]);else if(be(r)){const i=e[r],o=s[r];o&&i!==o&&!(d(i)&&i.includes(o))&&(e[r]=i?[].concat(i,o):o)}else r!==""&&(e[r]=s[r])}return e}{const t=Y(),e=(n,s)=>{let r;return(r=t[n])||(r=t[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};e("__VUE_INSTANCE_SETTERS__",n=>n),e("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const An=/(?:^|[-_])\w/g,In=t=>t.replace(An,e=>e.toUpperCase()).replace(/[-_]/g,"");function le(t,e=!0){return C(t)?t.displayName||t.name:t.name||e&&t.__name}function ue(t,e,n=!1){let s=le(e);if(!s&&e.__file){const r=e.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&t){const r=i=>{for(const o in i)if(i[o]===e)return o};s=r(t.components)||t.parent&&r(t.parent.type.components)||r(t.appContext.components)}return s?In(s):n?"App":"Anonymous"}function ae(t){return C(t)&&"__vccOpts"in t}function $n(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},n={style:"color:#f5222d"},s={style:"color:#eb2f96"},r={__vue_custom_formatter:!0,header(l){if(!g(l))return null;if(l.__isVue)return["div",t,"VueInstance"];if(b(l)){const h=l.value;return["div",{},["span",t,p(l)],"<",c(h),">"]}else{if(yt(l))return["div",{},["span",t,m(l)?"ShallowReactive":"Reactive"],"<",c(l),`>${E(l)?" (readonly)":""}`];if(E(l))return["div",{},["span",t,m(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 h=[];l.type.props&&l.props&&h.push(o("props",f(l.props))),l.setupState!==it&&h.push(o("setup",l.setupState)),l.data!==it&&h.push(o("data",f(l.data)));const S=u(l,"computed");S&&h.push(o("computed",S));const O=u(l,"inject");return O&&h.push(o("injected",O)),h.push(["div",{},["span",{style:s.style+";opacity:0.66"},"$ (internal): "],["object",{object:l}]]),h}function o(l,h){return h=T({},h),Object.keys(h).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},l],["div",{style:"padding-left:1.25em"},...Object.keys(h).map(S=>["div",{},["span",s,S+": "],c(h[S],!1)])]]:["span",{}]}function c(l,h=!0){return typeof l=="number"?["span",e,l]:typeof l=="string"?["span",n,JSON.stringify(l)]:typeof l=="boolean"?["span",s,l]:g(l)?["object",{object:h?f(l):l}]:["span",n,String(l)]}function u(l,h){const S=l.type;if(C(S))return;const O={};for(const q in l.ctx)a(S,q,h)&&(O[q]=l.ctx[q]);return O}function a(l,h,S){const O=l[S];if(d(O)&&O.includes(h)||g(O)&&h in O||l.extends&&a(l.extends,h,S)||l.mixins&&l.mixins.some(q=>a(q,h,S)))return!0}function p(l){return m(l)?"ShallowRef":l.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(r):window.devtoolsFormatters=[r]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Dn(){$n()}process.env.NODE_ENV!=="production"&&Dn();function Vn(t,e,n){const s=n?{storeOptions:n}:{};return typeof e=="function"?Tn(t,e,s):xn(t,e,s)}function Tn(t,e,n){return V.defineStore(t,e,n)}function xn(t,e,n){return n&&(e={...e,...n??{}}),V.defineStore(t,e)}const Pn=new Set(["_","$"]);function Mn(t){return Pn.has(t[0])}class Fn extends Rt{_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,s=!1,r){super(s,r),this._options=n.storeOptions,this._store=e}addToState(e,n){this.isOptionApi()||n?.value||(n=Jt(n)),this.state[e]=n,this.store[e]=Be(this.state,e)}addSubscription(e,n,s){this._subscriptions[e]={subscription:n,...s??{}}}static customizeStore(e,n,s=!1,r){if(n.storeOptions&&this.hasRequiredKeys(n.storeOptions))return new this(e,n,s,r)}hasDeniedFirstChar(e){return Mn(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(!J(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 kn(t,e){const n=new It(t,e);return n.plugin.bind(n)}_.CustomConsole=Ct,_.PLUGIN_NAME=st,_.PluginSubscriber=fe,_.PluginSubscription=It,_.Store=Fn,_.createPlugin=kn,_.defineAStore=Vn,_.isEmpty=J,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
@@ -1,47 +1,99 @@
1
- import type { PiniaPlugin, PiniaPluginContext, Store as PiniaStore, StateTree } from "pinia"
2
- import type { PluginSubscriber as PluginSubscriberInterface, PluginSubscription, PluginSubscriptions, StoreOnActionSubscription, StoreMutationSubscription } from "./plugin"
3
- import type { DefineAugmentedStore, PluginStoreOptions, StatePropertyValue, StoreOptions, StoreOptionsPropertyValue } from "./store"
1
+ import type { PiniaPlugin, PiniaPluginContext, Store as PiniaStore, StateTree, StoreDefinition } from "pinia"
2
+ import type { Console } from "./log"
3
+ import type {
4
+ PluginSubscriber as PluginSubscriberInterface,
5
+ PluginSubscriptions,
6
+ StoreOnActionSubscription,
7
+ StoreOnActionSubscriptionCallback,
8
+ StoreMutationSubscription,
9
+ StoreMutationSubscriptionCallback
10
+ } from "./plugin"
11
+ import type { StatePropertyValue, StoreOptions, StoreOptionsPropertyValue } from "./store"
4
12
 
5
13
 
6
14
  declare module 'pinia-plugin-subscription' {
7
- export function createPlugin(subscribers: PluginSubscriberInterface<Store>[], debug?: boolean): PiniaPlugin;
15
+ export const PLUGIN_NAME: string;
8
16
 
9
- export function defineAStore<TStore, TState>(id: string, storeDefinition: () => AnyObject, storeOptions?: StoreOptions): DefineAugmentedStore<TStore, TState>
17
+ export function createPlugin(subscribers: PluginSubscriberInterface[], debug?: string[]): PiniaPlugin;
18
+
19
+ export function defineAStore<TStore, TState>(id: string, storeDefinition: () => AnyObject, storeOptions?: StoreOptions): StoreDefinition & TState & TStore
10
20
 
11
21
  export function isEmpty(value: any): boolean
12
22
 
13
- export abstract class PluginSubscriber<Instance extends Store> implements PluginSubscriberInterface<Instance> {
23
+ export default abstract class Debug {
24
+ protected abstract _className: string
25
+ public console: Console
26
+ public debug: boolean
27
+
28
+ constructor(debug: boolean, customConsole?: Console)
29
+
30
+
31
+ debugLog(message: string, args: any): void
32
+
33
+ logError(...args: any): void
34
+ }
35
+
36
+ export abstract class CustomConsole {
37
+ protected _bgColor: string
38
+ protected _color: string
39
+ protected _icon: string
40
+ protected _errorBgColor: string
41
+ protected _errorColor: string
42
+ protected _errorIcon: string
43
+ protected abstract _pluginName: string
44
+
45
+ log(...args: any): void
46
+ error(...args: any): void
47
+ }
48
+
49
+ export abstract class PluginSubscriber<Instance extends Store> implements PluginSubscriberInterface {
50
+ public console: Console
14
51
  public name: string
52
+ public pluginOptions: AnyObject
15
53
  public resetStoreCallback: ((store?: PiniaStore) => void) | undefined
16
54
  public storeOnActionSubscription: StoreOnActionSubscription | undefined
17
55
  public storeMutationSubscription: StoreMutationSubscription | undefined
18
56
  public subscriptions: PluginSubscriptions | undefined
57
+ protected pluginCreated?: (store: PiniaStore) => void
58
+ protected _resetStoreCallback?: (store?: PiniaStore) => void
19
59
 
20
- constructor(pluginName: string, createInstanceFunction: (store: PiniaStore, options: AnyObject, debug?: boolean) => Store | undefined)
60
+ constructor(
61
+ pluginName: string,
62
+ createInstanceFunction: (store: PiniaStore, options: AnyObject, debug: boolean, pluginConsole?: Console) => Instance | undefined,
63
+ pluginConsole?: CustomConsole
64
+ )
21
65
 
22
- public invoke(context: PiniaPluginContext, debug?: boolean): void
66
+ public invoke(context: PiniaPluginContext, debug: boolean): boolean
23
67
  }
24
68
 
25
- export class Store {
26
- constructor(store: PiniaStore, options: PluginStoreOptions, debug?: boolean)
69
+ export class Store extends Debug {
70
+ constructor(store: PiniaStore, options: AnyObject, debug: boolean, customConsole?: Console)
27
71
 
72
+ protected _className: string
73
+ protected static _requiredKeys?: string[]
28
74
  public debug: boolean
29
- public onAction: StoreOnActionSubscription | undefined
75
+ public onAction: StoreOnActionSubscription | StoreOnActionSubscriptionCallback | undefined
30
76
  public readonly options: StoreOptions
77
+ public resetCallback: (() => void) | undefined
31
78
  public state: StateTree
32
- public storeSubscribe: StoreMutationSubscription | undefined
79
+ public storeSubscribe: StoreMutationSubscriptionCallback | undefined
33
80
  public readonly store: AnyObject
34
81
 
35
82
  addPropertiesToState(properties: string[], values?: AnyObject): void
36
83
 
37
- addSubscription(pluginName: string, subscription: PluginSubscription): void
84
+ addSubscription(
85
+ pluginName: string,
86
+ subscription: PluginSubscriberInterface,
87
+ options?: { subscriptionOptions?: StoreOptions, stores?: PiniaStore[] }
88
+ ): void
38
89
 
39
90
  addToState(name: string, value?: StatePropertyValue): void
40
91
 
41
92
  static customizeStore<Instance extends Store>(
42
93
  store: PiniaStore,
43
- options: PluginStoreOptions,
44
- debug?: boolean
94
+ options: AnyObject,
95
+ debug: boolean,
96
+ console?: Console
45
97
  ): Instance | undefined
46
98
 
47
99
  debugLog(message: string, args: any): void
@@ -56,6 +108,8 @@ declare module 'pinia-plugin-subscription' {
56
108
 
57
109
  getValue(value: any): any
58
110
 
111
+ protected static hasRequiredKeys(options: AnyObject): boolean
112
+
59
113
  isOptionApi(): boolean
60
114
 
61
115
  stateHas(property: string): boolean
@@ -70,5 +124,14 @@ export interface AnyObject {
70
124
  export interface SearchCollectionCriteria {
71
125
  [key: number | string | symbol]: boolean | number | string;
72
126
  }
73
- export type { CustomStore, DefineAugmentedStore, PluginStoreOptions, StatePropertyValue, StoreOptions, StoreOptionsPropertyValue } from "./store";
74
- export type { PluginSubscriber } from "./plugin";
127
+ export { Console, LogType, StyleDefinition as ConsoleStyleDefinition, StyleDefinitionKeys as ConsoleStyleDefinitionKeys, StyleDefinitions as ConsoleStyleDefinitions } from './log';
128
+ export type { CustomStore, PluginStoreOptions, StatePropertyValue, StoreOptions, StoreOptionsPropertyValue } from "./store";
129
+ export type { PluginSubscriber as PluginSubscriberInterface, StoreMutationSubscriptionCallback, StoreOnActionCallbackParameters } from "./plugin";
130
+
131
+
132
+
133
+ declare module 'pinia' {
134
+ export interface DefineStoreOptionsBase<S, Store> {
135
+ storeOptions?: StoreOptions
136
+ }
137
+ }
@@ -0,0 +1,8 @@
1
+ export interface Console {
2
+ log(...args: any): void;
3
+ error(...args: any): void;
4
+ }
5
+ export type LogType = 'error' | 'info';
6
+ export type StyleDefinition = Record<StyleDefinitionKeys, string>;
7
+ export type StyleDefinitionKeys = 'bgColor' | 'color' | 'icon';
8
+ export type StyleDefinitions = Record<LogType, Record<StyleDefinitionKeys, string>>;
@@ -1,25 +1,32 @@
1
1
  import type { PiniaPluginContext, StateTree, Store, SubscriptionCallbackMutation } from "pinia";
2
+ import { StoreOptions } from "./store";
3
+ import { Console, PluginSubscriberInterface } from ".";
2
4
  export interface PluginSubscriber {
3
- invoke: (context: PiniaPluginContext, debug?: boolean) => void;
5
+ console?: Console;
6
+ invoke: (context: PiniaPluginContext, debug: boolean) => boolean;
4
7
  name: string;
5
8
  resetStoreCallback?: (store?: Store) => void;
6
9
  storeOnActionSubscription?: StoreOnActionSubscription;
7
10
  storeMutationSubscription?: StoreMutationSubscription;
8
- subscriptions: PluginSubscriptions | undefined;
11
+ subscriptions?: PluginSubscriptions;
9
12
  }
10
13
  export interface NativePiniaSubscriptionReturn<Callback> {
11
14
  store: Store;
12
15
  callback: Callback;
13
16
  }
14
- export interface OnActionParameters {
17
+ export interface StoreOnActionCallbackParameters {
15
18
  after: Function;
16
19
  args: any[] | object;
17
20
  name: string;
18
21
  }
19
- export type PluginSubscription = (store?: Store) => Store[] | undefined;
22
+ export interface PluginSubscription {
23
+ stores?: Store[];
24
+ subscription: PluginSubscriberInterface;
25
+ subscriptionOptions?: StoreOptions;
26
+ }
20
27
  export type PluginSubscriptions = Record<string, PluginSubscription>;
21
28
  export type NativePiniaSubscription<Callback> = () => NativePiniaSubscriptionReturn<Callback>;
22
- export type StoreOnActionSubscriptionCallback = (params: OnActionParameters) => void;
29
+ export type StoreOnActionSubscriptionCallback = (params: StoreOnActionCallbackParameters) => void;
23
30
  export type StoreOnActionSubscriptionReturn = NativePiniaSubscriptionReturn<StoreOnActionSubscriptionCallback>;
24
31
  export type StoreOnActionSubscription = NativePiniaSubscription<StoreOnActionSubscriptionCallback>;
25
32
  export type StoreMutationSubscriptionCallback = (mutation: SubscriptionCallbackMutation<StateTree>) => void;
@@ -1,7 +1,7 @@
1
1
  import type { AnyObject } from ".";
2
2
  import type { PiniaCustomProperties, Store, StoreDefinition } from "pinia";
3
3
  import type { Ref } from "vue";
4
- export type CustomStore<TStore, TState> = Store & PiniaCustomProperties & StoreDefinition<string, AnyObject & TState, AnyObject, TStore> & TStore & TState;
4
+ export type CustomStore<TStore, TState> = Store & TStore & TState & PiniaCustomProperties & StoreDefinition;
5
5
  export type DefineAugmentedStore<TStore, TState> = (args?: any) => CustomStore<TStore, TState>;
6
6
  export type ObjectBaseProperty = Record<string, OptionBaseProperty | OptionBaseProperty[]>;
7
7
  export type OptionBaseProperty = string | number | boolean | null | undefined | object | Function;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Alexandre Bidaud <alexbidaud85@gmail.com> (https://github.com/AlxBDo)",
3
3
  "name": "pinia-plugin-subscription",
4
- "version": "0.0.0-beta.2",
4
+ "version": "0.0.0-beta.21",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {