@superutils/rx 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
1
  # @superutils/rx
2
2
 
3
3
  A set of small, focused utilities for working with RxJS observables and subjects.
4
+
5
+ <div v-if="false">
6
+
7
+ For full API reference check out the [docs page](https://alien45.github.io/superutils/packages/@superutils/rx/).
8
+
9
+ </div>
10
+
11
+ ## Installation
12
+
13
+ ### NPM
14
+
15
+ Install using your favorite package manager (e.g., `npm`, `yarn`, `pnpm`, `bun`, etc.):
16
+
17
+ ```bash
18
+ npm install @superutils/rx
19
+ ```
20
+
21
+ Dependency: `@superutils/core` and `@superutils/promise` will be automatically installed by package manager
22
+
23
+ ### CDN / Browser
24
+
25
+ If you are not using a bundler, you can include the minified browser build directly:
26
+
27
+ ```xml
28
+ <script src="https://unpkg.com/@superutils/rx@latest/dist/browser/index.min.js"></script>
29
+ ```
30
+
31
+ OR,
32
+
33
+ ```xml
34
+ <script src="https://cdn.jsdelivr.net/npm/@superutils/rx/dist/browser/index.min.js"></script>
35
+ ```
@@ -1,4 +1,4 @@
1
- this.superutils=this.superutils||{};this.superutils.rx=(function(exports){'use strict';var T=(e,r=true)=>!!e&&typeof e=="object"&&(!r||[Object.prototype,null].includes(Object.getPrototypeOf(e))),br=T,A=e=>Array.isArray(e);var vr=e=>A(e)&&e.every(A),gr=e=>A(e)||e instanceof Set||e instanceof Map;var xr=e=>Number.isInteger(e);var X=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),ge=e=>xr(e)&&e>0,F=e=>X(e)&&e>0,se=(e,r=false,t=false)=>{if(e==null)return true;switch(typeof e){case "number":return !X(e);case "string":return !e.replaceAll(" ","").trim().length;case "boolean":case "bigint":case "symbol":case "function":return false}if(e instanceof Date)return Number.isNaN(e.getTime());if(e instanceof Map||e instanceof Set)return !e.size;if(Array.isArray(e)||e instanceof Uint8Array)return !e.length;if(e instanceof Error)return !e.message.length;let o=typeof e=="object"&&Object.getPrototypeOf(e);return o===Object.prototype||o===null?r?!Object.getOwnPropertyNames(e).length:!Object.keys(e).length:t};function Ke(){}var m=e=>typeof e=="function";var Le=m,I=e=>e instanceof Map;var ze=e=>typeof e=="boolean"||e instanceof Boolean;var $e=e=>e instanceof Error,xe=e=>e instanceof Promise,Y=e=>e instanceof RegExp,Sr=e=>e instanceof Set,Z=e=>typeof e=="string",ae=(e,r=false)=>br(e,false)&&Le(e.subscribe)&&Le(e.next)&&(!r||"value"in e),wr=e=>typeof e=="symbol";var h=(e,r,t)=>{try{let o=m(e)?e(...m(r)?r():r):e;return xe(o)?o.catch(n=>m(t)?t(n):t):o}catch(o){return m(t)?t(o):t}},U=h;new Date().getTime();var _r=(e,r=true,t=true)=>U(()=>[...t&&Object.getOwnPropertySymbols(e)||[],...r?Object.keys(e).sort():Object.keys(e)],[],[]),Er=_r,G=(e,r="null")=>JSON.parse(U(JSON.stringify,[e],r)),N=(e,r,t,o=false,n=true)=>{let i=T(r,false)||m(r)?r:{};if(!T(e,false)&&!m(r))return i;let s=new Set(t!=null?t:[]),a=Er(e,true,true).filter(u=>!s.has(u));for(let u of a){let c=u,l=e[c];if(i.hasOwnProperty(c)&&(o==="empty"?!se(i[c]):m(o)?!o(c,i[c],l):true))continue;if([void 0,null,1/0,NaN].includes(l)||!T(l,false)){i[c]=l;continue}i[c]=(()=>{switch(Object.getPrototypeOf(l)){case Array.prototype:return G(l,"[]");case ArrayBuffer.prototype:return l.slice(0);case Date.prototype:return new Date(l.getTime());case Map.prototype:return new Map(G(Array.from(l),"[]"));case RegExp.prototype:return new RegExp(l);case Set.prototype:return new Set(G(Array.from(l)));case Uint8Array.prototype:return new Uint8Array([...l]);case URL.prototype:return new URL(l);}if(wr(c)||!n)return G(l);let y=[...s].map(g=>String(g).startsWith(String(c).concat("."))&&String(g).split(String(c).concat("."))[1]).filter(Boolean);return y.length?N(l,i[c],y,o,n):G(l)})();}return i},Tr=(e=[],r=[],t)=>{T(t)||(t={});for(let o=0;o<(A(e)?e:[]).length;o++)t[e[o]]=r==null?void 0:r[o];return t};var Ve=(e,r=true,t=false)=>A(e)?(t&&(e=[...e]),r?e.reverse():e):[];var ue=(e,r=0)=>A(e)?Array.from(new Set(e.flat(r))):[],ie=(e,r=50,t={})=>{let{leading:o=ie.defaults.leading,onError:n=ie.defaults.onError,thisArg:i}=t,{tid:s}=t;i!==void 0&&(e=e.bind(i));let a=(...l)=>U(e,l,n),u=null,c=o==="global";return (...l)=>{clearTimeout(s),s=setTimeout(()=>{u!==l&&a(...l),u=c?true:null;},r),!(!o||u)&&(u=l,a(...l));}};ie.defaults={leading:false,onError:void 0};var Or=ie,Se=(e,r=50,t={})=>{let{defaults:o}=Se,{onError:n=o.onError,trailing:i=o.trailing,thisArg:s}=t,{tid:a}=t,u=(...l)=>U(s!==void 0?e.bind(s):e,l,m(n)?f=>U(n,[f],void 0):void 0),c=null;return (...l)=>{if(a){c=l;return}a=setTimeout(()=>{if(a=void 0,!i)return;let f=c;c=null,f&&f!==l&&u(...f);},r),u(...l);}};Se.defaults={onError:void 0,trailing:false};var jr=Se,z=(e,r=50,t={})=>t.throttle?jr(e,r,t):Or(e,r,t),we=(e,r,t,o,n)=>{var i;I(n)||(n=new Map),ge(t)||(t=1/0);for(let[s,a]of ((i=e==null?void 0:e.entries)==null?void 0:i.call(e))||[]){if(n.size>=t)break;U(r!=null?r:a,[a,s,e],false)&&n.set(s,a);}return o?[...n.values()]:n},Ar=we,Cr=e=>{if(!e)return 0;try{let r="size"in e?e.size:"length"in e?e.length:0;return X(r)?r:0}catch(r){return 0}},Pr=Cr,_e=e=>{var r;return [...((r=e==null?void 0:e.values)==null?void 0:r.call(e))||[]]},Be=_e,K=(e,r)=>{var t;let o=!Pr(e)||se(r==null?void 0:r.query),n=I(r==null?void 0:r.result)?r.result:new Map,i=(t=r==null?void 0:r.asMap)!=null?t:K.defaults.asMap;if(o)return i?n:Be(n);r=N(K.defaults,r,[],"empty");let{ignoreCase:s,limit:a=1/0,matchAll:u,matchExact:c,ranked:l}=r,{query:f}=r,p=Z(f),y=Y(f),g=U(Object.keys,[f],[]);if(s&&!c&&!y&&(f=p?f.toLowerCase():Tr(g,Object.values(f).map(d=>Y(d)?d:`${d}`.toLowerCase()))),r.query=f,l){let d=[];for(let[v,S]of e.entries()){let j=-1;if(p||y){j=ne(r,S,void 0),j>=0&&d.push([j,v,S]);continue}let O=[];g[u?"every":"some"](b=>{let w=ne(r,S,b);return O.push(w),w>=0})&&(j=O.sort((b,w)=>b-w).filter(b=>b!==-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 e.entries()){if(n.size>=a)break;(p||y?ne(r,v,void 0)>=0:g[u?"every":"some"](j=>ne(r,v,j)>=0))&&n.set(d,v);}return i?n:Be(n)};K.defaults={asMap:true,ignoreCase:true,limit:1/0,matchAll:false,ranked:false,transform:true};function ne({query:e,ignoreCase:r,matchExact:t,transform:o=true},n,i){var s,a;let u=Z(e)||Y(e)||i===void 0,c=u?e:e[i],l=u||!T(n)?n:n[i],f=U(()=>m(o)?o(n,u?void 0:l,i):t&&o===!1?l:T(l,!1)?JSON.stringify(gr(l)?[...l.values()]:Object.values(l)):String(l!=null?l:""),[],"");if(f===c)return 0;if(t&&!Y(c))return -1;let p=String(f);return p.trim()?Y(c)?(a=(s=p.match(c))==null?void 0:s.index)!=null?a:-1:(r&&(p=p.toLowerCase()),p.indexOf(String(c))):-1}var Ir=K;function We(e,r){return (m(r)?Ar(e,r,1):Ir(e,{...r,asMap:true,limit:1}))[r!=null&&r.includeKey?"entries":"values"]().next().value}var qe=e=>{var r;return [...((r=e==null?void 0:e.entries)==null?void 0:r.call(e))||[]]},He=e=>{var r;return [...((r=e==null?void 0:e.keys)==null?void 0:r.call(e))||[]]};function le(e,r,t){let o=A(e)?1:I(e)?2:Sr(e)?3:0;if(!o)return e;let{asString:n,ignoreCase:i,newInstance:s,reverse:a,undefinedFirst:u}={...le.defaults,...T(t)?t:T(r)?r:{}};if(o===1&&m(r))return Ve(e.sort(r),a,s);let c=n?u?"":"Z".repeat(10):u?-1/0:1/0,l=m(r)?Ve([...e.entries()].sort(r),a,false):(()=>{let f=1,p=d=>{let v=T(d)&&f!==0?d[r]: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?[...e]:e).sort((d,v)=>p(d)>p(v)?y:g):(f=r===true?0:1,[...e.entries()].sort((d,v)=>p(d==null?void 0:d[f])>p(v==null?void 0:v[f])?y:g))})();if(o===1)return l;if(s)return o===2?new Map(l):new Set(l);e.clear();for(let f of l)o===2?e.set(...f):e.add(f);return e}le.defaults={asString:true,ignoreCase:true,newInstance:false,reverse:false,undefinedFirst:false};var Je=(...e)=>{var r;return new Map((r=e==null?void 0:e.flatMap)==null?void 0:r.call(e,t=>I(t)?Array.from(t.entries()):vr(t)?t:[]))};var D=globalThis.Promise,_=class extends D{constructor(r){let t,o,n=false,i=(s,a=true,u)=>{if(!n)return queueMicrotask(()=>i(s,a,u));s(u),this._state=a?1:2,this.onFinalize.forEach(c=>h(c,a?[u]:[void 0,u],void 0));};super((s,a)=>{o=u=>i(a,false,u),t=u=>i(s,true,u),m(r)?h(r,[t,o],o):xe(r)?r.then(t,o):r!==void 0&&t(r);}),this._state=0,this.onEarlyFinalize=[],this.onFinalize=[],this.resolve=s=>{var a,u;this.pending&&((a=this._resolve)==null||a.call(this,s),(u=this.onEarlyFinalize)==null||u.forEach(c=>{h(c,[true,s],void 0);}));},this.reject=s=>{var a,u;this.pending&&((a=this._reject)==null||a.call(this,s),(u=this.onEarlyFinalize)==null||u.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=e=>new _(D.all(e));_.allSettled=e=>new _(D.allSettled(e));_.any=e=>new _(D.any(e));_.race=e=>new _(D.race(e));_.reject=e=>{let r=new _;return queueMicrotask(()=>r.reject(e)),r};_.resolve=e=>new _(D.resolve(e));_.try=(e,...r)=>new _(h(e,r,t=>_.reject(t)));_.withResolvers=()=>{let e=new _;return {promise:e,reject:e.reject,resolve:e.resolve}};var Rr=_,C=Rr;function Ee(e={}){let r=0;e=N(Ee.defaults,e,[],"empty");let{onError:t,onIgnore:o,onResult:n}=e,{delay:i=0,ignoreStale:s,resolveError:a,resolveIgnored:u,thisArg:c,throttle:l}=e,f=null,p,y=new Map,g=!F(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,b]of O){y.delete(x);let w=s&&b.sequence<p.sequence;if(!(b.resolved||b.started&&!w))switch(b.started&&(b.getPromise=(()=>b.result)),h(o,[b.getPromise],0),u){case "WITH_UNDEFINED":b.resolve(void 0);break;case "WITH_LAST":p==null||p.then(b.resolve,b.reject);break;}}y.size||(r=0);},v=O=>{if(f=null,g){y.delete(O);let[b,w]=[...y.entries()][0]||[];return b&&w&&j(b,w)}let x=[...y.entries()];if(l===true&&e.trailing){let b=x.findIndex(([w])=>w===O);x=x.slice(0,b);}else l||(x=x.slice(0,-1));d(x),y.delete(O);},S=async(O,x)=>{var b;try{x.started=!0,p=x,f=x,(b=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:z(S,i,e);return O=>{let x=Symbol("deferred-queue-item-id"),b=new C;return b.getPromise=m(O)?O:()=>O,b.started=false,b.sequence=++r,y.set(x,b),(!f||!g)&&j(x,b),b}}Ee.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var Ge=Ee;function Fr(e,r={}){let{thisArg:t}=r;t!==void 0&&(e=e.bind(t));let o=Ge(r);return (...n)=>o(()=>e(...n))}var Mr=Fr;function ce(e=ce.defaults.duration,r,t=false){let o=new C,n=i=>{let s=h(async()=>{let a=await(m(i)?i():i);return t?a!=null?a:new Error(`${ce.defaults.delayTimeoutMsg} ${e}ms`):a!=null?a:e},[],a=>D.reject(a));t?s.then(o.reject,o.reject):o.resolve(s);};return o.timeoutId=setTimeout(()=>n(r),e),o.pause=()=>clearTimeout(o.timeoutId),o.catch(()=>{}).finally(()=>o.pause()),o.onEarlyFinalize.push(()=>o.pause()),o}ce.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var Te=ce;function kr(e,r){return Te(e,r,true)}var Ye=kr,Oe=(e,r)=>{let t=false,o=C.try(async()=>{var n,i;r=N(Oe.defaults,r!=null?r:{},[],(v,S)=>{switch(v){case "retry":case "retryDelay":case "retryDelayJitterMax":return S!==0&&!ge(S)}return !!se(S)});let{retry:s,retryBackOff:a,retryDelay:u,retryDelayJitter:c,retryDelayJitterMax:l}=r,f=u,p=0,y,g,d=false;do{if(p++,u>0&&!t&&p>0){a==="exponential"&&p>1&&(f*=2);let v=c?Math.floor(Math.random()*l):0;await Te(f+v);}if(t)break;try{g=void 0,y=await e();}catch(v){g=v!=null?v:new Error(v);}if(t||s===0||p>s)break;d=!!((i=await h((n=r.retryIf)!=null?n:g,[y,p,g],g))!=null?i:g);}while(d);return g!==void 0?D.reject(g):y});return o.onEarlyFinalize.push(()=>{t=true;}),o};Oe.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var Ur=Oe,Xe=1e4,je=2147483647,Nr=class extends C{constructor(e,r,t,o){super(e),this.started=new Date,this._setup=()=>{var n,i,s,a;this._signals=ue([(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(u=>u==null?void 0:u.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,u,c,l;this.cancelAbort(),this.clearTimeout(),!(!this.timeout.rejected&&!((s=this._signals)!=null&&s.find(f=>f==null?void 0:f.aborted)))&&((c=(u=(a=this.options)==null?void 0:a.abortCtrl)==null?void 0:u.signal)==null?void 0:c.aborted)===false&&((l=this.options)==null||l.abortCtrl.abort(i));}),this.data=e,this.options=T(t)?t:{},this.timeout=r,this._signals=o,this._setup();}get abortCtrl(){return this.options.abortCtrl}get aborted(){var e;return this.rejected&&!this.timeout.rejected&&!!((e=this._signals)!=null&&e.find(r=>r==null?void 0:r.aborted))}cancelAbort(){var e;(e=this._signals)==null||e.forEach(r=>r==null?void 0:r.removeEventListener("abort",this._handleAbort));}clearTimeout(){clearTimeout(this.timeout.timeoutId);}get timedout(){return this.rejected&&this.timeout.rejected}},Dr=Nr;function Ae(e,...r){var t;let o=N(Ae.defaults,X(e)?{timeout:e}:T(e)?e:{},[],"empty");o.timeout=Math.min(F(o.timeout)?o.timeout:Xe,je);let n=r.map(a=>m(a)?C.try(a):a),i=n.length<=1?n[0]instanceof C?n[0]:new C(n[0]):(m(C[o.batchFunc])?C[o.batchFunc]:C.all)(n),s=Ye(o.timeout,o.onTimeout);return new Dr(C.race([i,s]),s,o,ue([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}Ae.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:Xe};var Lr=Ae,V=class extends C{};V.deferred=Ge;V.deferredCallback=Mr;V.delay=Te;V.delayReject=Ye;V.retry=Ur;V.timeout=Lr;var Vr=V,fe=Vr;var Ce=function(e,r){return Ce=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]);},Ce(e,r)};function M(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Ce(e,r);function t(){this.constructor=e;}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t);}function Q(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return {next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var o=t.call(e),n,i=[],s;try{for(;(r===void 0||r-- >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 W(e,r,t){if(arguments.length===2)for(var o=0,n=r.length,i;o<n;o++)(i||!(o in r))&&(i||(i=Array.prototype.slice.call(r,0,o)),i[o]=r[o]);return e.concat(i||Array.prototype.slice.call(r))}function E(e){return typeof e=="function"}function pe(e){var r=function(o){Error.call(o),o.stack=new Error().stack;},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var de=pe(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
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:
2
2
  `+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=t;}});function ee(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1);}}var k=(function(){function e(r){this.initialTeardown=r,this.closed=false,this._parentage=null,this._finalizers=null;}return e.prototype.unsubscribe=function(){var r,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),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this);}}catch(d){r={error:d};}finally{try{u&&!u.done&&(t=a.return)&&t.call(a);}finally{if(r)throw r.error}}else s.remove(this);var l=this.initialTeardown;if(E(l))try{l();}catch(d){i=d instanceof de?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{Ze(g);}catch(d){i=i!=null?i:[],d instanceof de?i=W(W([],$(i)),$(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 de(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)Ze(r);else {if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r);}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r;},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&ee(t,r);},e.prototype.remove=function(r){var t=this._finalizers;t&&ee(t,r),r instanceof e&&r._removeParent(this);},e.EMPTY=(function(){var r=new e;return r.closed=true,r})(),e})();var Pe=k.EMPTY;function he(e){return e instanceof k||e&&"closed"in e&&E(e.remove)&&E(e.add)&&E(e.unsubscribe)}function Ze(e){E(e)?e():e.unsubscribe();}var R={Promise:void 0};var q={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,W([e,r],$(t)))},clearTimeout:function(e){return (clearTimeout)(e)},delegate:void 0};function Qe(e){q.setTimeout(function(){throw e});}function Ie(){}function H(e){e();}var re=(function(e){M(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=false,t?(o.destination=t,he(t)&&t.add(o)):o.destination=$r,o}return r.create=function(t,o,n){return new ye(t,o,n)},r.prototype.next=function(t){this.isStopped?Me():this._next(t);},r.prototype.error=function(t){this.isStopped?Me():(this.isStopped=true,this._error(t));},r.prototype.complete=function(){this.isStopped?Me():(this.isStopped=true,this._complete());},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=true,e.prototype.unsubscribe.call(this),this.destination=null);},r.prototype._next=function(t){this.destination.next(t);},r.prototype._error=function(t){try{this.destination.error(t);}finally{this.unsubscribe();}},r.prototype._complete=function(){try{this.destination.complete();}finally{this.unsubscribe();}},r})(k);var Kr=(function(){function e(r){this.partialObserver=r;}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r);}catch(o){me(o);}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r);}catch(o){me(o);}else me(r);},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete();}catch(t){me(t);}},e})(),ye=(function(e){M(r,e);function r(t,o,n){var i=e.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 Kr(s),i}return r})(re);function me(e){Qe(e);}function zr(e){throw e}function Me(e,r){}var $r={closed:true,next:Ie,error:zr,complete:Ie};var nr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ir(e){return e}function sr(e){return e.length===0?ir:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var te=(function(){function e(r){r&&(this._subscribe=r);}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,o){var n=this,i=qr(r)?r:new ye(r,t,o);return H(function(){var s=n,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?n._subscribe(i):n._trySubscribe(i));}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t);}},e.prototype.forEach=function(r,t){var o=this;return t=ar(t),new t(function(n,i){var s=new ye({next:function(a){try{r(a);}catch(u){i(u),s.unsubscribe();}},error:i,complete:n});o.subscribe(s);})},e.prototype._subscribe=function(r){var t;return (t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[nr]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return sr(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=ar(r),new r(function(o,n){var i;t.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)});})},e.create=function(r){return new e(r)},e})();function ar(e){var r;return (r=e!=null?e:R.Promise)!==null&&r!==void 0?r:Promise}function Wr(e){return e&&E(e.next)&&E(e.error)&&E(e.complete)}function qr(e){return e&&e instanceof re||Wr(e)&&he(e)}function Hr(e){return E(e==null?void 0:e.lift)}function ur(e){return function(r){if(Hr(r))return r.lift(function(t){try{return e(t,this)}catch(o){this.error(o);}});throw new TypeError("Unable to lift unknown Observable type")}}function lr(e,r,t,o,n){return new Jr(e,r,t,o,n)}var Jr=(function(e){M(r,e);function r(t,o,n,i,s,a){var u=e.call(this,t)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=o?function(c){try{o(c);}catch(l){t.error(l);}}:e.prototype._next,u._error=i?function(c){try{i(c);}catch(l){t.error(l);}finally{this.unsubscribe();}}:e.prototype._error,u._complete=n?function(){try{n();}catch(c){t.error(c);}finally{this.unsubscribe();}}:e.prototype._complete,u}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this));}},r})(re);var cr=pe(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var L=(function(e){M(r,e);function r(){var t=e.call(this)||this;return t.closed=false,t.currentObservers=null,t.observers=[],t.isStopped=false,t.hasError=false,t.thrownError=null,t}return r.prototype.lift=function(t){var o=new fr(this,this);return o.operator=t,o},r.prototype._throwIfClosed=function(){if(this.closed)throw new cr},r.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 u=a.value;u.next(t);}}catch(c){n={error:c};}finally{try{a&&!a.done&&(i=s.return)&&i.call(s);}finally{if(n)throw n.error}}}});},r.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);}});},r.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();}});},r.prototype.unsubscribe=function(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:false,configurable:true}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Pe:(this.currentObservers=null,a.push(t),new k(function(){o.currentObservers=null,ee(a,t);}))},r.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?t.error(i):s&&t.complete();},r.prototype.asObservable=function(){var t=new te;return t.source=this,t},r.create=function(t,o){return new fr(t,o)},r})(te);var fr=(function(e){M(r,e);function r(t,o){var n=e.call(this)||this;return n.destination=t,n.source=o,n}return r.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);},r.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);},r.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);},r.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:Pe},r})(L);var P=(function(e){M(r,e);function r(t){var o=e.call(this)||this;return o._value=t,o}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:false,configurable:true}),r.prototype._subscribe=function(t){var o=e.prototype._subscribe.call(this,t);return !o.closed&&t.next(this._value),o},r.prototype.getValue=function(){var t=this,o=t.hasError,n=t.thrownError,i=t._value;if(o)throw n;return this._throwIfClosed(),i},r.prototype.next=function(t){e.prototype.next.call(this,this._value=t);},r})(L);function be(e){return !!e&&(e instanceof te||E(e.lift)&&E(e.subscribe))}function pr(e,r){return ur(function(t,o){var n=0;t.subscribe(lr(o,function(i){return e.call(r,i,n++)&&o.next(i)}));})}function J(e){return pr(function(r,t){return e<=t})}var Vo=(e,r,t)=>{if(!ae(e)&&!be(e))return fe.reject(new Error("subject must be an instance of BehaviorSubject"));let o,n=T(t)?t:{timeout:t};n.timeout=F(n.timeout)?n.timeout:je;let i=fe.timeout({...n,onTimeout:async()=>{let{onTimeout:s,timeoutMsg:a}=n,u=await h(s,[],void 0);return u!=null?u:$e(a)?a:new Error(a!=null?a:"request timed out before an expected value is received")}},new fe(s=>{o=e.subscribe(a=>{(a===r||r===void 0||m(r)&&h(r,[a],false))&&s(a);});}));return i.onFinalize.push(()=>{var s;(s=o==null?void 0:o.unsubscribe)==null||s.call(o);}),i};var Gr=(e,r=false)=>ae(e,r),oe=Gr;var Yr=(e,r=false)=>{if(e instanceof k)return true;let t=e;return !r&&!!t&&ze(t.closed)&&m(t.unsubscribe)},dr=Yr;var ve=(e={},r)=>{if(e)try{if(m(e))return e();if(dr(e))return e.unsubscribe();Object.values(e).forEach(t=>ve(t,r));}catch(t){r==null||r(t);}},ke=ve;var Ue=Symbol("ignore-rx-update");function Ne(e,r,t,o){var l;r=oe(r)?r:new P(void 0),o={...Ne.defaults,...o!=null?o:{}};let n=oe(e)?[e]:A(e)?e:[e],i=new Map(n.map((f,p)=>[p,oe(f)?f.value:f])),s=()=>{let f=A(e)?[...i.values()]:i.get(0);if(!m(t))return r.next(f);let p=h(t,[f,void 0,r],y=>{var g;return h((g=o.onError)==null?void 0:g.bind(o.thisArg),[y],void 0),Ue});p!==Ue&&r.next(p);},a=F(o.delay)?z(s,o.delay,o):s,u=n.map((f,p)=>{if(!(!oe(f)||f.closed))return (f instanceof P?f.pipe(J(1)):f).subscribe(y=>{i.set(p,y),a();})}).filter(Boolean),c=(l=r==null?void 0:r.unsubscribe)==null?void 0:l.bind(r);return r.unsubscribe=(...f)=>{c==null||c(...f),ve(u),i.clear();},s(),r}Ne.defaults={delay:0,throttle:false};Ne.IGNORE_UPDATE_SYMBOL=Ue;var hr=new L,De=class{constructor(r,t){this.initialized=false;this.subscriptions={subject:void 0,forceUpdateCache:void 0};this.clear=()=>(this.setAll(new Map,true),this);this.delete=r=>{A(r)||(r=[r]);let t=this.getAll();for(let o of r)t.delete(o);return this.setAll(t,true),this};this.find=r=>We(this.getAll(),r);this.filter=(r,t,o,n)=>we(this.getAll(),r,t,o,n);this.get=r=>this.getAll().get(r);this.getAll=(r=false)=>{var n;let t=this.initialized;if(t||this.init(),this.cacheDisabled||this.name&&r){let i=this.read();return (r||!t&&i.size)&&this.subject.next(i),i}return (n=this.subject)==null?void 0:n.value};this.has=r=>this.getAll().has(r);this.init=r=>{var n,i;if(this.initialized)return false;this.initialized=true,this.subject instanceof P&&this.subject.next(this.read()),ke(this.subscriptions),this.cacheDisabled||(this.subscriptions.forceUpdateCache=hr.subscribe(s=>{if(!(this.name?A(s)?s.includes(this.name):Z(s)?s===this.name:s===true:false))return;let u=this.read();this.subject.next(u);})),!((i=(n=this.subject)==null?void 0:n.value)!=null&&i.size)&&I(r)&&(r!=null&&r.size)&&this.setAll(r);let t=this.subject.pipe(J(this.cacheDisabled||r!=null&&r.size?0:1)),o=s=>{if(!I(s))return this.subject.next(new Map);this.write(s),h(()=>{var a;return (a=this.onChange)==null?void 0:a.call(this,s)},[],this.triggerOnError("onChange"));};return this.delay>0&&(o=z(o,this.delay,this.delayOptions)),this.subscriptions.subject=t.subscribe(o),true};this.keys=()=>He(this.getAll());this.map=r=>this.toArray().map(([t,o],n,i)=>r(o,t,i,n));this.read=()=>{var o,n;let r=(n=(o=this.storage)==null?void 0:o.getItem(this.name))!=null?n:"[]",t=m(this.parse)&&h(this.parse,[r],this.triggerOnError("parse"));return I(t)?t:new Map(h(()=>JSON.parse(r),[],this.triggerOnError("parse-json")))};this.search=r=>K(this.getAll(),r);this.set=(r,t)=>(this.setAll(new Map([[r,t]]),false),this);this.setAll=(r=new Map,t=false)=>I(r)?(r=t?r:Je(this.getAll(),r),this.subject.next(new Map(r)),this):this;this.sort=((r,t)=>{let o=le(this.getAll(),r,t);return t!=null&&t.save&&this.setAll(o,true),o});this.toArray=()=>qe(this.getAll());this.toJSON=(r,t=this.spaces,o=this.getAll())=>{let n=Array.from(o),i=h(()=>{var s;return (s=this.stringify)==null?void 0:s.call(this,o)},[],this.triggerOnError("stringify"));return Z(i)?i:h(()=>JSON.stringify(n,r,t),[],this.triggerOnError("stringify-json"))};this.toObject=()=>{let r={};for(let[t,o]of this.getAll())r[t]=o;return r};this.toString=r=>this.toJSON(void 0,void 0,r);this.triggerOnError=r=>t=>{this.onError&&h(this.onError,[t,r],"");};this.unsubscribe=()=>ke(this.subscriptions);this.values=()=>_e(this.getAll());this.write=r=>{try{return !this.initialized&&this.init(),r!=null||(r=this.subject.value),!this.name||!this.storage||!I(r)?!1:(this.storage.setItem(this.name,this.toString(r)),!0)}catch(t){return this.triggerOnError("write")(t),false}};let{cacheDisabled:o=false,delay:n,delayOptions:i,initialValue:s,onError:a,onChange:u,parse:c,spaces:l,storage:f,stringify:p}=t!=null?t:{};if(this.delay=o?0:n===0||F(n)?n:300,this.name=`${r!=null?r:""}`.trim(),this.onError=a,this.onChange=u,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=l,this.subject=this.cacheDisabled?new L:new P(void 0),this.delayOptions=i,I(s)&&s.size&&this.init(s);}get size(){return this.getAll().size}};De.forceUpdateCache=r=>{hr.next(r);};var mr=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 yr=class{constructor(r,t,o,n=true,i=true){this.taskFn=r;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(r=false)=>{var n;let t,o;(this.sequential||r)&&this.clearInterval();try{++this.runCount,await((n=this.onBeforeExec)==null?void 0:n.call(this,this.runCount,r)),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,r],void 0),!r&&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=(r=false)=>this.onResult?(this.stop(r),this.start(this.onResult,this.onBeforeExec),true):false;this.start=(r,t)=>{if(!r||(this.onResult=r,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(Ke),this.idInterval=this.sequential?i?void 0:setTimeout(this.executeTask,o):setInterval(this.executeTask,o);}),true};this.stop=(r=false)=>{var t,o;return r&&(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=De;exports.IGNORE_UPDATE_SYMBOL=Ue;exports.IntervalRunner=yr;exports.IntervalSubject=mr;exports.Subject=L;exports.Subscription=k;exports.asPromise=Vo;exports.copyRxSubject=Ne;exports.forceUpdateCache$=hr;exports.isObservable=be;exports.isSubjectLike=Gr;exports.isSubscriptionLike=Yr;exports.skip=J;exports.unsubscribeAll=ve;return exports;})({});//# sourceMappingURL=index.min.js.map
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
4
4
  //# sourceMappingURL=index.min.js.map