@geodaoyu/accessor 3.0.0 → 3.0.1
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.
- package/README.md +13 -14
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +227 -194
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/Accessor.js +25 -2
- package/src/reactiveUtils.js +18 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Accessor is an abstract class that facilitates the access to instance properties
|
|
|
8
8
|
|
|
9
9
|
| Name | Type | Summary | Class |
|
|
10
10
|
| ------------- | ------------------------------------------------------------ | ---------------------- | -------- |
|
|
11
|
-
| declaredClass |
|
|
11
|
+
| declaredClass | **String** | The name of the class. | Accessor |
|
|
12
12
|
|
|
13
13
|
### Property Details
|
|
14
14
|
|
|
@@ -73,11 +73,10 @@ updateView({
|
|
|
73
73
|
|
|
74
74
|
Parameters:
|
|
75
75
|
|
|
76
|
-
|
|
|
77
|
-
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
78
|
-
| The path to the property to set, or an object of key-value pairs. |
|
|
79
|
-
|
|
|
80
|
-
| The new value to set on the property. | |
|
|
76
|
+
| Name | Type | Summary | Class |
|
|
77
|
+
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |---------- |
|
|
78
|
+
| path | String | The path to the property to set, or an object of key-value pairs. | Object |
|
|
79
|
+
| value | * | The new value to set on the property. | * |
|
|
81
80
|
|
|
82
81
|
Returns:
|
|
83
82
|
|
|
@@ -93,9 +92,9 @@ Returns:
|
|
|
93
92
|
|
|
94
93
|
## Using reactiveUtils
|
|
95
94
|
|
|
96
|
-
`reactiveUtils` provides five methods that offer different patterns and capabilities for observing state:
|
|
95
|
+
`reactiveUtils` provides five methods that offer different patterns and capabilities for observing state: `once()`, `watch()`, `when()` and `whenOnce()`.
|
|
97
96
|
|
|
98
|
-
The following is a basic example using
|
|
97
|
+
The following is a basic example using `reactiveUtils.watch()`. It demonstrates how to track the Map component `updating` property and then send a message to the console when the property changes. This snippet uses a `getValue` function as an expression that evaluates the `updating` property, and when a change is observed the new value is passed to the callback:
|
|
99
98
|
|
|
100
99
|
```
|
|
101
100
|
// Basic example of watching for changes on a boolean property
|
|
@@ -113,7 +112,7 @@ reactiveUtils.watch(
|
|
|
113
112
|
|
|
114
113
|
### Working with collections
|
|
115
114
|
|
|
116
|
-
`reactiveUtils` can be used to observe changes within a collection, such as
|
|
115
|
+
`reactiveUtils` can be used to observe changes within a collection, such as `Map.allLayers`. Out-of-the-box JavaScript methods such as `.map()` and `.filter()` can be used as expressions to be evaluated in the `getValue` function.
|
|
117
116
|
|
|
118
117
|
```
|
|
119
118
|
// Watching for changes within a collection
|
|
@@ -130,7 +129,7 @@ reactiveUtils.watch(
|
|
|
130
129
|
|
|
131
130
|
### Working with objects
|
|
132
131
|
|
|
133
|
-
With `reactiveUtils` you can track named object properties through dot notation (e.g. `viewElement.updating`) or through bracket notation (e.g. `viewElement["updating"]`). You can also use the
|
|
132
|
+
With `reactiveUtils` you can track named object properties through dot notation (e.g. `viewElement.updating`) or through bracket notation (e.g. `viewElement["updating"]`). You can also use the `optional chaining` operator (`?.`). This operator simplifies the process of verifying that properties used in the `getValue` function are not `undefined` or `null`.
|
|
134
133
|
|
|
135
134
|
```
|
|
136
135
|
// Watch for changes in an object using optional chaining
|
|
@@ -147,7 +146,7 @@ reactiveUtils.watch(
|
|
|
147
146
|
|
|
148
147
|
### WatchHandles and Promises
|
|
149
148
|
|
|
150
|
-
The
|
|
149
|
+
The `watch()` and `when()` methods return a `WatchHandle`. Be sure to remove watch handles when they are no longer needed to avoid memory leaks.
|
|
151
150
|
|
|
152
151
|
```
|
|
153
152
|
// Use a WatchHandle to stop watching
|
|
@@ -162,7 +161,7 @@ const handle = reactiveUtils.watch(
|
|
|
162
161
|
handle.remove()
|
|
163
162
|
```
|
|
164
163
|
|
|
165
|
-
The
|
|
164
|
+
The `once()` and `whenOnce()` methods return a Promise instead of a `WatchHandle`. In some advanced use cases where an API action may take additional time, these methods also offer the option to cancel the async callback via an `AbortSignal`. Be aware that if the returned Promise is not resolved, it can also result in a memory leak.
|
|
166
165
|
|
|
167
166
|
```
|
|
168
167
|
// Use an AbortSignal to cancel an async callback
|
|
@@ -186,7 +185,7 @@ const someFunction = () => {
|
|
|
186
185
|
|
|
187
186
|
### Working with truthy values
|
|
188
187
|
|
|
189
|
-
The
|
|
188
|
+
The `when()` and `whenOnce()` methods watch for *truthy* values, these are values that evaluate to `true` in boolean contexts. The snippets below use the `Popup.visible` property, which is a boolean.
|
|
190
189
|
|
|
191
190
|
```
|
|
192
191
|
// Observe changes on a boolean property
|
|
@@ -277,7 +276,7 @@ Represents a watch or event handler which can be removed.
|
|
|
277
276
|
|
|
278
277
|
Property:
|
|
279
278
|
|
|
280
|
-
| **remove** |
|
|
279
|
+
| **remove** | Function |
|
|
281
280
|
| ------------------------- | ------------------------------------------------------------ |
|
|
282
281
|
| Removes the watch handle. | |
|
|
283
282
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Lt(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const Wt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Ht=()=>{},ot=Object.assign,$t=Object.prototype.hasOwnProperty,ct=(t,e)=>$t.call(t,e),V=Array.isArray,P=t=>et(t)==="[object Map]",Ct=t=>et(t)==="[object Set]",wt=t=>typeof t=="function",zt=t=>typeof t=="string",F=t=>typeof t=="symbol",K=t=>t!==null&&typeof t=="object",Yt=Object.prototype.toString,et=t=>Yt.call(t),yt=t=>et(t).slice(8,-1),Bt=t=>et(t)==="[object Object]",dt=t=>zt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Ft=t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))},Ut=Ft(t=>t.charAt(0).toUpperCase()+t.slice(1)),m=(t,e)=>!Object.is(t,e);function S(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let u;const rt=new WeakSet;class Gt{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,rt.has(this)&&(rt.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jt(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Et(this),Nt(this);const e=u,n=g;u=this,g=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&u!==this&&S("Active effect was not restored correctly - this is likely a Vue internal bug."),xt(this),u=e,g=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)_t(e);this.deps=this.depsTail=void 0,Et(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?rt.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){at(this)&&this.run()}get dirty(){return at(this)}}let Dt=0,$,C;function Jt(t,e=!1){if(t.flags|=8,e){t.next=C,C=t;return}t.next=$,$=t}function ht(){Dt++}function vt(){if(--Dt>0)return;if(C){let e=C;for(C=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;$;){let e=$;for($=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}function Nt(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function xt(t){let e,n=t.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),_t(s),qt(s)):e=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}t.deps=e,t.depsTail=n}function at(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Qt(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Qt(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===k)||(t.globalVersion=k,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!at(t))))return;t.flags|=2;const e=t.dep,n=u,s=g;u=t,g=!0;try{Nt(t);const r=t.fn(t._value);(e.version===0||m(r,t._value))&&(t.flags|=128,t._value=r,e.version++)}catch(r){throw e.version++,r}finally{u=n,g=s,xt(t),t.flags&=-3}}function _t(t,e=!1){const{dep:n,prevSub:s,nextSub:r}=t;if(s&&(s.nextSub=r,t.prevSub=void 0),r&&(r.prevSub=s,t.nextSub=void 0),process.env.NODE_ENV!=="production"&&n.subsHead===t&&(n.subsHead=r),n.subs===t&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)_t(i,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function qt(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let g=!0;const Tt=[];function mt(){Tt.push(g),g=!1}function Rt(){const t=Tt.pop();g=t===void 0?!0:t}function Et(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=u;u=void 0;try{e()}finally{u=n}}}let k=0;class Xt{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Zt{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){if(!u||!g||u===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==u)n=this.activeLink=new Xt(u,this),u.deps?(n.prevDep=u.depsTail,u.depsTail.nextDep=n,u.depsTail=n):u.deps=u.depsTail=n,Vt(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=u.depsTail,n.nextDep=void 0,u.depsTail.nextDep=n,u.depsTail=n,u.deps===n&&(u.deps=s)}return process.env.NODE_ENV!=="production"&&u.onTrack&&u.onTrack(ot({effect:u},e)),n}trigger(e){this.version++,k++,this.notify(e)}notify(e){ht();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(ot({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{vt()}}}function Vt(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let s=e.deps;s;s=s.nextDep)Vt(s)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),process.env.NODE_ENV!=="production"&&t.dep.subsHead===void 0&&(t.dep.subsHead=t),t.dep.subs=t}}const ft=new WeakMap,R=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),lt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Y=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function _(t,e,n){if(g&&u){let s=ft.get(t);s||ft.set(t,s=new Map);let r=s.get(n);r||(s.set(n,r=new Zt),r.map=s,r.key=n),process.env.NODE_ENV!=="production"?r.track({target:t,type:e,key:n}):r.track()}}function y(t,e,n,s,r,i){const o=ft.get(t);if(!o){k++;return}const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:t,type:e,key:n,newValue:s,oldValue:r,oldTarget:i}):a.trigger())};if(ht(),e==="clear")o.forEach(c);else{const a=V(t),d=a&&dt(n);if(a&&n==="length"){const v=Number(s);o.forEach((f,h)=>{(h==="length"||h===Y||!F(h)&&h>=v)&&c(f)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),d&&c(o.get(Y)),e){case"add":a?d&&c(o.get("length")):(c(o.get(R)),P(t)&&c(o.get(lt)));break;case"delete":a||(c(o.get(R)),P(t)&&c(o.get(lt)));break;case"set":P(t)&&c(o.get(R));break}}vt()}function A(t){const e=p(t);return e===t?e:(_(e,"iterate",Y),w(t)?e:e.map(I))}function gt(t){return _(t=p(t),"iterate",Y),t}function O(t,e){return j(t)?z(t)?B(I(e)):B(e):I(e)}const kt={__proto__:null,[Symbol.iterator](){return st(this,Symbol.iterator,t=>O(this,t))},concat(...t){return A(this).concat(...t.map(e=>V(e)?A(e):e))},entries(){return st(this,"entries",t=>(t[1]=O(this,t[1]),t))},every(t,e){return E(this,"every",t,e,void 0,arguments)},filter(t,e){return E(this,"filter",t,e,n=>n.map(s=>O(this,s)),arguments)},find(t,e){return E(this,"find",t,e,n=>O(this,n),arguments)},findIndex(t,e){return E(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return E(this,"findLast",t,e,n=>O(this,n),arguments)},findLastIndex(t,e){return E(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return E(this,"forEach",t,e,void 0,arguments)},includes(...t){return it(this,"includes",t)},indexOf(...t){return it(this,"indexOf",t)},join(t){return A(this).join(t)},lastIndexOf(...t){return it(this,"lastIndexOf",t)},map(t,e){return E(this,"map",t,e,void 0,arguments)},pop(){return H(this,"pop")},push(...t){return H(this,"push",t)},reduce(t,...e){return St(this,"reduce",t,e)},reduceRight(t,...e){return St(this,"reduceRight",t,e)},shift(){return H(this,"shift")},some(t,e){return E(this,"some",t,e,void 0,arguments)},splice(...t){return H(this,"splice",t)},toReversed(){return A(this).toReversed()},toSorted(t){return A(this).toSorted(t)},toSpliced(...t){return A(this).toSpliced(...t)},unshift(...t){return H(this,"unshift",t)},values(){return st(this,"values",t=>O(this,t))}};function st(t,e,n){const s=gt(t),r=s[e]();return s!==t&&!w(t)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const te=Array.prototype;function E(t,e,n,s,r,i){const o=gt(t),c=o!==t&&!w(t),a=o[e];if(a!==te[e]){const f=a.apply(t,i);return c?I(f):f}let d=n;o!==t&&(c?d=function(f,h){return n.call(this,O(t,f),h,t)}:n.length>2&&(d=function(f,h){return n.call(this,f,h,t)}));const v=a.call(o,d,s);return c&&r?r(v):v}function St(t,e,n,s){const r=gt(t);let i=n;return r!==t&&(w(t)?n.length>3&&(i=function(o,c,a){return n.call(this,o,c,a,t)}):i=function(o,c,a){return n.call(this,o,O(t,c),a,t)}),r[e](i,...s)}function it(t,e,n){const s=p(t);_(s,"iterate",Y);const r=s[e](...n);return(r===-1||r===!1)&&ve(n[0])?(n[0]=p(n[0]),s[e](...n)):r}function H(t,e,n=[]){mt(),ht();const s=p(t)[e].apply(t,n);return vt(),Rt(),s}const ee=Lt("__proto__,__v_isRef,__isVue"),jt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(F));function ne(t){F(t)||(t=String(t));const e=p(this);return _(e,"has",t),e.hasOwnProperty(t)}class It{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?pe:Pt:i?ue:At).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=V(e);if(!r){let a;if(o&&(a=kt[n]))return a;if(n==="hasOwnProperty")return ne}const c=Reflect.get(e,n,N(e)?e:s);if((F(n)?jt.has(n):ee(n))||(r||_(e,"get",n),i))return c;if(N(c)){const a=o&&dt(n)?c:c.value;return r&&K(a)?pt(a):a}return K(c)?r?pt(c):bt(c):c}}class re extends It{constructor(e=!1){super(!1,e)}set(e,n,s,r){let i=e[n];const o=V(e)&&dt(n);if(!this._isShallow){const d=j(i);if(!w(s)&&!j(s)&&(i=p(i),s=p(s)),!o&&N(i)&&!N(s))return d?(process.env.NODE_ENV!=="production"&&S(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=s,!0)}const c=o?Number(n)<e.length:ct(e,n),a=Reflect.set(e,n,s,N(e)?e:r);return e===p(r)&&(c?m(s,i)&&y(e,"set",n,s,i):y(e,"add",n,s)),a}deleteProperty(e,n){const s=ct(e,n),r=e[n],i=Reflect.deleteProperty(e,n);return i&&s&&y(e,"delete",n,void 0,r),i}has(e,n){const s=Reflect.has(e,n);return(!F(n)||!jt.has(n))&&_(e,"has",n),s}ownKeys(e){return _(e,"iterate",V(e)?"length":R),Reflect.ownKeys(e)}}class se extends It{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&S(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&S(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const ie=new re,oe=new se,ut=t=>t,q=t=>Reflect.getPrototypeOf(t);function ce(t,e,n){return function(...s){const r=this.__v_raw,i=p(r),o=P(i),c=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,d=r[t](...s),v=n?ut:e?B:I;return!e&&_(i,"iterate",a?lt:R),{next(){const{value:f,done:h}=d.next();return h?{value:f,done:h}:{value:c?[v(f[0]),v(f[1])]:v(f),done:h}},[Symbol.iterator](){return this}}}}function X(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";S(`${Ut(t)} operation ${n}failed: target is readonly.`,p(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function ae(t,e){const n={get(r){const i=this.__v_raw,o=p(i),c=p(r);t||(m(r,c)&&_(o,"get",r),_(o,"get",c));const{has:a}=q(o),d=e?ut:t?B:I;if(a.call(o,r))return d(i.get(r));if(a.call(o,c))return d(i.get(c));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!t&&_(p(r),"iterate",R),r.size},has(r){const i=this.__v_raw,o=p(i),c=p(r);return t||(m(r,c)&&_(o,"has",r),_(o,"has",c)),r===c?i.has(r):i.has(r)||i.has(c)},forEach(r,i){const o=this,c=o.__v_raw,a=p(c),d=e?ut:t?B:I;return!t&&_(a,"iterate",R),c.forEach((v,f)=>r.call(i,d(v),d(f),o))}};return ot(n,t?{add:X("add"),set:X("set"),delete:X("delete"),clear:X("clear")}:{add(r){!e&&!w(r)&&!j(r)&&(r=p(r));const i=p(this);return q(i).has.call(i,r)||(i.add(r),y(i,"add",r,r)),this},set(r,i){!e&&!w(i)&&!j(i)&&(i=p(i));const o=p(this),{has:c,get:a}=q(o);let d=c.call(o,r);d?process.env.NODE_ENV!=="production"&&Ot(o,c,r):(r=p(r),d=c.call(o,r));const v=a.call(o,r);return o.set(r,i),d?m(i,v)&&y(o,"set",r,i,v):y(o,"add",r,i),this},delete(r){const i=p(this),{has:o,get:c}=q(i);let a=o.call(i,r);a?process.env.NODE_ENV!=="production"&&Ot(i,o,r):(r=p(r),a=o.call(i,r));const d=c?c.call(i,r):void 0,v=i.delete(r);return a&&y(i,"delete",r,void 0,d),v},clear(){const r=p(this),i=r.size!==0,o=process.env.NODE_ENV!=="production"?P(r)?new Map(r):new Set(r):void 0,c=r.clear();return i&&y(r,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=ce(r,t,e)}),n}function Mt(t,e){const n=ae(t,e);return(s,r,i)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?s:Reflect.get(ct(n,r)&&r in s?n:s,r,i)}const fe={get:Mt(!1,!1)},le={get:Mt(!0,!1)};function Ot(t,e,n){const s=p(n);if(s!==n&&e.call(t,s)){const r=yt(t);S(`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 At=new WeakMap,ue=new WeakMap,Pt=new WeakMap,pe=new WeakMap;function de(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function he(t){return t.__v_skip||!Object.isExtensible(t)?0:de(yt(t))}function bt(t){return j(t)?t:Kt(t,!1,ie,fe,At)}function pt(t){return Kt(t,!0,oe,le,Pt)}function Kt(t,e,n,s,r){if(!K(t))return process.env.NODE_ENV!=="production"&&S(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=he(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 z(t){return j(t)?z(t.__v_raw):!!(t&&t.__v_isReactive)}function j(t){return!!(t&&t.__v_isReadonly)}function w(t){return!!(t&&t.__v_isShallow)}function ve(t){return t?!!t.__v_raw:!1}function p(t){const e=t&&t.__v_raw;return e?p(e):t}const I=t=>K(t)?bt(t):t,B=t=>K(t)?pt(t):t;function N(t){return t?t.__v_isRef===!0:!1}const Z={},tt=new WeakMap;let T;function _e(t,e=!1,n=T){if(n){let s=tt.get(n);s||tt.set(n,s=[]),s.push(t)}else process.env.NODE_ENV!=="production"&&!e&&S("onWatcherCleanup() was called when there was no active watcher to associate with.")}function ge(t,e,n=Wt){const{immediate:s,deep:r,once:i,scheduler:o,augmentJob:c,call:a}=n,d=l=>{(n.onWarn||S)("Invalid watch source: ",l,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},v=l=>r?l:w(l)||r===!1||r===0?D(l,1):D(l);let f,h,L,U,G=!1,J=!1;if(N(t)?(h=()=>t.value,G=w(t)):z(t)?(h=()=>v(t),G=!0):V(t)?(J=!0,G=t.some(l=>z(l)||w(l)),h=()=>t.map(l=>{if(N(l))return l.value;if(z(l))return v(l);if(wt(l))return a?a(l,2):l();process.env.NODE_ENV!=="production"&&d(l)})):wt(t)?e?h=a?()=>a(t,2):t:h=()=>{if(L){mt();try{L()}finally{Rt()}}const l=T;T=f;try{return a?a(t,3,[U]):t(U)}finally{T=l}}:(h=Ht,process.env.NODE_ENV!=="production"&&d(t)),e&&r){const l=h,b=r===!0?1/0:r;h=()=>D(l(),b)}const M=()=>{f.stop()};if(i&&e){const l=e;e=(...b)=>{l(...b),M()}}let x=J?new Array(t.length).fill(Z):Z;const W=l=>{if(!(!(f.flags&1)||!f.dirty&&!l))if(e){const b=f.run();if(r||G||(J?b.some((nt,Q)=>m(nt,x[Q])):m(b,x))){L&&L();const nt=T;T=f;try{const Q=[b,x===Z?void 0:J&&x[0]===Z?[]:x,U];x=b,a?a(e,3,Q):e(...Q)}finally{T=nt}}}else f.run()};return c&&c(W),f=new Gt(h),f.scheduler=o?()=>o(W,!1):W,U=l=>_e(l,!1,f),L=f.onStop=()=>{const l=tt.get(f);if(l){if(a)a(l,4);else for(const b of l)b();tt.delete(f)}},process.env.NODE_ENV!=="production"&&(f.onTrack=n.onTrack,f.onTrigger=n.onTrigger),e?s?W(!0):x=f.run():o?o(W.bind(null,!0),!0):f.run(),M.pause=f.pause.bind(f),M.resume=f.resume.bind(f),M.stop=M,M}function D(t,e=1/0,n){if(e<=0||!K(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,N(t))D(t.value,e,n);else if(V(t))for(let s=0;s<t.length;s++)D(t[s],e,n);else if(Ct(t)||P(t))t.forEach(s=>{D(s,e,n)});else if(Bt(t)){for(const s in t)D(t[s],e,n);for(const s of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,s)&&D(t[s],e,n)}return t}class be{constructor(e){return e&&Object.assign(this,e),bt(this)}}const we={watch:ge};exports.Accessor=be;exports.reactiveUtils=we;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function $t(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const Ct=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Bt=()=>{},ot=Object.assign,zt=Object.prototype.hasOwnProperty,ct=(t,e)=>zt.call(t,e),j=Array.isArray,P=t=>et(t)==="[object Map]",Yt=t=>et(t)==="[object Set]",Et=t=>typeof t=="function",Ft=t=>typeof t=="string",F=t=>typeof t=="symbol",K=t=>t!==null&&typeof t=="object",Ut=Object.prototype.toString,et=t=>Ut.call(t),Nt=t=>et(t).slice(8,-1),Gt=t=>et(t)==="[object Object]",dt=t=>Ft(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Jt=t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))},Qt=Jt(t=>t.charAt(0).toUpperCase()+t.slice(1)),T=(t,e)=>!Object.is(t,e);function S(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let u;const rt=new WeakSet;class qt{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,rt.has(this)&&(rt.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Xt(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,St(this),mt(this);const e=u,n=g;u=this,g=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&u!==this&&S("Active effect was not restored correctly - this is likely a Vue internal bug."),Tt(this),u=e,g=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)_t(e);this.deps=this.depsTail=void 0,St(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?rt.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){at(this)&&this.run()}get dirty(){return at(this)}}let xt=0,$,C;function Xt(t,e=!1){if(t.flags|=8,e){t.next=C,C=t;return}t.next=$,$=t}function ht(){xt++}function vt(){if(--xt>0)return;if(C){let e=C;for(C=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;$;){let e=$;for($=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}function mt(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Tt(t){let e,n=t.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),_t(s),kt(s)):e=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}t.deps=e,t.depsTail=n}function at(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Zt(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Zt(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===k)||(t.globalVersion=k,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!at(t))))return;t.flags|=2;const e=t.dep,n=u,s=g;u=t,g=!0;try{mt(t);const r=t.fn(t._value);(e.version===0||T(r,t._value))&&(t.flags|=128,t._value=r,e.version++)}catch(r){throw e.version++,r}finally{u=n,g=s,Tt(t),t.flags&=-3}}function _t(t,e=!1){const{dep:n,prevSub:s,nextSub:r}=t;if(s&&(s.nextSub=r,t.prevSub=void 0),r&&(r.prevSub=s,t.nextSub=void 0),process.env.NODE_ENV!=="production"&&n.subsHead===t&&(n.subsHead=r),n.subs===t&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)_t(i,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function kt(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let g=!0;const Rt=[];function jt(){Rt.push(g),g=!1}function Vt(){const t=Rt.pop();g=t===void 0?!0:t}function St(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=u;u=void 0;try{e()}finally{u=n}}}let k=0;class te{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ee{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){if(!u||!g||u===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==u)n=this.activeLink=new te(u,this),u.deps?(n.prevDep=u.depsTail,u.depsTail.nextDep=n,u.depsTail=n):u.deps=u.depsTail=n,It(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=u.depsTail,n.nextDep=void 0,u.depsTail.nextDep=n,u.depsTail=n,u.deps===n&&(u.deps=s)}return process.env.NODE_ENV!=="production"&&u.onTrack&&u.onTrack(ot({effect:u},e)),n}trigger(e){this.version++,k++,this.notify(e)}notify(e){ht();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(ot({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{vt()}}}function It(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let s=e.deps;s;s=s.nextDep)It(s)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),process.env.NODE_ENV!=="production"&&t.dep.subsHead===void 0&&(t.dep.subsHead=t),t.dep.subs=t}}const ft=new WeakMap,R=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),lt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),z=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function _(t,e,n){if(g&&u){let s=ft.get(t);s||ft.set(t,s=new Map);let r=s.get(n);r||(s.set(n,r=new ee),r.map=s,r.key=n),process.env.NODE_ENV!=="production"?r.track({target:t,type:e,key:n}):r.track()}}function O(t,e,n,s,r,i){const o=ft.get(t);if(!o){k++;return}const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:t,type:e,key:n,newValue:s,oldValue:r,oldTarget:i}):a.trigger())};if(ht(),e==="clear")o.forEach(c);else{const a=j(t),p=a&&dt(n);if(a&&n==="length"){const v=Number(s);o.forEach((f,h)=>{(h==="length"||h===z||!F(h)&&h>=v)&&c(f)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),p&&c(o.get(z)),e){case"add":a?p&&c(o.get("length")):(c(o.get(R)),P(t)&&c(o.get(lt)));break;case"delete":a||(c(o.get(R)),P(t)&&c(o.get(lt)));break;case"set":P(t)&&c(o.get(R));break}}vt()}function A(t){const e=d(t);return e===t?e:(_(e,"iterate",z),w(t)?e:e.map(I))}function gt(t){return _(t=d(t),"iterate",z),t}function y(t,e){return V(t)?B(t)?Y(I(e)):Y(e):I(e)}const ne={__proto__:null,[Symbol.iterator](){return st(this,Symbol.iterator,t=>y(this,t))},concat(...t){return A(this).concat(...t.map(e=>j(e)?A(e):e))},entries(){return st(this,"entries",t=>(t[1]=y(this,t[1]),t))},every(t,e){return E(this,"every",t,e,void 0,arguments)},filter(t,e){return E(this,"filter",t,e,n=>n.map(s=>y(this,s)),arguments)},find(t,e){return E(this,"find",t,e,n=>y(this,n),arguments)},findIndex(t,e){return E(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return E(this,"findLast",t,e,n=>y(this,n),arguments)},findLastIndex(t,e){return E(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return E(this,"forEach",t,e,void 0,arguments)},includes(...t){return it(this,"includes",t)},indexOf(...t){return it(this,"indexOf",t)},join(t){return A(this).join(t)},lastIndexOf(...t){return it(this,"lastIndexOf",t)},map(t,e){return E(this,"map",t,e,void 0,arguments)},pop(){return H(this,"pop")},push(...t){return H(this,"push",t)},reduce(t,...e){return yt(this,"reduce",t,e)},reduceRight(t,...e){return yt(this,"reduceRight",t,e)},shift(){return H(this,"shift")},some(t,e){return E(this,"some",t,e,void 0,arguments)},splice(...t){return H(this,"splice",t)},toReversed(){return A(this).toReversed()},toSorted(t){return A(this).toSorted(t)},toSpliced(...t){return A(this).toSpliced(...t)},unshift(...t){return H(this,"unshift",t)},values(){return st(this,"values",t=>y(this,t))}};function st(t,e,n){const s=gt(t),r=s[e]();return s!==t&&!w(t)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const re=Array.prototype;function E(t,e,n,s,r,i){const o=gt(t),c=o!==t&&!w(t),a=o[e];if(a!==re[e]){const f=a.apply(t,i);return c?I(f):f}let p=n;o!==t&&(c?p=function(f,h){return n.call(this,y(t,f),h,t)}:n.length>2&&(p=function(f,h){return n.call(this,f,h,t)}));const v=a.call(o,p,s);return c&&r?r(v):v}function yt(t,e,n,s){const r=gt(t);let i=n;return r!==t&&(w(t)?n.length>3&&(i=function(o,c,a){return n.call(this,o,c,a,t)}):i=function(o,c,a){return n.call(this,o,y(t,c),a,t)}),r[e](i,...s)}function it(t,e,n){const s=d(t);_(s,"iterate",z);const r=s[e](...n);return(r===-1||r===!1)&&we(n[0])?(n[0]=d(n[0]),s[e](...n)):r}function H(t,e,n=[]){jt(),ht();const s=d(t)[e].apply(t,n);return vt(),Vt(),s}const se=$t("__proto__,__v_isRef,__isVue"),Mt=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(F));function ie(t){F(t)||(t=String(t));const e=d(this);return _(e,"has",t),e.hasOwnProperty(t)}class At{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?ve:Wt:i?Lt:Kt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=j(e);if(!r){let a;if(o&&(a=ne[n]))return a;if(n==="hasOwnProperty")return ie}const c=Reflect.get(e,n,N(e)?e:s);if((F(n)?Mt.has(n):se(n))||(r||_(e,"get",n),i))return c;if(N(c)){const a=o&&dt(n)?c:c.value;return r&&K(a)?pt(a):a}return K(c)?r?pt(c):Ht(c):c}}class Pt extends At{constructor(e=!1){super(!1,e)}set(e,n,s,r){let i=e[n];const o=j(e)&&dt(n);if(!this._isShallow){const p=V(i);if(!w(s)&&!V(s)&&(i=d(i),s=d(s)),!o&&N(i)&&!N(s))return p?(process.env.NODE_ENV!=="production"&&S(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=s,!0)}const c=o?Number(n)<e.length:ct(e,n),a=Reflect.set(e,n,s,N(e)?e:r);return e===d(r)&&(c?T(s,i)&&O(e,"set",n,s,i):O(e,"add",n,s)),a}deleteProperty(e,n){const s=ct(e,n),r=e[n],i=Reflect.deleteProperty(e,n);return i&&s&&O(e,"delete",n,void 0,r),i}has(e,n){const s=Reflect.has(e,n);return(!F(n)||!Mt.has(n))&&_(e,"has",n),s}ownKeys(e){return _(e,"iterate",j(e)?"length":R),Reflect.ownKeys(e)}}class oe extends At{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&S(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&S(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const ce=new Pt,ae=new oe,fe=new Pt(!0),ut=t=>t,q=t=>Reflect.getPrototypeOf(t);function le(t,e,n){return function(...s){const r=this.__v_raw,i=d(r),o=P(i),c=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,p=r[t](...s),v=n?ut:e?Y:I;return!e&&_(i,"iterate",a?lt:R),{next(){const{value:f,done:h}=p.next();return h?{value:f,done:h}:{value:c?[v(f[0]),v(f[1])]:v(f),done:h}},[Symbol.iterator](){return this}}}}function X(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";S(`${Qt(t)} operation ${n}failed: target is readonly.`,d(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function ue(t,e){const n={get(r){const i=this.__v_raw,o=d(i),c=d(r);t||(T(r,c)&&_(o,"get",r),_(o,"get",c));const{has:a}=q(o),p=e?ut:t?Y:I;if(a.call(o,r))return p(i.get(r));if(a.call(o,c))return p(i.get(c));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!t&&_(d(r),"iterate",R),r.size},has(r){const i=this.__v_raw,o=d(i),c=d(r);return t||(T(r,c)&&_(o,"has",r),_(o,"has",c)),r===c?i.has(r):i.has(r)||i.has(c)},forEach(r,i){const o=this,c=o.__v_raw,a=d(c),p=e?ut:t?Y:I;return!t&&_(a,"iterate",R),c.forEach((v,f)=>r.call(i,p(v),p(f),o))}};return ot(n,t?{add:X("add"),set:X("set"),delete:X("delete"),clear:X("clear")}:{add(r){!e&&!w(r)&&!V(r)&&(r=d(r));const i=d(this);return q(i).has.call(i,r)||(i.add(r),O(i,"add",r,r)),this},set(r,i){!e&&!w(i)&&!V(i)&&(i=d(i));const o=d(this),{has:c,get:a}=q(o);let p=c.call(o,r);p?process.env.NODE_ENV!=="production"&&Ot(o,c,r):(r=d(r),p=c.call(o,r));const v=a.call(o,r);return o.set(r,i),p?T(i,v)&&O(o,"set",r,i,v):O(o,"add",r,i),this},delete(r){const i=d(this),{has:o,get:c}=q(i);let a=o.call(i,r);a?process.env.NODE_ENV!=="production"&&Ot(i,o,r):(r=d(r),a=o.call(i,r));const p=c?c.call(i,r):void 0,v=i.delete(r);return a&&O(i,"delete",r,void 0,p),v},clear(){const r=d(this),i=r.size!==0,o=process.env.NODE_ENV!=="production"?P(r)?new Map(r):new Set(r):void 0,c=r.clear();return i&&O(r,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=le(r,t,e)}),n}function bt(t,e){const n=ue(t,e);return(s,r,i)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?s:Reflect.get(ct(n,r)&&r in s?n:s,r,i)}const pe={get:bt(!1,!1)},de={get:bt(!1,!0)},he={get:bt(!0,!1)};function Ot(t,e,n){const s=d(n);if(s!==n&&e.call(t,s)){const r=Nt(t);S(`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 Kt=new WeakMap,Lt=new WeakMap,Wt=new WeakMap,ve=new WeakMap;function _e(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ge(t){return t.__v_skip||!Object.isExtensible(t)?0:_e(Nt(t))}function Ht(t){return V(t)?t:wt(t,!1,ce,pe,Kt)}function be(t){return wt(t,!1,fe,de,Lt)}function pt(t){return wt(t,!0,ae,he,Wt)}function wt(t,e,n,s,r){if(!K(t))return process.env.NODE_ENV!=="production"&&S(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=ge(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 B(t){return V(t)?B(t.__v_raw):!!(t&&t.__v_isReactive)}function V(t){return!!(t&&t.__v_isReadonly)}function w(t){return!!(t&&t.__v_isShallow)}function we(t){return t?!!t.__v_raw:!1}function d(t){const e=t&&t.__v_raw;return e?d(e):t}const I=t=>K(t)?Ht(t):t,Y=t=>K(t)?pt(t):t;function N(t){return t?t.__v_isRef===!0:!1}const Z={},tt=new WeakMap;let m;function Ee(t,e=!1,n=m){if(n){let s=tt.get(n);s||tt.set(n,s=[]),s.push(t)}else process.env.NODE_ENV!=="production"&&!e&&S("onWatcherCleanup() was called when there was no active watcher to associate with.")}function Dt(t,e,n=Ct){const{immediate:s,deep:r,once:i,scheduler:o,augmentJob:c,call:a}=n,p=l=>{(n.onWarn||S)("Invalid watch source: ",l,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},v=l=>r?l:w(l)||r===!1||r===0?D(l,1):D(l);let f,h,L,U,G=!1,J=!1;if(N(t)?(h=()=>t.value,G=w(t)):B(t)?(h=()=>v(t),G=!0):j(t)?(J=!0,G=t.some(l=>B(l)||w(l)),h=()=>t.map(l=>{if(N(l))return l.value;if(B(l))return v(l);if(Et(l))return a?a(l,2):l();process.env.NODE_ENV!=="production"&&p(l)})):Et(t)?e?h=a?()=>a(t,2):t:h=()=>{if(L){jt();try{L()}finally{Vt()}}const l=m;m=f;try{return a?a(t,3,[U]):t(U)}finally{m=l}}:(h=Bt,process.env.NODE_ENV!=="production"&&p(t)),e&&r){const l=h,b=r===!0?1/0:r;h=()=>D(l(),b)}const M=()=>{f.stop()};if(i&&e){const l=e;e=(...b)=>{l(...b),M()}}let x=J?new Array(t.length).fill(Z):Z;const W=l=>{if(!(!(f.flags&1)||!f.dirty&&!l))if(e){const b=f.run();if(r||G||(J?b.some((nt,Q)=>T(nt,x[Q])):T(b,x))){L&&L();const nt=m;m=f;try{const Q=[b,x===Z?void 0:J&&x[0]===Z?[]:x,U];x=b,a?a(e,3,Q):e(...Q)}finally{m=nt}}}else f.run()};return c&&c(W),f=new qt(h),f.scheduler=o?()=>o(W,!1):W,U=l=>Ee(l,!1,f),L=f.onStop=()=>{const l=tt.get(f);if(l){if(a)a(l,4);else for(const b of l)b();tt.delete(f)}},process.env.NODE_ENV!=="production"&&(f.onTrack=n.onTrack,f.onTrigger=n.onTrigger),e?s?W(!0):x=f.run():o?o(W.bind(null,!0),!0):f.run(),M.pause=f.pause.bind(f),M.resume=f.resume.bind(f),M.stop=M,M}function D(t,e=1/0,n){if(e<=0||!K(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,N(t))D(t.value,e,n);else if(j(t))for(let s=0;s<t.length;s++)D(t[s],e,n);else if(Yt(t)||P(t))t.forEach(s=>{D(s,e,n)});else if(Gt(t)){for(const s in t)D(t[s],e,n);for(const s of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,s)&&D(t[s],e,n)}return t}class Se{constructor(e){return e&&Object.assign(this,e),be(this)}set(e,n){const s=(o,c)=>{this[o]=c};return typeof e=="string"?((o,c)=>{const[a,...p]=o.split(".");p.length===0?s(a,c):this[a]?.set(p.join("."),c)})(e,n):typeof e=="object"&&(o=>{Object.entries(o).forEach(([c,a])=>s(c,a))})(e),this}}const ye={watch:(...t)=>{const e=Dt(...t);return{...e,remove:e.stop}},once:t=>new Promise(e=>{const n=Dt(t,s=>{s&&(e(s),n.stop())})})};exports.Accessor=Se;exports.reactiveUtils=ye;
|
package/dist/index.es.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// @__NO_SIDE_EFFECTS__
|
|
2
|
-
function
|
|
2
|
+
function $t(t) {
|
|
3
3
|
const e = /* @__PURE__ */ Object.create(null);
|
|
4
4
|
for (const n of t.split(",")) e[n] = 1;
|
|
5
5
|
return (n) => n in e;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const Ct = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
|
|
8
8
|
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
9
|
-
const
|
|
10
|
-
}, ot = Object.assign,
|
|
9
|
+
const Bt = () => {
|
|
10
|
+
}, ot = Object.assign, zt = Object.prototype.hasOwnProperty, ct = (t, e) => zt.call(t, e), j = Array.isArray, P = (t) => et(t) === "[object Map]", Yt = (t) => et(t) === "[object Set]", Et = (t) => typeof t == "function", Ft = (t) => typeof t == "string", F = (t) => typeof t == "symbol", K = (t) => t !== null && typeof t == "object", Gt = Object.prototype.toString, et = (t) => Gt.call(t), Nt = (t) => et(t).slice(8, -1), Ut = (t) => et(t) === "[object Object]", ht = (t) => Ft(t) && t !== "NaN" && t[0] !== "-" && "" + parseInt(t, 10) === t, Jt = (t) => {
|
|
11
11
|
const e = /* @__PURE__ */ Object.create(null);
|
|
12
12
|
return ((n) => e[n] || (e[n] = t(n)));
|
|
13
|
-
},
|
|
13
|
+
}, Qt = Jt((t) => t.charAt(0).toUpperCase() + t.slice(1)), T = (t, e) => !Object.is(t, e);
|
|
14
14
|
function S(t, ...e) {
|
|
15
15
|
console.warn(`[Vue warn] ${t}`, ...e);
|
|
16
16
|
}
|
|
17
17
|
let u;
|
|
18
18
|
const rt = /* @__PURE__ */ new WeakSet();
|
|
19
|
-
class
|
|
19
|
+
class qt {
|
|
20
20
|
constructor(e) {
|
|
21
21
|
this.fn = e, this.deps = void 0, this.depsTail = void 0, this.flags = 5, this.next = void 0, this.cleanup = void 0, this.scheduler = void 0;
|
|
22
22
|
}
|
|
@@ -30,12 +30,12 @@ class Ut {
|
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
32
|
notify() {
|
|
33
|
-
this.flags & 2 && !(this.flags & 32) || this.flags & 8 ||
|
|
33
|
+
this.flags & 2 && !(this.flags & 32) || this.flags & 8 || Xt(this);
|
|
34
34
|
}
|
|
35
35
|
run() {
|
|
36
36
|
if (!(this.flags & 1))
|
|
37
37
|
return this.fn();
|
|
38
|
-
this.flags |= 2,
|
|
38
|
+
this.flags |= 2, St(this), mt(this);
|
|
39
39
|
const e = u, n = g;
|
|
40
40
|
u = this, g = !0;
|
|
41
41
|
try {
|
|
@@ -43,14 +43,14 @@ class Ut {
|
|
|
43
43
|
} finally {
|
|
44
44
|
process.env.NODE_ENV !== "production" && u !== this && S(
|
|
45
45
|
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
46
|
-
),
|
|
46
|
+
), Tt(this), u = e, g = n, this.flags &= -3;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
stop() {
|
|
50
50
|
if (this.flags & 1) {
|
|
51
51
|
for (let e = this.deps; e; e = e.nextDep)
|
|
52
52
|
_t(e);
|
|
53
|
-
this.deps = this.depsTail = void 0,
|
|
53
|
+
this.deps = this.depsTail = void 0, St(this), this.onStop && this.onStop(), this.flags &= -2;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
trigger() {
|
|
@@ -66,19 +66,19 @@ class Ut {
|
|
|
66
66
|
return at(this);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
let
|
|
70
|
-
function
|
|
69
|
+
let xt = 0, $, C;
|
|
70
|
+
function Xt(t, e = !1) {
|
|
71
71
|
if (t.flags |= 8, e) {
|
|
72
72
|
t.next = C, C = t;
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
t.next = $, $ = t;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
77
|
+
function dt() {
|
|
78
|
+
xt++;
|
|
79
79
|
}
|
|
80
80
|
function vt() {
|
|
81
|
-
if (--
|
|
81
|
+
if (--xt > 0)
|
|
82
82
|
return;
|
|
83
83
|
if (C) {
|
|
84
84
|
let e = C;
|
|
@@ -103,38 +103,38 @@ function vt() {
|
|
|
103
103
|
}
|
|
104
104
|
if (t) throw t;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function mt(t) {
|
|
107
107
|
for (let e = t.deps; e; e = e.nextDep)
|
|
108
108
|
e.version = -1, e.prevActiveLink = e.dep.activeLink, e.dep.activeLink = e;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Tt(t) {
|
|
111
111
|
let e, n = t.depsTail, s = n;
|
|
112
112
|
for (; s; ) {
|
|
113
113
|
const r = s.prevDep;
|
|
114
|
-
s.version === -1 ? (s === n && (n = r), _t(s),
|
|
114
|
+
s.version === -1 ? (s === n && (n = r), _t(s), kt(s)) : e = s, s.dep.activeLink = s.prevActiveLink, s.prevActiveLink = void 0, s = r;
|
|
115
115
|
}
|
|
116
116
|
t.deps = e, t.depsTail = n;
|
|
117
117
|
}
|
|
118
118
|
function at(t) {
|
|
119
119
|
for (let e = t.deps; e; e = e.nextDep)
|
|
120
|
-
if (e.dep.version !== e.version || e.dep.computed && (
|
|
120
|
+
if (e.dep.version !== e.version || e.dep.computed && (Zt(e.dep.computed) || e.dep.version !== e.version))
|
|
121
121
|
return !0;
|
|
122
122
|
return !!t._dirty;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Zt(t) {
|
|
125
125
|
if (t.flags & 4 && !(t.flags & 16) || (t.flags &= -17, t.globalVersion === k) || (t.globalVersion = k, !t.isSSR && t.flags & 128 && (!t.deps && !t._dirty || !at(t))))
|
|
126
126
|
return;
|
|
127
127
|
t.flags |= 2;
|
|
128
128
|
const e = t.dep, n = u, s = g;
|
|
129
129
|
u = t, g = !0;
|
|
130
130
|
try {
|
|
131
|
-
|
|
131
|
+
mt(t);
|
|
132
132
|
const r = t.fn(t._value);
|
|
133
|
-
(e.version === 0 ||
|
|
133
|
+
(e.version === 0 || T(r, t._value)) && (t.flags |= 128, t._value = r, e.version++);
|
|
134
134
|
} catch (r) {
|
|
135
135
|
throw e.version++, r;
|
|
136
136
|
} finally {
|
|
137
|
-
u = n, g = s,
|
|
137
|
+
u = n, g = s, Tt(t), t.flags &= -3;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
function _t(t, e = !1) {
|
|
@@ -146,20 +146,20 @@ function _t(t, e = !1) {
|
|
|
146
146
|
}
|
|
147
147
|
!e && !--n.sc && n.map && n.map.delete(n.key);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function kt(t) {
|
|
150
150
|
const { prevDep: e, nextDep: n } = t;
|
|
151
151
|
e && (e.nextDep = n, t.prevDep = void 0), n && (n.prevDep = e, t.nextDep = void 0);
|
|
152
152
|
}
|
|
153
153
|
let g = !0;
|
|
154
|
-
const
|
|
155
|
-
function
|
|
156
|
-
|
|
154
|
+
const Rt = [];
|
|
155
|
+
function jt() {
|
|
156
|
+
Rt.push(g), g = !1;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
const t =
|
|
158
|
+
function Vt() {
|
|
159
|
+
const t = Rt.pop();
|
|
160
160
|
g = t === void 0 ? !0 : t;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function St(t) {
|
|
163
163
|
const { cleanup: e } = t;
|
|
164
164
|
if (t.cleanup = void 0, e) {
|
|
165
165
|
const n = u;
|
|
@@ -172,12 +172,12 @@ function Et(t) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
let k = 0;
|
|
175
|
-
class
|
|
175
|
+
class te {
|
|
176
176
|
constructor(e, n) {
|
|
177
177
|
this.sub = e, this.dep = n, this.version = n.version, this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
class
|
|
180
|
+
class ee {
|
|
181
181
|
// TODO isolatedDeclarations "__v_skip"
|
|
182
182
|
constructor(e) {
|
|
183
183
|
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);
|
|
@@ -187,7 +187,7 @@ class Zt {
|
|
|
187
187
|
return;
|
|
188
188
|
let n = this.activeLink;
|
|
189
189
|
if (n === void 0 || n.sub !== u)
|
|
190
|
-
n = this.activeLink = new
|
|
190
|
+
n = this.activeLink = new te(u, this), u.deps ? (n.prevDep = u.depsTail, u.depsTail.nextDep = n, u.depsTail = n) : u.deps = u.depsTail = n, It(n);
|
|
191
191
|
else if (n.version === -1 && (n.version = this.version, n.nextDep)) {
|
|
192
192
|
const s = n.nextDep;
|
|
193
193
|
s.prevDep = n.prevDep, n.prevDep && (n.prevDep.nextDep = s), n.prevDep = u.depsTail, n.nextDep = void 0, u.depsTail.nextDep = n, u.depsTail = n, u.deps === n && (u.deps = s);
|
|
@@ -205,7 +205,7 @@ class Zt {
|
|
|
205
205
|
this.version++, k++, this.notify(e);
|
|
206
206
|
}
|
|
207
207
|
notify(e) {
|
|
208
|
-
|
|
208
|
+
dt();
|
|
209
209
|
try {
|
|
210
210
|
if (process.env.NODE_ENV !== "production")
|
|
211
211
|
for (let n = this.subsHead; n; n = n.nextSub)
|
|
@@ -224,13 +224,13 @@ class Zt {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function It(t) {
|
|
228
228
|
if (t.dep.sc++, t.sub.flags & 4) {
|
|
229
229
|
const e = t.dep.computed;
|
|
230
230
|
if (e && !t.dep.subs) {
|
|
231
231
|
e.flags |= 20;
|
|
232
232
|
for (let s = e.deps; s; s = s.nextDep)
|
|
233
|
-
|
|
233
|
+
It(s);
|
|
234
234
|
}
|
|
235
235
|
const n = t.dep.subs;
|
|
236
236
|
n !== t && (t.prevSub = n, n && (n.nextSub = t)), process.env.NODE_ENV !== "production" && t.dep.subsHead === void 0 && (t.dep.subsHead = t), t.dep.subs = t;
|
|
@@ -240,7 +240,7 @@ const ft = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ Symbol(
|
|
|
240
240
|
process.env.NODE_ENV !== "production" ? "Object iterate" : ""
|
|
241
241
|
), lt = /* @__PURE__ */ Symbol(
|
|
242
242
|
process.env.NODE_ENV !== "production" ? "Map keys iterate" : ""
|
|
243
|
-
),
|
|
243
|
+
), z = /* @__PURE__ */ Symbol(
|
|
244
244
|
process.env.NODE_ENV !== "production" ? "Array iterate" : ""
|
|
245
245
|
);
|
|
246
246
|
function _(t, e, n) {
|
|
@@ -248,14 +248,14 @@ function _(t, e, n) {
|
|
|
248
248
|
let s = ft.get(t);
|
|
249
249
|
s || ft.set(t, s = /* @__PURE__ */ new Map());
|
|
250
250
|
let r = s.get(n);
|
|
251
|
-
r || (s.set(n, r = new
|
|
251
|
+
r || (s.set(n, r = new ee()), r.map = s, r.key = n), process.env.NODE_ENV !== "production" ? r.track({
|
|
252
252
|
target: t,
|
|
253
253
|
type: e,
|
|
254
254
|
key: n
|
|
255
255
|
}) : r.track();
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function O(t, e, n, s, r, i) {
|
|
259
259
|
const o = ft.get(t);
|
|
260
260
|
if (!o) {
|
|
261
261
|
k++;
|
|
@@ -271,19 +271,19 @@ function y(t, e, n, s, r, i) {
|
|
|
271
271
|
oldTarget: i
|
|
272
272
|
}) : a.trigger());
|
|
273
273
|
};
|
|
274
|
-
if (
|
|
274
|
+
if (dt(), e === "clear")
|
|
275
275
|
o.forEach(c);
|
|
276
276
|
else {
|
|
277
|
-
const a =
|
|
277
|
+
const a = j(t), p = a && ht(n);
|
|
278
278
|
if (a && n === "length") {
|
|
279
279
|
const v = Number(s);
|
|
280
|
-
o.forEach((f,
|
|
281
|
-
(
|
|
280
|
+
o.forEach((f, d) => {
|
|
281
|
+
(d === "length" || d === z || !F(d) && d >= v) && c(f);
|
|
282
282
|
});
|
|
283
283
|
} else
|
|
284
|
-
switch ((n !== void 0 || o.has(void 0)) && c(o.get(n)),
|
|
284
|
+
switch ((n !== void 0 || o.has(void 0)) && c(o.get(n)), p && c(o.get(z)), e) {
|
|
285
285
|
case "add":
|
|
286
|
-
a ?
|
|
286
|
+
a ? p && c(o.get("length")) : (c(o.get(R)), P(t) && c(o.get(lt)));
|
|
287
287
|
break;
|
|
288
288
|
case "delete":
|
|
289
289
|
a || (c(o.get(R)), P(t) && c(o.get(lt)));
|
|
@@ -296,27 +296,27 @@ function y(t, e, n, s, r, i) {
|
|
|
296
296
|
vt();
|
|
297
297
|
}
|
|
298
298
|
function A(t) {
|
|
299
|
-
const e =
|
|
300
|
-
return e === t ? e : (_(e, "iterate",
|
|
299
|
+
const e = h(t);
|
|
300
|
+
return e === t ? e : (_(e, "iterate", z), w(t) ? e : e.map(I));
|
|
301
301
|
}
|
|
302
302
|
function gt(t) {
|
|
303
|
-
return _(t =
|
|
303
|
+
return _(t = h(t), "iterate", z), t;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
return
|
|
305
|
+
function y(t, e) {
|
|
306
|
+
return V(t) ? B(t) ? Y(I(e)) : Y(e) : I(e);
|
|
307
307
|
}
|
|
308
|
-
const
|
|
308
|
+
const ne = {
|
|
309
309
|
__proto__: null,
|
|
310
310
|
[Symbol.iterator]() {
|
|
311
|
-
return st(this, Symbol.iterator, (t) =>
|
|
311
|
+
return st(this, Symbol.iterator, (t) => y(this, t));
|
|
312
312
|
},
|
|
313
313
|
concat(...t) {
|
|
314
314
|
return A(this).concat(
|
|
315
|
-
...t.map((e) =>
|
|
315
|
+
...t.map((e) => j(e) ? A(e) : e)
|
|
316
316
|
);
|
|
317
317
|
},
|
|
318
318
|
entries() {
|
|
319
|
-
return st(this, "entries", (t) => (t[1] =
|
|
319
|
+
return st(this, "entries", (t) => (t[1] = y(this, t[1]), t));
|
|
320
320
|
},
|
|
321
321
|
every(t, e) {
|
|
322
322
|
return E(this, "every", t, e, void 0, arguments);
|
|
@@ -327,7 +327,7 @@ const kt = {
|
|
|
327
327
|
"filter",
|
|
328
328
|
t,
|
|
329
329
|
e,
|
|
330
|
-
(n) => n.map((s) =>
|
|
330
|
+
(n) => n.map((s) => y(this, s)),
|
|
331
331
|
arguments
|
|
332
332
|
);
|
|
333
333
|
},
|
|
@@ -337,7 +337,7 @@ const kt = {
|
|
|
337
337
|
"find",
|
|
338
338
|
t,
|
|
339
339
|
e,
|
|
340
|
-
(n) =>
|
|
340
|
+
(n) => y(this, n),
|
|
341
341
|
arguments
|
|
342
342
|
);
|
|
343
343
|
},
|
|
@@ -350,7 +350,7 @@ const kt = {
|
|
|
350
350
|
"findLast",
|
|
351
351
|
t,
|
|
352
352
|
e,
|
|
353
|
-
(n) =>
|
|
353
|
+
(n) => y(this, n),
|
|
354
354
|
arguments
|
|
355
355
|
);
|
|
356
356
|
},
|
|
@@ -384,10 +384,10 @@ const kt = {
|
|
|
384
384
|
return H(this, "push", t);
|
|
385
385
|
},
|
|
386
386
|
reduce(t, ...e) {
|
|
387
|
-
return
|
|
387
|
+
return yt(this, "reduce", t, e);
|
|
388
388
|
},
|
|
389
389
|
reduceRight(t, ...e) {
|
|
390
|
-
return
|
|
390
|
+
return yt(this, "reduceRight", t, e);
|
|
391
391
|
},
|
|
392
392
|
shift() {
|
|
393
393
|
return H(this, "shift");
|
|
@@ -412,7 +412,7 @@ const kt = {
|
|
|
412
412
|
return H(this, "unshift", t);
|
|
413
413
|
},
|
|
414
414
|
values() {
|
|
415
|
-
return st(this, "values", (t) =>
|
|
415
|
+
return st(this, "values", (t) => y(this, t));
|
|
416
416
|
}
|
|
417
417
|
};
|
|
418
418
|
function st(t, e, n) {
|
|
@@ -422,51 +422,51 @@ function st(t, e, n) {
|
|
|
422
422
|
return i.done || (i.value = n(i.value)), i;
|
|
423
423
|
}), r;
|
|
424
424
|
}
|
|
425
|
-
const
|
|
425
|
+
const re = Array.prototype;
|
|
426
426
|
function E(t, e, n, s, r, i) {
|
|
427
427
|
const o = gt(t), c = o !== t && !w(t), a = o[e];
|
|
428
|
-
if (a !==
|
|
428
|
+
if (a !== re[e]) {
|
|
429
429
|
const f = a.apply(t, i);
|
|
430
|
-
return c ?
|
|
430
|
+
return c ? I(f) : f;
|
|
431
431
|
}
|
|
432
|
-
let
|
|
433
|
-
o !== t && (c ?
|
|
434
|
-
return n.call(this,
|
|
435
|
-
} : n.length > 2 && (
|
|
436
|
-
return n.call(this, f,
|
|
432
|
+
let p = n;
|
|
433
|
+
o !== t && (c ? p = function(f, d) {
|
|
434
|
+
return n.call(this, y(t, f), d, t);
|
|
435
|
+
} : n.length > 2 && (p = function(f, d) {
|
|
436
|
+
return n.call(this, f, d, t);
|
|
437
437
|
}));
|
|
438
|
-
const v = a.call(o,
|
|
438
|
+
const v = a.call(o, p, s);
|
|
439
439
|
return c && r ? r(v) : v;
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function yt(t, e, n, s) {
|
|
442
442
|
const r = gt(t);
|
|
443
443
|
let i = n;
|
|
444
444
|
return r !== t && (w(t) ? n.length > 3 && (i = function(o, c, a) {
|
|
445
445
|
return n.call(this, o, c, a, t);
|
|
446
446
|
}) : i = function(o, c, a) {
|
|
447
|
-
return n.call(this, o,
|
|
447
|
+
return n.call(this, o, y(t, c), a, t);
|
|
448
448
|
}), r[e](i, ...s);
|
|
449
449
|
}
|
|
450
450
|
function it(t, e, n) {
|
|
451
|
-
const s =
|
|
452
|
-
_(s, "iterate",
|
|
451
|
+
const s = h(t);
|
|
452
|
+
_(s, "iterate", z);
|
|
453
453
|
const r = s[e](...n);
|
|
454
|
-
return (r === -1 || r === !1) &&
|
|
454
|
+
return (r === -1 || r === !1) && we(n[0]) ? (n[0] = h(n[0]), s[e](...n)) : r;
|
|
455
455
|
}
|
|
456
456
|
function H(t, e, n = []) {
|
|
457
|
-
|
|
458
|
-
const s =
|
|
459
|
-
return vt(),
|
|
457
|
+
jt(), dt();
|
|
458
|
+
const s = h(t)[e].apply(t, n);
|
|
459
|
+
return vt(), Vt(), s;
|
|
460
460
|
}
|
|
461
|
-
const
|
|
461
|
+
const se = /* @__PURE__ */ $t("__proto__,__v_isRef,__isVue"), Mt = new Set(
|
|
462
462
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((t) => t !== "arguments" && t !== "caller").map((t) => Symbol[t]).filter(F)
|
|
463
463
|
);
|
|
464
|
-
function
|
|
464
|
+
function ie(t) {
|
|
465
465
|
F(t) || (t = String(t));
|
|
466
|
-
const e =
|
|
466
|
+
const e = h(this);
|
|
467
467
|
return _(e, "has", t), e.hasOwnProperty(t);
|
|
468
468
|
}
|
|
469
|
-
class
|
|
469
|
+
class At {
|
|
470
470
|
constructor(e = !1, n = !1) {
|
|
471
471
|
this._isReadonly = e, this._isShallow = n;
|
|
472
472
|
}
|
|
@@ -480,16 +480,16 @@ class jt {
|
|
|
480
480
|
if (n === "__v_isShallow")
|
|
481
481
|
return i;
|
|
482
482
|
if (n === "__v_raw")
|
|
483
|
-
return s === (r ? i ?
|
|
483
|
+
return s === (r ? i ? ve : Wt : i ? Lt : Kt).get(e) || // receiver is not the reactive proxy, but has the same prototype
|
|
484
484
|
// this means the receiver is a user proxy of the reactive proxy
|
|
485
485
|
Object.getPrototypeOf(e) === Object.getPrototypeOf(s) ? e : void 0;
|
|
486
|
-
const o =
|
|
486
|
+
const o = j(e);
|
|
487
487
|
if (!r) {
|
|
488
488
|
let a;
|
|
489
|
-
if (o && (a =
|
|
489
|
+
if (o && (a = ne[n]))
|
|
490
490
|
return a;
|
|
491
491
|
if (n === "hasOwnProperty")
|
|
492
|
-
return
|
|
492
|
+
return ie;
|
|
493
493
|
}
|
|
494
494
|
const c = Reflect.get(
|
|
495
495
|
e,
|
|
@@ -499,26 +499,26 @@ class jt {
|
|
|
499
499
|
// its class methods
|
|
500
500
|
N(e) ? e : s
|
|
501
501
|
);
|
|
502
|
-
if ((F(n) ?
|
|
502
|
+
if ((F(n) ? Mt.has(n) : se(n)) || (r || _(e, "get", n), i))
|
|
503
503
|
return c;
|
|
504
504
|
if (N(c)) {
|
|
505
|
-
const a = o &&
|
|
505
|
+
const a = o && ht(n) ? c : c.value;
|
|
506
506
|
return r && K(a) ? pt(a) : a;
|
|
507
507
|
}
|
|
508
|
-
return K(c) ? r ? pt(c) :
|
|
508
|
+
return K(c) ? r ? pt(c) : Ht(c) : c;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
class
|
|
511
|
+
class Pt extends At {
|
|
512
512
|
constructor(e = !1) {
|
|
513
513
|
super(!1, e);
|
|
514
514
|
}
|
|
515
515
|
set(e, n, s, r) {
|
|
516
516
|
let i = e[n];
|
|
517
|
-
const o =
|
|
517
|
+
const o = j(e) && ht(n);
|
|
518
518
|
if (!this._isShallow) {
|
|
519
|
-
const
|
|
520
|
-
if (!w(s) && !
|
|
521
|
-
return
|
|
519
|
+
const p = V(i);
|
|
520
|
+
if (!w(s) && !V(s) && (i = h(i), s = h(s)), !o && N(i) && !N(s))
|
|
521
|
+
return p ? (process.env.NODE_ENV !== "production" && S(
|
|
522
522
|
`Set operation on key "${String(n)}" failed: target is readonly.`,
|
|
523
523
|
e[n]
|
|
524
524
|
), !0) : (i.value = s, !0);
|
|
@@ -529,25 +529,25 @@ class re extends jt {
|
|
|
529
529
|
s,
|
|
530
530
|
N(e) ? e : r
|
|
531
531
|
);
|
|
532
|
-
return e ===
|
|
532
|
+
return e === h(r) && (c ? T(s, i) && O(e, "set", n, s, i) : O(e, "add", n, s)), a;
|
|
533
533
|
}
|
|
534
534
|
deleteProperty(e, n) {
|
|
535
535
|
const s = ct(e, n), r = e[n], i = Reflect.deleteProperty(e, n);
|
|
536
|
-
return i && s &&
|
|
536
|
+
return i && s && O(e, "delete", n, void 0, r), i;
|
|
537
537
|
}
|
|
538
538
|
has(e, n) {
|
|
539
539
|
const s = Reflect.has(e, n);
|
|
540
|
-
return (!F(n) || !
|
|
540
|
+
return (!F(n) || !Mt.has(n)) && _(e, "has", n), s;
|
|
541
541
|
}
|
|
542
542
|
ownKeys(e) {
|
|
543
543
|
return _(
|
|
544
544
|
e,
|
|
545
545
|
"iterate",
|
|
546
|
-
|
|
546
|
+
j(e) ? "length" : R
|
|
547
547
|
), Reflect.ownKeys(e);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
class
|
|
550
|
+
class oe extends At {
|
|
551
551
|
constructor(e = !1) {
|
|
552
552
|
super(!0, e);
|
|
553
553
|
}
|
|
@@ -564,10 +564,10 @@ class se extends jt {
|
|
|
564
564
|
), !0;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
const
|
|
568
|
-
function
|
|
567
|
+
const ce = /* @__PURE__ */ new Pt(), ae = /* @__PURE__ */ new oe(), fe = /* @__PURE__ */ new Pt(!0), ut = (t) => t, q = (t) => Reflect.getPrototypeOf(t);
|
|
568
|
+
function le(t, e, n) {
|
|
569
569
|
return function(...s) {
|
|
570
|
-
const r = this.__v_raw, i =
|
|
570
|
+
const r = this.__v_raw, i = h(r), o = P(i), c = t === "entries" || t === Symbol.iterator && o, a = t === "keys" && o, p = r[t](...s), v = n ? ut : e ? Y : I;
|
|
571
571
|
return !e && _(
|
|
572
572
|
i,
|
|
573
573
|
"iterate",
|
|
@@ -575,10 +575,10 @@ function ce(t, e, n) {
|
|
|
575
575
|
), {
|
|
576
576
|
// iterator protocol
|
|
577
577
|
next() {
|
|
578
|
-
const { value: f, done:
|
|
579
|
-
return
|
|
578
|
+
const { value: f, done: d } = p.next();
|
|
579
|
+
return d ? { value: f, done: d } : {
|
|
580
580
|
value: c ? [v(f[0]), v(f[1])] : v(f),
|
|
581
|
-
done:
|
|
581
|
+
done: d
|
|
582
582
|
};
|
|
583
583
|
},
|
|
584
584
|
// iterable protocol
|
|
@@ -593,36 +593,36 @@ function X(t) {
|
|
|
593
593
|
if (process.env.NODE_ENV !== "production") {
|
|
594
594
|
const n = e[0] ? `on key "${e[0]}" ` : "";
|
|
595
595
|
S(
|
|
596
|
-
`${
|
|
597
|
-
|
|
596
|
+
`${Qt(t)} operation ${n}failed: target is readonly.`,
|
|
597
|
+
h(this)
|
|
598
598
|
);
|
|
599
599
|
}
|
|
600
600
|
return t === "delete" ? !1 : t === "clear" ? void 0 : this;
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function ue(t, e) {
|
|
604
604
|
const n = {
|
|
605
605
|
get(r) {
|
|
606
|
-
const i = this.__v_raw, o =
|
|
607
|
-
t || (
|
|
608
|
-
const { has: a } = q(o),
|
|
606
|
+
const i = this.__v_raw, o = h(i), c = h(r);
|
|
607
|
+
t || (T(r, c) && _(o, "get", r), _(o, "get", c));
|
|
608
|
+
const { has: a } = q(o), p = e ? ut : t ? Y : I;
|
|
609
609
|
if (a.call(o, r))
|
|
610
|
-
return
|
|
610
|
+
return p(i.get(r));
|
|
611
611
|
if (a.call(o, c))
|
|
612
|
-
return
|
|
612
|
+
return p(i.get(c));
|
|
613
613
|
i !== o && i.get(r);
|
|
614
614
|
},
|
|
615
615
|
get size() {
|
|
616
616
|
const r = this.__v_raw;
|
|
617
|
-
return !t && _(
|
|
617
|
+
return !t && _(h(r), "iterate", R), r.size;
|
|
618
618
|
},
|
|
619
619
|
has(r) {
|
|
620
|
-
const i = this.__v_raw, o =
|
|
621
|
-
return t || (
|
|
620
|
+
const i = this.__v_raw, o = h(i), c = h(r);
|
|
621
|
+
return t || (T(r, c) && _(o, "has", r), _(o, "has", c)), r === c ? i.has(r) : i.has(r) || i.has(c);
|
|
622
622
|
},
|
|
623
623
|
forEach(r, i) {
|
|
624
|
-
const o = this, c = o.__v_raw, a =
|
|
625
|
-
return !t && _(a, "iterate", R), c.forEach((v, f) => r.call(i,
|
|
624
|
+
const o = this, c = o.__v_raw, a = h(c), p = e ? ut : t ? Y : I;
|
|
625
|
+
return !t && _(a, "iterate", R), c.forEach((v, f) => r.call(i, p(v), p(f), o));
|
|
626
626
|
}
|
|
627
627
|
};
|
|
628
628
|
return ot(
|
|
@@ -634,28 +634,28 @@ function ae(t, e) {
|
|
|
634
634
|
clear: X("clear")
|
|
635
635
|
} : {
|
|
636
636
|
add(r) {
|
|
637
|
-
!e && !w(r) && !
|
|
638
|
-
const i =
|
|
639
|
-
return q(i).has.call(i, r) || (i.add(r),
|
|
637
|
+
!e && !w(r) && !V(r) && (r = h(r));
|
|
638
|
+
const i = h(this);
|
|
639
|
+
return q(i).has.call(i, r) || (i.add(r), O(i, "add", r, r)), this;
|
|
640
640
|
},
|
|
641
641
|
set(r, i) {
|
|
642
|
-
!e && !w(i) && !
|
|
643
|
-
const o =
|
|
644
|
-
let
|
|
645
|
-
|
|
642
|
+
!e && !w(i) && !V(i) && (i = h(i));
|
|
643
|
+
const o = h(this), { has: c, get: a } = q(o);
|
|
644
|
+
let p = c.call(o, r);
|
|
645
|
+
p ? process.env.NODE_ENV !== "production" && Ot(o, c, r) : (r = h(r), p = c.call(o, r));
|
|
646
646
|
const v = a.call(o, r);
|
|
647
|
-
return o.set(r, i),
|
|
647
|
+
return o.set(r, i), p ? T(i, v) && O(o, "set", r, i, v) : O(o, "add", r, i), this;
|
|
648
648
|
},
|
|
649
649
|
delete(r) {
|
|
650
|
-
const i =
|
|
650
|
+
const i = h(this), { has: o, get: c } = q(i);
|
|
651
651
|
let a = o.call(i, r);
|
|
652
|
-
a ? process.env.NODE_ENV !== "production" && Ot(i, o, r) : (r =
|
|
653
|
-
const
|
|
654
|
-
return a &&
|
|
652
|
+
a ? process.env.NODE_ENV !== "production" && Ot(i, o, r) : (r = h(r), a = o.call(i, r));
|
|
653
|
+
const p = c ? c.call(i, r) : void 0, v = i.delete(r);
|
|
654
|
+
return a && O(i, "delete", r, void 0, p), v;
|
|
655
655
|
},
|
|
656
656
|
clear() {
|
|
657
|
-
const r =
|
|
658
|
-
return i &&
|
|
657
|
+
const r = h(this), i = r.size !== 0, o = process.env.NODE_ENV !== "production" ? P(r) ? new Map(r) : new Set(r) : void 0, c = r.clear();
|
|
658
|
+
return i && O(
|
|
659
659
|
r,
|
|
660
660
|
"clear",
|
|
661
661
|
void 0,
|
|
@@ -670,33 +670,35 @@ function ae(t, e) {
|
|
|
670
670
|
"entries",
|
|
671
671
|
Symbol.iterator
|
|
672
672
|
].forEach((r) => {
|
|
673
|
-
n[r] =
|
|
673
|
+
n[r] = le(r, t, e);
|
|
674
674
|
}), n;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
677
|
-
const n =
|
|
676
|
+
function bt(t, e) {
|
|
677
|
+
const n = ue(t, e);
|
|
678
678
|
return (s, r, i) => r === "__v_isReactive" ? !t : r === "__v_isReadonly" ? t : r === "__v_raw" ? s : Reflect.get(
|
|
679
679
|
ct(n, r) && r in s ? n : s,
|
|
680
680
|
r,
|
|
681
681
|
i
|
|
682
682
|
);
|
|
683
683
|
}
|
|
684
|
-
const
|
|
685
|
-
get: /* @__PURE__ */
|
|
686
|
-
},
|
|
687
|
-
get: /* @__PURE__ */
|
|
684
|
+
const pe = {
|
|
685
|
+
get: /* @__PURE__ */ bt(!1, !1)
|
|
686
|
+
}, he = {
|
|
687
|
+
get: /* @__PURE__ */ bt(!1, !0)
|
|
688
|
+
}, de = {
|
|
689
|
+
get: /* @__PURE__ */ bt(!0, !1)
|
|
688
690
|
};
|
|
689
691
|
function Ot(t, e, n) {
|
|
690
|
-
const s =
|
|
692
|
+
const s = h(n);
|
|
691
693
|
if (s !== n && e.call(t, s)) {
|
|
692
|
-
const r =
|
|
694
|
+
const r = Nt(t);
|
|
693
695
|
S(
|
|
694
696
|
`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.`
|
|
695
697
|
);
|
|
696
698
|
}
|
|
697
699
|
}
|
|
698
|
-
const
|
|
699
|
-
function
|
|
700
|
+
const Kt = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap();
|
|
701
|
+
function _e(t) {
|
|
700
702
|
switch (t) {
|
|
701
703
|
case "Object":
|
|
702
704
|
case "Array":
|
|
@@ -710,28 +712,37 @@ function de(t) {
|
|
|
710
712
|
return 0;
|
|
711
713
|
}
|
|
712
714
|
}
|
|
713
|
-
function
|
|
714
|
-
return t.__v_skip || !Object.isExtensible(t) ? 0 :
|
|
715
|
+
function ge(t) {
|
|
716
|
+
return t.__v_skip || !Object.isExtensible(t) ? 0 : _e(Nt(t));
|
|
715
717
|
}
|
|
716
|
-
function
|
|
717
|
-
return
|
|
718
|
+
function Ht(t) {
|
|
719
|
+
return V(t) ? t : wt(
|
|
720
|
+
t,
|
|
721
|
+
!1,
|
|
722
|
+
ce,
|
|
723
|
+
pe,
|
|
724
|
+
Kt
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
function be(t) {
|
|
728
|
+
return wt(
|
|
718
729
|
t,
|
|
719
730
|
!1,
|
|
720
|
-
ie,
|
|
721
731
|
fe,
|
|
722
|
-
|
|
732
|
+
he,
|
|
733
|
+
Lt
|
|
723
734
|
);
|
|
724
735
|
}
|
|
725
736
|
function pt(t) {
|
|
726
|
-
return
|
|
737
|
+
return wt(
|
|
727
738
|
t,
|
|
728
739
|
!0,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
740
|
+
ae,
|
|
741
|
+
de,
|
|
742
|
+
Wt
|
|
732
743
|
);
|
|
733
744
|
}
|
|
734
|
-
function
|
|
745
|
+
function wt(t, e, n, s, r) {
|
|
735
746
|
if (!K(t))
|
|
736
747
|
return process.env.NODE_ENV !== "production" && S(
|
|
737
748
|
`value cannot be made ${e ? "readonly" : "reactive"}: ${String(
|
|
@@ -740,7 +751,7 @@ function Kt(t, e, n, s, r) {
|
|
|
740
751
|
), t;
|
|
741
752
|
if (t.__v_raw && !(e && t.__v_isReactive))
|
|
742
753
|
return t;
|
|
743
|
-
const i =
|
|
754
|
+
const i = ge(t);
|
|
744
755
|
if (i === 0)
|
|
745
756
|
return t;
|
|
746
757
|
const o = r.get(t);
|
|
@@ -752,29 +763,29 @@ function Kt(t, e, n, s, r) {
|
|
|
752
763
|
);
|
|
753
764
|
return r.set(t, c), c;
|
|
754
765
|
}
|
|
755
|
-
function
|
|
756
|
-
return
|
|
766
|
+
function B(t) {
|
|
767
|
+
return V(t) ? B(t.__v_raw) : !!(t && t.__v_isReactive);
|
|
757
768
|
}
|
|
758
|
-
function
|
|
769
|
+
function V(t) {
|
|
759
770
|
return !!(t && t.__v_isReadonly);
|
|
760
771
|
}
|
|
761
772
|
function w(t) {
|
|
762
773
|
return !!(t && t.__v_isShallow);
|
|
763
774
|
}
|
|
764
|
-
function
|
|
775
|
+
function we(t) {
|
|
765
776
|
return t ? !!t.__v_raw : !1;
|
|
766
777
|
}
|
|
767
|
-
function
|
|
778
|
+
function h(t) {
|
|
768
779
|
const e = t && t.__v_raw;
|
|
769
|
-
return e ?
|
|
780
|
+
return e ? h(e) : t;
|
|
770
781
|
}
|
|
771
|
-
const
|
|
782
|
+
const I = (t) => K(t) ? Ht(t) : t, Y = (t) => K(t) ? pt(t) : t;
|
|
772
783
|
function N(t) {
|
|
773
784
|
return t ? t.__v_isRef === !0 : !1;
|
|
774
785
|
}
|
|
775
786
|
const Z = {}, tt = /* @__PURE__ */ new WeakMap();
|
|
776
|
-
let
|
|
777
|
-
function
|
|
787
|
+
let m;
|
|
788
|
+
function Ee(t, e = !1, n = m) {
|
|
778
789
|
if (n) {
|
|
779
790
|
let s = tt.get(n);
|
|
780
791
|
s || tt.set(n, s = []), s.push(t);
|
|
@@ -782,42 +793,42 @@ function _e(t, e = !1, n = T) {
|
|
|
782
793
|
"onWatcherCleanup() was called when there was no active watcher to associate with."
|
|
783
794
|
);
|
|
784
795
|
}
|
|
785
|
-
function
|
|
786
|
-
const { immediate: s, deep: r, once: i, scheduler: o, augmentJob: c, call: a } = n,
|
|
796
|
+
function Dt(t, e, n = Ct) {
|
|
797
|
+
const { immediate: s, deep: r, once: i, scheduler: o, augmentJob: c, call: a } = n, p = (l) => {
|
|
787
798
|
(n.onWarn || S)(
|
|
788
799
|
"Invalid watch source: ",
|
|
789
800
|
l,
|
|
790
801
|
"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types."
|
|
791
802
|
);
|
|
792
803
|
}, v = (l) => r ? l : w(l) || r === !1 || r === 0 ? D(l, 1) : D(l);
|
|
793
|
-
let f,
|
|
794
|
-
if (N(t) ? (
|
|
804
|
+
let f, d, L, G, U = !1, J = !1;
|
|
805
|
+
if (N(t) ? (d = () => t.value, U = w(t)) : B(t) ? (d = () => v(t), U = !0) : j(t) ? (J = !0, U = t.some((l) => B(l) || w(l)), d = () => t.map((l) => {
|
|
795
806
|
if (N(l))
|
|
796
807
|
return l.value;
|
|
797
|
-
if (
|
|
808
|
+
if (B(l))
|
|
798
809
|
return v(l);
|
|
799
|
-
if (
|
|
810
|
+
if (Et(l))
|
|
800
811
|
return a ? a(l, 2) : l();
|
|
801
|
-
process.env.NODE_ENV !== "production" &&
|
|
802
|
-
})) :
|
|
812
|
+
process.env.NODE_ENV !== "production" && p(l);
|
|
813
|
+
})) : Et(t) ? e ? d = a ? () => a(t, 2) : t : d = () => {
|
|
803
814
|
if (L) {
|
|
804
|
-
|
|
815
|
+
jt();
|
|
805
816
|
try {
|
|
806
817
|
L();
|
|
807
818
|
} finally {
|
|
808
|
-
|
|
819
|
+
Vt();
|
|
809
820
|
}
|
|
810
821
|
}
|
|
811
|
-
const l =
|
|
812
|
-
|
|
822
|
+
const l = m;
|
|
823
|
+
m = f;
|
|
813
824
|
try {
|
|
814
825
|
return a ? a(t, 3, [G]) : t(G);
|
|
815
826
|
} finally {
|
|
816
|
-
|
|
827
|
+
m = l;
|
|
817
828
|
}
|
|
818
|
-
} : (
|
|
819
|
-
const l =
|
|
820
|
-
|
|
829
|
+
} : (d = Bt, process.env.NODE_ENV !== "production" && p(t)), e && r) {
|
|
830
|
+
const l = d, b = r === !0 ? 1 / 0 : r;
|
|
831
|
+
d = () => D(l(), b);
|
|
821
832
|
}
|
|
822
833
|
const M = () => {
|
|
823
834
|
f.stop();
|
|
@@ -833,10 +844,10 @@ function ge(t, e, n = Wt) {
|
|
|
833
844
|
if (!(!(f.flags & 1) || !f.dirty && !l))
|
|
834
845
|
if (e) {
|
|
835
846
|
const b = f.run();
|
|
836
|
-
if (r || U || (J ? b.some((nt, Q) =>
|
|
847
|
+
if (r || U || (J ? b.some((nt, Q) => T(nt, x[Q])) : T(b, x))) {
|
|
837
848
|
L && L();
|
|
838
|
-
const nt =
|
|
839
|
-
|
|
849
|
+
const nt = m;
|
|
850
|
+
m = f;
|
|
840
851
|
try {
|
|
841
852
|
const Q = [
|
|
842
853
|
b,
|
|
@@ -849,13 +860,13 @@ function ge(t, e, n = Wt) {
|
|
|
849
860
|
e(...Q)
|
|
850
861
|
);
|
|
851
862
|
} finally {
|
|
852
|
-
|
|
863
|
+
m = nt;
|
|
853
864
|
}
|
|
854
865
|
}
|
|
855
866
|
} else
|
|
856
867
|
f.run();
|
|
857
868
|
};
|
|
858
|
-
return c && c(W), f = new
|
|
869
|
+
return c && c(W), f = new qt(d), f.scheduler = o ? () => o(W, !1) : W, G = (l) => Ee(l, !1, f), L = f.onStop = () => {
|
|
859
870
|
const l = tt.get(f);
|
|
860
871
|
if (l) {
|
|
861
872
|
if (a)
|
|
@@ -871,14 +882,14 @@ function D(t, e = 1 / 0, n) {
|
|
|
871
882
|
return t;
|
|
872
883
|
if (n.set(t, e), e--, N(t))
|
|
873
884
|
D(t.value, e, n);
|
|
874
|
-
else if (
|
|
885
|
+
else if (j(t))
|
|
875
886
|
for (let s = 0; s < t.length; s++)
|
|
876
887
|
D(t[s], e, n);
|
|
877
|
-
else if (
|
|
888
|
+
else if (Yt(t) || P(t))
|
|
878
889
|
t.forEach((s) => {
|
|
879
890
|
D(s, e, n);
|
|
880
891
|
});
|
|
881
|
-
else if (
|
|
892
|
+
else if (Ut(t)) {
|
|
882
893
|
for (const s in t)
|
|
883
894
|
D(t[s], e, n);
|
|
884
895
|
for (const s of Object.getOwnPropertySymbols(t))
|
|
@@ -886,15 +897,37 @@ function D(t, e = 1 / 0, n) {
|
|
|
886
897
|
}
|
|
887
898
|
return t;
|
|
888
899
|
}
|
|
889
|
-
class
|
|
900
|
+
class Se {
|
|
890
901
|
constructor(e) {
|
|
891
|
-
return e && Object.assign(this, e),
|
|
902
|
+
return e && Object.assign(this, e), be(this);
|
|
892
903
|
}
|
|
893
|
-
|
|
894
|
-
const
|
|
895
|
-
|
|
904
|
+
set(e, n) {
|
|
905
|
+
const s = (o, c) => {
|
|
906
|
+
this[o] = c;
|
|
907
|
+
};
|
|
908
|
+
return typeof e == "string" ? ((o, c) => {
|
|
909
|
+
const [a, ...p] = o.split(".");
|
|
910
|
+
p.length === 0 ? s(a, c) : this[a]?.set(p.join("."), c);
|
|
911
|
+
})(e, n) : typeof e == "object" && ((o) => {
|
|
912
|
+
Object.entries(o).forEach(([c, a]) => s(c, a));
|
|
913
|
+
})(e), this;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
const ye = {
|
|
917
|
+
watch: (...t) => {
|
|
918
|
+
const e = Dt(...t);
|
|
919
|
+
return {
|
|
920
|
+
...e,
|
|
921
|
+
remove: e.stop
|
|
922
|
+
};
|
|
923
|
+
},
|
|
924
|
+
once: (t) => new Promise((e) => {
|
|
925
|
+
const n = Dt(t, (s) => {
|
|
926
|
+
s && (e(s), n.stop());
|
|
927
|
+
});
|
|
928
|
+
})
|
|
896
929
|
};
|
|
897
930
|
export {
|
|
898
|
-
|
|
899
|
-
|
|
931
|
+
Se as Accessor,
|
|
932
|
+
ye as reactiveUtils
|
|
900
933
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(x,W){typeof exports=="object"&&typeof module<"u"?W(exports):typeof define=="function"&&define.amd?define(["exports"],W):(x=typeof globalThis<"u"?globalThis:x||self,W(x.Accessor={}))})(this,(function(x){"use strict";function W(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const He=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const $e=()=>{},se=Object.assign,Ce=Object.prototype.hasOwnProperty,ie=(e,t)=>Ce.call(e,t),T=Array.isArray,A=e=>J(e)==="[object Map]",ze=e=>J(e)==="[object Set]",Se=e=>typeof e=="function",Ye=e=>typeof e=="string",H=e=>typeof e=="symbol",P=e=>e!==null&&typeof e=="object",Fe=Object.prototype.toString,J=e=>Fe.call(e),Oe=e=>J(e).slice(8,-1),Be=e=>J(e)==="[object Object]",oe=e=>Ye(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ue=(e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))})(e=>e.charAt(0).toUpperCase()+e.slice(1)),m=(e,t)=>!Object.is(e,t);function E(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let u;const ce=new WeakSet;class Ge{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ce.has(this)&&(ce.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Je(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Re(this),De(this);const t=u,n=g;u=this,g=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&u!==this&&E("Active effect was not restored correctly - this is likely a Vue internal bug."),Ne(this),u=t,g=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)ue(t);this.deps=this.depsTail=void 0,Re(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ce.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){le(this)&&this.run()}get dirty(){return le(this)}}let ye=0,$,C;function Je(e,t=!1){if(e.flags|=8,t){e.next=C,C=e;return}e.next=$,$=e}function ae(){ye++}function fe(){if(--ye>0)return;if(C){let t=C;for(C=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$;){let t=$;for($=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function De(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ne(e){let t,n=e.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),ue(s),qe(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}e.deps=t,e.depsTail=n}function le(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Qe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Qe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Q)||(e.globalVersion=Q,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!le(e))))return;e.flags|=2;const t=e.dep,n=u,s=g;u=e,g=!0;try{De(e);const r=e.fn(e._value);(t.version===0||m(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{u=n,g=s,Ne(e),e.flags&=-3}}function ue(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),process.env.NODE_ENV!=="production"&&n.subsHead===e&&(n.subsHead=r),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)ue(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function qe(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let g=!0;const xe=[];function Te(){xe.push(g),g=!1}function me(){const e=xe.pop();g=e===void 0?!0:e}function Re(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=u;u=void 0;try{t()}finally{u=n}}}let Q=0;class Xe{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ze{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(t){if(!u||!g||u===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==u)n=this.activeLink=new Xe(u,this),u.deps?(n.prevDep=u.depsTail,u.depsTail.nextDep=n,u.depsTail=n):u.deps=u.depsTail=n,Ve(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=u.depsTail,n.nextDep=void 0,u.depsTail.nextDep=n,u.depsTail=n,u.deps===n&&(u.deps=s)}return process.env.NODE_ENV!=="production"&&u.onTrack&&u.onTrack(se({effect:u},t)),n}trigger(t){this.version++,Q++,this.notify(t)}notify(t){ae();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(se({effect:n.sub},t));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{fe()}}}function Ve(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)Ve(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),process.env.NODE_ENV!=="production"&&e.dep.subsHead===void 0&&(e.dep.subsHead=e),e.dep.subs=e}}const pe=new WeakMap,R=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),de=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),z=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function _(e,t,n){if(g&&u){let s=pe.get(e);s||pe.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new Ze),r.map=s,r.key=n),process.env.NODE_ENV!=="production"?r.track({target:e,type:t,key:n}):r.track()}}function O(e,t,n,s,r,i){const o=pe.get(e);if(!o){Q++;return}const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:e,type:t,key:n,newValue:s,oldValue:r,oldTarget:i}):a.trigger())};if(ae(),t==="clear")o.forEach(c);else{const a=T(e),d=a&&oe(n);if(a&&n==="length"){const v=Number(s);o.forEach((f,h)=>{(h==="length"||h===z||!H(h)&&h>=v)&&c(f)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),d&&c(o.get(z)),t){case"add":a?d&&c(o.get("length")):(c(o.get(R)),A(e)&&c(o.get(de)));break;case"delete":a||(c(o.get(R)),A(e)&&c(o.get(de)));break;case"set":A(e)&&c(o.get(R));break}}fe()}function K(e){const t=p(e);return t===e?t:(_(t,"iterate",z),b(e)?t:t.map(j))}function he(e){return _(e=p(e),"iterate",z),e}function y(e,t){return V(e)?F(e)?B(j(t)):B(t):j(t)}const ke={__proto__:null,[Symbol.iterator](){return ve(this,Symbol.iterator,e=>y(this,e))},concat(...e){return K(this).concat(...e.map(t=>T(t)?K(t):t))},entries(){return ve(this,"entries",e=>(e[1]=y(this,e[1]),e))},every(e,t){return S(this,"every",e,t,void 0,arguments)},filter(e,t){return S(this,"filter",e,t,n=>n.map(s=>y(this,s)),arguments)},find(e,t){return S(this,"find",e,t,n=>y(this,n),arguments)},findIndex(e,t){return S(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return S(this,"findLast",e,t,n=>y(this,n),arguments)},findLastIndex(e,t){return S(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return S(this,"forEach",e,t,void 0,arguments)},includes(...e){return _e(this,"includes",e)},indexOf(...e){return _e(this,"indexOf",e)},join(e){return K(this).join(e)},lastIndexOf(...e){return _e(this,"lastIndexOf",e)},map(e,t){return S(this,"map",e,t,void 0,arguments)},pop(){return Y(this,"pop")},push(...e){return Y(this,"push",e)},reduce(e,...t){return je(this,"reduce",e,t)},reduceRight(e,...t){return je(this,"reduceRight",e,t)},shift(){return Y(this,"shift")},some(e,t){return S(this,"some",e,t,void 0,arguments)},splice(...e){return Y(this,"splice",e)},toReversed(){return K(this).toReversed()},toSorted(e){return K(this).toSorted(e)},toSpliced(...e){return K(this).toSpliced(...e)},unshift(...e){return Y(this,"unshift",e)},values(){return ve(this,"values",e=>y(this,e))}};function ve(e,t,n){const s=he(e),r=s[t]();return s!==e&&!b(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const et=Array.prototype;function S(e,t,n,s,r,i){const o=he(e),c=o!==e&&!b(e),a=o[t];if(a!==et[t]){const f=a.apply(e,i);return c?j(f):f}let d=n;o!==e&&(c?d=function(f,h){return n.call(this,y(e,f),h,e)}:n.length>2&&(d=function(f,h){return n.call(this,f,h,e)}));const v=a.call(o,d,s);return c&&r?r(v):v}function je(e,t,n,s){const r=he(e);let i=n;return r!==e&&(b(e)?n.length>3&&(i=function(o,c,a){return n.call(this,o,c,a,e)}):i=function(o,c,a){return n.call(this,o,y(e,c),a,e)}),r[t](i,...s)}function _e(e,t,n){const s=p(e);_(s,"iterate",z);const r=s[t](...n);return(r===-1||r===!1)&&vt(n[0])?(n[0]=p(n[0]),s[t](...n)):r}function Y(e,t,n=[]){Te(),ae();const s=p(e)[t].apply(e,n);return fe(),me(),s}const tt=W("__proto__,__v_isRef,__isVue"),Ie=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(H));function nt(e){H(e)||(e=String(e));const t=p(this);return _(t,"has",e),t.hasOwnProperty(e)}class Me{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__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?pt:Le:i?ut:Ke).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=T(t);if(!r){let a;if(o&&(a=ke[n]))return a;if(n==="hasOwnProperty")return nt}const c=Reflect.get(t,n,D(t)?t:s);if((H(n)?Ie.has(n):tt(n))||(r||_(t,"get",n),i))return c;if(D(c)){const a=o&&oe(n)?c:c.value;return r&&P(a)?we(a):a}return P(c)?r?we(c):be(c):c}}class rt extends Me{constructor(t=!1){super(!1,t)}set(t,n,s,r){let i=t[n];const o=T(t)&&oe(n);if(!this._isShallow){const d=V(i);if(!b(s)&&!V(s)&&(i=p(i),s=p(s)),!o&&D(i)&&!D(s))return d?(process.env.NODE_ENV!=="production"&&E(`Set operation on key "${String(n)}" failed: target is readonly.`,t[n]),!0):(i.value=s,!0)}const c=o?Number(n)<t.length:ie(t,n),a=Reflect.set(t,n,s,D(t)?t:r);return t===p(r)&&(c?m(s,i)&&O(t,"set",n,s,i):O(t,"add",n,s)),a}deleteProperty(t,n){const s=ie(t,n),r=t[n],i=Reflect.deleteProperty(t,n);return i&&s&&O(t,"delete",n,void 0,r),i}has(t,n){const s=Reflect.has(t,n);return(!H(n)||!Ie.has(n))&&_(t,"has",n),s}ownKeys(t){return _(t,"iterate",T(t)?"length":R),Reflect.ownKeys(t)}}class st extends Me{constructor(t=!1){super(!0,t)}set(t,n){return process.env.NODE_ENV!=="production"&&E(`Set operation on key "${String(n)}" failed: target is readonly.`,t),!0}deleteProperty(t,n){return process.env.NODE_ENV!=="production"&&E(`Delete operation on key "${String(n)}" failed: target is readonly.`,t),!0}}const it=new rt,ot=new st,ge=e=>e,q=e=>Reflect.getPrototypeOf(e);function ct(e,t,n){return function(...s){const r=this.__v_raw,i=p(r),o=A(i),c=e==="entries"||e===Symbol.iterator&&o,a=e==="keys"&&o,d=r[e](...s),v=n?ge:t?B:j;return!t&&_(i,"iterate",a?de:R),{next(){const{value:f,done:h}=d.next();return h?{value:f,done:h}:{value:c?[v(f[0]),v(f[1])]:v(f),done:h}},[Symbol.iterator](){return this}}}}function X(e){return function(...t){if(process.env.NODE_ENV!=="production"){const n=t[0]?`on key "${t[0]}" `:"";E(`${Ue(e)} operation ${n}failed: target is readonly.`,p(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function at(e,t){const n={get(r){const i=this.__v_raw,o=p(i),c=p(r);e||(m(r,c)&&_(o,"get",r),_(o,"get",c));const{has:a}=q(o),d=t?ge:e?B:j;if(a.call(o,r))return d(i.get(r));if(a.call(o,c))return d(i.get(c));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!e&&_(p(r),"iterate",R),r.size},has(r){const i=this.__v_raw,o=p(i),c=p(r);return e||(m(r,c)&&_(o,"has",r),_(o,"has",c)),r===c?i.has(r):i.has(r)||i.has(c)},forEach(r,i){const o=this,c=o.__v_raw,a=p(c),d=t?ge:e?B:j;return!e&&_(a,"iterate",R),c.forEach((v,f)=>r.call(i,d(v),d(f),o))}};return se(n,e?{add:X("add"),set:X("set"),delete:X("delete"),clear:X("clear")}:{add(r){!t&&!b(r)&&!V(r)&&(r=p(r));const i=p(this);return q(i).has.call(i,r)||(i.add(r),O(i,"add",r,r)),this},set(r,i){!t&&!b(i)&&!V(i)&&(i=p(i));const o=p(this),{has:c,get:a}=q(o);let d=c.call(o,r);d?process.env.NODE_ENV!=="production"&&Pe(o,c,r):(r=p(r),d=c.call(o,r));const v=a.call(o,r);return o.set(r,i),d?m(i,v)&&O(o,"set",r,i,v):O(o,"add",r,i),this},delete(r){const i=p(this),{has:o,get:c}=q(i);let a=o.call(i,r);a?process.env.NODE_ENV!=="production"&&Pe(i,o,r):(r=p(r),a=o.call(i,r));const d=c?c.call(i,r):void 0,v=i.delete(r);return a&&O(i,"delete",r,void 0,d),v},clear(){const r=p(this),i=r.size!==0,o=process.env.NODE_ENV!=="production"?A(r)?new Map(r):new Set(r):void 0,c=r.clear();return i&&O(r,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=ct(r,e,t)}),n}function Ae(e,t){const n=at(e,t);return(s,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(ie(n,r)&&r in s?n:s,r,i)}const ft={get:Ae(!1,!1)},lt={get:Ae(!0,!1)};function Pe(e,t,n){const s=p(n);if(s!==n&&t.call(e,s)){const r=Oe(e);E(`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 Ke=new WeakMap,ut=new WeakMap,Le=new WeakMap,pt=new WeakMap;function dt(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ht(e){return e.__v_skip||!Object.isExtensible(e)?0:dt(Oe(e))}function be(e){return V(e)?e:We(e,!1,it,ft,Ke)}function we(e){return We(e,!0,ot,lt,Le)}function We(e,t,n,s,r){if(!P(e))return process.env.NODE_ENV!=="production"&&E(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=ht(e);if(i===0)return e;const o=r.get(e);if(o)return o;const c=new Proxy(e,i===2?s:n);return r.set(e,c),c}function F(e){return V(e)?F(e.__v_raw):!!(e&&e.__v_isReactive)}function V(e){return!!(e&&e.__v_isReadonly)}function b(e){return!!(e&&e.__v_isShallow)}function vt(e){return e?!!e.__v_raw:!1}function p(e){const t=e&&e.__v_raw;return t?p(t):e}const j=e=>P(e)?be(e):e,B=e=>P(e)?we(e):e;function D(e){return e?e.__v_isRef===!0:!1}const Z={},k=new WeakMap;let I;function _t(e,t=!1,n=I){if(n){let s=k.get(n);s||k.set(n,s=[]),s.push(e)}else process.env.NODE_ENV!=="production"&&!t&&E("onWatcherCleanup() was called when there was no active watcher to associate with.")}function gt(e,t,n=He){const{immediate:s,deep:r,once:i,scheduler:o,augmentJob:c,call:a}=n,d=l=>{(n.onWarn||E)("Invalid watch source: ",l,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},v=l=>r?l:b(l)||r===!1||r===0?N(l,1):N(l);let f,h,U,ee,te=!1,ne=!1;if(D(e)?(h=()=>e.value,te=b(e)):F(e)?(h=()=>v(e),te=!0):T(e)?(ne=!0,te=e.some(l=>F(l)||b(l)),h=()=>e.map(l=>{if(D(l))return l.value;if(F(l))return v(l);if(Se(l))return a?a(l,2):l();process.env.NODE_ENV!=="production"&&d(l)})):Se(e)?t?h=a?()=>a(e,2):e:h=()=>{if(U){Te();try{U()}finally{me()}}const l=I;I=f;try{return a?a(e,3,[ee]):e(ee)}finally{I=l}}:(h=$e,process.env.NODE_ENV!=="production"&&d(e)),t&&r){const l=h,w=r===!0?1/0:r;h=()=>N(l(),w)}const L=()=>{f.stop()};if(i&&t){const l=t;t=(...w)=>{l(...w),L()}}let M=ne?new Array(e.length).fill(Z):Z;const G=l=>{if(!(!(f.flags&1)||!f.dirty&&!l))if(t){const w=f.run();if(r||te||(ne?w.some((Ee,re)=>m(Ee,M[re])):m(w,M))){U&&U();const Ee=I;I=f;try{const re=[w,M===Z?void 0:ne&&M[0]===Z?[]:M,ee];M=w,a?a(t,3,re):t(...re)}finally{I=Ee}}}else f.run()};return c&&c(G),f=new Ge(h),f.scheduler=o?()=>o(G,!1):G,ee=l=>_t(l,!1,f),U=f.onStop=()=>{const l=k.get(f);if(l){if(a)a(l,4);else for(const w of l)w();k.delete(f)}},process.env.NODE_ENV!=="production"&&(f.onTrack=n.onTrack,f.onTrigger=n.onTrigger),t?s?G(!0):M=f.run():o?o(G.bind(null,!0),!0):f.run(),L.pause=f.pause.bind(f),L.resume=f.resume.bind(f),L.stop=L,L}function N(e,t=1/0,n){if(t<=0||!P(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,D(e))N(e.value,t,n);else if(T(e))for(let s=0;s<e.length;s++)N(e[s],t,n);else if(ze(e)||A(e))e.forEach(s=>{N(s,t,n)});else if(Be(e)){for(const s in e)N(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&N(e[s],t,n)}return e}class bt{constructor(t){return t&&Object.assign(this,t),be(this)}}const wt={watch:gt};x.Accessor=bt,x.reactiveUtils=wt,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(x,W){typeof exports=="object"&&typeof module<"u"?W(exports):typeof define=="function"&&define.amd?define(["exports"],W):(x=typeof globalThis<"u"?globalThis:x||self,W(x.Accessor={}))})(this,(function(x){"use strict";function W(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Be=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const ze=()=>{},re=Object.assign,Ye=Object.prototype.hasOwnProperty,ie=(e,t)=>Ye.call(e,t),m=Array.isArray,A=e=>J(e)==="[object Map]",Fe=e=>J(e)==="[object Set]",ye=e=>typeof e=="function",Ue=e=>typeof e=="string",H=e=>typeof e=="symbol",P=e=>e!==null&&typeof e=="object",Ge=Object.prototype.toString,J=e=>Ge.call(e),Oe=e=>J(e).slice(8,-1),Je=e=>J(e)==="[object Object]",oe=e=>Ue(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Qe=(e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))})(e=>e.charAt(0).toUpperCase()+e.slice(1)),T=(e,t)=>!Object.is(e,t);function E(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let u;const ce=new WeakSet;class qe{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ce.has(this)&&(ce.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Xe(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,je(this),Ne(this);const t=u,n=g;u=this,g=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&u!==this&&E("Active effect was not restored correctly - this is likely a Vue internal bug."),xe(this),u=t,g=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)ue(t);this.deps=this.depsTail=void 0,je(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ce.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){le(this)&&this.run()}get dirty(){return le(this)}}let De=0,$,C;function Xe(e,t=!1){if(e.flags|=8,t){e.next=C,C=e;return}e.next=$,$=e}function ae(){De++}function fe(){if(--De>0)return;if(C){let t=C;for(C=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$;){let t=$;for($=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Ne(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function xe(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),ue(r),ke(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function le(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ze(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ze(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Q)||(e.globalVersion=Q,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!le(e))))return;e.flags|=2;const t=e.dep,n=u,r=g;u=e,g=!0;try{Ne(e);const s=e.fn(e._value);(t.version===0||T(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{u=n,g=r,xe(e),e.flags&=-3}}function ue(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),process.env.NODE_ENV!=="production"&&n.subsHead===e&&(n.subsHead=s),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)ue(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ke(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let g=!0;const me=[];function Te(){me.push(g),g=!1}function Re(){const e=me.pop();g=e===void 0?!0:e}function je(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=u;u=void 0;try{t()}finally{u=n}}}let Q=0;class et{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class tt{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(t){if(!u||!g||u===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==u)n=this.activeLink=new et(u,this),u.deps?(n.prevDep=u.depsTail,u.depsTail.nextDep=n,u.depsTail=n):u.deps=u.depsTail=n,Ve(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=u.depsTail,n.nextDep=void 0,u.depsTail.nextDep=n,u.depsTail=n,u.deps===n&&(u.deps=r)}return process.env.NODE_ENV!=="production"&&u.onTrack&&u.onTrack(re({effect:u},t)),n}trigger(t){this.version++,Q++,this.notify(t)}notify(t){ae();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(re({effect:n.sub},t));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{fe()}}}function Ve(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Ve(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),process.env.NODE_ENV!=="production"&&e.dep.subsHead===void 0&&(e.dep.subsHead=e),e.dep.subs=e}}const pe=new WeakMap,R=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),de=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),B=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function _(e,t,n){if(g&&u){let r=pe.get(e);r||pe.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new tt),s.map=r,s.key=n),process.env.NODE_ENV!=="production"?s.track({target:e,type:t,key:n}):s.track()}}function y(e,t,n,r,s,i){const o=pe.get(e);if(!o){Q++;return}const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:e,type:t,key:n,newValue:r,oldValue:s,oldTarget:i}):a.trigger())};if(ae(),t==="clear")o.forEach(c);else{const a=m(e),p=a&&oe(n);if(a&&n==="length"){const v=Number(r);o.forEach((f,h)=>{(h==="length"||h===B||!H(h)&&h>=v)&&c(f)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),p&&c(o.get(B)),t){case"add":a?p&&c(o.get("length")):(c(o.get(R)),A(e)&&c(o.get(de)));break;case"delete":a||(c(o.get(R)),A(e)&&c(o.get(de)));break;case"set":A(e)&&c(o.get(R));break}}fe()}function K(e){const t=d(e);return t===e?t:(_(t,"iterate",B),b(e)?t:t.map(V))}function he(e){return _(e=d(e),"iterate",B),e}function O(e,t){return j(e)?Y(e)?F(V(t)):F(t):V(t)}const nt={__proto__:null,[Symbol.iterator](){return ve(this,Symbol.iterator,e=>O(this,e))},concat(...e){return K(this).concat(...e.map(t=>m(t)?K(t):t))},entries(){return ve(this,"entries",e=>(e[1]=O(this,e[1]),e))},every(e,t){return S(this,"every",e,t,void 0,arguments)},filter(e,t){return S(this,"filter",e,t,n=>n.map(r=>O(this,r)),arguments)},find(e,t){return S(this,"find",e,t,n=>O(this,n),arguments)},findIndex(e,t){return S(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return S(this,"findLast",e,t,n=>O(this,n),arguments)},findLastIndex(e,t){return S(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return S(this,"forEach",e,t,void 0,arguments)},includes(...e){return _e(this,"includes",e)},indexOf(...e){return _e(this,"indexOf",e)},join(e){return K(this).join(e)},lastIndexOf(...e){return _e(this,"lastIndexOf",e)},map(e,t){return S(this,"map",e,t,void 0,arguments)},pop(){return z(this,"pop")},push(...e){return z(this,"push",e)},reduce(e,...t){return Ie(this,"reduce",e,t)},reduceRight(e,...t){return Ie(this,"reduceRight",e,t)},shift(){return z(this,"shift")},some(e,t){return S(this,"some",e,t,void 0,arguments)},splice(...e){return z(this,"splice",e)},toReversed(){return K(this).toReversed()},toSorted(e){return K(this).toSorted(e)},toSpliced(...e){return K(this).toSpliced(...e)},unshift(...e){return z(this,"unshift",e)},values(){return ve(this,"values",e=>O(this,e))}};function ve(e,t,n){const r=he(e),s=r[t]();return r!==e&&!b(e)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const st=Array.prototype;function S(e,t,n,r,s,i){const o=he(e),c=o!==e&&!b(e),a=o[t];if(a!==st[t]){const f=a.apply(e,i);return c?V(f):f}let p=n;o!==e&&(c?p=function(f,h){return n.call(this,O(e,f),h,e)}:n.length>2&&(p=function(f,h){return n.call(this,f,h,e)}));const v=a.call(o,p,r);return c&&s?s(v):v}function Ie(e,t,n,r){const s=he(e);let i=n;return s!==e&&(b(e)?n.length>3&&(i=function(o,c,a){return n.call(this,o,c,a,e)}):i=function(o,c,a){return n.call(this,o,O(e,c),a,e)}),s[t](i,...r)}function _e(e,t,n){const r=d(e);_(r,"iterate",B);const s=r[t](...n);return(s===-1||s===!1)&&wt(n[0])?(n[0]=d(n[0]),r[t](...n)):s}function z(e,t,n=[]){Te(),ae();const r=d(e)[t].apply(e,n);return fe(),Re(),r}const rt=W("__proto__,__v_isRef,__isVue"),Me=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(H));function it(e){H(e)||(e=String(e));const t=d(this);return _(t,"has",e),t.hasOwnProperty(e)}class Ae{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__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?vt:He:i?We:Le).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=m(t);if(!s){let a;if(o&&(a=nt[n]))return a;if(n==="hasOwnProperty")return it}const c=Reflect.get(t,n,D(t)?t:r);if((H(n)?Me.has(n):rt(n))||(s||_(t,"get",n),i))return c;if(D(c)){const a=o&&oe(n)?c:c.value;return s&&P(a)?we(a):a}return P(c)?s?we(c):$e(c):c}}class Pe extends Ae{constructor(t=!1){super(!1,t)}set(t,n,r,s){let i=t[n];const o=m(t)&&oe(n);if(!this._isShallow){const p=j(i);if(!b(r)&&!j(r)&&(i=d(i),r=d(r)),!o&&D(i)&&!D(r))return p?(process.env.NODE_ENV!=="production"&&E(`Set operation on key "${String(n)}" failed: target is readonly.`,t[n]),!0):(i.value=r,!0)}const c=o?Number(n)<t.length:ie(t,n),a=Reflect.set(t,n,r,D(t)?t:s);return t===d(s)&&(c?T(r,i)&&y(t,"set",n,r,i):y(t,"add",n,r)),a}deleteProperty(t,n){const r=ie(t,n),s=t[n],i=Reflect.deleteProperty(t,n);return i&&r&&y(t,"delete",n,void 0,s),i}has(t,n){const r=Reflect.has(t,n);return(!H(n)||!Me.has(n))&&_(t,"has",n),r}ownKeys(t){return _(t,"iterate",m(t)?"length":R),Reflect.ownKeys(t)}}class ot extends Ae{constructor(t=!1){super(!0,t)}set(t,n){return process.env.NODE_ENV!=="production"&&E(`Set operation on key "${String(n)}" failed: target is readonly.`,t),!0}deleteProperty(t,n){return process.env.NODE_ENV!=="production"&&E(`Delete operation on key "${String(n)}" failed: target is readonly.`,t),!0}}const ct=new Pe,at=new ot,ft=new Pe(!0),ge=e=>e,q=e=>Reflect.getPrototypeOf(e);function lt(e,t,n){return function(...r){const s=this.__v_raw,i=d(s),o=A(i),c=e==="entries"||e===Symbol.iterator&&o,a=e==="keys"&&o,p=s[e](...r),v=n?ge:t?F:V;return!t&&_(i,"iterate",a?de:R),{next(){const{value:f,done:h}=p.next();return h?{value:f,done:h}:{value:c?[v(f[0]),v(f[1])]:v(f),done:h}},[Symbol.iterator](){return this}}}}function X(e){return function(...t){if(process.env.NODE_ENV!=="production"){const n=t[0]?`on key "${t[0]}" `:"";E(`${Qe(e)} operation ${n}failed: target is readonly.`,d(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function ut(e,t){const n={get(s){const i=this.__v_raw,o=d(i),c=d(s);e||(T(s,c)&&_(o,"get",s),_(o,"get",c));const{has:a}=q(o),p=t?ge:e?F:V;if(a.call(o,s))return p(i.get(s));if(a.call(o,c))return p(i.get(c));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!e&&_(d(s),"iterate",R),s.size},has(s){const i=this.__v_raw,o=d(i),c=d(s);return e||(T(s,c)&&_(o,"has",s),_(o,"has",c)),s===c?i.has(s):i.has(s)||i.has(c)},forEach(s,i){const o=this,c=o.__v_raw,a=d(c),p=t?ge:e?F:V;return!e&&_(a,"iterate",R),c.forEach((v,f)=>s.call(i,p(v),p(f),o))}};return re(n,e?{add:X("add"),set:X("set"),delete:X("delete"),clear:X("clear")}:{add(s){!t&&!b(s)&&!j(s)&&(s=d(s));const i=d(this);return q(i).has.call(i,s)||(i.add(s),y(i,"add",s,s)),this},set(s,i){!t&&!b(i)&&!j(i)&&(i=d(i));const o=d(this),{has:c,get:a}=q(o);let p=c.call(o,s);p?process.env.NODE_ENV!=="production"&&Ke(o,c,s):(s=d(s),p=c.call(o,s));const v=a.call(o,s);return o.set(s,i),p?T(i,v)&&y(o,"set",s,i,v):y(o,"add",s,i),this},delete(s){const i=d(this),{has:o,get:c}=q(i);let a=o.call(i,s);a?process.env.NODE_ENV!=="production"&&Ke(i,o,s):(s=d(s),a=o.call(i,s));const p=c?c.call(i,s):void 0,v=i.delete(s);return a&&y(i,"delete",s,void 0,p),v},clear(){const s=d(this),i=s.size!==0,o=process.env.NODE_ENV!=="production"?A(s)?new Map(s):new Set(s):void 0,c=s.clear();return i&&y(s,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=lt(s,e,t)}),n}function be(e,t){const n=ut(e,t);return(r,s,i)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(ie(n,s)&&s in r?n:r,s,i)}const pt={get:be(!1,!1)},dt={get:be(!1,!0)},ht={get:be(!0,!1)};function Ke(e,t,n){const r=d(n);if(r!==n&&t.call(e,r)){const s=Oe(e);E(`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 Le=new WeakMap,We=new WeakMap,He=new WeakMap,vt=new WeakMap;function _t(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function gt(e){return e.__v_skip||!Object.isExtensible(e)?0:_t(Oe(e))}function $e(e){return j(e)?e:Ee(e,!1,ct,pt,Le)}function bt(e){return Ee(e,!1,ft,dt,We)}function we(e){return Ee(e,!0,at,ht,He)}function Ee(e,t,n,r,s){if(!P(e))return process.env.NODE_ENV!=="production"&&E(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=gt(e);if(i===0)return e;const o=s.get(e);if(o)return o;const c=new Proxy(e,i===2?r:n);return s.set(e,c),c}function Y(e){return j(e)?Y(e.__v_raw):!!(e&&e.__v_isReactive)}function j(e){return!!(e&&e.__v_isReadonly)}function b(e){return!!(e&&e.__v_isShallow)}function wt(e){return e?!!e.__v_raw:!1}function d(e){const t=e&&e.__v_raw;return t?d(t):e}const V=e=>P(e)?$e(e):e,F=e=>P(e)?we(e):e;function D(e){return e?e.__v_isRef===!0:!1}const Z={},k=new WeakMap;let I;function Et(e,t=!1,n=I){if(n){let r=k.get(n);r||k.set(n,r=[]),r.push(e)}else process.env.NODE_ENV!=="production"&&!t&&E("onWatcherCleanup() was called when there was no active watcher to associate with.")}function Ce(e,t,n=Be){const{immediate:r,deep:s,once:i,scheduler:o,augmentJob:c,call:a}=n,p=l=>{(n.onWarn||E)("Invalid watch source: ",l,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},v=l=>s?l:b(l)||s===!1||s===0?N(l,1):N(l);let f,h,U,ee,te=!1,ne=!1;if(D(e)?(h=()=>e.value,te=b(e)):Y(e)?(h=()=>v(e),te=!0):m(e)?(ne=!0,te=e.some(l=>Y(l)||b(l)),h=()=>e.map(l=>{if(D(l))return l.value;if(Y(l))return v(l);if(ye(l))return a?a(l,2):l();process.env.NODE_ENV!=="production"&&p(l)})):ye(e)?t?h=a?()=>a(e,2):e:h=()=>{if(U){Te();try{U()}finally{Re()}}const l=I;I=f;try{return a?a(e,3,[ee]):e(ee)}finally{I=l}}:(h=ze,process.env.NODE_ENV!=="production"&&p(e)),t&&s){const l=h,w=s===!0?1/0:s;h=()=>N(l(),w)}const L=()=>{f.stop()};if(i&&t){const l=t;t=(...w)=>{l(...w),L()}}let M=ne?new Array(e.length).fill(Z):Z;const G=l=>{if(!(!(f.flags&1)||!f.dirty&&!l))if(t){const w=f.run();if(s||te||(ne?w.some((Se,se)=>T(Se,M[se])):T(w,M))){U&&U();const Se=I;I=f;try{const se=[w,M===Z?void 0:ne&&M[0]===Z?[]:M,ee];M=w,a?a(t,3,se):t(...se)}finally{I=Se}}}else f.run()};return c&&c(G),f=new qe(h),f.scheduler=o?()=>o(G,!1):G,ee=l=>Et(l,!1,f),U=f.onStop=()=>{const l=k.get(f);if(l){if(a)a(l,4);else for(const w of l)w();k.delete(f)}},process.env.NODE_ENV!=="production"&&(f.onTrack=n.onTrack,f.onTrigger=n.onTrigger),t?r?G(!0):M=f.run():o?o(G.bind(null,!0),!0):f.run(),L.pause=f.pause.bind(f),L.resume=f.resume.bind(f),L.stop=L,L}function N(e,t=1/0,n){if(t<=0||!P(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,D(e))N(e.value,t,n);else if(m(e))for(let r=0;r<e.length;r++)N(e[r],t,n);else if(Fe(e)||A(e))e.forEach(r=>{N(r,t,n)});else if(Je(e)){for(const r in e)N(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&N(e[r],t,n)}return e}class St{constructor(t){return t&&Object.assign(this,t),bt(this)}set(t,n){const r=(o,c)=>{this[o]=c};return typeof t=="string"?((o,c)=>{const[a,...p]=o.split(".");p.length===0?r(a,c):this[a]?.set(p.join("."),c)})(t,n):typeof t=="object"&&(o=>{Object.entries(o).forEach(([c,a])=>r(c,a))})(t),this}}const yt={watch:(...e)=>{const t=Ce(...e);return{...t,remove:t.stop}},once:e=>new Promise(t=>{const n=Ce(e,r=>{r&&(t(r),n.stop())})})};x.Accessor=St,x.reactiveUtils=yt,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
package/src/Accessor.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { shallowReactive } from "@vue/reactivity";
|
|
2
2
|
|
|
3
3
|
class Accessor {
|
|
4
4
|
constructor(properties) {
|
|
5
5
|
properties && Object.assign(this, properties);
|
|
6
|
-
return
|
|
6
|
+
return shallowReactive(this);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
set(path, value) {
|
|
10
|
+
const setter = (key, value) => {
|
|
11
|
+
this[key] = value;
|
|
12
|
+
};
|
|
13
|
+
const setByString = (str, value) => {
|
|
14
|
+
const [key, ...rest] = str.split(".");
|
|
15
|
+
if (rest.length === 0) {
|
|
16
|
+
setter(key, value);
|
|
17
|
+
} else {
|
|
18
|
+
this[key]?.set(rest.join("."), value);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const setByObject = (obj) => {
|
|
22
|
+
Object.entries(obj).forEach(([key, value]) => setter(key, value));
|
|
23
|
+
};
|
|
24
|
+
if (typeof path === "string") {
|
|
25
|
+
setByString(path, value);
|
|
26
|
+
} else if (typeof path === "object") {
|
|
27
|
+
setByObject(path);
|
|
28
|
+
}
|
|
29
|
+
return this;
|
|
7
30
|
}
|
|
8
31
|
}
|
|
9
32
|
|
package/src/reactiveUtils.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { watch } from "@vue/reactivity";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
watch
|
|
4
|
+
watch: (...args) => {
|
|
5
|
+
const handle = watch(...args);
|
|
6
|
+
return {
|
|
7
|
+
...handle,
|
|
8
|
+
remove: handle.stop,
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
once: (getValue) => {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
const handle = watch(getValue, (value) => {
|
|
14
|
+
debugger;
|
|
15
|
+
if (value) {
|
|
16
|
+
resolve(value);
|
|
17
|
+
handle.stop();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
},
|
|
5
22
|
};
|