@vitarx/responsive
Version:
Vitarx responsive package
2 lines (1 loc) • 22.1 kB
JavaScript
var Responsive=(function(c){"use strict";function _(r,e=new WeakMap){if(!r||typeof r!="object")return r;if(e.has(r))return e.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(r instanceof Set){const i=new Set;return e.set(r,i),r.forEach(s=>i.add(_(s,e))),i}if(r instanceof Map){const i=new Map;return e.set(r,i),r.forEach((s,n)=>i.set(_(n,e),_(s,e))),i}if(Array.isArray(r)){const i=[];return e.set(r,i),r.forEach((s,n)=>{i[n]=_(s,e)}),i}const t=Object.create(Object.getPrototypeOf(r));return e.set(r,t),Reflect.ownKeys(r).forEach(i=>{t[i]=_(r[i],e)}),t}function T(r){return typeof r=="object"&&r!==null}function G(r){return Array.isArray(r)}function M(r){return typeof r=="function"}function Z(r){return r instanceof Promise}function W(r,e){let t=null;return((...i)=>{t===null&&Promise.resolve().then(()=>{const s=t;t=null,r.apply(null,s)}),t=typeof e=="function"?e(i,t):i})}class m{static#e=new Map;static get store(){return this.#e}static get size(){return this.#e.size}static get tags(){return this.#e.keys()}static get(e){return this.#e.get(e)}static unset(e,t){return t?this.#e.has(e)?this.#e.get(e)===t?this.#e.delete(e):!1:!0:(this.#e.delete(e),!0)}static run(e,t,i){const s=this.set(e,t,!0);try{const n=i();return Z(n)&&n.finally(()=>this.unset(e,t)),n}finally{s()}}static async withAsyncContext(e,t=[]){if(M(e)&&(e=e()),!Z(e))return e;let i;if(G(t)&&t.length>0){const s=new Map;t.forEach(n=>{const a=this.get(n);a!==void 0&&(s.set(n,a),this.#e.delete(n))}),i=()=>{s.forEach((n,a)=>n&&this.#e.set(a,n)),s.clear()}}else{const s=this.#e;this.#e=new Map,i=()=>this.#e=s}try{return await e}finally{i()}}static clear(){this.#e.clear()}static set(e,t,i=!0){const s=i?this.#e.get(e):void 0;return this.#e.set(e,t),()=>s?(this.#e.set(e,s),!0):this.unset(e,t)}}function he(r,e,t=!0){return m.set(r,e,t)}function j(r){return m.get(r)}function de(r,e){return m.unset(r,e)}function X(r,e,t){return m.run(r,e,t)}async function be(r,e=[]){return m.withAsyncContext(r,e)}function Se(){m.clear()}function ye(){return m.tags}function ge(){return m.size}class B{callbacks;_state="active";get state(){return this._state}get isDeprecated(){return this.state==="deprecated"}get isPaused(){return this.state==="paused"}get isActive(){return this.state==="active"}getState(){return this._state}dispose(){return this.isDeprecated||(this._state="deprecated",this.triggerCallback("dispose"),this.clearCallbacks()),!0}onDispose(e){return this.addCallback(e,"dispose")}pause(){if(!this.isActive)throw new Error("Effect must be active to pause.");return this._state="paused",this.triggerCallback("pause"),!0}resume(){if(!this.isPaused)throw new Error("Effect must be paused to resume.");return this._state="active",this.triggerCallback("resume"),!0}onPause(e){return this.addCallback(e,"pause")}onResume(e){return this.addCallback(e,"resume")}onError(e){return this.addCallback(e,"error")}clearCallbacks(){this.callbacks&&(this.callbacks.clear(),this.callbacks=void 0)}reportError(e,t){const i=this.callbacks?.get("error");i?i.forEach(s=>{try{s(e,t)}catch(n){console.error(`Error handler for "${t}" threw an error:`,n)}}):console.error(`Unhandled error in effect callback (${t}):`,e)}triggerCallback(e){const t=this.callbacks?.get(e);t&&t.forEach(i=>{try{i()}catch(s){this.reportError(s,e)}})}addCallback(e,t){if(this.isDeprecated)throw new Error("Cannot add callback to a deprecated effect.");if(typeof e!="function")throw new TypeError(`Callback parameter for "${t}" must be a function.`);this.callbacks||(this.callbacks=new Map);const i=this.callbacks.get(t)||new Set;return i.add(e),this.callbacks.set(t,i),this}}const _e=r=>new p(r),H=()=>p.getCurrentScope(),we=r=>!!H()?.addEffect(r),x=r=>!r||typeof r!="object"?!1:r instanceof B?!0:typeof r.dispose=="function"&&typeof r.onDispose=="function"&&typeof r.pause=="function"&&typeof r.onPause=="function"&&typeof r.resume=="function"&&typeof r.onResume=="function"&&typeof r.onError=="function"&&typeof r.getState=="function";class p extends B{static contextTag=Symbol("EFFECT_SCOPE_CONTEXT_TAG");config;_effectSet;constructor(e){if(super(),this.config=Object.assign({attachToCurrentScope:!1,name:"anonymous",errorHandler:null},e),this.config.errorHandler&&typeof this.config.errorHandler!="function")throw new TypeError("[Vitarx.EffectScope]: The errorHandler must be a function type");this.config.attachToCurrentScope&&p.getCurrentScope()?.addEffect(this)}get name(){return this.config.name}get count(){return this._effectSet?.size??0}static getCurrentScope(){return j(p.contextTag)}run(e){return X(p.contextTag,this,e)}addEffect(e){if(this.isDeprecated)throw new Error("[Vitarx.EffectScope]: Cannot add effects to a destroyed scope");if(!x(e))throw new TypeError("[Vitarx.EffectScope]: Effect objects must implement the EffectInterface");return this.config.errorHandler&&e.onError&&e.onError(this.config.errorHandler),this._effectSet?this._effectSet.add(e):this._effectSet=new Set([e]),e.onDispose(()=>this._effectSet?.delete(e)),this}dispose(){return super.dispose()?(this._effectSet?.forEach(e=>{try{e.dispose()}catch(t){this.reportError(t,"dispose")}}),this._effectSet=void 0,this.config.errorHandler=null,!0):!1}pause(){return super.pause()?(this._effectSet?.forEach(e=>e?.pause?.()),!0):!1}resume(){return super.resume()?(this._effectSet?.forEach(e=>e.resume()),!0):!1}}class P extends B{#e;#t;#r=0;constructor(e,t={}){super();const{limit:i=0,scope:s=!0}=t;this.#e=e,this.#t=i,s&&p.getCurrentScope()?.addEffect(this)}get count(){return this.#r}get limit(){return this.#t}dispose(){return super.dispose()?(this.#e=void 0,!0):!1}trigger(...e){if(this.isDeprecated||!this.#e)return!1;if(this.isPaused)return!0;if(this.#t>0&&this.#r>=this.#t)return!1;try{this.#e.apply(null,e)}catch(t){this.reportError(t,"notify")}return this.#r++,this.#t>0&&this.#r>=this.#t?(this.dispose(),!1):!0}resetCount(){return this.isDeprecated?!1:(this.#r=0,!0)}}const F=Symbol("ALL_PROPERTIES_SYMBOL"),me=Symbol("OBSERVER_TARGET_SYMBOL");class f{static ALL_PROPERTIES_SYMBOL=F;static TARGET_SYMBOL=me;static#e=new WeakSet;static#t=new WeakMap;static#r=new WeakMap;static#i=new Map;static#n=!1;static getSubscriberStore(e=!0){return e?this.#t:this.#r}static notify(e,t){this.#n||(this.#i=new Map,this.#n=!0,Promise.resolve().then(()=>this.#a())),e=this.getOriginalTarget(e);const i=G(t)?t:[t],s=this.#r.get(e),n=this.#t.get(e);if(s||n){for(const a of i)this.#s(e,s?.get(a),[a]),this.#i.has(e)?this.#i.get(e).add(a):this.#i.set(e,new Set([a]));this.#s(e,s?.get(this.ALL_PROPERTIES_SYMBOL),i)}}static hasSubscribers(e,t=F){return e=this.getOriginalTarget(e),!!(this.#t.get(e)?.has(t)||this.#r.get(e)?.has(t))}static subscribe(e,t,i){const s=this.createSubscriber(t,i);return this.addSubscriber(e,this.ALL_PROPERTIES_SYMBOL,s,{batch:i?.batch}),s}static subscribeProperty(e,t,i,s){const n=this.createSubscriber(i,s);return this.addSubscriber(e,t,n,{batch:s?.batch}),n}static subscribeProperties(e,t,i,s){if(!e||typeof e!="object")throw new TypeError("Target must be an object");if(Array.isArray(t)&&(t=new Set(t)),t.size===0)throw new TypeError("Properties must be a non-empty array or set");const n=this.createSubscriber(i,s);if(s?.batch===!1||t.size===1)for(const a of t)this.addSubscriber(e,a,n,{batch:s?.batch});else{const a=t instanceof Set?t:new Set(t),u=this.addSyncSubscriber(e,W(o=>{const b=[];for(const y of new Set(o))a.has(y)&&b.push(y);b.length&&n.trigger(b,e)},(o,b)=>b?(b[0].push(...o[0]),b):o));n.onDispose(u)}return n}static addSyncSubscriber(e,t,i=this.ALL_PROPERTIES_SYMBOL){return this.addSubscriber(e,i,t,{batch:!1}),()=>this.removeSubscriber(e,i,t,!1)}static subscribes(e,t,i){if(Array.isArray(e)&&(e=new Set(e)),!(e instanceof Set)||e.size===0)throw new TypeError("Targets must be a non-empty array or set collection");const s=this.createSubscriber(t,i);for(const n of e){if(!T(n)){e.delete(n);continue}this.addSubscriber(n,this.ALL_PROPERTIES_SYMBOL,s,{batch:i?.batch,autoRemove:!1})}return s.onDispose(()=>{for(const n of e)this.removeSubscriber(n,this.ALL_PROPERTIES_SYMBOL,s,i?.batch)}),s}static createSubscriber(e,t){return M(e)?new P(e,t):e}static getOriginalTarget(e){return Reflect.get(e,this.TARGET_SYMBOL)??e}static addSubscriber(e,t,i,s){const{batch:n=!0,autoRemove:a=!0}=s||{},u=this.getSubscriberStore(n),o=this.getOriginalTarget(e),b=this.#c(o);try{u.has(o)||u.set(o,new Map);const y=u.get(o);y.has(t)||y.set(t,new Set),y.get(t).add(i),a&&i instanceof P&&i.onDispose(()=>this.removeSubscriber(o,t,i,n))}finally{b()}}static removeSubscriber(e,t,i,s=!0){const n=this.getSubscriberStore(s);e=this.getOriginalTarget(e);const a=this.#c(e),u=n.get(e)?.get(t);if(u)try{u.delete(i),u.size===0&&n.get(e)?.delete(t),n.get(e)?.size===0&&n.delete(e)}finally{a()}}static#a(){this.#n=!1;const e=this.#i;for(const[t,i]of e)this.#u(t,i)}static#u(e,t){const i=this.#t.get(e);if(i){for(const s of t)this.#s(e,i.get(s),[s]);t.has(this.ALL_PROPERTIES_SYMBOL)||this.#s(e,i.get(this.ALL_PROPERTIES_SYMBOL),Array.from(t))}}static#s(e,t,i){if(t?.size)for(const s of t)typeof s=="function"?s(i,e):s.trigger(i,e)}static#c(e){for(;this.#e.has(e););return this.#e.add(e),()=>{this.#e.delete(e)}}}function ee(r,e){f.notify(r,e)}function pe(r,e,t){return f.subscribe(r,e,t)}function Ee(r,e,t){return f.subscribes(r,e,t)}function Re(r,e,t,i){return f.subscribeProperty(r,e,t,i)}function ve(r,e,t,i){return f.subscribeProperties(r,e,t,i)}class d{static#e=new Map;static#t;static track(e,t){this.#t?this.#r(this.#t,e,t):this.#e.size&&this.#e.forEach(i=>{this.#r(i,e,t)})}static collect(e,t="shared"){if(t==="exclusive")return this.#i(e);const i=Symbol("collector-id"),s=new Map;this.#e.set(i,s);try{return{result:e(),deps:s}}finally{this.#e.delete(i)}}static#r(e,t,i){e.has(t)?e.get(t).add(i):e.set(t,new Set([i]))}static#i(e){const t=this.#t;this.#t=new Map;try{return{result:e(),deps:this.#t}}finally{this.#t=t}}static subscribe(e,t,i){if(!M(e))throw new TypeError("effect argument must be a callable function");const{deps:s,result:n}=d.collect(e);let a;if(s.size>0){if(t=t??e,typeof t!="function")throw new TypeError("callback argument must be a callable function");a=new P(i?.batch===!1?()=>t():W(()=>t()),i);for(const[u,o]of s)f.subscribeProperties(u,o,a,{batch:!1})}return{subscriber:a,result:n,deps:s}}}function Pe(r,e){d.track(r,e)}function Oe(r,e="shared"){return d.collect(r,e)}function $(r,e,t){return d.subscribe(r,e,t)}const E=Symbol("VITARX_SIGNAL_SYMBOL"),L=Symbol("VITARX_DEEP_SIGNAL_SYMBOL"),U=Symbol("VITARX_NOT_SIGNAL_SYMBOL"),I=Symbol("VITARX_REF_SIGNAL_SYMBOL"),N=Symbol("VITARX_PROXY_SIGNAL_SYMBOL"),O=Symbol("VITARX_SIGNAL_RAW_VALUE_SYMBOL");class h{static _parentSignalMap=new WeakMap;static getParents(e){return this._parentSignalMap.get(e)}static bindParent(e,t,i){const s=this._parentSignalMap.get(e)||new Map,n=s.get(t)||new Set;this._parentSignalMap.has(e)||this._parentSignalMap.set(e,s),s.has(t)||s.set(t,n),n.add(i)}static unbindParent(e,t,i){const s=this._parentSignalMap.get(e);if(!s)return;const n=s.get(t);n&&(n.delete(i),n.size===0&&s.delete(t),s.size===0&&this._parentSignalMap.delete(e))}static hasParent(e,t,i){const s=this._parentSignalMap.get(e);if(!s)return!1;const n=s.get(t);return n?n.has(i):!1}static notifyParent(e){const t=h.getParents(e);if(t)for(const[i,s]of t)f.notify(i,Array.from(s)),this.notifyParent(i)}static notifySubscribers(e,t,i=!0){f.notify(e,t),i&&h.notifyParent(e)}}function te(r,e,t=!0){h.notifySubscribers(r,e,t)}function C(r){return r?.[E]===!0}function R(r){return r?.[E]===!0&&r?.[I]===!0}function q(r){return r?.[E]===!0&&r?.[N]===!0}function Me(r){return r?.[L]===!0}function re(r){if(typeof r!="object"||r===null)throw new TypeError("[Vitarx.markNotSignal]: The argument must be an object type");return Object.defineProperty(r,U,{value:!0}),r}function V(r){return!!r[U]}function ie(r){return r?.[O]??r}const D=Symbol("REACTIVE_PROXY_SYMBOL"),Le=[E,N,D];class se{target;options;childSignalMap;isArray;#e=null;constructor(e,t){this.options={compare:t?.compare??Object.is,deep:t?.deep??!0},this.childSignalMap=this.options.deep?new Map:void 0,this.target=e,this.isArray=Array.isArray(e)}get proxy(){return this.#e||(this.#e=new Proxy(this.target,this)),this.#e}get(e,t,i){if(typeof t=="symbol"){if(Le.includes(t))return!0;if(t===L)return this.options.deep;if(t===O)return e;if(t===f.TARGET_SYMBOL)return i}const s=Reflect.get(e,t,i);if(this.isArray&&typeof s=="function")return this.track("length"),s;if(this.childSignalMap&&T(s)&&!V(s)){if(this.childSignalMap.has(t))return this.childSignalMap.get(t);if(C(s))return this.childSignalMap.set(t,s),h.bindParent(s,this.proxy,t),R(s)?s.value:s;const n=ce(s);let a;return n==="object"?a=Y(s,{...this.options}):a=ne(s,n),h.bindParent(a,this.proxy,t),this.childSignalMap.set(t,a),a}return C(s)||this.track(t),this.options.deep&&R(s)?s.value:s}deleteProperty(e,t){return Reflect.deleteProperty(e,t)?(this.removeChildSignal(t),this.notify(t),!0):!1}has(e,t){return this.track(t),Reflect.has(e,t)}set(e,t,i,s){const n=Reflect.get(e,t);if(t==="length"&&this.isArray)return this.notify(t),!0;if(this.options.compare(n,i))return!0;if(this.removeChildSignal(t),R(n))n.value=i;else if(!Reflect.set(e,t,i,s))return!1;return this.notify(t),!0}removeChildSignal(e){this.childSignalMap&&this.childSignalMap.has(e)&&(h.unbindParent(this.childSignalMap.get(e),this.proxy,e),this.childSignalMap.delete(e))}notify(e){h.notifySubscribers(this.proxy,e)}track(e){d.track(this.proxy,e)}}function ne(r,e){const t=s=>(...n)=>{const a=r.size,u=r[s](...n);return r.size!==a&&h.notifySubscribers(i,"size"),u},i=new Proxy(r,{get(s,n,a){if(n===E||n===N||n===D)return!0;if(n===L)return!1;if(n===O)return s;if(n===f.TARGET_SYMBOL)return i;if(typeof n=="string"&&(n==="clear"||n==="delete"||e==="set"&&n==="add"||e==="map"&&n==="set"))return t(n);d.track(i,"size");const u=Reflect.get(s,n,a);return typeof u=="function"?u.bind(s):u}});return i}function ce(r){return r instanceof Set?"set":r instanceof Map?"map":"object"}function Y(r,e){if(!T(r))throw new TypeError("Parameter 1 (target) must be an object!");if(Object.isFrozen(r))throw new TypeError("Parameter 1 (target) cannot be a frozen object");if(R(r))throw new TypeError("Parameter 1 (target) cannot be a value reference object!");if(q(r))return r;const t=ce(r);return t!=="object"?ne(r,t):new se(r,e).proxy}function ae(r,e){return typeof e=="boolean"?Y(r,{deep:e}):Y(r,e)}function Ce(r,e){return Y(r,{...e,deep:!1})}function Ae(r){return typeof r=="object"&&r!==null&&!!Reflect.get(r,D)}function Te(r){return Reflect.get(r,O)??r}class k{[E]=!0;[I]=!0;_options;_shouldProxyValue=!1;_reactiveValue;constructor(e,t){if(R(e))throw new Error("Cannot set value of Ref to Ref");this._options={compare:t?.compare??Object.is,deep:t?.deep??!0},this._value=e,this.evaluateProxyNeeded()}_value;get value(){return this._reactiveValue?this._reactiveValue:this._shouldProxyValue?(this._reactiveValue=ae(this._value,this._options),h.bindParent(this._reactiveValue,this,"value"),this._shouldProxyValue=!1,this._reactiveValue):(d.track(this,"value"),this._value)}get[O](){return d.track(this,"value"),this._value}set value(e){if(R(e))throw new Error("Cannot set value of Ref to Ref");this._options.compare(this._value,e)||(this._reactiveValue&&(h.unbindParent(this._reactiveValue,this,"value"),this._reactiveValue=void 0),this._value=e,this.evaluateProxyNeeded(),h.notifySubscribers(this,"value"))}get[L](){return this._options.deep}[Symbol.toPrimitive](e){switch(e){case"number":return this.value;case"string":return this.toString();case"default":return this.value}}toString(){return this._value?.toString?this._value.toString():`[Object Ref<${typeof this._value}>]`}evaluateProxyNeeded(){this._shouldProxyValue=this._options.deep&&T(this._value)&&!V(this._value)&&!C(!this._value)}forceUpdate(){h.notifySubscribers(this,"value")}}function Ye(r,e){return J(r)?r:typeof e=="boolean"?new k(r,{deep:e}):new k(r,e)}function ke(r,e){return J(r)?r:new k(r,{...e,deep:!1})}function J(r){return r instanceof k}function Be(r){return ie(r)}class A{static#e=new WeakMap;#t;constructor(e){this.#t={deep:e?.deep??!0,write:e?.write??"error",message:"the object is read-only, and the ${prop} attribute cannot be modify!"}}static create(e,t){return this.#e.has(e)||this.#e.set(e,new Proxy(e,new A(t))),this.#e.get(e)}set(e,t,i){if(this.#t.write==="error")throw new Error(this.createMessage(t,"ERROR"));return console.warn(this.createMessage(t,"WARN")),this.#t.write==="warningAndWrite"?Reflect.set(e,t,i):!0}deleteProperty(e,t){if(this.#t.write==="error")throw new Error(this.createMessage(t,"ERROR"));return console.warn(this.createMessage(t,"WARN")),this.#t.write==="warningAndWrite"?Reflect.deleteProperty(e,t):!0}createMessage(e,t){return`[Readonly][${t}]:`+this.#t.message.replace("${prop}",String(e))}get(e,t,i){if(t===Q)return!0;if(t===f.TARGET_SYMBOL)return e;const s=Reflect.get(e,t,i);return this.#t.deep&&T(s)&&!ue(s)?A.create(s,this.#t):s}}const Q=Symbol("READONLY_OBJECT_SYMBOL");function Ie(r,e){return typeof e=="boolean"?A.create(r,{deep:e}):A.create(r,e)}function Ne(r,e){return A.create(r,{...e,deep:!1})}function ue(r){return r?.[Q]===!0}class K{[L]=!1;[I]=!0;[E]=!0;_computedResult=void 0;_getter;_options;_handler=void 0;constructor(e,t={}){this._getter=e,this._options=t,t.immediate&&this.init()}_initialize=!1;get initialize(){return this._initialize}get[O](){return this._computedResult}get value(){return this.initialize||this.init(),d.track(this,"value"),this._computedResult}set value(e){typeof this._options.setter=="function"?this._options.setter(e):console.warn("[Computed]:Computed properties should not be modified directly unless a setter function is defined。")}toString(){return this.value?.toString&&M(this.value.toString)?this.value.toString():`[Object Computed<${typeof this.value}>]`}stop(){return this._handler&&(this._handler.dispose(),this._handler=void 0),this._computedResult}[Symbol.toPrimitive](e){switch(e){case"number":return this.value;case"string":return this.toString();case"default":return this.value}}scope(e){return e instanceof p?this._handler&&e.addEffect(this._handler):this._options.scope=e,this}init(){if(!this._initialize){this._initialize=!0;const{result:e,deps:t}=d.collect(()=>this._getter(this._computedResult),"exclusive");if(this._computedResult=e,t.size>0){const i=()=>{const s=this._getter(this._computedResult);s!==this._computedResult&&(this._computedResult=s,h.notifySubscribers(this,"value"))};this._handler=new P(this._options.batch===!1?i:W(i),{scope:this._options.scope}),t.forEach((s,n)=>{for(const a of s)f.addSubscriber(n,a,this._handler,{batch:!1,autoRemove:!1})}),this._handler.onDispose(()=>{t.forEach((s,n)=>{for(const a of s)f.removeSubscriber(n,a,this._handler,!1)}),this._handler=void 0})}else console.warn("[Computed]:No dependencies detected in computed property. The computed value will not automatically update when data changes. Consider checking if your getter function accesses signal properties correctly.")}return this}}function oe(r,e){return new K(r,e)}function Ve(r,e,t={}){return oe(r,{...t,setter:e})}function fe(r){return r instanceof K}function De(r){return fe(r)?r.stop():r}function le(r,e,t){const i=e?r[e]:r;return t?_(i):i}function ze(r,e,t){if(!M(e))throw new TypeError("callback is not a function");const{clone:i=!1,immediate:s=!1,...n}=t??{};let a=r,u,o;const b=l=>{if(typeof l!="function")throw new TypeError("onCleanup handler it must be a function");u=l},y=()=>{u&&(u(),u=void 0)};if(M(r)){let{subscriber:l,result:w}=d.subscribe(r,()=>{const g=r();if(w===g)return;w=g;const v=i?_(g):g,S=o;o=v,e(v,S,b)},n);if(l)return o=i?_(w):w,l.onDispose(y);a=w}if(C(a)){const l=R(a)?"value":void 0;o=le(a,l,i);const w=new P(()=>{y();const g=le(a,l,i),v=o;o=g,e(g,v,b)},n);return s&&w.trigger(),f.subscribe(a,w,n).onDispose(y)}if(G(a)){const l=[...a],w=()=>{y();const S=i?_(l):l,z=o;o=S,e(S,z,b)},g=[];for(let S=0;S<l.length;S++){const z=l[S];C(z)&&(g.push(S),h.bindParent(z,l,S))}if(g.length===0)throw new TypeError("If the source parameter is passed into a normal array, the array contains at least one signal object that can be listened to");o=i?_(l):l;const v=new P(w,n).onDispose(()=>{for(const S of g)h.unbindParent(l[S],l,S)});return f.addSubscriber(l,f.ALL_PROPERTIES_SYMBOL,v,{batch:n.batch}),s&&v.trigger(),v}throw new TypeError("The source parameter can only be a valid signal object, or a function with side effects, an array with a signal object")}function Ge(r,e,t){return f.subscribes(r,e,t)}function We(r,e,t,i){const{immediate:s=!1,...n}=i??{};let a=e;typeof e=="string"&&(a=[e]);const u=f.subscribeProperties(r,a,t,n);return s&&u.trigger(Array.from(a),r),u}return c.ALL_PROPERTIES_SYMBOL=F,c.Computed=K,c.Context=m,c.DEEP_SIGNAL_SYMBOL=L,c.Depend=d,c.Effect=B,c.EffectScope=p,c.NOT_SIGNAL_SYMBOL=U,c.Observer=f,c.ObserverManager=f,c.PROXY_SIGNAL_SYMBOL=N,c.REACTIVE_PROXY_SYMBOL=D,c.READONLY_OBJECT_SYMBOL=Q,c.REF_SIGNAL_SYMBOL=I,c.ReactiveProxyHandler=se,c.Ref=k,c.SIGNAL_RAW_VALUE_SYMBOL=O,c.SIGNAL_SYMBOL=E,c.SignalManager=h,c.Subscriber=P,c.addEffect=we,c.clearAllContexts=Se,c.computed=oe,c.computedWithSetter=Ve,c.createContext=he,c.createReactiveProxySignal=Y,c.createScope=_e,c.depCollect=Oe,c.depSubscribe=$,c.depTrack=Pe,c.getAllContextTags=ye,c.getContext=j,c.getContextCount=ge,c.getCurrentScope=H,c.isComputed=fe,c.isDeepSignal=Me,c.isEffect=x,c.isMarkNotSignal=V,c.isMarkRaw=V,c.isProxy=q,c.isProxySignal=q,c.isReactive=Ae,c.isReadonly=ue,c.isRef=J,c.isRefSignal=R,c.isSignal=C,c.markNotSignal=re,c.markRaw=re,c.notify=ee,c.notifySubscribers=te,c.reactive=ae,c.readonly=Ie,c.ref=Ye,c.removeContext=de,c.runContext=X,c.runInContext=X,c.shallowReactive=Ce,c.shallowReadonly=Ne,c.shallowRef=ke,c.stopCompute=De,c.subscribe=pe,c.subscribeProperties=ve,c.subscribeProperty=Re,c.subscribes=Ee,c.toRaw=ie,c.trigger=ee,c.triggerSubscribers=te,c.unreactive=Te,c.unref=Be,c.useCurrentScope=H,c.watch=ze,c.watchChanges=Ge,c.watchDepend=$,c.watchEffect=$,c.watchProperty=We,c.withAsyncContext=be,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),c})({});