You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
12 KiB
1 lines
12 KiB
function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),a=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,f=(t,e)=>!Object.is(t,e);let _;class p{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&_&&(this.parent=_,this.index=(_.scopes||(_.scopes=[])).push(this)-1)}run(t){if(this.active){const e=_;try{return _=this,t()}finally{_=e}}}on(){_=this}off(){_=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function d(t){return new p(t)}function v(t,e=_){e&&e.active&&e.effects.push(t)}function g(){return _}function y(t){_&&_.cleanups.push(t)}const w=t=>{const e=new Set(t);return e.w=0,e.n=0,e},b=t=>(t.w&k)>0,R=t=>(t.n&k)>0,S=new WeakMap;let m=0,k=1;let j;const O=Symbol(""),x=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,v(this,n)}run(){if(!this.active)return this.fn();let t=j,e=W;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=j,j=this,W=!0,k=1<<++m,m<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=k})(this):P(this),this.fn()}finally{m<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];b(i)&&!R(i)?i.delete(t):e[n++]=i,i.w&=~k,i.n&=~k}e.length=n}})(this),k=1<<--m,j=this.parent,W=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){j===this?this.deferStop=!0:this.active&&(P(this),this.onStop&&this.onStop(),this.active=!1)}}function P(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function M(t,e){t.effect&&(t=t.effect.fn);const s=new E(t);e&&(n(s,e),e.scope&&v(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function z(t){t.effect.stop()}let W=!0;const V=[];function A(){V.push(W),W=!1}function N(){V.push(W),W=!0}function I(){const t=V.pop();W=void 0===t||t}function K(t,e,n){if(W&&j){let e=S.get(t);e||S.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=w()),C(s)}}function C(t,e){let n=!1;m<=30?R(t)||(t.n|=k,n=!b(t)):n=!t.has(j),n&&(t.add(j),j.deps.push(t))}function L(t,e,n,s,i,o){const u=S.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?a(n)&&h.push(u.get("length")):(h.push(u.get(O)),c(t)&&h.push(u.get(x)));break;case"delete":r(t)||(h.push(u.get(O)),c(t)&&h.push(u.get(x)));break;case"set":c(t)&&h.push(u.get(O))}if(1===h.length)h[0]&&q(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);q(w(t))}}function q(t,e){const n=r(t)?t:[...t];for(const s of n)s.computed&&B(s);for(const s of n)s.computed||B(s)}function B(t,e){(t!==j||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const D=t("__proto__,__v_isRef,__isVue"),F=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(o)),G=X(),H=X(!1,!0),J=X(!0),Q=X(!0,!0),T=U();function U(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Ct(this);for(let e=0,i=this.length;e<i;e++)K(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Ct)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A();const n=Ct(this)[e].apply(this,t);return I(),n}})),t}function X(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&c===(t?e?xt:Ot:e?jt:kt).get(n))return n;const h=r(n);if(!t&&h&&i(T,s))return Reflect.get(T,s,c);const l=Reflect.get(n,s,c);return(o(s)?F.has(s):D(s))?l:(t||K(n,0,s),e?l:Gt(l)?h&&a(s)?l:l.value:u(l)?t?zt(l):Pt(l):l)}}function Y(t=!1){return function(e,n,s,c){let o=e[n];if(Nt(o)&&Gt(o)&&!Gt(s))return!1;if(!t&&!Nt(s)&&(It(s)||(s=Ct(s),o=Ct(o)),!r(e)&&Gt(o)&&!Gt(s)))return o.value=s,!0;const u=r(e)&&a(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===Ct(c)&&(u?f(s,o)&&L(e,"set",n,s):L(e,"add",n,s)),h}}const Z={get:G,set:Y(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&L(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return o(e)&&F.has(e)||K(t,0,e),n},ownKeys:function(t){return K(t,0,r(t)?"length":O),Reflect.ownKeys(t)}},$={get:J,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},tt=n({},Z,{get:H,set:Y(!0)}),et=n({},$,{get:Q}),nt=t=>t,st=t=>Reflect.getPrototypeOf(t);function it(t,e,n=!1,s=!1){const i=Ct(t=t.__v_raw),r=Ct(e);n||(e!==r&&K(i,0,e),K(i,0,r));const{has:c}=st(i),o=s?nt:n?Bt:qt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function rt(t,e=!1){const n=this.__v_raw,s=Ct(n),i=Ct(t);return e||(t!==i&&K(s,0,t),K(s,0,i)),t===i?n.has(t):n.has(t)||n.has(i)}function ct(t,e=!1){return t=t.__v_raw,!e&&K(Ct(t),0,O),Reflect.get(t,"size",t)}function ot(t){t=Ct(t);const e=Ct(this);return st(e).has.call(e,t)||(e.add(t),L(e,"add",t,t)),this}function ut(t,e){e=Ct(e);const n=Ct(this),{has:s,get:i}=st(n);let r=s.call(n,t);r||(t=Ct(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?f(e,c)&&L(n,"set",t,e):L(n,"add",t,e),this}function ht(t){const e=Ct(this),{has:n,get:s}=st(e);let i=n.call(e,t);i||(t=Ct(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&L(e,"delete",t,void 0),r}function lt(){const t=Ct(this),e=0!==t.size,n=t.clear();return e&&L(t,"clear",void 0,void 0),n}function at(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Ct(r),o=e?nt:t?Bt:qt;return!t&&K(c,0,O),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function ft(t,e,n){return function(...s){const i=this.__v_raw,r=Ct(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?nt:e?Bt:qt;return!e&&K(r,0,h?x:O),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function _t(t){return function(...e){return"delete"!==t&&this}}function pt(){const t={get(t){return it(this,t)},get size(){return ct(this)},has:rt,add:ot,set:ut,delete:ht,clear:lt,forEach:at(!1,!1)},e={get(t){return it(this,t,!1,!0)},get size(){return ct(this)},has:rt,add:ot,set:ut,delete:ht,clear:lt,forEach:at(!1,!0)},n={get(t){return it(this,t,!0)},get size(){return ct(this,!0)},has(t){return rt.call(this,t,!0)},add:_t("add"),set:_t("set"),delete:_t("delete"),clear:_t("clear"),forEach:at(!0,!1)},s={get(t){return it(this,t,!0,!0)},get size(){return ct(this,!0)},has(t){return rt.call(this,t,!0)},add:_t("add"),set:_t("set"),delete:_t("delete"),clear:_t("clear"),forEach:at(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=ft(i,!1,!1),n[i]=ft(i,!0,!1),e[i]=ft(i,!1,!0),s[i]=ft(i,!0,!0)})),[t,n,e,s]}const[dt,vt,gt,yt]=pt();function wt(t,e){const n=e?t?yt:gt:t?vt:dt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const bt={get:wt(!1,!1)},Rt={get:wt(!1,!0)},St={get:wt(!0,!1)},mt={get:wt(!0,!0)},kt=new WeakMap,jt=new WeakMap,Ot=new WeakMap,xt=new WeakMap;function Et(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>l(t).slice(8,-1))(t))}function Pt(t){return Nt(t)?t:Vt(t,!1,Z,bt,kt)}function Mt(t){return Vt(t,!1,tt,Rt,jt)}function zt(t){return Vt(t,!0,$,St,Ot)}function Wt(t){return Vt(t,!0,et,mt,xt)}function Vt(t,e,n,s,i){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=Et(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function At(t){return Nt(t)?At(t.__v_raw):!(!t||!t.__v_isReactive)}function Nt(t){return!(!t||!t.__v_isReadonly)}function It(t){return!(!t||!t.__v_isShallow)}function Kt(t){return At(t)||Nt(t)}function Ct(t){const e=t&&t.__v_raw;return e?Ct(e):t}function Lt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const qt=t=>u(t)?Pt(t):t,Bt=t=>u(t)?zt(t):t;function Dt(t){W&&j&&C((t=Ct(t)).dep||(t.dep=w()))}function Ft(t,e){(t=Ct(t)).dep&&q(t.dep)}function Gt(t){return!(!t||!0!==t.__v_isRef)}function Ht(t){return Qt(t,!1)}function Jt(t){return Qt(t,!0)}function Qt(t,e){return Gt(t)?t:new Tt(t,e)}class Tt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Ct(t),this._value=e?t:qt(t)}get value(){return Dt(this),this._value}set value(t){t=this.__v_isShallow?t:Ct(t),f(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:qt(t),Ft(this))}}function Ut(t){Ft(t)}function Xt(t){return Gt(t)?t.value:t}const Yt={get:(t,e,n)=>Xt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Gt(i)&&!Gt(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function Zt(t){return At(t)?t:new Proxy(t,Yt)}class $t{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Dt(this)),(()=>Ft(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function te(t){return new $t(t)}function ee(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=se(t,n);return e}class ne{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function se(t,e,n){const s=t[e];return Gt(s)?s:new ne(t,e,n)}class ie{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Ft(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=Ct(this);return Dt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function re(t,n,s=!1){let i,r;const c="function"==typeof t;c?(i=t,r=e):(i=t.get,r=t.set);return new ie(i,r,c||!r,s)}var ce;const oe=Promise.resolve(),ue=[];let he=!1;const le=()=>{for(let t=0;t<ue.length;t++)ue[t]();ue.length=0,he=!1};class ae{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[ce]=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,ue.push((()=>{this.effect.active&&this._get()!==t&&Ft(this),s=!1})),he||(he=!0,oe.then(le))}for(const t of this.dep)t.computed instanceof ae&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Dt(this),Ct(this)._get()}}function fe(t){return new ae(t)}ce="__v_isReadonly";export{p as EffectScope,O as ITERATE_KEY,E as ReactiveEffect,re as computed,te as customRef,fe as deferredComputed,M as effect,d as effectScope,N as enableTracking,g as getCurrentScope,Kt as isProxy,At as isReactive,Nt as isReadonly,Gt as isRef,It as isShallow,Lt as markRaw,y as onScopeDispose,A as pauseTracking,Zt as proxyRefs,Pt as reactive,zt as readonly,Ht as ref,I as resetTracking,Mt as shallowReactive,Wt as shallowReadonly,Jt as shallowRef,z as stop,Ct as toRaw,se as toRef,ee as toRefs,K as track,L as trigger,Ut as triggerRef,Xt as unref};
|
|
|