rx-tiny-flux 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rx-tiny-flux.esm.js
CHANGED
|
@@ -1516,42 +1516,6 @@ function startWith() {
|
|
|
1516
1516
|
});
|
|
1517
1517
|
}
|
|
1518
1518
|
|
|
1519
|
-
function tap(observerOrNext, error, complete) {
|
|
1520
|
-
var tapObserver = isFunction(observerOrNext) || error || complete
|
|
1521
|
-
?
|
|
1522
|
-
{ next: observerOrNext, error: error, complete: complete }
|
|
1523
|
-
: observerOrNext;
|
|
1524
|
-
return tapObserver
|
|
1525
|
-
? operate(function (source, subscriber) {
|
|
1526
|
-
var _a;
|
|
1527
|
-
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1528
|
-
var isUnsub = true;
|
|
1529
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1530
|
-
var _a;
|
|
1531
|
-
(_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
|
|
1532
|
-
subscriber.next(value);
|
|
1533
|
-
}, function () {
|
|
1534
|
-
var _a;
|
|
1535
|
-
isUnsub = false;
|
|
1536
|
-
(_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1537
|
-
subscriber.complete();
|
|
1538
|
-
}, function (err) {
|
|
1539
|
-
var _a;
|
|
1540
|
-
isUnsub = false;
|
|
1541
|
-
(_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
|
|
1542
|
-
subscriber.error(err);
|
|
1543
|
-
}, function () {
|
|
1544
|
-
var _a, _b;
|
|
1545
|
-
if (isUnsub) {
|
|
1546
|
-
(_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1547
|
-
}
|
|
1548
|
-
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
|
1549
|
-
}));
|
|
1550
|
-
})
|
|
1551
|
-
:
|
|
1552
|
-
identity;
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
1519
|
/**
|
|
1556
1520
|
* @typedef {import('./actions').Action} Action
|
|
1557
1521
|
*/
|
|
@@ -1584,10 +1548,7 @@ class Store {
|
|
|
1584
1548
|
const initialStoreState = typeof structuredClone === 'function' ? structuredClone(initialState) : JSON.parse(JSON.stringify(initialState));
|
|
1585
1549
|
this._state$ = new BehaviorSubject(initialStoreState);
|
|
1586
1550
|
|
|
1587
|
-
const dispatcher$ = this._actions
|
|
1588
|
-
// Optional: log for debugging
|
|
1589
|
-
tap((action) => console.log('Action Dispatched:', action))
|
|
1590
|
-
);
|
|
1551
|
+
const dispatcher$ = this._actions$;
|
|
1591
1552
|
|
|
1592
1553
|
const state$ = dispatcher$.pipe(
|
|
1593
1554
|
scan((currentState, action) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=function(r,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},t(r,n)};function r(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function n(t,r,n,e){return new(n||(n=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(u,c)}s((e=e.apply(t,r||[])).next())})}function e(t,r){var n,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(t,i)}catch(t){c=[6,t],e=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,r){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,o,i=n.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function u(t,r,n){if(n||2===arguments.length)for(var e,o=0,i=r.length;o<i;o++)!e&&o in r||(e||(e=Array.prototype.slice.call(r,0,o)),e[o]=r[o]);return t.concat(e||Array.prototype.slice.call(r))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=n.apply(t,r||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(r){return Promise.resolve(r).then(t,f)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,r){o[t]&&(e[t]=function(r){return new Promise(function(n,e){i.push([t,r,n,e])>1||s(t,r)})},r&&(e[t]=r(e[t])))}function s(t,r){try{(n=o[t](r)).value instanceof c?Promise.resolve(n.value.v).then(a,f):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function a(t){s("next",t)}function f(t){s("throw",t)}function l(t,r){t(r),i.shift(),i.length&&s(i[0][0],i[0][1])}}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=t[Symbol.asyncIterator];return n?n.call(t):(t=o(t),r={},e("next"),e("throw"),e("return"),r[Symbol.asyncIterator]=function(){return this},r);function e(n){r[n]=t[n]&&function(r){return new Promise(function(e,o){(function(t,r,n,e){Promise.resolve(e).then(function(r){t({value:r,done:n})},r)})(e,o,(r=t[n](r)).done,r.value)})}}}function f(t){return"function"==typeof t}function l(t){var r=t(function(t){Error.call(t),t.stack=(new Error).stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}"function"==typeof SuppressedError&&SuppressedError;var p=l(function(t){return function(r){t(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=r}});function h(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var v=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var r;return t.prototype.unsubscribe=function(){var t,r,n,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=o(s),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(r){t={error:r}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(f(h))try{h()}catch(t){c=t instanceof p?t.errors:[t]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var d=o(v),b=d.next();!b.done;b=d.next()){var w=b.value;try{y(w)}catch(t){c=null!=c?c:[],t instanceof p?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){n={error:t}}finally{try{b&&!b.done&&(e=d.return)&&e.call(d)}finally{if(n)throw n.error}}}if(c)throw new p(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)y(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(r)}},t.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},t.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},t.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&h(r,t)},t.prototype.remove=function(r){var n=this._finalizers;n&&h(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=((r=new t).closed=!0,r),t}(),d=v.EMPTY;function b(t){return t instanceof v||t&&"closed"in t&&f(t.remove)&&f(t.add)&&f(t.unsubscribe)}function y(t){f(t)?t():t.unsubscribe()}var w={Promise:void 0},m=function(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,r],i(n)))};function _(t){m(function(){throw t})}function x(){}function S(t){t()}var g=function(t){function n(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,b(r)&&r.add(n)):n.destination=I,n}return r(n,t),n.create=function(t,r,n){return new E(t,r,n)},n.prototype.next=function(t){this.isStopped||this._next(t)},n.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(t){this.destination.next(t)},n.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(v),O=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(t){P(t)}},t.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(t){P(t)}else P(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){P(t)}},t}(),E=function(t){function n(r,n,e){var o,i=t.call(this)||this;return o=f(r)||!r?{next:null!=r?r:void 0,error:null!=n?n:void 0,complete:null!=e?e:void 0}:r,i.destination=new O(o),i}return r(n,t),n}(g);function P(t){_(t)}var I={closed:!0,next:x,error:function(t){throw t},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function A(t){return t}var j=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(t,r,n){var e,o=this,i=(e=t)&&e instanceof g||function(t){return t&&f(t.next)&&f(t.error)&&f(t.complete)}(e)&&b(e)?t:new E(t,r,n);return S(function(){var t=o,r=t.operator,n=t.source;i.add(r?r.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},t.prototype.forEach=function(t,r){var n=this;return new(r=C(r))(function(r,e){var o=new E({next:function(r){try{t(r)}catch(t){e(t),o.unsubscribe()}},error:e,complete:r});n.subscribe(o)})},t.prototype._subscribe=function(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)},t.prototype[T]=function(){return this},t.prototype.pipe=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(0===(t=r).length?A:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)})(this)},t.prototype.toPromise=function(t){var r=this;return new(t=C(t))(function(t,n){var e;r.subscribe(function(t){return e=t},function(t){return n(t)},function(){return t(e)})})},t.create=function(r){return new t(r)},t}();function C(t){var r;return null!==(r=null!=t?t:w.Promise)&&void 0!==r?r:Promise}function z(t){return function(r){if(function(t){return f(null==t?void 0:t.lift)}(r))return r.lift(function(r){try{return t(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function k(t,r,n,e,o){return new F(t,r,n,e,o)}var F=function(t){function n(r,n,e,o,i,u){var c=t.call(this,r)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){r.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return r(n,t),n.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(r=this.onFinalize)||void 0===r||r.call(this))}},n}(g),$=l(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),R=function(t){function n(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return r(n,t),n.prototype.lift=function(t){var r=new J(this,this);return r.operator=t,r},n.prototype._throwIfClosed=function(){if(this.closed)throw new $},n.prototype.next=function(t){var r=this;S(function(){var n,e;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=o(r.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(t)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}}})},n.prototype.error=function(t){var r=this;S(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var n=r.observers;n.length;)n.shift().error(t)}})},n.prototype.complete=function(){var t=this;S(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},n.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},n.prototype._innerSubscribe=function(t){var r=this,n=this,e=n.hasError,o=n.isStopped,i=n.observers;return e||o?d:(this.currentObservers=null,i.push(t),new v(function(){r.currentObservers=null,h(i,t)}))},n.prototype._checkFinalizedStatuses=function(t){var r=this,n=r.hasError,e=r.thrownError,o=r.isStopped;n?t.error(e):o&&t.complete()},n.prototype.asObservable=function(){var t=new j;return t.source=this,t},n.create=function(t,r){return new J(t,r)},n}(j),J=function(t){function n(r,n){var e=t.call(this)||this;return e.destination=r,e.source=n,e}return r(n,t),n.prototype.next=function(t){var r,n;null===(n=null===(r=this.destination)||void 0===r?void 0:r.next)||void 0===n||n.call(r,t)},n.prototype.error=function(t){var r,n;null===(n=null===(r=this.destination)||void 0===r?void 0:r.error)||void 0===n||n.call(r,t)},n.prototype.complete=function(){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===r||r.call(t)},n.prototype._subscribe=function(t){var r,n;return null!==(n=null===(r=this.source)||void 0===r?void 0:r.subscribe(t))&&void 0!==n?n:d},n}(R),N=function(t){function n(r){var n=t.call(this)||this;return n._value=r,n}return r(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},n.prototype.getValue=function(){var t=this,r=t.hasError,n=t.thrownError,e=t._value;if(r)throw n;return this._throwIfClosed(),e},n.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},n}(R),U={now:function(){return(U.delegate||Date).now()},delegate:void 0},W=function(t){function n(r,n,e){void 0===r&&(r=1/0),void 0===n&&(n=1/0),void 0===e&&(e=U);var o=t.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=e,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return r(n,t),n.prototype.next=function(r){var n=this,e=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;e||(o.push(r),!i&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,r)},n.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),n=this._infiniteTimeWindow,e=this._buffer.slice(),o=0;o<e.length&&!t.closed;o+=n?1:2)t.next(e[o]);return this._checkFinalizedStatuses(t),r},n.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,n=t._timestampProvider,e=t._buffer,o=t._infiniteTimeWindow,i=(o?1:2)*r;if(r<1/0&&i<e.length&&e.splice(0,e.length-i),!o){for(var u=n.now(),c=0,s=1;s<e.length&&e[s]<=u;s+=2)c=s;c&&e.splice(0,c+1)}},n}(R);function M(t){return(r=(n=t)[n.length-1])&&f(r.schedule)?t.pop():void 0;var r,n}var Y=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function B(t){return f(null==t?void 0:t.then)}function V(t){return f(t[T])}function D(t){return Symbol.asyncIterator&&f(null==t?void 0:t[Symbol.asyncIterator])}function Z(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var G="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function K(t){return f(null==t?void 0:t[G])}function L(t){return s(this,arguments,function(){var r,n,o;return e(this,function(e){switch(e.label){case 0:r=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(r.read())];case 3:return n=e.sent(),o=n.value,n.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function q(t){return f(null==t?void 0:t.getReader)}function H(t){if(t instanceof j)return t;if(null!=t){if(V(t))return i=t,new j(function(t){var r=i[T]();if(f(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Y(t))return e=t,new j(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()});if(B(t))return n=t,new j(function(t){n.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,_)});if(D(t))return Q(t);if(K(t))return r=t,new j(function(t){var n,e;try{for(var i=o(r),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}t.complete()});if(q(t))return Q(L(t))}var r,n,e,i;throw Z(t)}function Q(t){return new j(function(r){(function(t,r){var o,i,u,c;return n(this,void 0,void 0,function(){var n,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=a(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(n=i.value,r.next(n),r.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})})(t,r).catch(function(t){return r.error(t)})})}function X(t,r,n,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=r.schedule(function(){n(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function tt(t,r){return void 0===r&&(r=0),z(function(n,e){n.subscribe(k(e,function(n){return X(e,t,function(){return e.next(n)},r)},function(){return X(e,t,function(){return e.complete()},r)},function(n){return X(e,t,function(){return e.error(n)},r)}))})}function rt(t,r){return void 0===r&&(r=0),z(function(n,e){e.add(t.schedule(function(){return n.subscribe(e)},r))})}function nt(t,r){if(!t)throw new Error("Iterable cannot be null");return new j(function(n){X(n,r,function(){var e=t[Symbol.asyncIterator]();X(n,r,function(){e.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function et(t,r){if(null!=t){if(V(t))return function(t,r){return H(t).pipe(rt(r),tt(r))}(t,r);if(Y(t))return function(t,r){return new j(function(n){var e=0;return r.schedule(function(){e===t.length?n.complete():(n.next(t[e++]),n.closed||this.schedule())})})}(t,r);if(B(t))return function(t,r){return H(t).pipe(rt(r),tt(r))}(t,r);if(D(t))return nt(t,r);if(K(t))return function(t,r){return new j(function(n){var e;return X(n,r,function(){e=t[G](),X(n,r,function(){var t,r,o;try{r=(t=e.next()).value,o=t.done}catch(t){return void n.error(t)}o?n.complete():n.next(r)},0,!0)}),function(){return f(null==e?void 0:e.return)&&e.return()}})}(t,r);if(q(t))return function(t,r){return nt(L(t),r)}(t,r)}throw Z(t)}function ot(t,r){return z(function(n,e){var o=0;n.subscribe(k(e,function(n){e.next(t.call(r,n,o++))}))})}function it(t,r,n){return void 0===n&&(n=1/0),f(r)?it(function(n,e){return ot(function(t,o){return r(n,t,e,o)})(H(t(n,e)))},n):("number"==typeof r&&(n=r),z(function(r,e){return function(t,r,n,e,o,i,u){var c=[],s=0,a=0,f=!1,l=function(){!f||c.length||s||r.complete()},p=function(t){s++;var o=!1;H(n(t,a++)).subscribe(k(r,function(t){r.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||p(t)};c.length&&s<e;)t();l()}catch(t){r.error(t)}}))};return t.subscribe(k(r,function(t){return s<e?p(t):c.push(t)},function(){f=!0,l()})),function(){}}(r,e,t,n)}))}function ut(){return it(A,1)}function ct(){for(var t,r,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return ut()((t=n,(r=M(n))?et(t,r):H(t)))}function st(t,r){return t===r}function at(t,r){return z(function(t,r,n,e,o){return function(e,i){var u=n,c=r,s=0;e.subscribe(k(i,function(r){var n=s++;c=u?t(c,r,n):(u=!0,r),i.next(c)},o))}}(t,r,arguments.length>=2))}function ft(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];if(!0!==r){if(!1!==r){var o=new E({next:function(){o.unsubscribe(),t()}});return H(r.apply(void 0,u([],i(n)))).subscribe(o)}}else t()}function lt(t,r,n){var e;return e=t,function(t){void 0===t&&(t={});var r=t.connector,n=void 0===r?function(){return new R}:r,e=t.resetOnError,o=void 0===e||e,i=t.resetOnComplete,u=void 0===i||i,c=t.resetOnRefCountZero,s=void 0===c||c;return function(t){var r,e,i,c=0,a=!1,f=!1,l=function(){null==e||e.unsubscribe(),e=void 0},p=function(){l(),r=i=void 0,a=f=!1},h=function(){var t=r;p(),null==t||t.unsubscribe()};return z(function(t,v){c++,f||a||l();var d=i=null!=i?i:n();v.add(function(){0!==--c||f||a||(e=ft(h,s))}),d.subscribe(v),!r&&c>0&&(r=new E({next:function(t){return d.next(t)},error:function(t){f=!0,l(),e=ft(p,o,t),d.error(t)},complete:function(){a=!0,l(),e=ft(p,u),d.complete()}}),H(t).subscribe(r))})(t)}}({connector:function(){return new W(e,r,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:!1})}class pt{_state$;_actions$=new R;_reducers=[];constructor(t={}){const r="function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t));this._state$=new N(r);var n,e,o,i;const u=this._actions$.pipe((i=f(n=t=>console.log("Action Dispatched:",t))||e||o?{next:n,error:e,complete:o}:n)?z(function(t,r){var n;null===(n=i.subscribe)||void 0===n||n.call(i);var e=!0;t.subscribe(k(r,function(t){var n;null===(n=i.next)||void 0===n||n.call(i,t),r.next(t)},function(){var t;e=!1,null===(t=i.complete)||void 0===t||t.call(i),r.complete()},function(t){var n;e=!1,null===(n=i.error)||void 0===n||n.call(i,t),r.error(t)},function(){var t,r;e&&(null===(t=i.unsubscribe)||void 0===t||t.call(i)),null===(r=i.finalize)||void 0===r||r.call(i)}))}):A).pipe(at((t,r)=>{const n=JSON.parse(JSON.stringify(t));return this._reducers.forEach(({path:t,reducerFn:e})=>{const o=n[t],i=e(o,r);void 0!==i&&o!==i&&(n[t]=i)}),n},r),function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=M(t);return z(function(r,e){(n?ct(t,r,n):ct(t,r)).subscribe(e)})}(t),lt(1));u.subscribe(this._state$)}registerReducers(...t){this._reducers.push(...t);const r=this._state$.getValue(),n=JSON.parse(JSON.stringify(r));t.forEach(({path:t,initialState:r})=>{void 0===n[t]&&(n[t]=r)}),this._state$.next(n)}registerEffects(...t){t.forEach(t=>{const r=t._rxEffect||{dispatch:!0},n=t(this._actions$);r.dispatch?n.subscribe(this.dispatch.bind(this)):n.subscribe()})}dispatch(t){this._actions$.next(t)}select(t){return this._state$.pipe(ot(r=>t(r)),(void 0===n&&(n=A),r=null!=r?r:st,z(function(t,e){var o,i=!0;t.subscribe(k(e,function(t){var u=n(t);!i&&r(o,u)||(i=!1,o=u,e.next(t))}))})));var r,n}}function ht(t){const r=r=>({type:t,payload:r});return r.type=t,r}function vt(){}function dt(...t){const r=t.pop(),n=t,e=n.includes(vt);if(e&&n.length>1)throw new Error("The `anyAction` token cannot be mixed with other action creators in a single `on` handler.");return{types:n.map(t=>t.type),reducerFn:r,isCatchAll:e}}function bt(t,r,...n){if(!t||"string"!=typeof t)throw new Error("Reducer featureKey must be a non-empty string.");const e=n.filter(t=>!t.isCatchAll),o=n.find(t=>t.isCatchAll);return{path:t,initialState:r,reducerFn:(t=r,n)=>{for(const r of e)if(r.types.includes(n.type))return r.reducerFn(t,n);return o?o.reducerFn(t,n):t}}}function yt(...t){const r=t.map(t=>t.type);return n=t=>r.includes(t.type),z(function(t,r){var o=0;t.subscribe(k(r,function(t){return n.call(e,t,o++)&&r.next(t)}))});var n,e}function wt(t,r={dispatch:!0}){if("function"!=typeof t)throw new Error("Effect must be a function.");return Object.defineProperty(t,"_rxEffect",{value:{dispatch:!1!==r.dispatch},enumerable:!1}),t}function mt(t,r){return n=>{const e=n[t];return r?r(e):e}}function _t(...t){const r=t.pop(),n=t;if("function"!=typeof r)throw new Error("The last argument to createSelector must be a projection function.");return t=>{const e=n.map(r=>r(t));return r(...e)}}export{pt as Store,vt as anyAction,ht as createAction,wt as createEffect,mt as createFeatureSelector,bt as createReducer,_t as createSelector,yt as ofType,dt as on};
|
|
1
|
+
var t=function(r,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},t(r,n)};function r(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function n(t,r,n,e){return new(n||(n=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(u,c)}s((e=e.apply(t,r||[])).next())})}function e(t,r){var n,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(t,i)}catch(t){c=[6,t],e=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,r){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,o,i=n.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function u(t,r,n){if(n||2===arguments.length)for(var e,o=0,i=r.length;o<i;o++)!e&&o in r||(e||(e=Array.prototype.slice.call(r,0,o)),e[o]=r[o]);return t.concat(e||Array.prototype.slice.call(r))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=n.apply(t,r||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(r){return Promise.resolve(r).then(t,f)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,r){o[t]&&(e[t]=function(r){return new Promise(function(n,e){i.push([t,r,n,e])>1||s(t,r)})},r&&(e[t]=r(e[t])))}function s(t,r){try{(n=o[t](r)).value instanceof c?Promise.resolve(n.value.v).then(a,f):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function a(t){s("next",t)}function f(t){s("throw",t)}function l(t,r){t(r),i.shift(),i.length&&s(i[0][0],i[0][1])}}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=t[Symbol.asyncIterator];return n?n.call(t):(t=o(t),r={},e("next"),e("throw"),e("return"),r[Symbol.asyncIterator]=function(){return this},r);function e(n){r[n]=t[n]&&function(r){return new Promise(function(e,o){(function(t,r,n,e){Promise.resolve(e).then(function(r){t({value:r,done:n})},r)})(e,o,(r=t[n](r)).done,r.value)})}}}function f(t){return"function"==typeof t}function l(t){var r=t(function(t){Error.call(t),t.stack=(new Error).stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}"function"==typeof SuppressedError&&SuppressedError;var p=l(function(t){return function(r){t(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=r}});function h(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var d=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var r;return t.prototype.unsubscribe=function(){var t,r,n,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=o(s),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(r){t={error:r}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(f(h))try{h()}catch(t){c=t instanceof p?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=o(d),b=v.next();!b.done;b=v.next()){var w=b.value;try{y(w)}catch(t){c=null!=c?c:[],t instanceof p?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){n={error:t}}finally{try{b&&!b.done&&(e=v.return)&&e.call(v)}finally{if(n)throw n.error}}}if(c)throw new p(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)y(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(r)}},t.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},t.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},t.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&h(r,t)},t.prototype.remove=function(r){var n=this._finalizers;n&&h(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=((r=new t).closed=!0,r),t}(),v=d.EMPTY;function b(t){return t instanceof d||t&&"closed"in t&&f(t.remove)&&f(t.add)&&f(t.unsubscribe)}function y(t){f(t)?t():t.unsubscribe()}var w={Promise:void 0},m=function(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,r],i(n)))};function _(t){m(function(){throw t})}function x(){}function S(t){t()}var g=function(t){function n(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,b(r)&&r.add(n)):n.destination=I,n}return r(n,t),n.create=function(t,r,n){return new E(t,r,n)},n.prototype.next=function(t){this.isStopped||this._next(t)},n.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(t){this.destination.next(t)},n.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(d),O=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(t){P(t)}},t.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(t){P(t)}else P(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){P(t)}},t}(),E=function(t){function n(r,n,e){var o,i=t.call(this)||this;return o=f(r)||!r?{next:null!=r?r:void 0,error:null!=n?n:void 0,complete:null!=e?e:void 0}:r,i.destination=new O(o),i}return r(n,t),n}(g);function P(t){_(t)}var I={closed:!0,next:x,error:function(t){throw t},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function A(t){return t}var j=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(t,r,n){var e,o=this,i=(e=t)&&e instanceof g||function(t){return t&&f(t.next)&&f(t.error)&&f(t.complete)}(e)&&b(e)?t:new E(t,r,n);return S(function(){var t=o,r=t.operator,n=t.source;i.add(r?r.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},t.prototype.forEach=function(t,r){var n=this;return new(r=C(r))(function(r,e){var o=new E({next:function(r){try{t(r)}catch(t){e(t),o.unsubscribe()}},error:e,complete:r});n.subscribe(o)})},t.prototype._subscribe=function(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)},t.prototype[T]=function(){return this},t.prototype.pipe=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(0===(t=r).length?A:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)})(this)},t.prototype.toPromise=function(t){var r=this;return new(t=C(t))(function(t,n){var e;r.subscribe(function(t){return e=t},function(t){return n(t)},function(){return t(e)})})},t.create=function(r){return new t(r)},t}();function C(t){var r;return null!==(r=null!=t?t:w.Promise)&&void 0!==r?r:Promise}function z(t){return function(r){if(function(t){return f(null==t?void 0:t.lift)}(r))return r.lift(function(r){try{return t(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function k(t,r,n,e,o){return new F(t,r,n,e,o)}var F=function(t){function n(r,n,e,o,i,u){var c=t.call(this,r)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){r.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return r(n,t),n.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(r=this.onFinalize)||void 0===r||r.call(this))}},n}(g),$=l(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),R=function(t){function n(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return r(n,t),n.prototype.lift=function(t){var r=new J(this,this);return r.operator=t,r},n.prototype._throwIfClosed=function(){if(this.closed)throw new $},n.prototype.next=function(t){var r=this;S(function(){var n,e;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=o(r.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(t)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}}})},n.prototype.error=function(t){var r=this;S(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var n=r.observers;n.length;)n.shift().error(t)}})},n.prototype.complete=function(){var t=this;S(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},n.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},n.prototype._innerSubscribe=function(t){var r=this,n=this,e=n.hasError,o=n.isStopped,i=n.observers;return e||o?v:(this.currentObservers=null,i.push(t),new d(function(){r.currentObservers=null,h(i,t)}))},n.prototype._checkFinalizedStatuses=function(t){var r=this,n=r.hasError,e=r.thrownError,o=r.isStopped;n?t.error(e):o&&t.complete()},n.prototype.asObservable=function(){var t=new j;return t.source=this,t},n.create=function(t,r){return new J(t,r)},n}(j),J=function(t){function n(r,n){var e=t.call(this)||this;return e.destination=r,e.source=n,e}return r(n,t),n.prototype.next=function(t){var r,n;null===(n=null===(r=this.destination)||void 0===r?void 0:r.next)||void 0===n||n.call(r,t)},n.prototype.error=function(t){var r,n;null===(n=null===(r=this.destination)||void 0===r?void 0:r.error)||void 0===n||n.call(r,t)},n.prototype.complete=function(){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===r||r.call(t)},n.prototype._subscribe=function(t){var r,n;return null!==(n=null===(r=this.source)||void 0===r?void 0:r.subscribe(t))&&void 0!==n?n:v},n}(R),N=function(t){function n(r){var n=t.call(this)||this;return n._value=r,n}return r(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},n.prototype.getValue=function(){var t=this,r=t.hasError,n=t.thrownError,e=t._value;if(r)throw n;return this._throwIfClosed(),e},n.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},n}(R),U={now:function(){return(U.delegate||Date).now()},delegate:void 0},W=function(t){function n(r,n,e){void 0===r&&(r=1/0),void 0===n&&(n=1/0),void 0===e&&(e=U);var o=t.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=e,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return r(n,t),n.prototype.next=function(r){var n=this,e=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;e||(o.push(r),!i&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,r)},n.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),n=this._infiniteTimeWindow,e=this._buffer.slice(),o=0;o<e.length&&!t.closed;o+=n?1:2)t.next(e[o]);return this._checkFinalizedStatuses(t),r},n.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,n=t._timestampProvider,e=t._buffer,o=t._infiniteTimeWindow,i=(o?1:2)*r;if(r<1/0&&i<e.length&&e.splice(0,e.length-i),!o){for(var u=n.now(),c=0,s=1;s<e.length&&e[s]<=u;s+=2)c=s;c&&e.splice(0,c+1)}},n}(R);function M(t){return(r=(n=t)[n.length-1])&&f(r.schedule)?t.pop():void 0;var r,n}var Y=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function B(t){return f(null==t?void 0:t.then)}function V(t){return f(t[T])}function Z(t){return Symbol.asyncIterator&&f(null==t?void 0:t[Symbol.asyncIterator])}function D(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var G="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function K(t){return f(null==t?void 0:t[G])}function L(t){return s(this,arguments,function(){var r,n,o;return e(this,function(e){switch(e.label){case 0:r=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(r.read())];case 3:return n=e.sent(),o=n.value,n.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function q(t){return f(null==t?void 0:t.getReader)}function H(t){if(t instanceof j)return t;if(null!=t){if(V(t))return i=t,new j(function(t){var r=i[T]();if(f(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Y(t))return e=t,new j(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()});if(B(t))return n=t,new j(function(t){n.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,_)});if(Z(t))return Q(t);if(K(t))return r=t,new j(function(t){var n,e;try{for(var i=o(r),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}t.complete()});if(q(t))return Q(L(t))}var r,n,e,i;throw D(t)}function Q(t){return new j(function(r){(function(t,r){var o,i,u,c;return n(this,void 0,void 0,function(){var n,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=a(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(n=i.value,r.next(n),r.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})})(t,r).catch(function(t){return r.error(t)})})}function X(t,r,n,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=r.schedule(function(){n(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function tt(t,r){return void 0===r&&(r=0),z(function(n,e){n.subscribe(k(e,function(n){return X(e,t,function(){return e.next(n)},r)},function(){return X(e,t,function(){return e.complete()},r)},function(n){return X(e,t,function(){return e.error(n)},r)}))})}function rt(t,r){return void 0===r&&(r=0),z(function(n,e){e.add(t.schedule(function(){return n.subscribe(e)},r))})}function nt(t,r){if(!t)throw new Error("Iterable cannot be null");return new j(function(n){X(n,r,function(){var e=t[Symbol.asyncIterator]();X(n,r,function(){e.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function et(t,r){if(null!=t){if(V(t))return function(t,r){return H(t).pipe(rt(r),tt(r))}(t,r);if(Y(t))return function(t,r){return new j(function(n){var e=0;return r.schedule(function(){e===t.length?n.complete():(n.next(t[e++]),n.closed||this.schedule())})})}(t,r);if(B(t))return function(t,r){return H(t).pipe(rt(r),tt(r))}(t,r);if(Z(t))return nt(t,r);if(K(t))return function(t,r){return new j(function(n){var e;return X(n,r,function(){e=t[G](),X(n,r,function(){var t,r,o;try{r=(t=e.next()).value,o=t.done}catch(t){return void n.error(t)}o?n.complete():n.next(r)},0,!0)}),function(){return f(null==e?void 0:e.return)&&e.return()}})}(t,r);if(q(t))return function(t,r){return nt(L(t),r)}(t,r)}throw D(t)}function ot(t,r){return z(function(n,e){var o=0;n.subscribe(k(e,function(n){e.next(t.call(r,n,o++))}))})}function it(t,r,n){return void 0===n&&(n=1/0),f(r)?it(function(n,e){return ot(function(t,o){return r(n,t,e,o)})(H(t(n,e)))},n):("number"==typeof r&&(n=r),z(function(r,e){return function(t,r,n,e,o,i,u){var c=[],s=0,a=0,f=!1,l=function(){!f||c.length||s||r.complete()},p=function(t){s++;var o=!1;H(n(t,a++)).subscribe(k(r,function(t){r.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||p(t)};c.length&&s<e;)t();l()}catch(t){r.error(t)}}))};return t.subscribe(k(r,function(t){return s<e?p(t):c.push(t)},function(){f=!0,l()})),function(){}}(r,e,t,n)}))}function ut(){return it(A,1)}function ct(){for(var t,r,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return ut()((t=n,(r=M(n))?et(t,r):H(t)))}function st(t,r){return t===r}function at(t,r){return z(function(t,r,n,e,o){return function(e,i){var u=n,c=r,s=0;e.subscribe(k(i,function(r){var n=s++;c=u?t(c,r,n):(u=!0,r),i.next(c)},o))}}(t,r,arguments.length>=2))}function ft(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];if(!0!==r){if(!1!==r){var o=new E({next:function(){o.unsubscribe(),t()}});return H(r.apply(void 0,u([],i(n)))).subscribe(o)}}else t()}function lt(t,r,n){var e;return e=t,function(t){void 0===t&&(t={});var r=t.connector,n=void 0===r?function(){return new R}:r,e=t.resetOnError,o=void 0===e||e,i=t.resetOnComplete,u=void 0===i||i,c=t.resetOnRefCountZero,s=void 0===c||c;return function(t){var r,e,i,c=0,a=!1,f=!1,l=function(){null==e||e.unsubscribe(),e=void 0},p=function(){l(),r=i=void 0,a=f=!1},h=function(){var t=r;p(),null==t||t.unsubscribe()};return z(function(t,d){c++,f||a||l();var v=i=null!=i?i:n();d.add(function(){0!==--c||f||a||(e=ft(h,s))}),v.subscribe(d),!r&&c>0&&(r=new E({next:function(t){return v.next(t)},error:function(t){f=!0,l(),e=ft(p,o,t),v.error(t)},complete:function(){a=!0,l(),e=ft(p,u),v.complete()}}),H(t).subscribe(r))})(t)}}({connector:function(){return new W(e,r,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:!1})}class pt{_state$;_actions$=new R;_reducers=[];constructor(t={}){const r="function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t));this._state$=new N(r);const n=this._actions$.pipe(at((t,r)=>{const n=JSON.parse(JSON.stringify(t));return this._reducers.forEach(({path:t,reducerFn:e})=>{const o=n[t],i=e(o,r);void 0!==i&&o!==i&&(n[t]=i)}),n},r),function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=M(t);return z(function(r,e){(n?ct(t,r,n):ct(t,r)).subscribe(e)})}(t),lt(1));n.subscribe(this._state$)}registerReducers(...t){this._reducers.push(...t);const r=this._state$.getValue(),n=JSON.parse(JSON.stringify(r));t.forEach(({path:t,initialState:r})=>{void 0===n[t]&&(n[t]=r)}),this._state$.next(n)}registerEffects(...t){t.forEach(t=>{const r=t._rxEffect||{dispatch:!0},n=t(this._actions$);r.dispatch?n.subscribe(this.dispatch.bind(this)):n.subscribe()})}dispatch(t){this._actions$.next(t)}select(t){return this._state$.pipe(ot(r=>t(r)),(void 0===n&&(n=A),r=null!=r?r:st,z(function(t,e){var o,i=!0;t.subscribe(k(e,function(t){var u=n(t);!i&&r(o,u)||(i=!1,o=u,e.next(t))}))})));var r,n}}function ht(t){const r=r=>({type:t,payload:r});return r.type=t,r}function dt(){}function vt(...t){const r=t.pop(),n=t,e=n.includes(dt);if(e&&n.length>1)throw new Error("The `anyAction` token cannot be mixed with other action creators in a single `on` handler.");return{types:n.map(t=>t.type),reducerFn:r,isCatchAll:e}}function bt(t,r,...n){if(!t||"string"!=typeof t)throw new Error("Reducer featureKey must be a non-empty string.");const e=n.filter(t=>!t.isCatchAll),o=n.find(t=>t.isCatchAll);return{path:t,initialState:r,reducerFn:(t=r,n)=>{for(const r of e)if(r.types.includes(n.type))return r.reducerFn(t,n);return o?o.reducerFn(t,n):t}}}function yt(...t){const r=t.map(t=>t.type);return n=t=>r.includes(t.type),z(function(t,r){var o=0;t.subscribe(k(r,function(t){return n.call(e,t,o++)&&r.next(t)}))});var n,e}function wt(t,r={dispatch:!0}){if("function"!=typeof t)throw new Error("Effect must be a function.");return Object.defineProperty(t,"_rxEffect",{value:{dispatch:!1!==r.dispatch},enumerable:!1}),t}function mt(t,r){return n=>{const e=n[t];return r?r(e):e}}function _t(...t){const r=t.pop(),n=t;if("function"!=typeof r)throw new Error("The last argument to createSelector must be a projection function.");return t=>{const e=n.map(r=>r(t));return r(...e)}}export{pt as Store,dt as anyAction,ht as createAction,wt as createEffect,mt as createFeatureSelector,bt as createReducer,_t as createSelector,yt as ofType,vt as on};
|
package/dist/zeppos.esm.js
CHANGED
|
@@ -1595,6 +1595,8 @@ function storePlugin(instance, store) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
1597
|
return {
|
|
1598
|
+
onInit() { console.log ('storePlugin.init()');},
|
|
1599
|
+
onCreate() { console.log ('storePlugin.create()');},
|
|
1598
1600
|
/**
|
|
1599
1601
|
* A proxy to the store's dispatch method. It injects the component's `this`
|
|
1600
1602
|
* context into the action, allowing effects to access other plugins.
|
package/dist/zeppos.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},t(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(t,n,r,e){return new(r||(r=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,c)}s((e=e.apply(t,n||[])).next())})}function e(t,n){var r,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(t,i)}catch(t){c=[6,t],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],e=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,o,i=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(t,n,r){if(r||2===arguments.length)for(var e,o=0,i=n.length;o<i;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(t,n||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(n){return Promise.resolve(n).then(t,a)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,n){o[t]&&(e[t]=function(n){return new Promise(function(r,e){i.push([t,n,r,e])>1||s(t,n)})},n&&(e[t]=n(e[t])))}function s(t,n){try{(r=o[t](n)).value instanceof c?Promise.resolve(r.value.v).then(l,a):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function l(t){s("next",t)}function a(t){s("throw",t)}function f(t,n){t(n),i.shift(),i.length&&s(i[0][0],i[0][1])}}function l(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t[Symbol.asyncIterator];return r?r.call(t):(t=o(t),n={},e("next"),e("throw"),e("return"),n[Symbol.asyncIterator]=function(){return this},n);function e(r){n[r]=t[r]&&function(n){return new Promise(function(e,o){(function(t,n,r,e){Promise.resolve(e).then(function(n){t({value:n,done:r})},n)})(e,o,(n=t[r](n)).done,n.value)})}}}function a(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var f,h=((f=function(t){return function(n){t(this),this.message=n?n.length+" errors occurred during unsubscription:\n"+n.map(function(t,n){return n+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=n}}(function(t){Error.call(t),t.stack=(new Error).stack})).prototype=Object.create(Error.prototype),f.prototype.constructor=f,f);function p(t,n){if(t){var r=t.indexOf(n);0<=r&&t.splice(r,1)}}var d=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var n;return t.prototype.unsubscribe=function(){var t,n,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var l=o(s),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(n){t={error:n}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(a(p))try{p()}catch(t){c=t instanceof h?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var b=o(d),y=b.next();!y.done;y=b.next()){var w=y.value;try{v(w)}catch(t){c=null!=c?c:[],t instanceof h?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){r={error:t}}finally{try{y&&!y.done&&(e=b.return)&&e.call(b)}finally{if(r)throw r.error}}}if(c)throw new h(c)}},t.prototype.add=function(n){var r;if(n&&n!==this)if(this.closed)v(n);else{if(n instanceof t){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(n)}},t.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},t.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},t.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&p(n,t)},t.prototype.remove=function(n){var r=this._finalizers;r&&p(r,n),n instanceof t&&n._removeParent(this)},t.EMPTY=((n=new t).closed=!0,n),t}();function b(t){return t instanceof d||t&&"closed"in t&&a(t.remove)&&a(t.add)&&a(t.unsubscribe)}function v(t){a(t)?t():t.unsubscribe()}d.EMPTY;var y={Promise:void 0},w=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,n],i(r)))};function m(t){w(function(){throw t})}function x(){}var _=function(t){function r(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,b(n)&&n.add(r)):r.destination=A,r}return n(r,t),r.create=function(t,n,r){return new S(t,n,r)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.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}(d),g=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(t){I(t)}},t.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(t){I(t)}else I(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){I(t)}},t}(),S=function(t){function r(n,r,e){var o,i=t.call(this)||this;return o=a(n)||!n?{next:null!=n?n:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:n,i.destination=new g(o),i}return n(r,t),r}(_);function I(t){m(t)}var A={closed:!0,next:x,error:function(t){throw t},complete:x},E="function"==typeof Symbol&&Symbol.observable||"@@observable";function P(t){return t}function O(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return j(t)}function j(t){return 0===t.length?P:1===t.length?t[0]:function(n){return t.reduce(function(t,n){return n(t)},n)}}var T=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(n){var r=new t;return r.source=this,r.operator=n,r},t.prototype.subscribe=function(t,n,r){var e,o=this,i=(e=t)&&e instanceof _||function(t){return t&&a(t.next)&&a(t.error)&&a(t.complete)}(e)&&b(e)?t:new S(t,n,r);return function(){var t=o,n=t.operator,r=t.source;i.add(n?n.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},t.prototype.forEach=function(t,n){var r=this;return new(n=k(n))(function(n,e){var o=new S({next:function(n){try{t(n)}catch(t){e(t),o.unsubscribe()}},error:e,complete:n});r.subscribe(o)})},t.prototype._subscribe=function(t){var n;return null===(n=this.source)||void 0===n?void 0:n.subscribe(t)},t.prototype[E]=function(){return this},t.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return j(t)(this)},t.prototype.toPromise=function(t){var n=this;return new(t=k(t))(function(t,r){var e;n.subscribe(function(t){return e=t},function(t){return r(t)},function(){return t(e)})})},t.create=function(n){return new t(n)},t}();function k(t){var n;return null!==(n=null!=t?t:y.Promise)&&void 0!==n?n:Promise}function z(t){return function(n){if(function(t){return a(null==t?void 0:t.lift)}(n))return n.lift(function(n){try{return t(n,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function U(t,n,r,e,o){return new C(t,n,r,e,o)}var C=function(t){function r(n,r,e,o,i,u){var c=t.call(this,n)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(t){try{r(t)}catch(t){n.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(r,t),r.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(n=this.onFinalize)||void 0===n||n.call(this))}},r}(_),Y=function(){return Date.now()},q=function(t){function r(n,r){return t.call(this)||this}return n(r,t),r.prototype.schedule=function(t,n){return this},r}(d),D=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setInterval.apply(void 0,u([t,n],i(r)))},F=function(t){return clearInterval(t)},R=function(t){function r(n,r){var e=t.call(this,n,r)||this;return e.scheduler=n,e.work=r,e.pending=!1,e}return n(r,t),r.prototype.schedule=function(t,n){var r;if(void 0===n&&(n=0),this.closed)return this;this.state=t;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,n)),this.pending=!0,this.delay=n,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,n),this},r.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),D(t.flush.bind(t,this),r)},r.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return n;null!=n&&F(n)},r.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,n);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(t,n){var r,e=!1;try{this.work(t)}catch(t){e=!0,r=t||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var n=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(e,this),null!=n&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},r}(q),L=function(){function t(n,r){void 0===r&&(r=t.now),this.schedulerActionCtor=n,this.now=r}return t.prototype.schedule=function(t,n,r){return void 0===n&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},t.now=Y,t}(),M=new(function(t){function r(n,r){void 0===r&&(r=L.now);var e=t.call(this,n,r)||this;return e.actions=[],e._active=!1,e}return n(r,t),r.prototype.flush=function(t){var n=this.actions;if(this._active)n.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=n.shift());if(this._active=!1,r){for(;t=n.shift();)t.unsubscribe();throw r}}},r}(L))(R),N=M,G=new T(function(t){return t.complete()});function Z(t){return t&&a(t.schedule)}function B(t){return t[t.length-1]}var H=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function J(t){return a(null==t?void 0:t.then)}function K(t){return a(t[E])}function Q(t){return Symbol.asyncIterator&&a(null==t?void 0:t[Symbol.asyncIterator])}function V(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var W="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function X(t){return a(null==t?void 0:t[W])}function $(t){return s(this,arguments,function(){var n,r,o;return e(this,function(e){switch(e.label){case 0:n=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(n.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function tt(t){return a(null==t?void 0:t.getReader)}function nt(t){if(t instanceof T)return t;if(null!=t){if(K(t))return i=t,new T(function(t){var n=i[E]();if(a(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(H(t))return e=t,new T(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()});if(J(t))return r=t,new T(function(t){r.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,m)});if(Q(t))return rt(t);if(X(t))return n=t,new T(function(t){var r,e;try{for(var i=o(n),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){r={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}t.complete()});if(tt(t))return rt($(t))}var n,r,e,i;throw V(t)}function rt(t){return new T(function(n){(function(t,n){var o,i,u,c;return r(this,void 0,void 0,function(){var r,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=l(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,n.next(r),n.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})})(t,n).catch(function(t){return n.error(t)})})}function et(t,n,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=n.schedule(function(){r(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function ot(t,n){return void 0===n&&(n=0),z(function(r,e){r.subscribe(U(e,function(r){return et(e,t,function(){return e.next(r)},n)},function(){return et(e,t,function(){return e.complete()},n)},function(r){return et(e,t,function(){return e.error(r)},n)}))})}function it(t,n){return void 0===n&&(n=0),z(function(r,e){e.add(t.schedule(function(){return r.subscribe(e)},n))})}function ut(t,n){if(!t)throw new Error("Iterable cannot be null");return new T(function(r){et(r,n,function(){var e=t[Symbol.asyncIterator]();et(r,n,function(){e.next().then(function(t){t.done?r.complete():r.next(t.value)})},0,!0)})})}function ct(t,n){if(null!=t){if(K(t))return function(t,n){return nt(t).pipe(it(n),ot(n))}(t,n);if(H(t))return function(t,n){return new T(function(r){var e=0;return n.schedule(function(){e===t.length?r.complete():(r.next(t[e++]),r.closed||this.schedule())})})}(t,n);if(J(t))return function(t,n){return nt(t).pipe(it(n),ot(n))}(t,n);if(Q(t))return ut(t,n);if(X(t))return function(t,n){return new T(function(r){var e;return et(r,n,function(){e=t[W](),et(r,n,function(){var t,n,o;try{n=(t=e.next()).value,o=t.done}catch(t){return void r.error(t)}o?r.complete():r.next(n)},0,!0)}),function(){return a(null==e?void 0:e.return)&&e.return()}})}(t,n);if(tt(t))return function(t,n){return ut($(t),n)}(t,n)}throw V(t)}function st(t,n){return n?ct(t,n):nt(t)}function lt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(t){return Z(B(t))?t.pop():void 0}(t);return st(t,r)}function at(t,n){return z(function(r,e){var o=0;r.subscribe(U(e,function(r){e.next(t.call(n,r,o++))}))})}function ft(t,n,r){return void 0===r&&(r=1/0),a(n)?ft(function(r,e){return at(function(t,o){return n(r,t,e,o)})(nt(t(r,e)))},r):("number"==typeof n&&(r=n),z(function(n,e){return function(t,n,r,e,o,i,u){var c=[],s=0,l=0,a=!1,f=function(){!a||c.length||s||n.complete()},h=function(t){s++;var o=!1;nt(r(t,l++)).subscribe(U(n,function(t){n.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||h(t)};c.length&&s<e;)t();f()}catch(t){n.error(t)}}))};return t.subscribe(U(n,function(t){return s<e?h(t):c.push(t)},function(){a=!0,f()})),function(){}}(n,e,t,r)}))}function ht(t){return new T(function(n){nt(t()).subscribe(n)})}function pt(t,n,r){void 0===t&&(t=0),void 0===r&&(r=N);var e=-1;return null!=n&&(Z(n)?r=n:e=n),new T(function(n){var o,i=(o=t)instanceof Date&&!isNaN(o)?+t-r.now():t;i<0&&(i=0);var u=0;return r.schedule(function(){n.closed||(n.next(u++),0<=e?this.schedule(void 0,e):n.complete())},i)})}function dt(t,n){return z(function(r,e){var o=0;r.subscribe(U(e,function(r){return t.call(n,r,o++)&&e.next(r)}))})}function bt(t){return z(function(n,r){var e,o=null,i=!1;o=n.subscribe(U(r,void 0,void 0,function(u){e=nt(t(u,bt(t)(n))),o?(o.unsubscribe(),o=null,e.subscribe(r)):i=!0})),i&&(o.unsubscribe(),o=null,e.subscribe(r))})}function vt(t,n){return a(n)?ft(t,n,1):ft(t,1)}function yt(t,n){return ft(function(n,r){return nt(t(n,r)).pipe((e=1)<=0?function(){return G}:z(function(t,n){var r=0;t.subscribe(U(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))}),function(t){return at(function(){return t})}(n));var e})}function wt(t,n){void 0===n&&(n=M);var r=pt(t,n);return yt(function(){return r})}function mt(t,n){return n?function(r){return r.pipe(mt(function(r,e){return nt(t(r,e)).pipe(at(function(t,o){return n(r,t,e,o)}))}))}:z(function(n,r){var e=0,o=null,i=!1;n.subscribe(U(r,function(n){o||(o=U(r,void 0,function(){o=null,i&&r.complete()}),nt(t(n,e++)).subscribe(o))},function(){i=!0,!o&&r.complete()}))})}function xt(t,n){return z(function(r,e){var o=null,i=0,u=!1,c=function(){return u&&!o&&e.complete()};r.subscribe(U(e,function(r){null==o||o.unsubscribe();var u=0,s=i++;nt(t(r,s)).subscribe(o=U(e,function(t){return e.next(n?n(r,t,s,u++):t)},function(){o=null,c()}))},function(){u=!0,c()}))})}function _t(t,n,r){var e=a(t)||n||r?{next:t,error:n,complete:r}:t;return e?z(function(t,n){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;t.subscribe(U(n,function(t){var r;null===(r=e.next)||void 0===r||r.call(e,t),n.next(t)},function(){var t;o=!1,null===(t=e.complete)||void 0===t||t.call(e),n.complete()},function(t){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,t),n.error(t)},function(){var t,n;o&&(null===(t=e.unsubscribe)||void 0===t||t.call(e)),null===(n=e.finalize)||void 0===n||n.call(e)}))}):P}function gt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r,e=a(B(r=t))?r.pop():void 0;return z(function(n,r){for(var o=t.length,c=new Array(o),s=t.map(function(){return!1}),l=!1,a=function(n){nt(t[n]).subscribe(U(r,function(t){c[n]=t,l||s[n]||(s[n]=!0,(l=s.every(P))&&(s=null))},x))},f=0;f<o;f++)a(f);n.subscribe(U(r,function(t){if(l){var n=u([t],i(c));r.next(e?e.apply(void 0,u([],i(n))):n)}}))})}const St=t=>n=>n.pipe(ft(n=>{if(!n.context||"function"!=typeof n.context.subscribe)throw new Error("[rx-tiny-flux] `withLatestFromStore` operator requires a `subscribe` method on `action.context`. Ensure you are using the `storePlugin` for ZeppOS.");return new T(r=>{const e=n.context.subscribe(t,t=>{r.next(t),r.complete()});return()=>{e.unsubscribe()}}).pipe(at(t=>[n,t]))})),It=()=>dt(()=>"undefined"!=typeof messaging),At=()=>dt(()=>"undefined"==typeof messaging),Et=()=>_t(t=>{if(t.context&&"function"==typeof t.context.call){const{context:n,...r}=t;t.context.call(r)}});function Pt(t,n){return n?{dispatch(t){const r={...t,context:this};n.dispatch(r)},subscribe(t,r){this._subscriptions||(this._subscriptions=[]);const e=n.select(t).subscribe(r);return this._subscriptions.push(e),e},onCall(t){t&&"string"==typeof t.type&&this.dispatch(t)},onDestroy(){this._subscriptions&&this._subscriptions.length>0&&(this._subscriptions.forEach(t=>t.unsubscribe()),this._subscriptions=[])}}:(console.error("[rx-tiny-flux] StorePlugin Error: Store instance was not provided on .use()"),{})}export{G as EMPTY,bt as catchError,vt as concatMap,ht as defer,wt as delay,mt as exhaustMap,dt as filter,st as from,At as isApp,It as isSideService,at as map,ft as mergeMap,lt as of,O as pipe,Et as propagateAction,Pt as storePlugin,xt as switchMap,_t as tap,gt as withLatestFrom,St as withLatestFromStore};
|
|
1
|
+
var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},t(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(t,n,r,e){return new(r||(r=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,c)}s((e=e.apply(t,n||[])).next())})}function e(t,n){var r,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(t,i)}catch(t){c=[6,t],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],e=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,o,i=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(t,n,r){if(r||2===arguments.length)for(var e,o=0,i=n.length;o<i;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(t,n||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(n){return Promise.resolve(n).then(t,a)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,n){o[t]&&(e[t]=function(n){return new Promise(function(r,e){i.push([t,n,r,e])>1||s(t,n)})},n&&(e[t]=n(e[t])))}function s(t,n){try{(r=o[t](n)).value instanceof c?Promise.resolve(r.value.v).then(l,a):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function l(t){s("next",t)}function a(t){s("throw",t)}function f(t,n){t(n),i.shift(),i.length&&s(i[0][0],i[0][1])}}function l(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t[Symbol.asyncIterator];return r?r.call(t):(t=o(t),n={},e("next"),e("throw"),e("return"),n[Symbol.asyncIterator]=function(){return this},n);function e(r){n[r]=t[r]&&function(n){return new Promise(function(e,o){(function(t,n,r,e){Promise.resolve(e).then(function(n){t({value:n,done:r})},n)})(e,o,(n=t[r](n)).done,n.value)})}}}function a(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var f,h=((f=function(t){return function(n){t(this),this.message=n?n.length+" errors occurred during unsubscription:\n"+n.map(function(t,n){return n+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=n}}(function(t){Error.call(t),t.stack=(new Error).stack})).prototype=Object.create(Error.prototype),f.prototype.constructor=f,f);function p(t,n){if(t){var r=t.indexOf(n);0<=r&&t.splice(r,1)}}var d=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var n;return t.prototype.unsubscribe=function(){var t,n,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var l=o(s),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(n){t={error:n}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(a(p))try{p()}catch(t){c=t instanceof h?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var b=o(d),y=b.next();!y.done;y=b.next()){var w=y.value;try{v(w)}catch(t){c=null!=c?c:[],t instanceof h?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){r={error:t}}finally{try{y&&!y.done&&(e=b.return)&&e.call(b)}finally{if(r)throw r.error}}}if(c)throw new h(c)}},t.prototype.add=function(n){var r;if(n&&n!==this)if(this.closed)v(n);else{if(n instanceof t){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(n)}},t.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},t.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},t.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&p(n,t)},t.prototype.remove=function(n){var r=this._finalizers;r&&p(r,n),n instanceof t&&n._removeParent(this)},t.EMPTY=((n=new t).closed=!0,n),t}();function b(t){return t instanceof d||t&&"closed"in t&&a(t.remove)&&a(t.add)&&a(t.unsubscribe)}function v(t){a(t)?t():t.unsubscribe()}d.EMPTY;var y={Promise:void 0},w=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,n],i(r)))};function m(t){w(function(){throw t})}function x(){}var _=function(t){function r(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,b(n)&&n.add(r)):r.destination=P,r}return n(r,t),r.create=function(t,n,r){return new S(t,n,r)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.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}(d),g=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(t){I(t)}},t.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(t){I(t)}else I(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){I(t)}},t}(),S=function(t){function r(n,r,e){var o,i=t.call(this)||this;return o=a(n)||!n?{next:null!=n?n:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:n,i.destination=new g(o),i}return n(r,t),r}(_);function I(t){m(t)}var P={closed:!0,next:x,error:function(t){throw t},complete:x},A="function"==typeof Symbol&&Symbol.observable||"@@observable";function E(t){return t}function O(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return j(t)}function j(t){return 0===t.length?E:1===t.length?t[0]:function(n){return t.reduce(function(t,n){return n(t)},n)}}var T=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(n){var r=new t;return r.source=this,r.operator=n,r},t.prototype.subscribe=function(t,n,r){var e,o=this,i=(e=t)&&e instanceof _||function(t){return t&&a(t.next)&&a(t.error)&&a(t.complete)}(e)&&b(e)?t:new S(t,n,r);return function(){var t=o,n=t.operator,r=t.source;i.add(n?n.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},t.prototype.forEach=function(t,n){var r=this;return new(n=k(n))(function(n,e){var o=new S({next:function(n){try{t(n)}catch(t){e(t),o.unsubscribe()}},error:e,complete:n});r.subscribe(o)})},t.prototype._subscribe=function(t){var n;return null===(n=this.source)||void 0===n?void 0:n.subscribe(t)},t.prototype[A]=function(){return this},t.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return j(t)(this)},t.prototype.toPromise=function(t){var n=this;return new(t=k(t))(function(t,r){var e;n.subscribe(function(t){return e=t},function(t){return r(t)},function(){return t(e)})})},t.create=function(n){return new t(n)},t}();function k(t){var n;return null!==(n=null!=t?t:y.Promise)&&void 0!==n?n:Promise}function z(t){return function(n){if(function(t){return a(null==t?void 0:t.lift)}(n))return n.lift(function(n){try{return t(n,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function C(t,n,r,e,o){return new U(t,n,r,e,o)}var U=function(t){function r(n,r,e,o,i,u){var c=t.call(this,n)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(t){try{r(t)}catch(t){n.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(r,t),r.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(n=this.onFinalize)||void 0===n||n.call(this))}},r}(_),Y=function(){return Date.now()},q=function(t){function r(n,r){return t.call(this)||this}return n(r,t),r.prototype.schedule=function(t,n){return this},r}(d),D=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setInterval.apply(void 0,u([t,n],i(r)))},F=function(t){return clearInterval(t)},R=function(t){function r(n,r){var e=t.call(this,n,r)||this;return e.scheduler=n,e.work=r,e.pending=!1,e}return n(r,t),r.prototype.schedule=function(t,n){var r;if(void 0===n&&(n=0),this.closed)return this;this.state=t;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,n)),this.pending=!0,this.delay=n,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,n),this},r.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),D(t.flush.bind(t,this),r)},r.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return n;null!=n&&F(n)},r.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,n);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(t,n){var r,e=!1;try{this.work(t)}catch(t){e=!0,r=t||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var n=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(e,this),null!=n&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},r}(q),L=function(){function t(n,r){void 0===r&&(r=t.now),this.schedulerActionCtor=n,this.now=r}return t.prototype.schedule=function(t,n,r){return void 0===n&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},t.now=Y,t}(),M=new(function(t){function r(n,r){void 0===r&&(r=L.now);var e=t.call(this,n,r)||this;return e.actions=[],e._active=!1,e}return n(r,t),r.prototype.flush=function(t){var n=this.actions;if(this._active)n.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=n.shift());if(this._active=!1,r){for(;t=n.shift();)t.unsubscribe();throw r}}},r}(L))(R),N=M,G=new T(function(t){return t.complete()});function Z(t){return t&&a(t.schedule)}function B(t){return t[t.length-1]}var H=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function J(t){return a(null==t?void 0:t.then)}function K(t){return a(t[A])}function Q(t){return Symbol.asyncIterator&&a(null==t?void 0:t[Symbol.asyncIterator])}function V(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var W="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function X(t){return a(null==t?void 0:t[W])}function $(t){return s(this,arguments,function(){var n,r,o;return e(this,function(e){switch(e.label){case 0:n=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(n.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function tt(t){return a(null==t?void 0:t.getReader)}function nt(t){if(t instanceof T)return t;if(null!=t){if(K(t))return i=t,new T(function(t){var n=i[A]();if(a(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(H(t))return e=t,new T(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()});if(J(t))return r=t,new T(function(t){r.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,m)});if(Q(t))return rt(t);if(X(t))return n=t,new T(function(t){var r,e;try{for(var i=o(n),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){r={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}t.complete()});if(tt(t))return rt($(t))}var n,r,e,i;throw V(t)}function rt(t){return new T(function(n){(function(t,n){var o,i,u,c;return r(this,void 0,void 0,function(){var r,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=l(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,n.next(r),n.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})})(t,n).catch(function(t){return n.error(t)})})}function et(t,n,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=n.schedule(function(){r(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function ot(t,n){return void 0===n&&(n=0),z(function(r,e){r.subscribe(C(e,function(r){return et(e,t,function(){return e.next(r)},n)},function(){return et(e,t,function(){return e.complete()},n)},function(r){return et(e,t,function(){return e.error(r)},n)}))})}function it(t,n){return void 0===n&&(n=0),z(function(r,e){e.add(t.schedule(function(){return r.subscribe(e)},n))})}function ut(t,n){if(!t)throw new Error("Iterable cannot be null");return new T(function(r){et(r,n,function(){var e=t[Symbol.asyncIterator]();et(r,n,function(){e.next().then(function(t){t.done?r.complete():r.next(t.value)})},0,!0)})})}function ct(t,n){if(null!=t){if(K(t))return function(t,n){return nt(t).pipe(it(n),ot(n))}(t,n);if(H(t))return function(t,n){return new T(function(r){var e=0;return n.schedule(function(){e===t.length?r.complete():(r.next(t[e++]),r.closed||this.schedule())})})}(t,n);if(J(t))return function(t,n){return nt(t).pipe(it(n),ot(n))}(t,n);if(Q(t))return ut(t,n);if(X(t))return function(t,n){return new T(function(r){var e;return et(r,n,function(){e=t[W](),et(r,n,function(){var t,n,o;try{n=(t=e.next()).value,o=t.done}catch(t){return void r.error(t)}o?r.complete():r.next(n)},0,!0)}),function(){return a(null==e?void 0:e.return)&&e.return()}})}(t,n);if(tt(t))return function(t,n){return ut($(t),n)}(t,n)}throw V(t)}function st(t,n){return n?ct(t,n):nt(t)}function lt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(t){return Z(B(t))?t.pop():void 0}(t);return st(t,r)}function at(t,n){return z(function(r,e){var o=0;r.subscribe(C(e,function(r){e.next(t.call(n,r,o++))}))})}function ft(t,n,r){return void 0===r&&(r=1/0),a(n)?ft(function(r,e){return at(function(t,o){return n(r,t,e,o)})(nt(t(r,e)))},r):("number"==typeof n&&(r=n),z(function(n,e){return function(t,n,r,e,o,i,u){var c=[],s=0,l=0,a=!1,f=function(){!a||c.length||s||n.complete()},h=function(t){s++;var o=!1;nt(r(t,l++)).subscribe(C(n,function(t){n.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||h(t)};c.length&&s<e;)t();f()}catch(t){n.error(t)}}))};return t.subscribe(C(n,function(t){return s<e?h(t):c.push(t)},function(){a=!0,f()})),function(){}}(n,e,t,r)}))}function ht(t){return new T(function(n){nt(t()).subscribe(n)})}function pt(t,n,r){void 0===t&&(t=0),void 0===r&&(r=N);var e=-1;return null!=n&&(Z(n)?r=n:e=n),new T(function(n){var o,i=(o=t)instanceof Date&&!isNaN(o)?+t-r.now():t;i<0&&(i=0);var u=0;return r.schedule(function(){n.closed||(n.next(u++),0<=e?this.schedule(void 0,e):n.complete())},i)})}function dt(t,n){return z(function(r,e){var o=0;r.subscribe(C(e,function(r){return t.call(n,r,o++)&&e.next(r)}))})}function bt(t){return z(function(n,r){var e,o=null,i=!1;o=n.subscribe(C(r,void 0,void 0,function(u){e=nt(t(u,bt(t)(n))),o?(o.unsubscribe(),o=null,e.subscribe(r)):i=!0})),i&&(o.unsubscribe(),o=null,e.subscribe(r))})}function vt(t,n){return a(n)?ft(t,n,1):ft(t,1)}function yt(t,n){return ft(function(n,r){return nt(t(n,r)).pipe((e=1)<=0?function(){return G}:z(function(t,n){var r=0;t.subscribe(C(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))}),function(t){return at(function(){return t})}(n));var e})}function wt(t,n){void 0===n&&(n=M);var r=pt(t,n);return yt(function(){return r})}function mt(t,n){return n?function(r){return r.pipe(mt(function(r,e){return nt(t(r,e)).pipe(at(function(t,o){return n(r,t,e,o)}))}))}:z(function(n,r){var e=0,o=null,i=!1;n.subscribe(C(r,function(n){o||(o=C(r,void 0,function(){o=null,i&&r.complete()}),nt(t(n,e++)).subscribe(o))},function(){i=!0,!o&&r.complete()}))})}function xt(t,n){return z(function(r,e){var o=null,i=0,u=!1,c=function(){return u&&!o&&e.complete()};r.subscribe(C(e,function(r){null==o||o.unsubscribe();var u=0,s=i++;nt(t(r,s)).subscribe(o=C(e,function(t){return e.next(n?n(r,t,s,u++):t)},function(){o=null,c()}))},function(){u=!0,c()}))})}function _t(t,n,r){var e=a(t)||n||r?{next:t,error:n,complete:r}:t;return e?z(function(t,n){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;t.subscribe(C(n,function(t){var r;null===(r=e.next)||void 0===r||r.call(e,t),n.next(t)},function(){var t;o=!1,null===(t=e.complete)||void 0===t||t.call(e),n.complete()},function(t){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,t),n.error(t)},function(){var t,n;o&&(null===(t=e.unsubscribe)||void 0===t||t.call(e)),null===(n=e.finalize)||void 0===n||n.call(e)}))}):E}function gt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r,e=a(B(r=t))?r.pop():void 0;return z(function(n,r){for(var o=t.length,c=new Array(o),s=t.map(function(){return!1}),l=!1,a=function(n){nt(t[n]).subscribe(C(r,function(t){c[n]=t,l||s[n]||(s[n]=!0,(l=s.every(E))&&(s=null))},x))},f=0;f<o;f++)a(f);n.subscribe(C(r,function(t){if(l){var n=u([t],i(c));r.next(e?e.apply(void 0,u([],i(n))):n)}}))})}const St=t=>n=>n.pipe(ft(n=>{if(!n.context||"function"!=typeof n.context.subscribe)throw new Error("[rx-tiny-flux] `withLatestFromStore` operator requires a `subscribe` method on `action.context`. Ensure you are using the `storePlugin` for ZeppOS.");return new T(r=>{const e=n.context.subscribe(t,t=>{r.next(t),r.complete()});return()=>{e.unsubscribe()}}).pipe(at(t=>[n,t]))})),It=()=>dt(()=>"undefined"!=typeof messaging),Pt=()=>dt(()=>"undefined"==typeof messaging),At=()=>_t(t=>{if(t.context&&"function"==typeof t.context.call){const{context:n,...r}=t;t.context.call(r)}});function Et(t,n){return n?{onInit(){console.log("storePlugin.init()")},onCreate(){console.log("storePlugin.create()")},dispatch(t){const r={...t,context:this};n.dispatch(r)},subscribe(t,r){this._subscriptions||(this._subscriptions=[]);const e=n.select(t).subscribe(r);return this._subscriptions.push(e),e},onCall(t){t&&"string"==typeof t.type&&this.dispatch(t)},onDestroy(){this._subscriptions&&this._subscriptions.length>0&&(this._subscriptions.forEach(t=>t.unsubscribe()),this._subscriptions=[])}}:(console.error("[rx-tiny-flux] StorePlugin Error: Store instance was not provided on .use()"),{})}export{G as EMPTY,bt as catchError,vt as concatMap,ht as defer,wt as delay,mt as exhaustMap,dt as filter,st as from,Pt as isApp,It as isSideService,at as map,ft as mergeMap,lt as of,O as pipe,At as propagateAction,Et as storePlugin,xt as switchMap,_t as tap,gt as withLatestFrom,St as withLatestFromStore};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rx-tiny-flux",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "A lightweight, minimalist state management library for pure JavaScript projects, inspired by NgRx and Redux, and built with RxJS.",
|
|
5
5
|
"author": "Bernardo Baumblatt <baumblatt@gmail.com>",
|
|
6
6
|
"license": "MIT",
|