@superutils/rx 0.1.5 → 0.1.7
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/dist/browser/index.min.js +2 -2
- package/dist/browser/index.min.js.map +1 -1
- package/dist/index.cjs +154 -267
- package/dist/index.d.cts +366 -233
- package/dist/index.d.ts +366 -233
- package/dist/index.js +151 -264
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
this.superutils=this.superutils||{};this.superutils.rx=(function(exports){'use strict';var w=(r,e=true)=>!!r&&typeof r=="object"&&(!e||[Object.prototype,null].includes(Object.getPrototypeOf(r))),gr=w,C=r=>Array.isArray(r);var Sr=r=>C(r)&&r.every(C),xr=r=>C(r)||r instanceof Set||r instanceof Map;var wr=r=>Number.isInteger(r);var Z=r=>typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r),Se=r=>wr(r)&&r>0,M=r=>Z(r)&&r>0,se=(r,e=false,t=false)=>{if(r==null)return true;switch(typeof r){case "number":return !Z(r);case "string":return !r.replaceAll(" ","").trim().length;case "boolean":case "bigint":case "symbol":case "function":return false}if(r instanceof Date)return Number.isNaN(r.getTime());if(r instanceof Map||r instanceof Set)return !r.size;if(Array.isArray(r)||r instanceof Uint8Array)return !r.length;if(r instanceof Error)return !r.message.length;let o=typeof r=="object"&&Object.getPrototypeOf(r);return o===Object.prototype||o===null?e?!Object.getOwnPropertyNames(r).length:!Object.keys(r).length:t};function ze(){}var b=r=>typeof r=="function";var Ne=b,V=r=>r instanceof Map;var $e=r=>typeof r=="boolean"||r instanceof Boolean;var We=r=>r instanceof Error,xe=r=>r instanceof Promise,X=r=>r instanceof RegExp,_r=r=>r instanceof Set,Q=r=>typeof r=="string",le=(r,e=false)=>gr(r,false)&&Ne(r.subscribe)&&Ne(r.next)&&(!e||"value"in r),Tr=r=>typeof r=="symbol";var h=(r,e,t)=>{try{let o=b(r)?r(...b(e)?e():e):r;return xe(o)?o.catch(n=>b(t)?t(n):t):o}catch(o){return b(t)?t(o):t}},D=h;new Date().getTime();var Er=(r,e=true,t=true)=>D(()=>[...t&&Object.getOwnPropertySymbols(r)||[],...e?Object.keys(r).sort():Object.keys(r)],[],[]),Or=Er,Y=(r,e="null")=>JSON.parse(D(JSON.stringify,[r],e)),R=(r,e,t,o=false,n=true)=>{let i=w(e,false)||b(e)?e:{};if(!w(r,false)&&!b(e))return i;let a=new Set(t!=null?t:[]),s=Or(r,true,true).filter(l=>!a.has(l));for(let l of s){let c=l,u=r[c];if(i.hasOwnProperty(c)&&(o==="empty"?!se(i[c]):b(o)?!o(c,i[c],u):true))continue;if([void 0,null,1/0,NaN].includes(u)||!w(u,false)){i[c]=u;continue}i[c]=(()=>{switch(Object.getPrototypeOf(u)){case Array.prototype:return Y(u,"[]");case ArrayBuffer.prototype:return u.slice(0);case Date.prototype:return new Date(u.getTime());case Map.prototype:return new Map(Y(Array.from(u),"[]"));case RegExp.prototype:return new RegExp(u);case Set.prototype:return new Set(Y(Array.from(u)));case Uint8Array.prototype:return new Uint8Array([...u]);case URL.prototype:return new URL(u);}if(Tr(c)||!n)return Y(u);let m=[...a].map(g=>String(g).startsWith(String(c).concat("."))&&String(g).split(String(c).concat("."))[1]).filter(Boolean);return m.length?R(u,i[c],m,o,n):Y(u)})();}return i},jr=(r=[],e=[],t)=>{w(t)||(t={});for(let o=0;o<(C(r)?r:[]).length;o++)t[r[o]]=e==null?void 0:e[o];return t};function we(r){let e=Object.entries(w(r)?r:{});return new Map(e.map(([t,o])=>[t,o]))}var Be=(r,e=true,t=false)=>C(r)?(t&&(r=[...r]),e?r.reverse():r):[];var ue=(r,e=0)=>C(r)?Array.from(new Set(r.flat(e))):[],ae=(r,e=50,t={})=>{let{leading:o=ae.defaults.leading,onError:n=ae.defaults.onError,thisArg:i}=t,{tid:a}=t;i!==void 0&&(r=r.bind(i));let s=(...u)=>D(r,u,n),l=null,c=o==="global";return (...u)=>{clearTimeout(a),a=setTimeout(()=>{l!==u&&s(...u),l=c?true:null;},e),!(!o||l)&&(l=u,s(...u));}};ae.defaults={leading:false,onError:void 0};var Cr=ae,_e=(r,e=50,t={})=>{let{defaults:o}=_e,{onError:n=o.onError,trailing:i=o.trailing,thisArg:a}=t,{tid:s}=t,l=(...u)=>D(a!==void 0?r.bind(a):r,u,b(n)?f=>D(n,[f],void 0):void 0),c=null;return (...u)=>{if(s){c=u;return}s=setTimeout(()=>{if(s=void 0,!i)return;let f=c;c=null,f&&f!==u&&l(...f);},e),l(...u);}};_e.defaults={onError:void 0,trailing:false};var Ar=_e,z=(r,e=50,t={})=>t.throttle?Ar(r,e,t):Cr(r,e,t),Te=(r,e,t,o,n)=>{var i;V(n)||(n=new Map),Se(t)||(t=1/0);for(let[a,s]of ((i=r==null?void 0:r.entries)==null?void 0:i.call(r))||[]){if(n.size>=t)break;D(e!=null?e:s,[s,a,r],false)&&n.set(a,s);}return o?[...n.values()]:n},Pr=Te,Vr=r=>{if(!r)return 0;try{let e="size"in r?r.size:"length"in r?r.length:0;return Z(e)?e:0}catch(e){return 0}},Ir=Vr,Ee=r=>{var e;return [...((e=r==null?void 0:r.values)==null?void 0:e.call(r))||[]]},Le=Ee,L=(r,e)=>{var t;let o=!Ir(r)||se(e==null?void 0:e.query),n=V(e==null?void 0:e.result)?e.result:new Map,i=(t=e==null?void 0:e.asMap)!=null?t:L.defaults.asMap;if(o)return i?n:Le(n);e=R(L.defaults,e,[],"empty");let{ignoreCase:a,limit:s=1/0,matchAll:l,matchExact:c,ranked:u}=e,{query:f}=e,p=Q(f),m=X(f),g=D(Object.keys,[f],[]);if(a&&!c&&!m&&(f=p?f.toLowerCase():jr(g,Object.values(f).map(d=>X(d)?d:`${d}`.toLowerCase()))),e.query=f,u){let d=[];for(let[v,x]of r.entries()){let j=-1;if(p||m){j=ie(e,x,void 0),j>=0&&d.push([j,v,x]);continue}let O=[];g[l?"every":"some"](y=>{let _=ie(e,x,y);return O.push(_),_>=0})&&(j=O.sort((y,_)=>y-_).filter(y=>y!==-1)[0],j>=0&&d.push([j,v,x]));}d.sort((v,x)=>v[0]-x[0]).slice(0,s).forEach(([v,x,j])=>n.set(x,j));}else for(let[d,v]of r.entries()){if(n.size>=s)break;(p||m?ie(e,v,void 0)>=0:g[l?"every":"some"](j=>ie(e,v,j)>=0))&&n.set(d,v);}return i?n:Le(n)};L.defaults={asMap:true,ignoreCase:true,limit:1/0,matchAll:false,ranked:false,transform:true};function ie({query:r,ignoreCase:e,matchExact:t,transform:o=true},n,i){var a,s;let l=Q(r)||X(r)||i===void 0,c=l?r:r[i],u=l||!w(n)?n:n[i],f=D(()=>b(o)?o(n,l?void 0:u,i):t&&o===!1?u:w(u,!1)?JSON.stringify(xr(u)?[...u.values()]:Object.values(u)):String(u!=null?u:""),[],"");if(f===c)return 0;if(t&&!X(c))return -1;let p=String(f);return p.trim()?X(c)?(s=(a=p.match(c))==null?void 0:a.index)!=null?s:-1:(e&&(p=p.toLowerCase()),p.indexOf(String(c))):-1}var Mr=L;function Je(r,e){return (b(e)?Pr(r,e,1):Mr(r,{...e,asMap:true,limit:1}))[e!=null&&e.includeKey?"entries":"values"]().next().value}var qe=r=>{var e;return [...((e=r==null?void 0:r.entries)==null?void 0:e.call(r))||[]]},He=r=>{var e;return [...((e=r==null?void 0:r.keys)==null?void 0:e.call(r))||[]]};function ce(r,e,t){let o=C(r)?1:V(r)?2:_r(r)?3:0;if(!o)return r;let{asString:n,ignoreCase:i,newInstance:a,reverse:s,undefinedFirst:l}={...ce.defaults,...w(t)?t:w(e)?e:{}};if(o===1&&b(e))return Be(r.sort(e),s,a);let c=n?l?"":"Z".repeat(10):l?-1/0:1/0,u=b(e)?Be([...r.entries()].sort(e),s,false):(()=>{let f=1,p=d=>{let v=w(d)&&f!==0?d[e]:d;if(!n)return v;let x=`${v!=null?v:c}`;return i?x.toLowerCase():x},[m,g]=s?[-1,1]:[1,-1];return [1,3].includes(o)?(o===3||a?[...r]:r).sort((d,v)=>p(d)>p(v)?m:g):(f=e===true?0:1,[...r.entries()].sort((d,v)=>p(d==null?void 0:d[f])>p(v==null?void 0:v[f])?m:g))})();if(o===1)return u;if(a)return o===2?new Map(u):new Set(u);r.clear();for(let f of u)o===2?r.set(...f):r.add(f);return r}ce.defaults={asString:true,ignoreCase:true,newInstance:false,reverse:false,undefinedFirst:false};var Ge=(...r)=>{var e;return new Map((e=r==null?void 0:r.flatMap)==null?void 0:e.call(r,t=>V(t)?Array.from(t.entries()):Sr(t)?t:[]))};var k=globalThis.Promise,T=class extends k{constructor(e){let t,o,n=false,i=(a,s=true,l)=>{if(!n)return queueMicrotask(()=>i(a,s,l));a(l),this._state=s?1:2,this.onFinalize.forEach(c=>h(c,s?[l]:[void 0,l],void 0));};super((a,s)=>{o=l=>i(s,false,l),t=l=>i(a,true,l),b(e)?h(e,[t,o],o):xe(e)?e.then(t,o):e!==void 0&&t(e);}),this._state=0,this.onEarlyFinalize=[],this.onFinalize=[],this.resolve=a=>{var s,l;this.pending&&((s=this._resolve)==null||s.call(this,a),(l=this.onEarlyFinalize)==null||l.forEach(c=>{h(c,[true,a],void 0);}));},this.reject=a=>{var s,l;this.pending&&((s=this._reject)==null||s.call(this,a),(l=this.onEarlyFinalize)==null||l.forEach(c=>{h(c,[false,a],void 0);}));},n=true,this._resolve=t,this._reject=o;}get pending(){return this.state===0}get rejected(){return this.state===2}get resolved(){return this.state===1}get state(){return this._state}};T.all=r=>new T(k.all(r));T.allSettled=r=>new T(k.allSettled(r));T.any=r=>new T(k.any(r));T.race=r=>new T(k.race(r));T.reject=r=>{let e=new T;return queueMicrotask(()=>e.reject(r)),e};T.resolve=r=>new T(k.resolve(r));T.try=(r,...e)=>new T(h(r,e,t=>T.reject(t)));T.withResolvers=()=>{let r=new T;return {promise:r,reject:r.reject,resolve:r.resolve}};var Fr=T,A=Fr;function Oe(r={}){let e=0;r=R(Oe.defaults,r,[],"empty");let{onError:t,onIgnore:o,onResult:n}=r,{delay:i=0,ignoreStale:a,resolveError:s,resolveIgnored:l,thisArg:c,throttle:u}=r,f=null,p,m=new Map,g=!M(i);c!==void 0&&(t=t==null?void 0:t.bind(c),o=o==null?void 0:o.bind(c),n=n==null?void 0:n.bind(c));let d=O=>{for(let[S,y]of O){m.delete(S);let _=a&&y.sequence<p.sequence;if(!(y.resolved||y.started&&!_))switch(y.started&&(y.getPromise=(()=>y.result)),h(o,[y.getPromise],0),l){case "WITH_UNDEFINED":y.resolve(void 0);break;case "WITH_LAST":p==null||p.then(y.resolve,y.reject);break;}}m.size||(e=0);},v=O=>{if(f=null,g){m.delete(O);let[y,_]=[...m.entries()][0]||[];return y&&_&&j(y,_)}let S=[...m.entries()];if(u===true&&r.trailing){let y=S.findIndex(([_])=>_===O);S=S.slice(0,y);}else u||(S=S.slice(0,-1));d(S),m.delete(O);},x=async(O,S)=>{var y;try{S.started=!0,p=S,f=S,(y=S.result)!=null||(S.result=A.try(S.getPromise));let _=await S.result;if(!!a&&S.sequence<p.sequence)return d([[O,S]]);S.resolve(_),n&&h(n,[_],void 0);}catch(_){switch(t&&h(t,[_],void 0),s){case "REJECT":S.reject(_);case "NEVER":break;case "RESOLVE_UNDEFINED":S.resolve(void 0);break;case "RESOLVE_ERROR":S.resolve(_);break}}v(O);},j=g?x:z(x,i,r);return O=>{let S=Symbol("deferred-queue-item-id"),y=new A;return y.getPromise=b(O)?O:()=>O,y.started=false,y.sequence=++e,m.set(S,y),(!f||!g)&&j(S,y),y}}Oe.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var Ye=Oe;function Kr(r,e={}){let{thisArg:t}=e;t!==void 0&&(r=r.bind(t));let o=Ye(e);return (...n)=>o(()=>r(...n))}var Dr=Kr;function fe(r=fe.defaults.duration,e,t=false){let o=new A,n=i=>{let a=h(async()=>{let s=await(b(i)?i():i);return t?s!=null?s:new Error(`${fe.defaults.delayTimeoutMsg} ${r}ms`):s!=null?s:r},[],s=>k.reject(s));t?a.then(o.reject,o.reject):o.resolve(a);};return o.timeoutId=setTimeout(()=>n(e),r),o.pause=()=>clearTimeout(o.timeoutId),o.catch(()=>{}).finally(()=>o.pause()),o.onEarlyFinalize.push(()=>o.pause()),o}fe.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var je=fe;function Rr(r,e){return je(r,e,true)}var Xe=Rr,Ce=(r,e)=>{let t=false,o=A.try(async()=>{var n,i;e=R(Ce.defaults,e!=null?e:{},[],(v,x)=>{switch(v){case "retry":case "retryDelay":case "retryDelayJitterMax":return x!==0&&!Se(x)}return !!se(x)});let{retry:a,retryBackOff:s,retryDelay:l,retryDelayJitter:c,retryDelayJitterMax:u}=e,f=l,p=0,m,g,d=false;do{if(p++,l>0&&!t&&p>0){s==="exponential"&&p>1&&(f*=2);let v=c?Math.floor(Math.random()*u):0;await je(f+v);}if(t)break;try{g=void 0,m=await r();}catch(v){g=v!=null?v:new Error(v);}if(t||a===0||p>a)break;d=!!((i=await h((n=e.retryIf)!=null?n:g,[m,p,g],g))!=null?i:g);}while(d);return g!==void 0?k.reject(g):m});return o.onEarlyFinalize.push(()=>{t=true;}),o};Ce.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var kr=Ce,Ze=1e4,Ae=2147483647,Ur=class extends A{constructor(r,e,t,o){super(r),this.started=new Date,this._setup=()=>{var n,i,a,s;this._signals=ue([(i=(n=this.options)==null?void 0:n.abortCtrl)==null?void 0:i.signal,(a=this.options)==null?void 0:a.signal].filter(Boolean)),!this.onEarlyFinalize.includes(this._handleEarlyFinalize)&&this.onEarlyFinalize.push(this._handleEarlyFinalize),!this.onFinalize.includes(this._handleFinalize)&&this.onFinalize.push(this._handleFinalize),(s=this._signals)==null||s.forEach(l=>l==null?void 0:l.addEventListener("abort",this._handleAbort));},this._handleAbort=async()=>{var n;let a=await h((n=this.options)==null?void 0:n.onAbort,[],void 0);a!=null||(a=new Error(`Aborted after ${new Date().getTime()-this.started.getTime()}ms`)),(a.name)!=null||(a.name="AbortError"),this.reject(a);},this._handleEarlyFinalize=()=>{var n,i,a,s;(n=this.options)!=null&&n.abortOnEarlyFinalize&&((s=(a=(i=this.options)==null?void 0:i.abortCtrl)==null?void 0:a.abort)==null||s.call(a));},this._handleFinalize=((n,i)=>{var a,s,l,c,u;this.cancelAbort(),this.clearTimeout(),!(!this.timeout.rejected&&!((a=this._signals)!=null&&a.find(f=>f==null?void 0:f.aborted)))&&((c=(l=(s=this.options)==null?void 0:s.abortCtrl)==null?void 0:l.signal)==null?void 0:c.aborted)===false&&((u=this.options)==null||u.abortCtrl.abort(i));}),this.data=r,this.options=w(t)?t:{},this.timeout=e,this._signals=o,this._setup();}get abortCtrl(){return this.options.abortCtrl}get aborted(){var r;return this.rejected&&!this.timeout.rejected&&!!((r=this._signals)!=null&&r.find(e=>e==null?void 0:e.aborted))}cancelAbort(){var r;(r=this._signals)==null||r.forEach(e=>e==null?void 0:e.removeEventListener("abort",this._handleAbort));}clearTimeout(){clearTimeout(this.timeout.timeoutId);}get timedout(){return this.rejected&&this.timeout.rejected}},Nr=Ur;function Pe(r,...e){var t;let o=R(Pe.defaults,Z(r)?{timeout:r}:w(r)?r:{},[],"empty");o.timeout=Math.min(M(o.timeout)?o.timeout:Ze,Ae);let n=e.map(s=>b(s)?A.try(s):s),i=n.length<=1?n[0]instanceof A?n[0]:new A(n[0]):(b(A[o.batchFunc])?A[o.batchFunc]:A.all)(n),a=Xe(o.timeout,o.onTimeout);return new Nr(A.race([i,a]),a,o,ue([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}Pe.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:Ze};var Br=Pe,N=class extends A{};N.deferred=Ye;N.deferredCallback=Dr;N.delay=je;N.delayReject=Xe;N.retry=kr;N.timeout=Br;var Lr=N,pe=Lr;var Ve=function(r,e){return Ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o;}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);},Ve(r,e)};function F(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ve(r,e);function t(){this.constructor=r;}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t);}function ee(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return {next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var o=t.call(r),n,i=[],a;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)i.push(n.value);}catch(s){a={error:s};}finally{try{n&&!n.done&&(t=o.return)&&t.call(o);}finally{if(a)throw a.error}}return i}function W(r,e,t){if(arguments.length===2)for(var o=0,n=e.length,i;o<n;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return r.concat(i||Array.prototype.slice.call(e))}function E(r){return typeof r=="function"}function de(r){var e=function(o){Error.call(o),o.stack=new Error().stack;},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var he=de(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
1
|
+
this.superutils=this.superutils||{};this.superutils.rx=(function(exports){'use strict';var T=(r,e=true)=>!!r&&typeof r=="object"&&(!e||[Object.prototype,null].includes(Object.getPrototypeOf(r))),xr=T,A=r=>Array.isArray(r);var Sr=r=>A(r)&&r.every(A),Tr=r=>A(r)||r instanceof Set||r instanceof Map;var wr=r=>Number.isInteger(r);var Z=r=>typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r),Se=r=>wr(r)&&r>0,D=r=>Z(r)&&r>0,ae=(r,e=false,t=false)=>{if(r==null)return true;switch(typeof r){case "number":return !Z(r);case "string":return !r.replaceAll(" ","").trim().length;case "boolean":case "bigint":case "symbol":case "function":return false}if(r instanceof Date)return Number.isNaN(r.getTime());if(r instanceof Map||r instanceof Set)return !r.size;if(Array.isArray(r)||r instanceof Uint8Array)return !r.length;if(r instanceof Error)return !r.message.length;let o=typeof r=="object"&&Object.getPrototypeOf(r);return o===Object.prototype||o===null?e?!Object.getOwnPropertyNames(r).length:!Object.keys(r).length:t};function ze(){}var b=r=>typeof r=="function";var Ne=b,P=r=>r instanceof Map;var $e=r=>typeof r=="boolean"||r instanceof Boolean,We=r=>r!=null,Je=r=>r instanceof Error,Te=r=>r instanceof Promise,X=r=>r instanceof RegExp,_r=r=>r instanceof Set,z=r=>typeof r=="string",le=(r,e=false)=>xr(r,false)&&Ne(r.subscribe)&&Ne(r.next)&&(!e||"value"in r),Er=r=>typeof r=="symbol";var h=(r,e,t)=>{try{let o=b(r)?r(...b(e)?e():e):r;return Te(o)?o.catch(n=>b(t)?t(n):t):o}catch(o){return b(t)?t(o):t}},R=h;new Date().getTime();var Or=(r,e=true,t=true)=>R(()=>[...t&&Object.getOwnPropertySymbols(r)||[],...e?Object.keys(r).sort():Object.keys(r)],[],[]),jr=Or,Y=(r,e="null")=>JSON.parse(R(JSON.stringify,[r],e)),K=(r,e,t,o=false,n=true)=>{let i=T(e,false)||b(e)?e:{};if(!T(r,false)&&!b(e))return i;let s=new Set(t!=null?t:[]),a=jr(r,true,true).filter(l=>!s.has(l));for(let l of a){let c=l,u=r[c];if(i.hasOwnProperty(c)&&(o==="empty"?!ae(i[c]):b(o)?!o(c,i[c],u):true))continue;if([void 0,null,1/0,NaN].includes(u)||!T(u,false)){i[c]=u;continue}i[c]=(()=>{switch(Object.getPrototypeOf(u)){case Array.prototype:return Y(u,"[]");case ArrayBuffer.prototype:return u.slice(0);case Date.prototype:return new Date(u.getTime());case Map.prototype:return new Map(Y(Array.from(u),"[]"));case RegExp.prototype:return new RegExp(u);case Set.prototype:return new Set(Y(Array.from(u)));case Uint8Array.prototype:return new Uint8Array([...u]);case URL.prototype:return new URL(u);}if(Er(c)||!n)return Y(u);let y=[...s].map(g=>String(g).startsWith(String(c).concat("."))&&String(g).split(String(c).concat("."))[1]).filter(Boolean);return y.length?K(u,i[c],y,o,n):Y(u)})();}return i},Ar=(r=[],e=[],t)=>{T(t)||(t={});for(let o=0;o<(A(r)?r:[]).length;o++)t[r[o]]=e==null?void 0:e[o];return t};function ue(r){let e=Object.entries(T(r)?r:{});return new Map(e.map(([t,o])=>[t,o]))}var Be=(r,e=true,t=false)=>A(r)?(t&&(r=[...r]),e?r.reverse():r):[];var ce=(r,e=0)=>A(r)?Array.from(new Set(r.flat(e))):[],se=(r,e=50,t={})=>{let{leading:o=se.defaults.leading,onError:n=se.defaults.onError,thisArg:i}=t,{tid:s}=t;i!==void 0&&(r=r.bind(i));let a=(...u)=>R(r,u,n),l=null,c=o==="global";return (...u)=>{clearTimeout(s),s=setTimeout(()=>{l!==u&&a(...u),l=c?true:null;},e),!(!o||l)&&(l=u,a(...u));}};se.defaults={leading:false,onError:void 0};var Cr=se,we=(r,e=50,t={})=>{let{defaults:o}=we,{onError:n=o.onError,trailing:i=o.trailing,thisArg:s}=t,{tid:a}=t,l=(...u)=>R(s!==void 0?r.bind(s):r,u,b(n)?f=>R(n,[f],void 0):void 0),c=null;return (...u)=>{if(a){c=u;return}a=setTimeout(()=>{if(a=void 0,!i)return;let f=c;c=null,f&&f!==u&&l(...f);},e),l(...u);}};we.defaults={onError:void 0,trailing:false};var Ir=we,$=(r,e=50,t={})=>t.throttle?Ir(r,e,t):Cr(r,e,t),_e=(r,e,t,o,n)=>{var i;P(n)||(n=new Map),Se(t)||(t=1/0);for(let[s,a]of ((i=r==null?void 0:r.entries)==null?void 0:i.call(r))||[]){if(n.size>=t)break;R(e!=null?e:a,[a,s,r],false)&&n.set(s,a);}return o?n:[...n.values()]},Pr=_e,Mr=r=>{if(!r)return 0;try{let e="size"in r?r.size:"length"in r?r.length:0;return Z(e)?e:0}catch(e){return 0}},Dr=Mr,Ee=r=>{var e;return [...((e=r==null?void 0:r.values)==null?void 0:e.call(r))||[]]},Le=Ee,L=(r,e)=>{var t;let o=!Dr(r)||ae(e==null?void 0:e.query),n=P(e==null?void 0:e.result)?e.result:new Map,i=(t=e==null?void 0:e.asMap)!=null?t:L.defaults.asMap;if(o)return i?n:Le(n);e=K(L.defaults,e,[],"empty");let{ignoreCase:s,limit:a=1/0,matchAll:l,matchExact:c,ranked:u}=e,{query:f}=e,p=z(f),y=X(f),g=R(Object.keys,[f],[]);if(s&&!c&&!y&&(f=p?f.toLowerCase():Ar(g,Object.values(f).map(d=>X(d)?d:`${d}`.toLowerCase()))),e.query=f,u){let d=[];for(let[v,S]of r.entries()){let j=-1;if(p||y){j=ie(e,S,void 0),j>=0&&d.push([j,v,S]);continue}let O=[];g[l?"every":"some"](m=>{let w=ie(e,S,m);return O.push(w),w>=0})&&(j=O.sort((m,w)=>m-w).filter(m=>m!==-1)[0],j>=0&&d.push([j,v,S]));}d.sort((v,S)=>v[0]-S[0]).slice(0,a).forEach(([v,S,j])=>n.set(S,j));}else for(let[d,v]of r.entries()){if(n.size>=a)break;(p||y?ie(e,v,void 0)>=0:g[l?"every":"some"](j=>ie(e,v,j)>=0))&&n.set(d,v);}return i?n:Le(n)};L.defaults={asMap:true,ignoreCase:true,limit:1/0,matchAll:false,ranked:false,transform:true};function ie({query:r,ignoreCase:e,matchExact:t,transform:o=true},n,i){var s,a;let l=z(r)||X(r)||i===void 0,c=l?r:r[i],u=l||!T(n)?n:n[i],f=R(()=>b(o)?o(n,l?void 0:u,i):t&&o===!1?u:T(u,!1)?JSON.stringify(Tr(u)?[...u.values()]:Object.values(u)):String(u!=null?u:""),[],"");if(f===c)return 0;if(t&&!X(c))return -1;let p=String(f);return p.trim()?X(c)?(a=(s=p.match(c))==null?void 0:s.index)!=null?a:-1:(e&&(p=p.toLowerCase()),p.indexOf(String(c))):-1}var Vr=L;function qe(r,e){return (b(e)?Pr(r,e,1):Vr(r,{...e,asMap:true,limit:1}))[e!=null&&e.includeKey?"entries":"values"]().next().value}var He=r=>{var e;return [...((e=r==null?void 0:r.entries)==null?void 0:e.call(r))||[]]},Ge=r=>{var e;return [...((e=r==null?void 0:r.keys)==null?void 0:e.call(r))||[]]};function fe(r,e,t){let o=A(r)?1:P(r)?2:_r(r)?3:0;if(!o)return r;let{asString:n,ignoreCase:i,newInstance:s,reverse:a,undefinedFirst:l}={...fe.defaults,...T(t)?t:T(e)?e:{}};if(o===1&&b(e))return Be(r.sort(e),a,s);let c=n?l?"":"Z".repeat(10):l?-1/0:1/0,u=b(e)?Be([...r.entries()].sort(e),a,false):(()=>{let f=1,p=d=>{let v=T(d)&&f!==0?d[e]:d;if(!n)return v;let S=`${v!=null?v:c}`;return i?S.toLowerCase():S},[y,g]=a?[-1,1]:[1,-1];return [1,3].includes(o)?(o===3||s?[...r]:r).sort((d,v)=>p(d)>p(v)?y:g):(f=e===true?0:1,[...r.entries()].sort((d,v)=>p(d==null?void 0:d[f])>p(v==null?void 0:v[f])?y:g))})();if(o===1)return u;if(s)return o===2?new Map(u):new Set(u);r.clear();for(let f of u)o===2?r.set(...f):r.add(f);return r}fe.defaults={asString:true,ignoreCase:true,newInstance:false,reverse:false,undefinedFirst:false};var Ye=(...r)=>{var e;return new Map((e=r==null?void 0:r.flatMap)==null?void 0:e.call(r,t=>P(t)?Array.from(t.entries()):Sr(t)?t:[]))};var F=globalThis.Promise,_=class extends F{constructor(e){let t,o,n=false,i=(s,a=true,l)=>{if(!n)return queueMicrotask(()=>i(s,a,l));s(l),this._state=a?1:2,this.onFinalize.forEach(c=>h(c,a?[l]:[void 0,l],void 0));};super((s,a)=>{o=l=>i(a,false,l),t=l=>i(s,true,l),b(e)?h(e,[t,o],o):Te(e)?e.then(t,o):e!==void 0&&t(e);}),this._state=0,this.onEarlyFinalize=[],this.onFinalize=[],this.resolve=s=>{var a,l;this.pending&&((a=this._resolve)==null||a.call(this,s),(l=this.onEarlyFinalize)==null||l.forEach(c=>{h(c,[true,s],void 0);}));},this.reject=s=>{var a,l;this.pending&&((a=this._reject)==null||a.call(this,s),(l=this.onEarlyFinalize)==null||l.forEach(c=>{h(c,[false,s],void 0);}));},n=true,this._resolve=t,this._reject=o;}get pending(){return this.state===0}get rejected(){return this.state===2}get resolved(){return this.state===1}get state(){return this._state}};_.all=r=>new _(F.all(r));_.allSettled=r=>new _(F.allSettled(r));_.any=r=>new _(F.any(r));_.race=r=>new _(F.race(r));_.reject=r=>{let e=new _;return queueMicrotask(()=>e.reject(r)),e};_.resolve=r=>new _(F.resolve(r));_.try=(r,...e)=>new _(h(r,e,t=>_.reject(t)));_.withResolvers=()=>{let r=new _;return {promise:r,reject:r.reject,resolve:r.resolve}};var kr=_,C=kr;function Oe(r={}){let e=0;r=K(Oe.defaults,r,[],"empty");let{onError:t,onIgnore:o,onResult:n}=r,{delay:i=0,ignoreStale:s,resolveError:a,resolveIgnored:l,thisArg:c,throttle:u}=r,f=null,p,y=new Map,g=!D(i);c!==void 0&&(t=t==null?void 0:t.bind(c),o=o==null?void 0:o.bind(c),n=n==null?void 0:n.bind(c));let d=O=>{for(let[x,m]of O){y.delete(x);let w=s&&m.sequence<p.sequence;if(!(m.resolved||m.started&&!w))switch(m.started&&(m.getPromise=(()=>m.result)),h(o,[m.getPromise],0),l){case "WITH_UNDEFINED":m.resolve(void 0);break;case "WITH_LAST":p==null||p.then(m.resolve,m.reject);break;}}y.size||(e=0);},v=O=>{if(f=null,g){y.delete(O);let[m,w]=[...y.entries()][0]||[];return m&&w&&j(m,w)}let x=[...y.entries()];if(u===true&&r.trailing){let m=x.findIndex(([w])=>w===O);x=x.slice(0,m);}else u||(x=x.slice(0,-1));d(x),y.delete(O);},S=async(O,x)=>{var m;try{x.started=!0,p=x,f=x,(m=x.result)!=null||(x.result=C.try(x.getPromise));let w=await x.result;if(!!s&&x.sequence<p.sequence)return d([[O,x]]);x.resolve(w),n&&h(n,[w],void 0);}catch(w){switch(t&&h(t,[w],void 0),a){case "REJECT":x.reject(w);case "NEVER":break;case "RESOLVE_UNDEFINED":x.resolve(void 0);break;case "RESOLVE_ERROR":x.resolve(w);break}}v(O);},j=g?S:$(S,i,r);return O=>{let x=Symbol("deferred-queue-item-id"),m=new C;return m.getPromise=b(O)?O:()=>O,m.started=false,m.sequence=++e,y.set(x,m),(!f||!g)&&j(x,m),m}}Oe.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var Xe=Oe;function Rr(r,e={}){let{thisArg:t}=e;t!==void 0&&(r=r.bind(t));let o=Xe(e);return (...n)=>o(()=>r(...n))}var Kr=Rr;function pe(r=pe.defaults.duration,e,t=false){let o=new C,n=i=>{let s=h(async()=>{let a=await(b(i)?i():i);return t?a!=null?a:new Error(`${pe.defaults.delayTimeoutMsg} ${r}ms`):a!=null?a:r},[],a=>F.reject(a));t?s.then(o.reject,o.reject):o.resolve(s);};return o.timeoutId=setTimeout(()=>n(e),r),o.pause=()=>clearTimeout(o.timeoutId),o.catch(()=>{}).finally(()=>o.pause()),o.onEarlyFinalize.push(()=>o.pause()),o}pe.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var je=pe;function Fr(r,e){return je(r,e,true)}var Ze=Fr,Ae=(r,e)=>{let t=false,o=C.try(async()=>{var n,i;e=K(Ae.defaults,e!=null?e:{},[],(v,S)=>{switch(v){case "retry":case "retryDelay":case "retryDelayJitterMax":return S!==0&&!Se(S)}return !!ae(S)});let{retry:s,retryBackOff:a,retryDelay:l,retryDelayJitter:c,retryDelayJitterMax:u}=e,f=l,p=0,y,g,d=false;do{if(p++,l>0&&!t&&p>0){a==="exponential"&&p>1&&(f*=2);let v=c?Math.floor(Math.random()*u):0;await je(f+v);}if(t)break;try{g=void 0,y=await r();}catch(v){g=v!=null?v:new Error(v);}if(t||s===0||p>s)break;d=!!((i=await h((n=e.retryIf)!=null?n:g,[y,p,g],g))!=null?i:g);}while(d);return g!==void 0?F.reject(g):y});return o.onEarlyFinalize.push(()=>{t=true;}),o};Ae.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var Ur=Ae,Qe=1e4,Ce=2147483647,Nr=class extends C{constructor(r,e,t,o){super(r),this.started=new Date,this._setup=()=>{var n,i,s,a;this._signals=ce([(i=(n=this.options)==null?void 0:n.abortCtrl)==null?void 0:i.signal,(s=this.options)==null?void 0:s.signal].filter(Boolean)),!this.onEarlyFinalize.includes(this._handleEarlyFinalize)&&this.onEarlyFinalize.push(this._handleEarlyFinalize),!this.onFinalize.includes(this._handleFinalize)&&this.onFinalize.push(this._handleFinalize),(a=this._signals)==null||a.forEach(l=>l==null?void 0:l.addEventListener("abort",this._handleAbort));},this._handleAbort=async()=>{var n;let s=await h((n=this.options)==null?void 0:n.onAbort,[],void 0);s!=null||(s=new Error(`Aborted after ${new Date().getTime()-this.started.getTime()}ms`)),(s.name)!=null||(s.name="AbortError"),this.reject(s);},this._handleEarlyFinalize=()=>{var n,i,s,a;(n=this.options)!=null&&n.abortOnEarlyFinalize&&((a=(s=(i=this.options)==null?void 0:i.abortCtrl)==null?void 0:s.abort)==null||a.call(s));},this._handleFinalize=((n,i)=>{var s,a,l,c,u;this.cancelAbort(),this.clearTimeout(),!(!this.timeout.rejected&&!((s=this._signals)!=null&&s.find(f=>f==null?void 0:f.aborted)))&&((c=(l=(a=this.options)==null?void 0:a.abortCtrl)==null?void 0:l.signal)==null?void 0:c.aborted)===false&&((u=this.options)==null||u.abortCtrl.abort(i));}),this.data=r,this.options=T(t)?t:{},this.timeout=e,this._signals=o,this._setup();}get abortCtrl(){return this.options.abortCtrl}get aborted(){var r;return this.rejected&&!this.timeout.rejected&&!!((r=this._signals)!=null&&r.find(e=>e==null?void 0:e.aborted))}cancelAbort(){var r;(r=this._signals)==null||r.forEach(e=>e==null?void 0:e.removeEventListener("abort",this._handleAbort));}clearTimeout(){clearTimeout(this.timeout.timeoutId);}get timedout(){return this.rejected&&this.timeout.rejected}},Br=Nr;function Ie(r,...e){var t;let o=K(Ie.defaults,Z(r)?{timeout:r}:T(r)?r:{},[],"empty");o.timeout=Math.min(D(o.timeout)?o.timeout:Qe,Ce);let n=e.map(a=>b(a)?C.try(a):a),i=n.length<=1?n[0]instanceof C?n[0]:new C(n[0]):(b(C[o.batchFunc])?C[o.batchFunc]:C.all)(n),s=Ze(o.timeout,o.onTimeout);return new Br(C.race([i,s]),s,o,ce([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}Ie.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:Qe};var Lr=Ie,N=class extends C{};N.deferred=Xe;N.deferredCallback=Kr;N.delay=je;N.delayReject=Ze;N.retry=Ur;N.timeout=Lr;var zr=N,de=zr;var Pe=function(r,e){return Pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o;}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);},Pe(r,e)};function V(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Pe(r,e);function t(){this.constructor=r;}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t);}function Q(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return {next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var o=t.call(r),n,i=[],s;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)i.push(n.value);}catch(a){s={error:a};}finally{try{n&&!n.done&&(t=o.return)&&t.call(o);}finally{if(s)throw s.error}}return i}function J(r,e,t){if(arguments.length===2)for(var o=0,n=e.length,i;o<n;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return r.concat(i||Array.prototype.slice.call(e))}function E(r){return typeof r=="function"}function he(r){var e=function(o){Error.call(o),o.stack=new Error().stack;},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ye=he(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
2
2
|
`+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=t;}});function re(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1);}}var K=(function(){function r(e){this.initialTeardown=e,this.closed=false,this._parentage=null,this._finalizers=null;}return r.prototype.unsubscribe=function(){var e,t,o,n,i;if(!this.closed){this.closed=true;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=ee(a),l=s.next();!l.done;l=s.next()){var c=l.value;c.remove(this);}}catch(d){e={error:d};}finally{try{l&&!l.done&&(t=s.return)&&t.call(s);}finally{if(e)throw e.error}}else a.remove(this);var u=this.initialTeardown;if(E(u))try{u();}catch(d){i=d instanceof he?d.errors:[d];}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=ee(f),m=p.next();!m.done;m=p.next()){var g=m.value;try{Qe(g);}catch(d){i=i!=null?i:[],d instanceof he?i=W(W([],$(i)),$(d.errors)):i.push(d);}}}catch(d){o={error:d};}finally{try{m&&!m.done&&(n=p.return)&&n.call(p);}finally{if(o)throw o.error}}}if(i)throw new he(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Qe(e);else {if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e);}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e;},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&re(t,e);},r.prototype.remove=function(e){var t=this._finalizers;t&&re(t,e),e instanceof r&&e._removeParent(this);},r.EMPTY=(function(){var e=new r;return e.closed=true,e})(),r})();var Ie=K.EMPTY;function me(r){return r instanceof K||r&&"closed"in r&&E(r.remove)&&E(r.add)&&E(r.unsubscribe)}function Qe(r){E(r)?r():r.unsubscribe();}var I={Promise:void 0};var J={setTimeout:function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,W([r,e],$(t)))},clearTimeout:function(r){return (clearTimeout)(r)},delegate:void 0};function er(r){J.setTimeout(function(){throw r});}function Me(){}function q(r){r();}var te=(function(r){F(e,r);function e(t){var o=r.call(this)||this;return o.isStopped=false,t?(o.destination=t,me(t)&&t.add(o)):o.destination=Jr,o}return e.create=function(t,o,n){return new be(t,o,n)},e.prototype.next=function(t){this.isStopped?De():this._next(t);},e.prototype.error=function(t){this.isStopped?De():(this.isStopped=true,this._error(t));},e.prototype.complete=function(){this.isStopped?De():(this.isStopped=true,this._complete());},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=true,r.prototype.unsubscribe.call(this),this.destination=null);},e.prototype._next=function(t){this.destination.next(t);},e.prototype._error=function(t){try{this.destination.error(t);}finally{this.unsubscribe();}},e.prototype._complete=function(){try{this.destination.complete();}finally{this.unsubscribe();}},e})(K);var $r=(function(){function r(e){this.partialObserver=e;}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e);}catch(o){ye(o);}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e);}catch(o){ye(o);}else ye(e);},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete();}catch(t){ye(t);}},r})(),be=(function(r){F(e,r);function e(t,o,n){var i=r.call(this)||this,a;if(E(t)||!t)a={next:t!=null?t:void 0,error:o!=null?o:void 0,complete:n!=null?n:void 0};else {a=t;}return i.destination=new $r(a),i}return e})(te);function ye(r){er(r);}function Wr(r){throw r}function De(r,e){}var Jr={closed:true,next:Me,error:Wr,complete:Me};var ir=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ar(r){return r}function sr(r){return r.length===0?ar:r.length===1?r[0]:function(t){return r.reduce(function(o,n){return n(o)},t)}}var oe=(function(){function r(e){e&&(this._subscribe=e);}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,o){var n=this,i=Hr(e)?e:new be(e,t,o);return q(function(){var a=n,s=a.operator,l=a.source;i.add(s?s.call(i,l):l?n._subscribe(i):n._trySubscribe(i));}),i},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t);}},r.prototype.forEach=function(e,t){var o=this;return t=lr(t),new t(function(n,i){var a=new be({next:function(s){try{e(s);}catch(l){i(l),a.unsubscribe();}},error:i,complete:n});o.subscribe(a);})},r.prototype._subscribe=function(e){var t;return (t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[ir]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return sr(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=lr(e),new e(function(o,n){var i;t.subscribe(function(a){return i=a},function(a){return n(a)},function(){return o(i)});})},r.create=function(e){return new r(e)},r})();function lr(r){var e;return (e=r!=null?r:I.Promise)!==null&&e!==void 0?e:Promise}function qr(r){return r&&E(r.next)&&E(r.error)&&E(r.complete)}function Hr(r){return r&&r instanceof te||qr(r)&&me(r)}function Gr(r){return E(r==null?void 0:r.lift)}function ur(r){return function(e){if(Gr(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o);}});throw new TypeError("Unable to lift unknown Observable type")}}function cr(r,e,t,o,n){return new Yr(r,e,t,o,n)}var Yr=(function(r){F(e,r);function e(t,o,n,i,a,s){var l=r.call(this,t)||this;return l.onFinalize=a,l.shouldUnsubscribe=s,l._next=o?function(c){try{o(c);}catch(u){t.error(u);}}:r.prototype._next,l._error=i?function(c){try{i(c);}catch(u){t.error(u);}finally{this.unsubscribe();}}:r.prototype._error,l._complete=n?function(){try{n();}catch(c){t.error(c);}finally{this.unsubscribe();}}:r.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this));}},e})(te);var fr=de(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var U=(function(r){F(e,r);function e(){var t=r.call(this)||this;return t.closed=false,t.currentObservers=null,t.observers=[],t.isStopped=false,t.hasError=false,t.thrownError=null,t}return e.prototype.lift=function(t){var o=new pr(this,this);return o.operator=t,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new fr},e.prototype.next=function(t){var o=this;q(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var a=ee(o.currentObservers),s=a.next();!s.done;s=a.next()){var l=s.value;l.next(t);}}catch(c){n={error:c};}finally{try{s&&!s.done&&(i=a.return)&&i.call(a);}finally{if(n)throw n.error}}}});},e.prototype.error=function(t){var o=this;q(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=true,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t);}});},e.prototype.complete=function(){var t=this;q(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=true;for(var o=t.observers;o.length;)o.shift().complete();}});},e.prototype.unsubscribe=function(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:false,configurable:true}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var o=this,n=this,i=n.hasError,a=n.isStopped,s=n.observers;return i||a?Ie:(this.currentObservers=null,s.push(t),new K(function(){o.currentObservers=null,re(s,t);}))},e.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,i=o.thrownError,a=o.isStopped;n?t.error(i):a&&t.complete();},e.prototype.asObservable=function(){var t=new oe;return t.source=this,t},e.create=function(t,o){return new pr(t,o)},e})(oe);var pr=(function(r){F(e,r);function e(t,o){var n=r.call(this)||this;return n.destination=t,n.source=o,n}return e.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t);},e.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t);},e.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t);},e.prototype._subscribe=function(t){var o,n;return (n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Ie},e})(U);var P=(function(r){F(e,r);function e(t){var o=r.call(this)||this;return o._value=t,o}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:false,configurable:true}),e.prototype._subscribe=function(t){var o=r.prototype._subscribe.call(this,t);return !o.closed&&t.next(this._value),o},e.prototype.getValue=function(){var t=this,o=t.hasError,n=t.thrownError,i=t._value;if(o)throw n;return this._throwIfClosed(),i},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t);},e})(U);function ve(r){return !!r&&(r instanceof oe||E(r.lift)&&E(r.subscribe))}function dr(r,e){return ur(function(t,o){var n=0;t.subscribe(cr(o,function(i){return r.call(e,i,n++)&&o.next(i)}));})}function H(r){return dr(function(e,t){return r<=t})}var Bo=(r,e,t)=>{if(!le(r)&&!ve(r))return pe.reject(new Error("subject must be an instance of BehaviorSubject"));let o,n=w(t)?t:{timeout:t};n.timeout=M(n.timeout)?n.timeout:Ae;let i=pe.timeout({...n,onTimeout:async()=>{let{onTimeout:a,timeoutMsg:s}=n,l=await h(a,[],void 0);return l!=null?l:We(s)?s:new Error(s!=null?s:"request timed out before an expected value is received")}},new pe(a=>{o=r.subscribe(s=>{(s===e||e===void 0||b(e)&&h(e,[s],false))&&a(s);});}));return i.onFinalize.push(()=>{var a;(a=o==null?void 0:o.unsubscribe)==null||a.call(o);}),i};var Xr=(r,e=false)=>le(r,e),ne=Xr;var Zr=(r,e=false)=>{if(r instanceof K)return true;let t=r;return !e&&!!t&&$e(t.closed)&&b(t.unsubscribe)},hr=Zr;var ge=(r={},e)=>{if(r)try{if(b(r))return r();if(hr(r))return r.unsubscribe();Object.values(r).forEach(t=>ge(t,e));}catch(t){e==null||e(t);}},Re=ge;var ke=Symbol("ignore-rx-update");function Ue(r,e,t,o){var u;e=ne(e)?e:new P(void 0),o={...Ue.defaults,...o!=null?o:{}};let n=ne(r)?[r]:C(r)?r:[r],i=new Map(n.map((f,p)=>[p,ne(f)?f.value:f])),a=()=>{let f=C(r)?[...i.values()]:i.get(0);if(!b(t))return e.next(f);let p=h(t,[f,void 0,e],m=>{var g;return h((g=o.onError)==null?void 0:g.bind(o.thisArg),[m],void 0),ke});p!==ke&&e.next(p);},s=M(o.delay)?z(a,o.delay,o):a,l=n.map((f,p)=>{if(!(!ne(f)||f.closed))return (f instanceof P?f.pipe(H(1)):f).subscribe(m=>{i.set(p,m),s();})}).filter(Boolean),c=(u=e==null?void 0:e.unsubscribe)==null?void 0:u.bind(e);return e.unsubscribe=(...f)=>{c==null||c(...f),ge(l),i.clear();},a(),e}Ue.defaults={delay:0,throttle:false};Ue.IGNORE_UPDATE_SYMBOL=ke;var Qr=(a=>(a.onChange="onChange",a.parse="parse",a.parse_json="parse-json",a.stringify="stringify",a.stringify_json="stringify-json",a.write="write",a))(Qr||{});var mr=new U,G=class G{constructor(e,t){this.initialized=false;this.subscriptions={subject:void 0,forceUpdateCache:void 0};this.handleForceUpdateCacheChange=e=>{if(!(this.name?C(e)?e.includes(this.name):Q(e)?e===this.name:e===true:false))return;let o=this.read();this.subject.next(o);};this.handleSubjectChange=e=>{var t;if(!V(e))return this.subject.next(new Map);this.write(e),h((t=this.onChange)==null?void 0:t.bind(this),[e],this.triggerOnError("onChange"));};this.triggerOnError=(e,t=void 0)=>o=>{var n;return h((n=this.onError)==null?void 0:n.bind(this),[o,e],""),t};let{cacheDisabled:o=false,delay:n,delayOptions:i,initialValue:a,onError:s,onChange:l,parse:c,spaces:u,storage:f,stringify:p}=t!=null?t:{};if(this.delay=n===0||M(n)?n:300,this.name=`${e!=null?e:""}`.trim(),this.onError=s,this.onChange=l,this.parse=c,this.storage=f===null?null:f!=null?f:h(()=>globalThis.localStorage,[],void 0),this.name&&!this.storage)throw new Error("options.storage: LocalStorage instance or equivalent required");this.cacheDisabled=!!this.storage&&o,this.stringify=p,this.spaces=u,this.subject=this.cacheDisabled?new U:new P(void 0),this.delayOptions=i,V(a)&&a.size&&this.init(a);}get size(){return this.getAll().size}clear(){return this.setAll(new Map,true),this}delete(e){C(e)||(e=[e]);let t=this.getAll();for(let o of e)t.delete(o);return this.setAll(t,true),this}find(e){return Je(this.getAll(),e)}filter(...e){return Te(this.getAll(),...e)}get(e){return this.getAll().get(e)}getAll(e=false){var n,i;let t=this.initialized;if(t||this.init(),this.cacheDisabled||this.name&&e){let a=this.read();return (e||!t&&a.size)&&this.subject.next(a),a}return (i=(n=this.subject)==null?void 0:n.value)!=null?i:new Map}has(e){return this.getAll().has(e)}init(e){if(this.initialized)return false;this.initialized=true;let t=true;if(e!=null&&e.size||!this.cacheDisabled){let o=this.read();o.size&&(e=o),t=this.cacheDisabled||o.size===0;}return e!=null&&e.size&&this.subject.next(e),Re(this.subscriptions),this.cacheDisabled||(this.subscriptions.forceUpdateCache=mr.subscribe(this.handleForceUpdateCacheChange)),this.subscriptions.subject=this.subject.pipe(H(this.cacheDisabled||t?0:1)).subscribe(!this.cacheDisabled&&this.delay>0?z(this.handleSubjectChange,this.delay,{thisArg:this,...this.delayOptions}):this.handleSubjectChange),true}keys(){return He(this.getAll())}map(e){return this.toArray().map(([t,o],n,i)=>e(o,t,i,n))}read(){var n,i,a;let e=(i=(n=this.storage)==null?void 0:n.getItem(this.name))!=null?i:"",t=(a=this.parse)==null?void 0:a.bind(this),o=h(t,[e],this.triggerOnError("parse"));return V(o)?o:new Map(h(()=>JSON.parse(e),[],this.triggerOnError("parse-json")))}search(e){return L(this.getAll(),e)}set(e,t){return this.setAll(new Map([[e,t]]),false),this}setAll(e=new Map,t=false){return V(e)?(e=t?e:Ge(this.getAll(),e),this.subject.next(new Map(e)),this):this}sort(...e){var o;let t=ce(this.getAll(),e[0],e[1]);return (o=e[1])!=null&&o.save&&this.setAll(t,true),t}toArray(){return qe(this.getAll())}toJSON(...[e,t=this.spaces,o=this.getAll()]){var a;let n=(a=this.stringify)==null?void 0:a.bind(this),i=h(n,[o],this.triggerOnError("stringify"));return Q(i)?i:h(()=>JSON.stringify(Array.from(o),e,t),[],this.triggerOnError("stringify-json",""))}toObject(e=(t=>(t=this==null?void 0:this.getAll)==null?void 0:t.call(this))()){let o={};e=V(e)?e:new Map;for(let[n,i]of e)o[n]=i;return o}toString(e){return this.toJSON(void 0,void 0,e)}unsubscribe(){return Re(this.subscriptions)}values(){return Ee(this.getAll())}write(e){try{return !this.initialized&&this.init(),e!=null||(e=this.subject.value),!this.name||!this.storage||!V(e)?!1:(this.storage.setItem(this.name,this.toString(e)),!0)}catch(t){return this.triggerOnError("write")(t),false}}};G.fromObject=(e,t)=>new G(e,{parse:o=>we(JSON.parse(o||"{}")),stringify:o=>JSON.stringify(G.prototype.toObject(o)),...t,initialValue:w(t==null?void 0:t.initialValue,true)?we(t.initialValue):t==null?void 0:t.initialValue}),G.forceUpdateCache=e=>{mr.next(e);};var yr=G;var br=class extends P{constructor(t,o=1e3,n=0,i=1){super(n);this.autoStart=t;this._delay=o;this.initialValue=n;this.incrementBy=i;this._running=false;this.pause=()=>(clearInterval(this._intervalId),this._running=false,this);this.resume=()=>this.start();this.start=()=>(this._running||(this._running=true,this._intervalId=setInterval(()=>this.next(this.value+this.incrementBy),this._delay)),this);this.stop=()=>(this.pause(),this.next(0),this);this.autoStart&&this.start();}get delay(){return this._delay}set delay(t){this._running||(this._delay=t);}get running(){return this._running}};var vr=class{constructor(e,t,o,n=true,i=true){this.taskFn=e;this.taskArgs=t;this.sequential=n;this.preExecute=i;this.minIntervalMs=1e3;this.runCount=0;this.started=false;this.clearInterval=()=>{this.sequential?clearTimeout(this.idInterval):clearInterval(this.idInterval),this.idInterval=void 0;};this.executeTask=async(e=false)=>{var n;let t,o;(this.sequential||e)&&this.clearInterval();try{++this.runCount,await((n=this.onBeforeExec)==null?void 0:n.call(this,this.runCount,e)),o=await this.taskFn.apply(void 0,this.taskArgs),this.lastResult=o;}catch(i){t=i;}return h(this.onResult,[t!=null?t:null,o,this.runCount,e],void 0),!e&&this.sequential&&this.intervalMs$.value>this.minIntervalMs&&(this.idInterval=setTimeout(this.executeTask,this.intervalMs$.value)),this.lastResult};this.executeOnce=async()=>await this.executeTask(true);this.isStarted=()=>this.started;this.restart=(e=false)=>this.onResult?(this.stop(e),this.start(this.onResult,this.onBeforeExec),true):false;this.start=(e,t)=>{if(!e||(this.onResult=e,this.onBeforeExec=t,this.started))return false;this.started=true;let o;return this.subscription=this.intervalMs$.subscribe(n=>{var a;if(o===n&&n!==void 0)return;o=Math.max((a=n!=null?n:o)!=null?a:0,this.minIntervalMs),this.clearInterval();let i=this.lastResult===void 0&&this.preExecute;i&&this.executeTask().catch(ze),this.idInterval=this.sequential?i?void 0:setTimeout(this.executeTask,o):setInterval(this.executeTask,o);}),true};this.stop=(e=false)=>{var t,o;return e&&(this.runCount=0),this.started=false,(o=(t=this.subscription)==null?void 0:t.unsubscribe)==null||o.call(t),this.clearInterval(),this};this.intervalMs$=o instanceof P?o:new P(o);}};exports.BehaviorSubject=P;exports.DataStorage=yr;exports.IGNORE_UPDATE_SYMBOL=ke;exports.IntervalRunner=vr;exports.IntervalSubject=br;exports.OnErrorType=Qr;exports.Subject=U;exports.Subscription=K;exports.asPromise=Bo;exports.copyRxSubject=Ue;exports.forceUpdateCache$=mr;exports.isObservable=ve;exports.isSubjectLike=Xr;exports.isSubscriptionLike=Zr;exports.skip=H;exports.unsubscribeAll=ge;return exports;})({});//# sourceMappingURL=index.min.js.map
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=t;}});function ee(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1);}}var k=(function(){function r(e){this.initialTeardown=e,this.closed=false,this._parentage=null,this._finalizers=null;}return r.prototype.unsubscribe=function(){var e,t,o,n,i;if(!this.closed){this.closed=true;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Q(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this);}}catch(d){e={error:d};}finally{try{l&&!l.done&&(t=a.return)&&t.call(a);}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(E(u))try{u();}catch(d){i=d instanceof ye?d.errors:[d];}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=Q(f),y=p.next();!y.done;y=p.next()){var g=y.value;try{er(g);}catch(d){i=i!=null?i:[],d instanceof ye?i=J(J([],W(i)),W(d.errors)):i.push(d);}}}catch(d){o={error:d};}finally{try{y&&!y.done&&(n=p.return)&&n.call(p);}finally{if(o)throw o.error}}}if(i)throw new ye(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)er(e);else {if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e);}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e;},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ee(t,e);},r.prototype.remove=function(e){var t=this._finalizers;t&&ee(t,e),e instanceof r&&e._removeParent(this);},r.EMPTY=(function(){var e=new r;return e.closed=true,e})(),r})();var Me=k.EMPTY;function me(r){return r instanceof k||r&&"closed"in r&&E(r.remove)&&E(r.add)&&E(r.unsubscribe)}function er(r){E(r)?r():r.unsubscribe();}var M={Promise:void 0};var q={setTimeout:function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,J([r,e],W(t)))},clearTimeout:function(r){return (clearTimeout)(r)},delegate:void 0};function rr(r){q.setTimeout(function(){throw r});}function De(){}function H(r){r();}var re=(function(r){V(e,r);function e(t){var o=r.call(this)||this;return o.isStopped=false,t?(o.destination=t,me(t)&&t.add(o)):o.destination=qr,o}return e.create=function(t,o,n){return new ve(t,o,n)},e.prototype.next=function(t){this.isStopped?Re():this._next(t);},e.prototype.error=function(t){this.isStopped?Re():(this.isStopped=true,this._error(t));},e.prototype.complete=function(){this.isStopped?Re():(this.isStopped=true,this._complete());},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=true,r.prototype.unsubscribe.call(this),this.destination=null);},e.prototype._next=function(t){this.destination.next(t);},e.prototype._error=function(t){try{this.destination.error(t);}finally{this.unsubscribe();}},e.prototype._complete=function(){try{this.destination.complete();}finally{this.unsubscribe();}},e})(k);var Wr=(function(){function r(e){this.partialObserver=e;}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e);}catch(o){be(o);}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e);}catch(o){be(o);}else be(e);},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete();}catch(t){be(t);}},r})(),ve=(function(r){V(e,r);function e(t,o,n){var i=r.call(this)||this,s;if(E(t)||!t)s={next:t!=null?t:void 0,error:o!=null?o:void 0,complete:n!=null?n:void 0};else {s=t;}return i.destination=new Wr(s),i}return e})(re);function be(r){rr(r);}function Jr(r){throw r}function Re(r,e){}var qr={closed:true,next:De,error:Jr,complete:De};var sr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ar(r){return r}function lr(r){return r.length===0?ar:r.length===1?r[0]:function(t){return r.reduce(function(o,n){return n(o)},t)}}var te=(function(){function r(e){e&&(this._subscribe=e);}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,o){var n=this,i=Gr(e)?e:new ve(e,t,o);return H(function(){var s=n,a=s.operator,l=s.source;i.add(a?a.call(i,l):l?n._subscribe(i):n._trySubscribe(i));}),i},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t);}},r.prototype.forEach=function(e,t){var o=this;return t=ur(t),new t(function(n,i){var s=new ve({next:function(a){try{e(a);}catch(l){i(l),s.unsubscribe();}},error:i,complete:n});o.subscribe(s);})},r.prototype._subscribe=function(e){var t;return (t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[sr]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return lr(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=ur(e),new e(function(o,n){var i;t.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)});})},r.create=function(e){return new r(e)},r})();function ur(r){var e;return (e=r!=null?r:M.Promise)!==null&&e!==void 0?e:Promise}function Hr(r){return r&&E(r.next)&&E(r.error)&&E(r.complete)}function Gr(r){return r&&r instanceof re||Hr(r)&&me(r)}function Yr(r){return E(r==null?void 0:r.lift)}function cr(r){return function(e){if(Yr(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o);}});throw new TypeError("Unable to lift unknown Observable type")}}function fr(r,e,t,o,n){return new Xr(r,e,t,o,n)}var Xr=(function(r){V(e,r);function e(t,o,n,i,s,a){var l=r.call(this,t)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=o?function(c){try{o(c);}catch(u){t.error(u);}}:r.prototype._next,l._error=i?function(c){try{i(c);}catch(u){t.error(u);}finally{this.unsubscribe();}}:r.prototype._error,l._complete=n?function(){try{n();}catch(c){t.error(c);}finally{this.unsubscribe();}}:r.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this));}},e})(re);var pr=he(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var U=(function(r){V(e,r);function e(){var t=r.call(this)||this;return t.closed=false,t.currentObservers=null,t.observers=[],t.isStopped=false,t.hasError=false,t.thrownError=null,t}return e.prototype.lift=function(t){var o=new dr(this,this);return o.operator=t,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new pr},e.prototype.next=function(t){var o=this;H(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=Q(o.currentObservers),a=s.next();!a.done;a=s.next()){var l=a.value;l.next(t);}}catch(c){n={error:c};}finally{try{a&&!a.done&&(i=s.return)&&i.call(s);}finally{if(n)throw n.error}}}});},e.prototype.error=function(t){var o=this;H(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=true,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t);}});},e.prototype.complete=function(){var t=this;H(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=true;for(var o=t.observers;o.length;)o.shift().complete();}});},e.prototype.unsubscribe=function(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:false,configurable:true}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Me:(this.currentObservers=null,a.push(t),new k(function(){o.currentObservers=null,ee(a,t);}))},e.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?t.error(i):s&&t.complete();},e.prototype.asObservable=function(){var t=new te;return t.source=this,t},e.create=function(t,o){return new dr(t,o)},e})(te);var dr=(function(r){V(e,r);function e(t,o){var n=r.call(this)||this;return n.destination=t,n.source=o,n}return e.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t);},e.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t);},e.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t);},e.prototype._subscribe=function(t){var o,n;return (n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Me},e})(U);var I=(function(r){V(e,r);function e(t){var o=r.call(this)||this;return o._value=t,o}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:false,configurable:true}),e.prototype._subscribe=function(t){var o=r.prototype._subscribe.call(this,t);return !o.closed&&t.next(this._value),o},e.prototype.getValue=function(){var t=this,o=t.hasError,n=t.thrownError,i=t._value;if(o)throw n;return this._throwIfClosed(),i},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t);},e})(U);function ge(r){return !!r&&(r instanceof te||E(r.lift)&&E(r.subscribe))}function hr(r,e){return cr(function(t,o){var n=0;t.subscribe(fr(o,function(i){return r.call(e,i,n++)&&o.next(i)}));})}function G(r){return hr(function(e,t){return r<=t})}var Lo=(r,e,t)=>{if(!le(r)&&!ge(r))return de.reject(new Error("subject must be an instance of BehaviorSubject"));let o,n=T(t)?t:{timeout:t};n.timeout=D(n.timeout)?n.timeout:Ce;let i=de.timeout({...n,onTimeout:async()=>{let{onTimeout:s,timeoutMsg:a}=n,l=await h(s,[],void 0);return l!=null?l:Je(a)?a:new Error(a!=null?a:"request timed out before an expected value is received")}},new de(s=>{o=r.subscribe(a=>{(a===e||e===void 0||b(e)&&h(e,[a],false))&&s(a);});}));return i.onFinalize.push(()=>{var s;(s=o==null?void 0:o.unsubscribe)==null||s.call(o);}),i};var Zr=(r,e=false)=>le(r,e),oe=Zr;var Qr=(r,e=false)=>{if(r instanceof k)return true;let t=r;return !e&&!!t&&$e(t.closed)&&b(t.unsubscribe)},yr=Qr;var xe=(r={},e)=>{if(r)try{if(b(r))return r();if(yr(r))return r.unsubscribe();Object.values(r).forEach(t=>xe(t,e));}catch(t){e==null||e(t);}},Ke=xe;var Fe=Symbol("ignore-rx-update");function Ue(r,e,t,o){var u;e=oe(e)?e:new I(void 0),o={...Ue.defaults,...o!=null?o:{}};let n=oe(r)?[r]:A(r)?r:[r],i=new Map(n.map((f,p)=>[p,oe(f)?f.value:f])),s=()=>{let f=A(r)?[...i.values()]:i.get(0);if(!b(t))return e.next(f);let p=h(t,[f,void 0,e],y=>{var g;return h((g=o.onError)==null?void 0:g.bind(o.thisArg),[y],void 0),Fe});p!==Fe&&e.next(p);},a=D(o.delay)?$(s,o.delay,o):s,l=n.map((f,p)=>{if(!(!oe(f)||f.closed))return (f instanceof I?f.pipe(G(1)):f).subscribe(y=>{i.set(p,y),a();})}).filter(Boolean),c=(u=e==null?void 0:e.unsubscribe)==null?void 0:u.bind(e);return e.unsubscribe=(...f)=>{c==null||c(...f),xe(l),i.clear();},s(),e}Ue.defaults={delay:0,throttle:false};Ue.IGNORE_UPDATE_SYMBOL=Fe;var et=(s=>(s.onChange="onChange",s.parse="parse",s.parse_json="parse-json",s.stringify="stringify",s.stringify_json="stringify-json",s.write="write",s))(et||{});var mr=new U,ne=class ne{constructor(e,t){this.initialized=false;this.subscriptions={subject:void 0,forceUpdateCache:void 0};this.clear=()=>this.setAll(new Map,true);this.delete=e=>{A(e)||(e=[e]);let t=this.getAll();for(let o of e)t.delete(o);return this.setAll(t,true),this};this.filter=(...e)=>_e(this.getAll(),...e);this.find=e=>qe(this.getAll(),e);this.get=e=>this.getAll().get(e);this.getAll=(e=false)=>{var n,i;let t=this.initialized;if(t||this.init(),this.cacheDisabled||this.name&&e){let s=this.read();return (e||!t&&s.size)&&this.subject.next(s),s}return (i=(n=this.subject)==null?void 0:n.value)!=null?i:new Map};this.handleForceUpdateCacheChange=e=>{if(!(this.name?A(e)?e.includes(this.name):z(e)?e===this.name:e===true:false))return;let o=this.read();this.subject.next(o);};this.handleSubjectChange=e=>{var t;if(!P(e))return this.subject.next(new Map);this.write(e),h((t=this.onChange)==null?void 0:t.bind(this),[e],this.triggerOnError("onChange"));};this.has=e=>this.getAll().has(e);this.init=e=>{var o;if(this.initialized)return false;this.initialized=true;let t=true;if(e!=null&&e.size||!this.cacheDisabled){let n=this.name?(o=this.storage)==null?void 0:o.getItem(this.name):null,i=this.read(n);We(n)&&(e=i),t=this.cacheDisabled||i.size===0;}return e!=null&&e.size&&this.subject.next(e),Ke(this.subscriptions),this.cacheDisabled||(this.subscriptions.forceUpdateCache=mr.subscribe(this.handleForceUpdateCacheChange)),this.subscriptions.subject=this.subject.pipe(G(this.cacheDisabled||t?0:1)).subscribe(!this.cacheDisabled&&this.delay>0?$(this.handleSubjectChange,this.delay,{thisArg:this,...this.delayOptions}):this.handleSubjectChange),true};this.keys=()=>Ge(this.getAll());this.map=e=>this.toArray().map(([t,o],n,i)=>e(o,t,i,n));this.read=(e=this.name?(t=>(t=this.storage)==null?void 0:t.getItem(this.name))():null)=>{var n;if(!this.name)return (n=this.subject.value)!=null?n:new Map;let o=h((()=>{var i;return (i=this.parse)==null?void 0:i.call(this,e)}),[],this.triggerOnError("parse"));return P(o)?o:z(e)?new Map(h(()=>JSON.parse(e),[],this.triggerOnError("parse-json"))):new Map};this.search=(...e)=>L(this.getAll(),...e);this.set=(e,t)=>this.setAll(new Map([[e,t]]),false);this.setAll=(e,t=false)=>P(e)?(e=t?e:Ye(this.getAll(),e),this.subject.next(new Map(e)),this):this;this.sort=(...e)=>{var o;let t=fe(this.getAll(),e[0],e[1]);return (o=e[1])!=null&&o.save&&this.setAll(t,true),t};this.toArray=()=>He(this.getAll());this.toJSON=(e,t=this.spaces,o=this.getAll())=>{let n=h((()=>{var i;return (i=this.stringify)==null?void 0:i.call(this,o)}),[],this.triggerOnError("stringify"));return z(n)?n:h(()=>JSON.stringify(Array.from(o),e,t),[],this.triggerOnError("stringify-json",""))};this.toObject=(e=this.getAll())=>{let t={};if(!P(e))return t;for(let[o,n]of e)t[o]=n;return t};this.toString=(e=this.getAll())=>this.toJSON(void 0,void 0,e);this.triggerOnError=(e,t=void 0)=>o=>{var n;return h((n=this.onError)==null?void 0:n.bind(this),[o,e],""),t};this.unsubscribe=()=>Ke(this.subscriptions);this.values=()=>Ee(this.getAll());this.write=e=>{var t;try{!this.initialized&&this.init();let o=e!=null?e:(t=this.subject)==null?void 0:t.value;return !this.name||!this.storage||!P(o)?!1:(this.storage.setItem(this.name,this.toString(o)),!0)}catch(o){return this.triggerOnError("write")(o),false}};let{cacheDisabled:o=false,delay:n,delayOptions:i,initialValue:s,onError:a,onChange:l,parse:c,spaces:u,storage:f,stringify:p}=t!=null?t:{};if(this.delay=n===0||D(n)?n:300,this.name=`${e!=null?e:""}`.trim(),this.onError=a,this.onChange=l,this.parse=c,this.storage=f===null?null:f!=null?f:h(()=>globalThis.localStorage,[],void 0),this.name&&!this.storage)throw new Error("options.storage: LocalStorage instance or equivalent required");this.cacheDisabled=!!this.storage&&o,this.stringify=p,this.spaces=u,this.subject=this.cacheDisabled?new U:new I(void 0),this.delayOptions=i,P(s)&&s.size&&this.init(s);}get size(){return this.getAll().size}};ne.fromObject=(e,t)=>new ne(e,{parse:o=>ue(JSON.parse(o!=null?o:"{}")),stringify:function(o){return JSON.stringify(this.toObject(o))},...t,initialValue:T(t==null?void 0:t.initialValue,true)?ue(t.initialValue):t==null?void 0:t.initialValue}),ne.forceUpdateCache=e=>{mr.next(e);};var br=ne;var vr=class extends I{constructor(t,o=1e3,n=0,i=1){super(n);this.autoStart=t;this._delay=o;this.initialValue=n;this.incrementBy=i;this._running=false;this.pause=()=>(clearInterval(this._intervalId),this._running=false,this);this.resume=()=>this.start();this.start=()=>(this._running||(this._running=true,this._intervalId=setInterval(()=>this.next(this.value+this.incrementBy),this._delay)),this);this.stop=()=>(this.pause(),this.next(0),this);this.autoStart&&this.start();}get delay(){return this._delay}set delay(t){this._running||(this._delay=t);}get running(){return this._running}};var gr=class{constructor(e,t,o,n=true,i=true){this.taskFn=e;this.taskArgs=t;this.sequential=n;this.preExecute=i;this.minIntervalMs=1e3;this.runCount=0;this.started=false;this.clearInterval=()=>{this.sequential?clearTimeout(this.idInterval):clearInterval(this.idInterval),this.idInterval=void 0;};this.executeTask=async(e=false)=>{var n;let t,o;(this.sequential||e)&&this.clearInterval();try{++this.runCount,await((n=this.onBeforeExec)==null?void 0:n.call(this,this.runCount,e)),o=await this.taskFn.apply(void 0,this.taskArgs),this.lastResult=o;}catch(i){t=i;}return h(this.onResult,[t!=null?t:null,o,this.runCount,e],void 0),!e&&this.sequential&&this.intervalMs$.value>this.minIntervalMs&&(this.idInterval=setTimeout(this.executeTask,this.intervalMs$.value)),this.lastResult};this.executeOnce=async()=>await this.executeTask(true);this.isStarted=()=>this.started;this.restart=(e=false)=>this.onResult?(this.stop(e),this.start(this.onResult,this.onBeforeExec),true):false;this.start=(e,t)=>{if(!e||(this.onResult=e,this.onBeforeExec=t,this.started))return false;this.started=true;let o;return this.subscription=this.intervalMs$.subscribe(n=>{var s;if(o===n&&n!==void 0)return;o=Math.max((s=n!=null?n:o)!=null?s:0,this.minIntervalMs),this.clearInterval();let i=this.lastResult===void 0&&this.preExecute;i&&this.executeTask().catch(ze),this.idInterval=this.sequential?i?void 0:setTimeout(this.executeTask,o):setInterval(this.executeTask,o);}),true};this.stop=(e=false)=>{var t,o;return e&&(this.runCount=0),this.started=false,(o=(t=this.subscription)==null?void 0:t.unsubscribe)==null||o.call(t),this.clearInterval(),this};this.intervalMs$=o instanceof I?o:new I(o);}};exports.BehaviorSubject=I;exports.DataStorage=br;exports.IGNORE_UPDATE_SYMBOL=Fe;exports.IntervalRunner=gr;exports.IntervalSubject=vr;exports.OnErrorType=et;exports.Subject=U;exports.Subscription=k;exports.asPromise=Lo;exports.copyRxSubject=Ue;exports.forceUpdateCache$=mr;exports.isObservable=ge;exports.isSubjectLike=Zr;exports.isSubscriptionLike=Qr;exports.objToMap=ue;exports.skip=G;exports.unsubscribeAll=xe;return exports;})({});//# sourceMappingURL=index.min.js.map
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|