@superutils/rx 0.1.17 → 0.1.19

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.
@@ -1,4 +1,4 @@
1
- this.superutils=this.superutils||{};this.superutils.rx=(function(exports){'use strict';var j=(e,r=true)=>!!e&&typeof e=="object"&&(!r||[Object.prototype,null].includes(Object.getPrototypeOf(e))),ar=j,R=e=>Array.isArray(e);var lr=e=>Number.isInteger(e);var K=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),Re=e=>lr(e)&&e>0,F=e=>K(e)&&e>0,ne=(e,r=false,t=false)=>{if(e==null)return true;switch(typeof e){case "number":return !K(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 Ce(){}var b=e=>typeof e=="function";var Ae=b;var Fe=e=>typeof e=="boolean"||e instanceof Boolean;var ke=e=>e instanceof Error,G=e=>e instanceof Promise,Ne=(e,r=false)=>ar(e,false)&&Ae(e.subscribe)&&Ae(e.next)&&(!r||"value"in e),fr=e=>typeof e=="symbol";var g=(e,r,t)=>{try{let o=b(e)?e(...b(r)?r():r):e;return G(o)?o.catch(n=>b(t)?t(n):t):o}catch(o){return b(t)?t(o):t}},N=g;new Date().getTime();var pr=(e,r=true,t=true)=>N(()=>[...t&&Object.getOwnPropertySymbols(e)||[],...r?Object.keys(e).sort():Object.keys(e)],[],[]),dr=pr,q=(e,r="null")=>JSON.parse(N(JSON.stringify,[e],r)),k=(e,r,t,o=false,n=true)=>{let i=j(r,false)||b(r)?r:{};if(!j(e,false)&&!b(r))return i;let s=new Set(t!=null?t:[]),a=dr(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"?!ne(i[c]):b(o)?!o(c,i[c],l):true))continue;if([void 0,null,1/0,NaN].includes(l)||!j(l,false)){i[c]=l;continue}i[c]=(()=>{switch(Object.getPrototypeOf(l)){case Array.prototype:return q(l,"[]");case ArrayBuffer.prototype:return l.slice(0);case Date.prototype:return new Date(l.getTime());case Map.prototype:return new Map(q(Array.from(l),"[]"));case RegExp.prototype:return new RegExp(l);case Set.prototype:return new Set(q(Array.from(l)));case Uint8Array.prototype:return new Uint8Array([...l]);case URL.prototype:return new URL(l);}if(fr(c)||!n)return q(l);let v=[...s].map(y=>String(y).startsWith(String(c).concat("."))&&String(y).split(String(c).concat("."))[1]).filter(Boolean);return v.length?k(l,i[c],v,o,n):q(l)})();}return i};var ie=(e,r=0)=>R(e)?Array.from(new Set(e.flat(r))):[],oe=(e,r=50,t={})=>{let{leading:o=oe.defaults.leading,onError:n=oe.defaults.onError,thisArg:i}=t,{tid:s}=t;i!==void 0&&(e=e.bind(i));let a=(...l)=>N(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));}};oe.defaults={leading:false,onError:void 0};var mr=oe,he=(e,r=50,t={})=>{let{defaults:o}=he,{onError:n=o.onError,trailing:i=o.trailing,thisArg:s}=t,{tid:a}=t,u=(...l)=>N(s!==void 0?e.bind(s):e,l,b(n)?p=>N(n,[p],void 0):void 0),c=null;return (...l)=>{if(a){c=l;return}a=setTimeout(()=>{if(a=void 0,!i)return;let p=c;c=null,p&&p!==l&&u(...p);},r),u(...l);}};he.defaults={onError:void 0,trailing:false};var vr=he,se=(e,r=50,t={})=>t.throttle?vr(e,r,t):mr(e,r,t);var U=globalThis.Promise,E=class extends U{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=>g(c,a?[u]:[void 0,u],void 0));};super((s,a)=>{o=u=>i(a,false,u),t=u=>i(s,true,u),b(r)?g(r,[t,o],o):G(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=>{g(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=>{g(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}};E.all=e=>new E(U.all(e));E.allSettled=e=>new E(U.allSettled(e));E.any=e=>new E(U.any(e));E.race=e=>new E(U.race(e));E.reject=e=>{let r=new E;return queueMicrotask(()=>r.reject(e)),r};E.resolve=e=>new E(U.resolve(e));E.try=(e,...r)=>new E(g(e,r,t=>E.reject(t)));E.withResolvers=()=>{let e=new E;return {promise:e,reject:e.reject,resolve:e.resolve}};var gr=E,A=gr;function me(e={}){let r=0;e=k(me.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,p=null,h,v=new Map,y=!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 f=S=>{for(let[x,m]of S){v.delete(x);let w=s&&m.sequence<h.sequence;if(!(m.resolved||m.started&&!w))switch(m.started&&(m.getPromise=(()=>m.result)),g(o,[m.getPromise],0),u){case "WITH_UNDEFINED":m.resolve(void 0);break;case "WITH_LAST":h==null||h.then(m.resolve,m.reject);break;}}v.size||(r=0);},d=S=>{if(p=null,y){v.delete(S);let[m,w]=[...v.entries()][0]||[];return m&&w&&O(m,w)}let x=[...v.entries()];if(l&&e.trailing){let m=x.findIndex(([w])=>w===S);x=x.slice(0,m);}else l||(x=x.slice(0,-1));f(x),v.delete(S);},_=async(S,x)=>{var m;try{x.started=!0,h=x,p=x,(m=x.result)!=null||(x.result=A.try(x.getPromise));let w=await x.result;if(!!s&&x.sequence<h.sequence)return f([[S,x]]);x.resolve(w),n&&g(n,[w],void 0);}catch(w){switch(t&&g(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}}d(S);},O=y?_:se(_,i,e);return S=>{let x=Symbol("deferred-queue-item-id"),m=new A;return m.getPromise=b(S)?S:()=>S,m.started=false,m.sequence=++r,v.set(x,m),(!p||!y)&&O(x,m),m}}me.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var De=me;function _r(e,r={}){let{thisArg:t}=r;t!==void 0&&(e=e.bind(t));let o=De(r);return (...n)=>o(()=>e(...n))}var wr=_r;function ae(e=ae.defaults.duration,r,t=false){let o=new A,n=i=>{let s=g(async()=>{let a=await(b(i)?i():i);return t?a!=null?a:new Error(`${ae.defaults.delayTimeoutMsg} ${e}ms`):a!=null?a:e},[],a=>U.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}ae.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var ve=ae;function Er(e,r){return ve(e,r,true)}var Le=Er,be=(e,r)=>{let t=false,o=A.try(async()=>{var n,i;r=k(be.defaults,r!=null?r:{},[],(d,_)=>{switch(d){case "retry":case "retryDelay":case "retryDelayJitterMax":return _!==0&&!Re(_)}return !!ne(_)});let{retry:s,retryBackOff:a,retryDelay:u,retryDelayJitter:c,retryDelayJitterMax:l}=r,p=u,h=0,v,y,f=false;do{if(h++,u>0&&!t&&h>0){a==="exponential"&&h>1&&(p*=2);let d=c?Math.floor(Math.random()*l):0;await ve(p+d);}if(t)break;try{y=void 0,v=await e();}catch(d){y=d!=null?d:new Error(d);}if(t||s===0||h>s)break;f=!!((i=await g((n=r.retryIf)!=null?n:y,[v,h,y],y))!=null?i:y);}while(f);return y!==void 0?U.reject(y):v});return o.onEarlyFinalize.push(()=>{t=true;}),o};be.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var Sr=be,$e=1e4,ye=2147483647,Tr=class extends A{constructor(e,r,t,o){super(e),this.started=new Date,this._setup=()=>{var n,i,s,a;this._signals=ie([(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 g((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(p=>p==null?void 0:p.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=j(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}},Or=Tr;function J(e,...r){var t;let o=k(J.defaults,K(e)?{timeout:e}:j(e)?e:{},[],"empty");o.timeout=Math.min(F(o.timeout)?o.timeout:$e,ye);let n=r.map(a=>b(a)?A.try(a):a),i=n.length<=1?n[0]instanceof A?n[0]:new A(n[0]):(b(A[o.batchFunc])?A[o.batchFunc]:A.all)(n),s=Le(o.timeout,o.onTimeout);return new Or(A.race([i,s]),s,o,ie([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}J.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:$e};var jr=J,B=class extends A{};B.deferred=De;B.deferredCallback=wr;B.delay=ve;B.delayReject=Le;B.retry=Sr;B.timeout=jr;var Ar=B,ze=Ar;var xe=function(e,r){return xe=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]);},xe(e,r)};function I(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");xe(e,r);function t(){this.constructor=e;}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t);}function Y(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 z(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 T(e){return typeof e=="function"}function ue(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 le=ue(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 j=(e,r=true)=>!!e&&typeof e=="object"&&(!r||[Object.prototype,null].includes(Object.getPrototypeOf(e))),ar=j,R=e=>Array.isArray(e);var lr=e=>Number.isInteger(e);var K=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),Re=e=>lr(e)&&e>0,F=e=>K(e)&&e>0,ne=(e,r=false,t=false)=>{if(e==null)return true;switch(typeof e){case "number":return !K(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 Ce(){}var m=e=>typeof e=="function";var Ae=m;var Fe=e=>typeof e=="boolean"||e instanceof Boolean;var ke=e=>e instanceof Error,G=e=>e instanceof Promise,Ne=(e,r=false)=>ar(e,false)&&Ae(e.subscribe)&&Ae(e.next)&&(!r||"value"in e),fr=e=>typeof e=="symbol";var _=(e,r,t)=>{try{let o=m(e)?e(...m(r)?r():r):e;return G(o)?o.catch(n=>m(t)?t(n):t):o}catch(o){return m(t)?t(o):t}},N=_;new Date().getTime();var pr=(e,r=true,t=true)=>N(()=>[...t&&Object.getOwnPropertySymbols(e)||[],...r?Object.keys(e).sort():Object.keys(e)],[],[]),dr=pr,q=(e,r="null")=>JSON.parse(N(JSON.stringify,[e],r)),k=(e,r,t,o=false,n=true)=>{let i=j(r,false)||m(r)?r:{};if(!j(e,false)&&!m(r))return i;let s=new Set(t!=null?t:[]),a=dr(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"?!ne(i[c]):m(o)?!o(c,i[c],l):true))continue;if([void 0,null,1/0,NaN].includes(l)||!j(l,false)){i[c]=l;continue}i[c]=(()=>{switch(Object.getPrototypeOf(l)){case Array.prototype:return q(l,"[]");case ArrayBuffer.prototype:return l.slice(0);case Date.prototype:return new Date(l.getTime());case Map.prototype:return new Map(q(Array.from(l),"[]"));case RegExp.prototype:return new RegExp(l);case Set.prototype:return new Set(q(Array.from(l)));case Uint8Array.prototype:return new Uint8Array([...l]);case URL.prototype:return new URL(l);}if(fr(c)||!n)return q(l);let b=[...s].map(y=>String(y).startsWith(String(c).concat("."))&&String(y).split(String(c).concat("."))[1]).filter(Boolean);return b.length?k(l,i[c],b,o,n):q(l)})();}return i};var ie=(e,r=0)=>R(e)?Array.from(new Set(e.flat(r))):[],oe=(e,r=50,t={})=>{let{leading:o=oe.defaults.leading,onError:n=oe.defaults.onError,thisArg:i}=t,{tid:s}=t;i!==void 0&&(e=e.bind(i));let a=(...l)=>N(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));}};oe.defaults={leading:false,onError:void 0};var mr=oe,he=(e,r=50,t={})=>{let{defaults:o}=he,{onError:n=o.onError,trailing:i=o.trailing,thisArg:s}=t,{tid:a}=t,u=(...l)=>N(s!==void 0?e.bind(s):e,l,m(n)?p=>N(n,[p],void 0):void 0),c=null;return (...l)=>{if(a){c=l;return}a=setTimeout(()=>{if(a=void 0,!i)return;let p=c;c=null,p&&p!==l&&u(...p);},r),u(...l);}};he.defaults={onError:void 0,trailing:false};var vr=he,se=(e,r=50,t={})=>t.throttle?vr(e,r,t):mr(e,r,t);var U=globalThis.Promise,S=class extends U{constructor(r){let t,o,n=false,i=(s,a=false,u=false)=>{var c;if(!n)return queueMicrotask(()=>i(s,a,u));if(!this.pending)return;(a?t:o)(s),this.state=a?1:2,(c=this.onFinalize)==null||c.forEach(p=>_(p,a?[s,void 0]:[void 0,s],null)),u&&this.onEarlyFinalize.forEach(p=>_(p,[a,s],null));};super((s,a)=>{o=a,t=s,m(r)?_(r,[u=>i(u,true),i],i):G(r)?r.then(u=>i(u,true),i):r!==void 0&&i(r,true);}),this.onEarlyFinalize=[],this.onFinalize=[],this.state=0,n=true,this.reject=s=>i(s,false,true),this.resolve=s=>i(s,true,true);}get pending(){return this.state===0}get rejected(){return this.state===2}get resolved(){return this.state===1}};S.all=e=>new S(U.all(e));S.allSettled=e=>new S(U.allSettled(e));S.any=e=>new S(U.any(e));S.race=e=>new S(U.race(e));S.reject=e=>{let r=new S;return queueMicrotask(()=>r.reject(e)),r};S.resolve=e=>new S(U.resolve(e));S.try=(e,...r)=>new S(_(e,r,t=>S.reject(t)));S.withResolvers=()=>{let e=new S;return {promise:e,reject:e.reject,resolve:e.resolve}};var xr=S,A=xr;function me(e={}){let r=0;e=k(me.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,p=null,h,b=new Map,y=!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 f=E=>{for(let[g,v]of E){b.delete(g);let w=s&&v.sequence<h.sequence;if(!(v.resolved||v.started&&!w))switch(v.started&&(v.getPromise=(()=>v.result)),_(o,[v.getPromise],0),u){case "WITH_UNDEFINED":v.resolve(void 0);break;case "WITH_LAST":h==null||h.then(v.resolve,v.reject);break;}}b.size||(r=0);},d=E=>{if(p=null,y){b.delete(E);let[v,w]=[...b.entries()][0]||[];return v&&w&&O(v,w)}let g=[...b.entries()];if(l&&e.trailing){let v=g.findIndex(([w])=>w===E);g=g.slice(0,v);}else l||(g=g.slice(0,-1));f(g),b.delete(E);},x=async(E,g)=>{var v;try{g.started=!0,h=g,p=g,(v=g.result)!=null||(g.result=A.try(g.getPromise));let w=await g.result;if(!!s&&g.sequence<h.sequence)return f([[E,g]]);g.resolve(w),n&&_(n,[w],void 0);}catch(w){switch(t&&_(t,[w],void 0),a){case "REJECT":g.reject(w);case "NEVER":break;case "RESOLVE_UNDEFINED":g.resolve(void 0);break;case "RESOLVE_ERROR":g.resolve(w);break}}d(E);},O=y?x:se(x,i,e);return E=>{let g=Symbol("deferred-queue-item-id"),v=new A;return v.getPromise=m(E)?E:()=>E,v.started=false,v.sequence=++r,b.set(g,v),(!p||!y)&&O(g,v),v}}me.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var De=me;function _r(e,r={}){let{thisArg:t}=r;t!==void 0&&(e=e.bind(t));let o=De(r);return (...n)=>o(()=>e(...n))}var wr=_r;function ae(e=ae.defaults.duration,r,t=false){let o=new A,n=i=>{let s=_(async()=>{let a=await(m(i)?i():i);return t?a!=null?a:new Error(`${ae.defaults.delayTimeoutMsg} ${e}ms`):a!=null?a:e},[],a=>U.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}ae.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var ve=ae;function Sr(e,r){return ve(e,r,true)}var Le=Sr,be=(e,r)=>{let t=false,o=A.try(async()=>{var n,i;r=k(be.defaults,r!=null?r:{},[],(d,x)=>{switch(d){case "retry":case "retryDelay":case "retryDelayJitterMax":return x!==0&&!Re(x)}return !!ne(x)});let{retry:s,retryBackOff:a,retryDelay:u,retryDelayJitter:c,retryDelayJitterMax:l}=r,p=u,h=0,b,y,f=false;do{if(h++,u>0&&!t&&h>0){a==="exponential"&&h>1&&(p*=2);let d=c?Math.floor(Math.random()*l):0;await ve(p+d);}if(t)break;try{y=void 0,b=await e();}catch(d){y=d!=null?d:new Error(d);}if(t||s===0||h>s)break;f=!!((i=await _((n=r.retryIf)!=null?n:y,[b,h,y],y))!=null?i:y);}while(f);return y!==void 0?U.reject(y):b});return o.onFinalize.push(()=>{t=true;}),o};be.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var Er=be,ze=1e4,ye=2147483647,Tr=class extends A{constructor(e,r,t,o){super(e),this.started=new Date,this._setup=()=>{var n,i,s,a;this._signals=ie([(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 _((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(p=>p==null?void 0:p.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=j(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}},Or=Tr;function J(e,...r){var t;let o=k(J.defaults,K(e)?{timeout:e}:j(e)?e:{},[],"empty");o.timeout=Math.min(F(o.timeout)?o.timeout:ze,ye);let n=r.map(a=>m(a)?A.try(a):a),i=n.length<=1?n[0]instanceof A?n[0]:new A(n[0]):(m(A[o.batchFunc])?A[o.batchFunc]:A.all)(n),s=Le(o.timeout,o.onTimeout);return new Or(A.race([i,s]),s,o,ie([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}J.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:ze};var jr=J,B=class extends A{};B.deferred=De;B.deferredCallback=wr;B.delay=ve;B.delayReject=Le;B.retry=Er;B.timeout=jr;var Ar=B,$e=Ar;var ge=function(e,r){return ge=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]);},ge(e,r)};function I(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");ge(e,r);function t(){this.constructor=e;}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t);}function Y(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 z(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 $(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 T(e){return typeof e=="function"}function ue(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 le=ue(function(e){return function(t){e(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 X(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1);}}var C=(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=Y(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this);}}catch(f){r={error:f};}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(T(l))try{l();}catch(f){i=f instanceof le?f.errors:[f];}var p=this._finalizers;if(p){this._finalizers=null;try{for(var h=Y(p),v=h.next();!v.done;v=h.next()){var y=v.value;try{Ve(y);}catch(f){i=i!=null?i:[],f instanceof le?i=z(z([],$(i)),$(f.errors)):i.push(f);}}}catch(f){o={error:f};}finally{try{v&&!v.done&&(n=h.return)&&n.call(h);}finally{if(o)throw o.error}}}if(i)throw new le(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)Ve(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)&&X(t,r);},e.prototype.remove=function(r){var t=this._finalizers;t&&X(t,r),r instanceof e&&r._removeParent(this);},e.EMPTY=(function(){var r=new e;return r.closed=true,r})(),e})();var ge=C.EMPTY;function ce(e){return e instanceof C||e&&"closed"in e&&T(e.remove)&&T(e.add)&&T(e.unsubscribe)}function Ve(e){T(e)?e():e.unsubscribe();}var P={Promise:void 0};var V={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,z([e,r],$(t)))},clearTimeout:function(e){return (clearTimeout)(e)},delegate:void 0};function We(e){V.setTimeout(function(){throw e});}function _e(){}function W(e){e();}var Z=(function(e){I(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=false,t?(o.destination=t,ce(t)&&t.add(o)):o.destination=Cr,o}return r.create=function(t,o,n){return new pe(t,o,n)},r.prototype.next=function(t){this.isStopped?Se():this._next(t);},r.prototype.error=function(t){this.isStopped?Se():(this.isStopped=true,this._error(t));},r.prototype.complete=function(){this.isStopped?Se():(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})(C);var Ir=(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){fe(o);}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r);}catch(o){fe(o);}else fe(r);},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete();}catch(t){fe(t);}},e})(),pe=(function(e){I(r,e);function r(t,o,n){var i=e.call(this)||this,s;if(T(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 Ir(s),i}return r})(Z);function fe(e){We(e);}function Rr(e){throw e}function Se(e,r){}var Cr={closed:true,next:_e,error:Rr,complete:_e};var Je=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ye(e){return e}function Xe(e){return e.length===0?Ye:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var Q=(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=Fr(r)?r:new pe(r,t,o);return W(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=Ze(t),new t(function(n,i){var s=new pe({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[Je]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return Xe(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=Ze(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 Ze(e){var r;return (r=e!=null?e:P.Promise)!==null&&r!==void 0?r:Promise}function Mr(e){return e&&T(e.next)&&T(e.error)&&T(e.complete)}function Fr(e){return e&&e instanceof Z||Mr(e)&&ce(e)}function kr(e){return T(e==null?void 0:e.lift)}function Qe(e){return function(r){if(kr(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 er(e,r,t,o,n){return new Ur(e,r,t,o,n)}var Ur=(function(e){I(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})(Z);var rr=ue(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var Te=(function(e){I(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 tr(this,this);return o.operator=t,o},r.prototype._throwIfClosed=function(){if(this.closed)throw new rr},r.prototype.next=function(t){var o=this;W(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=Y(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;W(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;W(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?ge:(this.currentObservers=null,a.push(t),new C(function(){o.currentObservers=null,X(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 Q;return t.source=this,t},r.create=function(t,o){return new tr(t,o)},r})(Q);var tr=(function(e){I(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:ge},r})(Te);var M=(function(e){I(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})(Te);function L(e){return !!e&&(e instanceof Q||T(e.lift)&&T(e.subscribe))}function or(e,r){return Qe(function(t,o){var n=0;t.subscribe(er(o,function(i){return e.call(r,i,n++)&&o.next(i)}));})}function ee(e){return or(function(r,t){return e<=t})}var Oe=(e,r,t)=>{let o,n=j(t)?t:{timeout:t};n.timeout=F(n.timeout)?n.timeout:ye;let i=J({...n,onTimeout:async()=>{var a,u;let s=(a=n.timeoutMsg)!=null?a:Oe.defaults.timeoutMsg;return (u=await g(n.onTimeout,[],void 0))!=null?u:ke(s)?s:new Error(s)}},new Promise((s,a)=>{var u;if(!L(e))return a(new Error(Oe.defaults.invalidInputMsg));o=e.pipe(ee((u=n.skip)!=null?u:0)).subscribe(c=>{(c===r||r===void 0||b(r)&&g(r,[c],false))&&s(c);});}));return i.onFinalize.push(()=>{var s;(s=o==null?void 0:o.unsubscribe)==null||s.call(o);}),i};Oe.defaults={invalidInputMsg:"Input must be an observable or subject instance",timeoutMsg:"Request timed out before an expected value is received"};var Nr=(e,r=false)=>{if(e instanceof C)return true;let t=e;return !r&&!!t&&Fe(t.closed)&&b(t.unsubscribe)},nr=Nr;var je=(e={},r)=>{if(e)try{if(b(e)){e();return}if(nr(e)){e.unsubscribe();return}Object.values(e).forEach(t=>je(t,r));}catch(t){r==null||r(t);}};var Br=Symbol("ignore-update");function re(e,r,t){var p,h,v,y;let o=L(e)?[e]:R(e)?e:[e],n=new Map(o.map((f,d)=>[d,L(f)?f.value:f])),i={...re.defaults,...t!=null?t:{}};R(i.skipEmits)||(i.skipEmits=[i.skipEmits]),i.thisArg!==void 0&&(i.onError=(h=(p=i.onError)==null?void 0:p.bind)==null?void 0:h.call(p,i.thisArg),r=(v=r==null?void 0:r.bind)==null?void 0:v.call(r,i.thisArg)),b(r)&&i.transformSequentially&&(r=ze.deferredCallback(r,{delay:0,onError:i.onError,thisArg:i.thisArg}));let s=Ne(i.output)?i.output:new M(i.initialValue),a=f=>f!==re.IGNORE&&s.next(f),u=()=>{let f=R(e)?[...n.values()]:n.get(0);if(!b(r))return s.next(f);let d=g(r,[f,s],_=>(g(i.onError,[_],void 0),re.IGNORE));G(d)?d.then(a):a(d);};u=F(i.delay)?se(u,i.delay,i):u;let c=o.map((f,d)=>{var O;if(!L(f)||f.closed)return;let _=(O=i.skipEmits[d])!=null?O:f instanceof M?1:0;return _>0&&(f=f.pipe(ee(_))),f.subscribe({next:S=>{n.set(d,S),u();}})}),l=(y=s.unsubscribe)==null?void 0:y.bind(s);return s.unsubscribe=(...f)=>{l==null||l(...f),je(c),n.clear();},u(),s}re.defaults={delay:0,throttle:false};re.IGNORE=Br;var ir=class extends M{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 sr=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 g(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(Ce),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 M?o:new M(o);}};exports.IGNORE_UPDATE_SYMBOL=Br;exports.IntervalRunner=sr;exports.IntervalSubject=ir;exports.asPromise=Oe;exports.copyRx=re;exports.isSubscriptionLike=Nr;exports.unsubscribeAll=je;return exports;})({});//# sourceMappingURL=index.min.js.map
3
+ `):"",this.name="UnsubscriptionError",this.errors=t;}});function X(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1);}}var C=(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=Y(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this);}}catch(f){r={error:f};}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(T(l))try{l();}catch(f){i=f instanceof le?f.errors:[f];}var p=this._finalizers;if(p){this._finalizers=null;try{for(var h=Y(p),b=h.next();!b.done;b=h.next()){var y=b.value;try{Ve(y);}catch(f){i=i!=null?i:[],f instanceof le?i=$($([],z(i)),z(f.errors)):i.push(f);}}}catch(f){o={error:f};}finally{try{b&&!b.done&&(n=h.return)&&n.call(h);}finally{if(o)throw o.error}}}if(i)throw new le(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)Ve(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)&&X(t,r);},e.prototype.remove=function(r){var t=this._finalizers;t&&X(t,r),r instanceof e&&r._removeParent(this);},e.EMPTY=(function(){var r=new e;return r.closed=true,r})(),e})();var xe=C.EMPTY;function ce(e){return e instanceof C||e&&"closed"in e&&T(e.remove)&&T(e.add)&&T(e.unsubscribe)}function Ve(e){T(e)?e():e.unsubscribe();}var P={Promise:void 0};var V={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,$([e,r],z(t)))},clearTimeout:function(e){return (clearTimeout)(e)},delegate:void 0};function We(e){V.setTimeout(function(){throw e});}function _e(){}function W(e){e();}var Z=(function(e){I(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=false,t?(o.destination=t,ce(t)&&t.add(o)):o.destination=Cr,o}return r.create=function(t,o,n){return new pe(t,o,n)},r.prototype.next=function(t){this.isStopped?Ee():this._next(t);},r.prototype.error=function(t){this.isStopped?Ee():(this.isStopped=true,this._error(t));},r.prototype.complete=function(){this.isStopped?Ee():(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})(C);var Ir=(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){fe(o);}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r);}catch(o){fe(o);}else fe(r);},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete();}catch(t){fe(t);}},e})(),pe=(function(e){I(r,e);function r(t,o,n){var i=e.call(this)||this,s;if(T(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 Ir(s),i}return r})(Z);function fe(e){We(e);}function Rr(e){throw e}function Ee(e,r){}var Cr={closed:true,next:_e,error:Rr,complete:_e};var Je=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ye(e){return e}function Xe(e){return e.length===0?Ye:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var Q=(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=Fr(r)?r:new pe(r,t,o);return W(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=Ze(t),new t(function(n,i){var s=new pe({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[Je]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return Xe(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=Ze(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 Ze(e){var r;return (r=e!=null?e:P.Promise)!==null&&r!==void 0?r:Promise}function Mr(e){return e&&T(e.next)&&T(e.error)&&T(e.complete)}function Fr(e){return e&&e instanceof Z||Mr(e)&&ce(e)}function kr(e){return T(e==null?void 0:e.lift)}function Qe(e){return function(r){if(kr(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 er(e,r,t,o,n){return new Ur(e,r,t,o,n)}var Ur=(function(e){I(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})(Z);var rr=ue(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var Te=(function(e){I(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 tr(this,this);return o.operator=t,o},r.prototype._throwIfClosed=function(){if(this.closed)throw new rr},r.prototype.next=function(t){var o=this;W(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=Y(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;W(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;W(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?xe:(this.currentObservers=null,a.push(t),new C(function(){o.currentObservers=null,X(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 Q;return t.source=this,t},r.create=function(t,o){return new tr(t,o)},r})(Q);var tr=(function(e){I(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:xe},r})(Te);var M=(function(e){I(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})(Te);function L(e){return !!e&&(e instanceof Q||T(e.lift)&&T(e.subscribe))}function or(e,r){return Qe(function(t,o){var n=0;t.subscribe(er(o,function(i){return e.call(r,i,n++)&&o.next(i)}));})}function ee(e){return or(function(r,t){return e<=t})}var Oe=(e,r,t)=>{let o,n=j(t)?t:{timeout:t};n.timeout=F(n.timeout)?n.timeout:ye;let i=J({...n,onTimeout:async()=>{var a,u;let s=(a=n.timeoutMsg)!=null?a:Oe.defaults.timeoutMsg;return (u=await _(n.onTimeout,[],void 0))!=null?u:ke(s)?s:new Error(s)}},new Promise((s,a)=>{var u;if(!L(e))return a(new Error(Oe.defaults.invalidInputMsg));o=e.pipe(ee((u=n.skip)!=null?u:0)).subscribe(c=>{(c===r||r===void 0||m(r)&&_(r,[c],false))&&s(c);});}));return i.onFinalize.push(()=>{var s;(s=o==null?void 0:o.unsubscribe)==null||s.call(o);}),i};Oe.defaults={invalidInputMsg:"Input must be an observable or subject instance",timeoutMsg:"Request timed out before an expected value is received"};var Nr=(e,r=false)=>{if(e instanceof C)return true;let t=e;return !r&&!!t&&Fe(t.closed)&&m(t.unsubscribe)},nr=Nr;var je=(e={},r)=>{if(e)try{if(m(e)){e();return}if(nr(e)){e.unsubscribe();return}Object.values(e).forEach(t=>je(t,r));}catch(t){r==null||r(t);}};var Br=Symbol("ignore-update");function re(e,r,t){var p,h,b,y;let o=L(e)?[e]:R(e)?e:[e],n=new Map(o.map((f,d)=>[d,L(f)?f.value:f])),i={...re.defaults,...t!=null?t:{}};R(i.skipEmits)||(i.skipEmits=[i.skipEmits]),i.thisArg!==void 0&&(i.onError=(h=(p=i.onError)==null?void 0:p.bind)==null?void 0:h.call(p,i.thisArg),r=(b=r==null?void 0:r.bind)==null?void 0:b.call(r,i.thisArg)),m(r)&&i.transformSequentially&&(r=$e.deferredCallback(r,{delay:0,onError:i.onError,thisArg:i.thisArg}));let s=Ne(i.output)?i.output:new M(i.initialValue),a=f=>f!==re.IGNORE&&s.next(f),u=()=>{let f=R(e)?[...n.values()]:n.get(0);if(!m(r))return s.next(f);let d=_(r,[f,s],x=>(_(i.onError,[x],void 0),re.IGNORE));G(d)?d.then(a):a(d);};u=F(i.delay)?se(u,i.delay,i):u;let c=o.map((f,d)=>{var O;if(!L(f)||f.closed)return;let x=(O=i.skipEmits[d])!=null?O:f instanceof M?1:0;return x>0&&(f=f.pipe(ee(x))),f.subscribe({next:E=>{n.set(d,E),u();}})}),l=(y=s.unsubscribe)==null?void 0:y.bind(s);return s.unsubscribe=(...f)=>{l==null||l(...f),je(c),n.clear();},u(),s}re.defaults={delay:0,throttle:false};re.IGNORE=Br;var ir=class extends M{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 sr=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(...m(this.taskArgs)?this.taskArgs.call(this,this._runCount):this.taskArgs),this.lastResult=o;}catch(i){t=i;}return _(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),t&&(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(Ce),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 M?o:new M(o);}get runCount(){return this._runCount}};exports.IGNORE_UPDATE_SYMBOL=Br;exports.IntervalRunner=sr;exports.IntervalSubject=ir;exports.asPromise=Oe;exports.copyRx=re;exports.isSubscriptionLike=Nr;exports.unsubscribeAll=je;return exports;})({});//# sourceMappingURL=index.min.js.map
4
4
  //# sourceMappingURL=index.min.js.map