@blackglory/structures 0.10.10 → 0.10.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -231,10 +231,20 @@ class SparseMap<T> {
231
231
  get [Symbol.toStringTag](): string
232
232
  get size(): number
233
233
 
234
+ /**
235
+ * `SparseMap` cannot respond to any operations on the internal array,
236
+ * you must ensure that indexes accessed are less than the length of `SparseMap`.
237
+ *
238
+ * Keys do not correspond to indexes of the array.
239
+ */
240
+ get internalArray(): T[]
241
+
234
242
  entries(): IterableIterator<[key: number, value: T]>
235
243
  keys(): IterableIterator<number>
236
244
  values(): IterableIterator<T>
237
245
 
246
+ getInternalIndexOfKey(key: number): number | undefined
247
+
238
248
  has(key: number): boolean
239
249
  get(key: number): T | undefined
240
250
  set(key: number, value: T): void
@@ -251,7 +261,7 @@ class DynamicTypedArray<T extends TypedArrayConstructor> {
251
261
  readonly growthFactor: number
252
262
 
253
263
  /**
254
- * Note that `DynamicTypedArray` cannot respond to any operations on the internal array,
264
+ * `DynamicTypedArray` cannot respond to any operations on the internal array,
255
265
  * you must ensure that indexes accessed are less than the length of `DynamicTypedArray`.
256
266
  */
257
267
  get internalTypedArray(): TypedArrayOfConstructor<T>
@@ -294,12 +304,22 @@ class TypedSparseMap<T extends TypedArrayConstructor> {
294
304
  get [Symbol.toStringTag](): string
295
305
  get size(): number
296
306
 
307
+ /**
308
+ * `SparseMap` cannot respond to any operations on the internal array,
309
+ * you must ensure that indexes accessed are less than the length of `SparseMap`.
310
+ *
311
+ * Keys do not correspond to indexes of the array.
312
+ */
313
+ get internalTypedArray(): TypedArrayOfConstructor<T>
314
+
297
315
  constructor(array: DynamicTypedArray<T>)
298
316
 
299
317
  entries(): IterableIterator<[key: number, value: number]>
300
318
  keys(): IterableIterator<number>
301
319
  values(): IterableIterator<number>
302
320
 
321
+ getInternalIndexOfKey(key: number): number | undefined
322
+
303
323
  has(key: number): boolean
304
324
  get(key: number): T | undefined
305
325
  set(key: number, value: number): void
@@ -12,5 +12,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var ox=function(t,e){return(ox=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function ix(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}ox(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function ax(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sx(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function cx(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function ux(t){return"function"==typeof t}function lx(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var fx=lx((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function yx(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var dx=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=ax(i),s=a.next();!s.done;s=a.next()){s.value.remove(this)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else i.remove(this);var c=this.initialTeardown;if(ux(c))try{c()}catch(t){o=t instanceof fx?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=ax(u),f=l.next();!f.done;f=l.next()){var y=f.value;try{px(y)}catch(t){o=null!=o?o:[],t instanceof fx?o=cx(cx([],sx(o)),sx(t.errors)):o.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new fx(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)px(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&yx(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&yx(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),vx=dx.EMPTY;function hx(t){return t instanceof dx||t&&"closed"in t&&ux(t.remove)&&ux(t.add)&&ux(t.unsubscribe)}function px(t){ux(t)?t():t.unsubscribe()}var mx={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},bx=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,cx([t,e],sx(n)))};function gx(){}function wx(t){t()}var Ax=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,hx(e)&&e.add(n)):n.destination=Ex,n}return ix(e,t),e.create=function(t,e,n){return new Tx(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(dx),Ix=Function.prototype.bind;function Sx(t,e){return Ix.call(t,e)}var xx=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){_x(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){_x(t)}else _x(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){_x(t)}},t}(),Tx=function(t){function e(e,n,r){var o,i,a=t.call(this)||this;ux(e)||!e?o={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:a&&mx.useDeprecatedNextContext?((i=Object.create(e)).unsubscribe=function(){return a.unsubscribe()},o={next:e.next&&Sx(e.next,i),error:e.error&&Sx(e.error,i),complete:e.complete&&Sx(e.complete,i)}):o=e;return a.destination=new xx(o),a}return ix(e,t),e}(Ax);function _x(t){var e;e=t,bx((function(){throw e}))}var Ex={closed:!0,next:gx,error:function(t){throw t},complete:gx},Ox="function"==typeof Symbol&&Symbol.observable||"@@observable";function jx(t){return t}function Nx(t){return 0===t.length?jx:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var kx=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,o=this,i=(r=t)&&r instanceof Ax||function(t){return t&&ux(t.next)&&ux(t.error)&&ux(t.complete)}(r)&&hx(r)?t:new Tx(t,e,n);return wx((function(){var t=o,e=t.operator,n=t.source;i.add(e?e.call(i,n):n?o._subscribe(i):o._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=Bx(e))((function(e,r){var o=new Tx({next:function(e){try{t(e)}catch(t){r(t),o.unsubscribe()}},error:r,complete:e});n.subscribe(o)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[Ox]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Nx(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=Bx(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function Bx(t){var e;return null!==(e=null!=t?t:mx.Promise)&&void 0!==e?e:Promise}function Px(t){return ux(null==t?void 0:t.lift)}function qx(t,e,n,r,o){return new Cx(t,e,n,r,o)}var Cx=function(t){function e(e,n,r,o,i,a){var s=t.call(this,e)||this;return s.onFinalize=i,s.shouldUnsubscribe=a,s._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,s._error=o?function(t){try{o(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,s._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,s}return ix(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(Ax);function Rx(){return t=function(t,e){var n=null;t._refCount++;var r=qx(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)n=null;else{var r=t._connection,o=n;n=null,!r||o&&r!==o||r.unsubscribe(),e.unsubscribe()}}));t.subscribe(r),r.closed||(n=t.connect())},function(e){if(Px(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")};var t}!function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Px(e)&&(r.lift=e.lift),r}ix(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new dx;var n=this.getSubject();e.add(this.source.subscribe(qx(n,void 0,(function(){t._teardown(),n.complete()}),(function(e){t._teardown(),n.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=dx.EMPTY)}return e},e.prototype.refCount=function(){return Rx()(this)}}(kx);var zx,Ux,Dx={now:function(){return(Dx.delegate||performance).now()},delegate:void 0},Mx={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new dx((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Mx.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,cx([],sx(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,cx([],sx(t)))},delegate:void 0};Ux=Mx.schedule,new kx((function(t){var e=new dx,n=zx||Dx,r=n.now(),o=function(i){var a=n.now();t.next({timestamp:zx?a:i,elapsed:a-r}),t.closed||e.add(Ux(o))};return e.add(Ux(o)),e}));var Fx=lx((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Jx=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return ix(e,t),e.prototype.lift=function(t){var e=new Vx(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Fx},e.prototype.next=function(t){var e=this;wx((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var o=ax(e.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(t)}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;wx((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;wx((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,o=n.isStopped,i=n.observers;return r||o?vx:(this.currentObservers=null,i.push(t),new dx((function(){e.currentObservers=null,yx(i,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,o=e.isStopped;n?t.error(r):o&&t.complete()},e.prototype.asObservable=function(){var t=new kx;return t.source=this,t},e.create=function(t,e){return new Vx(t,e)},e}(kx),Vx=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return ix(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:vx},e}(Jx);!function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}ix(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(Jx);var Lx={now:function(){return(Lx.delegate||Date).now()},delegate:void 0};!function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Lx);var o=t.call(this)||this;return o._bufferSize=e,o._windowTime=n,o._timestampProvider=r,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,e),o._windowTime=Math.max(1,n),o}ix(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,a=n._timestampProvider,s=n._windowTime;r||(o.push(e),!i&&o.push(a.now()+s)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),o=0;o<r.length&&!t.closed;o+=n?1:2)t.next(r[o]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,o=t._infiniteTimeWindow,i=(o?1:2)*e;if(e<1/0&&i<r.length&&r.splice(0,r.length-i),!o){for(var a=n.now(),s=0,c=1;c<r.length&&r[c]<=a;c+=2)s=c;s&&r.splice(0,s+1)}}}(Jx),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}ix(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e._hasValue,o=e._value,i=e.thrownError,a=e.isStopped,s=e._isComplete;n?t.error(i):(a||s)&&(r&&t.next(o),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,n=e._hasValue,r=e._value;e._isComplete||(this._isComplete=!0,n&&t.prototype.next.call(this,r),t.prototype.complete.call(this))}}(Jx);var Kx,Wx=function(t){function e(e,n){return t.call(this)||this}return ix(e,t),e.prototype.schedule=function(t,e){return this},e}(dx),Yx=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,cx([t,e],sx(n)))},$x=function(t){return clearInterval(t)},Hx=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return ix(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),Yx(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;$x(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,yx(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Wx),Xx=1,Gx={};function Qx(t){return t in Gx&&(delete Gx[t],!0)}var Zx=function(t){var e=Xx++;return Gx[e]=!0,Kx||(Kx=Promise.resolve()),Kx.then((function(){return Qx(e)&&t()})),e},tT=function(t){Qx(t)},eT={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=eT.delegate;return((null==n?void 0:n.setImmediate)||Zx).apply(void 0,cx([],sx(t)))},clearImmediate:function(t){return tT(t)},delegate:void 0},nT=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return ix(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=eT.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);e.actions.some((function(t){return t.id===n}))||(eT.clearImmediate(n),e._scheduled=void 0)},e}(Hx),rT=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=Lx.now,t}(),oT=function(t){function e(e,n){void 0===n&&(n=rT.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return ix(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(rT);new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ix(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(oT))(nT),new oT(Hx);var iT=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return ix(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(Hx);new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ix(e,t),e}(oT))(iT);var aT=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return ix(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=Mx.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);e.actions.some((function(t){return t.id===n}))||(Mx.cancelAnimationFrame(n),e._scheduled=void 0)},e}(Hx);new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ix(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(oT))(aT),function(t){function e(e,n){void 0===e&&(e=cT),void 0===n&&(n=1/0);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}ix(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(oT);var sT,cT=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var o=t.call(this,e,n)||this;return o.scheduler=e,o.work=n,o.index=r,o.active=!0,o.index=e.index=r,o}return ix(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var o=new e(this.scheduler,this.work);return this.add(o),o.schedule(n,r)}return dx.EMPTY},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var o=t.actions;return o.push(this),o.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,n){},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(Hx);new kx((function(t){return t.complete()})),function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(sT||(sT={})),lx((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),lx((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),lx((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),lx((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}})),lx((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}})),new kx(gx);class uT extends nx{constructor(){super(...arguments),this.stateChanges=new Jx}get[Symbol.toStringTag](){return this.constructor.name}observeStateChanges(){return this.stateChanges}send(t){const e=this.state;super.send(t);const r=this.state;this.stateChanges.next({event:t,oldState:e,newState:r}),n.isEmptyObject(this.schema[r])&&this.stateChanges.complete()}}class lT{constructor(t=[]){this.indexToValue=[];const e=[];if(t.length>0)for(const[n,r]of t.entries())e[r]=n;this.valueToIndex=e}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.iterator](){return this.indexToValue[Symbol.iterator]()}values(){return this.indexToValue[Symbol.iterator]()}has(t){return t in this.valueToIndex}add(t){if(!this.has(t)){const e=this.indexToValue.length;this.indexToValue.push(t),this.valueToIndex[t]=e}}delete(t){if(this.has(t)){const e=this.indexToValue.pop();if(t===e)delete this.valueToIndex[t];else{const n=this.valueToIndex[t];this.indexToValue[n]=e,this.valueToIndex[e]=n,delete this.valueToIndex[t]}return!0}return!1}}class fT{constructor(){this.keyToIndex=[],this.indexToKey=[],this.indexToValue=[]}get[Symbol.toStringTag](){return this.constructor.name}get size(){return this.indexToKey.length}*entries(){for(let t=0;t<this.indexToKey.length;t++)yield[this.indexToKey[t],this.indexToValue[t]]}keys(){return this.indexToKey.values()}values(){return this.indexToValue.values()}has(t){return t in this.keyToIndex}get(t){if(this.has(t)){const e=this.keyToIndex[t];return this.indexToValue[e]}}set(t,e){if(this.has(t)){const n=this.keyToIndex[t];this.indexToValue[n]=e}else{const n=this.indexToKey.length;this.indexToKey.push(t),this.indexToValue.push(e),this.keyToIndex[t]=n}}delete(t){if(this.has(t)){const e=this.indexToKey.pop(),n=this.indexToValue.pop();if(t===e)delete this.keyToIndex[t];else{const r=this.keyToIndex[t];this.indexToKey[r]=e,this.indexToValue[r]=n,this.keyToIndex[t]=r,delete this.keyToIndex[t]}}}}class yT{constructor(t){this.keyToIndex=[],this.indexToKey=[],Mt.assert(0===t.length,"array should be empty"),this.indexToValue=t}get[Symbol.toStringTag](){return this.constructor.name}get size(){return this.indexToKey.length}*entries(){for(let t=0;t<this.indexToKey.length;t++)yield[this.indexToKey[t],this.indexToValue.internalTypedArray[t]]}keys(){return this.indexToKey.values()}*values(){for(let t=0;t<this.indexToKey.length;t++)yield this.indexToValue.internalTypedArray[t]}has(t){const e=this.keyToIndex[t];return this.indexToKey[e]===t}get(t){const e=this.keyToIndex[t];return this.indexToKey[e]===t?this.indexToValue.internalTypedArray[e]:void 0}set(t,e){const n=this.keyToIndex[t];if(this.indexToKey[n]===t)this.indexToValue.internalTypedArray[n]=e;else{const n=this.indexToKey.length;this.indexToKey.push(t),this.indexToValue.push(e),this.keyToIndex[t]=n}}delete(t){const e=this.keyToIndex[t];if(this.indexToKey[e]===t){const n=this.indexToKey.pop(),r=this.indexToValue.pop();t!==n&&(this.indexToKey[e]=n,this.indexToValue.internalTypedArray[e]=r,this.keyToIndex[n]=e)}}}class dT{constructor(t){const e=[];if(t.length>0)for(const[n,r]of t.internalTypedArray.entries())e[r]=n;this.indexToValue=t,this.valueToIndex=e}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.iterator](){return this.values()}*values(){for(let t=0;t<this.indexToValue.length;t++)yield this.indexToValue.internalTypedArray[t]}has(t){const e=this.valueToIndex[t];return this.indexToValue.internalTypedArray[e]===t}add(t){if(!this.has(t)){const e=this.indexToValue.length;this.indexToValue.push(t),this.valueToIndex[t]=e}}delete(t){const e=this.valueToIndex[t];if(this.indexToValue.internalTypedArray[e]===t){const n=this.indexToValue.pop();return t!==n&&(this.indexToValue.internalTypedArray[e]=n,this.valueToIndex[n]=e),!0}return!1}}class vT{constructor(t,{capacity:e=0,growthFactor:n=1.5}={}){this.typedArrayConstructor=t,this._length=0,Mt.assert(Number.isInteger(e),"capacity must be an integer"),Mt.assert(e>=0,"capacity must be greater than or equal to 0"),Mt.assert(n>=1,"growthFactory must be greater than or equal to 1"),this.array=new t(e),this.growthFactor=n}get internalTypedArray(){return this.array}get[Symbol.toStringTag](){return this.constructor.name}get capacity(){return this.array.length}get length(){return this._length}set(t,e){if(t>=this.capacity){const e=hT(this.capacity,t+1,this.growthFactor);this.resize(e)}t>=this._length&&(this._length=t+1),this.array[t]=e}get(t){return t<this._length?this.array[t]:void 0}push(...t){const e=this._length+t.length;if(e>this.capacity){const t=hT(this.capacity,e,this.growthFactor);this.resize(t)}for(const e of t)this.array[this._length++]=e}pop(){if(this._length>0){const t=this.array[this._length-1];this._length--;const e=hT(this.capacity,this.length,this.growthFactor);return this.resize(e),t}}sort(t){const e=this.capacity;this.resize(this.length),this.array.sort(t),this.resize(e)}resize(t){if(this.array.length!==t)if(this.array.length<t){const e=new this.typedArrayConstructor(t);e.set(this.array),this.array=e}else if(this.array.length>t){const e=new this.typedArrayConstructor(t);for(let n=t;n--;)e[n]=this.array[n];this.array=e}}}function hT(t,e,n){if(1===n)return e;if(t===e)return e;if(t<e){let r=Math.max(t,1);for(;r<e;)r*=n;return Math.floor(r)}if(0===e)return 0;{let r=t;for(;;){const t=r/n;if(t<e)break;r=t}return Math.floor(r)}}class pT{constructor(t){this.value=t,this.previous=null,this.next=null,this.up=null,this.down=null}}class mT{constructor(t){this.compare=t,this.head=new pT(null),this.tail=new pT(null),this.height=0,this._size=0,this.head.next=this.tail,this.tail.previous=this.head}get size(){return this._size}*elements(){let t=this.head;for(;t.down;)t=t.down;for(;t.next&&n.isntNull(t.next.value);)t=t.next,yield t}dumpList(){const t=[];let e=this.head;do{t.push([]);let n=e;do{t[t.length-1].push(n.value),n=n.next}while(n)}while(e=e.down);return t}delete(t){let e=this.findNode(t);for(;e;)e.previous.next=e.next,e.next.previous=e.previous,e=e.down;this._size--}has(t){return n.isntNull(this.findNode(t))}findNode(t){let e=this.head;for(;;){for(;e.next&&n.isntNull(e.next.value);){const n=this.compare(e.next.value,t);if(0===n)return e.next;if(!(n<0))break;e=e.next}if(!e.down)return null;e=e.down}}add(t){let e=this.findPreviousNode(t);if(e.next&&n.isntNull(e.next.value)&&0===this.compare(e.next.value,t))return;let r=new pT(t);e.next&&(r.next=e.next,e.next.previous=r),e.next=r,r.previous=e;let o=0;for(;Math.random()<.5;){if(o===this.height){const t=new pT(null),e=new pT(null);t.next=e,t.down=this.head,e.previous=t,e.down=this.tail,this.head.up=t,this.tail.up=e,this.head=t,this.tail=e,this.height++}for(;!e.up;)e=e.previous;e=e.up;const n=new pT(t);e.next&&(n.next=e.next,e.next.previous=n),e.next=n,n.previous=e,n.down=r,r.up=n,r=n,o++}this._size++}findPreviousNode(t){let e=this.head;for(;;){for(;e.next&&n.isntNull(e.next.value);){if(this.compare(e.next.value,t)>=0)break;e=e.next}if(!e.down)return e;e=e.down}}}class bT{constructor(t){this.skipList=new mT(t)}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.iterator](){return this.values()}values(){return pc.map(this.skipList.elements(),(t=>t.value))}has(t){return this.skipList.has(t)}add(t){this.skipList.add(t)}delete(t){this.skipList.delete(t)}}class gT{constructor(){this.array=new vT(Uint8Array),this.length=0}get[Symbol.toStringTag](){return this.constructor.name}get size(){return this.length}[Symbol.iterator](){return this.values()}*values(){if(this.length>0){const t=Math.ceil(this.length/gT.bitsPerElement),e=gT.bitsPerElement-(t*gT.bitsPerElement-this.length),n=t-1;for(let t=0;t<n;t++){const e=this.array.internalTypedArray[t];for(let n=0;n<gT.bitsPerElement;n++){const r=this.getMask(n);(e&r)===r&&(yield t*gT.bitsPerElement+n)}}const r=this.array.internalTypedArray[t-1];for(let t=0;t<e;t++){const e=this.getMask(t);(r&e)===e&&(yield n*gT.bitsPerElement+t)}}}_dumpBinaryStrings(){const t=[];for(let e=0;e<this.array.length;e++){const n=this.array.internalTypedArray[e].toString(2);n.length<gT.bitsPerElement?t.push("0".repeat(gT.bitsPerElement-n.length)+n):t.push(n)}return t}has(t){var e;const[n,r]=this.getPosition(t);return((null!==(e=this.array.get(n))&&void 0!==e?e:0)&r)===r}add(t){var e;Mt.assert(t>=0,"value must be greater than or equal to 0"),t>=this.length&&(this.length=t+1);const[n,r]=this.getPosition(t);this.array.set(n,(null!==(e=this.array.get(n))&&void 0!==e?e:0)|r)}delete(t){var e;const[n,r]=this.getPosition(t),o=null!==(e=this.array.get(n))&&void 0!==e?e:0;return this.array.set(n,o&~r),(o&r)===r}clear(){for(let t=this.array.length;t--;)this.array.set(t,0)}getPosition(t){const e=t%gT.bitsPerElement;return[(t-e)/gT.bitsPerElement,this.getMask(e)]}getMask(t){return Math.pow(2,t)}}gT.bitsPerElement=8*Uint8Array.BYTES_PER_ELEMENT;export{rx as BadEventError,gT as BitSet,t as Box,vT as DynamicTypedArray,Rt as Emitter,QS as ExpirableMap,nx as FiniteStateMachine,zt as HashMap,Ut as HashSet,GS as LRUMap,uT as ObservableFiniteStateMachine,Dt as Queue,bT as SortedSet,fT as SparseMap,lT as SparseSet,ZS as TLRUMap,ex as TrieMap,yT as TypedSparseMap,dT as TypedSparseSet,Ct as convertArrayToCons,qt as convertConsToArray};
15
+ ***************************************************************************** */var ox=function(t,e){return(ox=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function ix(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}ox(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function ax(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sx(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function cx(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function ux(t){return"function"==typeof t}function lx(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var fx=lx((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function yx(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var dx=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=ax(i),s=a.next();!s.done;s=a.next()){s.value.remove(this)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else i.remove(this);var c=this.initialTeardown;if(ux(c))try{c()}catch(t){o=t instanceof fx?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=ax(u),f=l.next();!f.done;f=l.next()){var y=f.value;try{px(y)}catch(t){o=null!=o?o:[],t instanceof fx?o=cx(cx([],sx(o)),sx(t.errors)):o.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new fx(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)px(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&yx(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&yx(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),vx=dx.EMPTY;function hx(t){return t instanceof dx||t&&"closed"in t&&ux(t.remove)&&ux(t.add)&&ux(t.unsubscribe)}function px(t){ux(t)?t():t.unsubscribe()}var mx={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},bx=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,cx([t,e],sx(n)))};function gx(){}function wx(t){t()}var Ax=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,hx(e)&&e.add(n)):n.destination=Ex,n}return ix(e,t),e.create=function(t,e,n){return new Tx(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(dx),Ix=Function.prototype.bind;function Sx(t,e){return Ix.call(t,e)}var xx=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){_x(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){_x(t)}else _x(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){_x(t)}},t}(),Tx=function(t){function e(e,n,r){var o,i,a=t.call(this)||this;ux(e)||!e?o={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:a&&mx.useDeprecatedNextContext?((i=Object.create(e)).unsubscribe=function(){return a.unsubscribe()},o={next:e.next&&Sx(e.next,i),error:e.error&&Sx(e.error,i),complete:e.complete&&Sx(e.complete,i)}):o=e;return a.destination=new xx(o),a}return ix(e,t),e}(Ax);function _x(t){var e;e=t,bx((function(){throw e}))}var Ex={closed:!0,next:gx,error:function(t){throw t},complete:gx},Ox="function"==typeof Symbol&&Symbol.observable||"@@observable";function jx(t){return t}function Nx(t){return 0===t.length?jx:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var kx=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,o=this,i=(r=t)&&r instanceof Ax||function(t){return t&&ux(t.next)&&ux(t.error)&&ux(t.complete)}(r)&&hx(r)?t:new Tx(t,e,n);return wx((function(){var t=o,e=t.operator,n=t.source;i.add(e?e.call(i,n):n?o._subscribe(i):o._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=Bx(e))((function(e,r){var o=new Tx({next:function(e){try{t(e)}catch(t){r(t),o.unsubscribe()}},error:r,complete:e});n.subscribe(o)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[Ox]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Nx(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=Bx(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function Bx(t){var e;return null!==(e=null!=t?t:mx.Promise)&&void 0!==e?e:Promise}function Px(t){return ux(null==t?void 0:t.lift)}function qx(t,e,n,r,o){return new Cx(t,e,n,r,o)}var Cx=function(t){function e(e,n,r,o,i,a){var s=t.call(this,e)||this;return s.onFinalize=i,s.shouldUnsubscribe=a,s._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,s._error=o?function(t){try{o(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,s._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,s}return ix(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(Ax);function Rx(){return t=function(t,e){var n=null;t._refCount++;var r=qx(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)n=null;else{var r=t._connection,o=n;n=null,!r||o&&r!==o||r.unsubscribe(),e.unsubscribe()}}));t.subscribe(r),r.closed||(n=t.connect())},function(e){if(Px(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")};var t}!function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Px(e)&&(r.lift=e.lift),r}ix(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new dx;var n=this.getSubject();e.add(this.source.subscribe(qx(n,void 0,(function(){t._teardown(),n.complete()}),(function(e){t._teardown(),n.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=dx.EMPTY)}return e},e.prototype.refCount=function(){return Rx()(this)}}(kx);var zx,Ux,Dx={now:function(){return(Dx.delegate||performance).now()},delegate:void 0},Mx={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new dx((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Mx.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,cx([],sx(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,cx([],sx(t)))},delegate:void 0};Ux=Mx.schedule,new kx((function(t){var e=new dx,n=zx||Dx,r=n.now(),o=function(i){var a=n.now();t.next({timestamp:zx?a:i,elapsed:a-r}),t.closed||e.add(Ux(o))};return e.add(Ux(o)),e}));var Fx=lx((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Jx=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return ix(e,t),e.prototype.lift=function(t){var e=new Vx(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Fx},e.prototype.next=function(t){var e=this;wx((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var o=ax(e.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(t)}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;wx((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;wx((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,o=n.isStopped,i=n.observers;return r||o?vx:(this.currentObservers=null,i.push(t),new dx((function(){e.currentObservers=null,yx(i,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,o=e.isStopped;n?t.error(r):o&&t.complete()},e.prototype.asObservable=function(){var t=new kx;return t.source=this,t},e.create=function(t,e){return new Vx(t,e)},e}(kx),Vx=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return ix(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:vx},e}(Jx);!function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}ix(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(Jx);var Lx={now:function(){return(Lx.delegate||Date).now()},delegate:void 0};!function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Lx);var o=t.call(this)||this;return o._bufferSize=e,o._windowTime=n,o._timestampProvider=r,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,e),o._windowTime=Math.max(1,n),o}ix(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,a=n._timestampProvider,s=n._windowTime;r||(o.push(e),!i&&o.push(a.now()+s)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),o=0;o<r.length&&!t.closed;o+=n?1:2)t.next(r[o]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,o=t._infiniteTimeWindow,i=(o?1:2)*e;if(e<1/0&&i<r.length&&r.splice(0,r.length-i),!o){for(var a=n.now(),s=0,c=1;c<r.length&&r[c]<=a;c+=2)s=c;s&&r.splice(0,s+1)}}}(Jx),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}ix(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e._hasValue,o=e._value,i=e.thrownError,a=e.isStopped,s=e._isComplete;n?t.error(i):(a||s)&&(r&&t.next(o),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,n=e._hasValue,r=e._value;e._isComplete||(this._isComplete=!0,n&&t.prototype.next.call(this,r),t.prototype.complete.call(this))}}(Jx);var Kx,Wx=function(t){function e(e,n){return t.call(this)||this}return ix(e,t),e.prototype.schedule=function(t,e){return this},e}(dx),Yx=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,cx([t,e],sx(n)))},$x=function(t){return clearInterval(t)},Hx=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return ix(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),Yx(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;$x(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,yx(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Wx),Xx=1,Gx={};function Qx(t){return t in Gx&&(delete Gx[t],!0)}var Zx=function(t){var e=Xx++;return Gx[e]=!0,Kx||(Kx=Promise.resolve()),Kx.then((function(){return Qx(e)&&t()})),e},tT=function(t){Qx(t)},eT={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=eT.delegate;return((null==n?void 0:n.setImmediate)||Zx).apply(void 0,cx([],sx(t)))},clearImmediate:function(t){return tT(t)},delegate:void 0},nT=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return ix(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=eT.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);e.actions.some((function(t){return t.id===n}))||(eT.clearImmediate(n),e._scheduled=void 0)},e}(Hx),rT=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=Lx.now,t}(),oT=function(t){function e(e,n){void 0===n&&(n=rT.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return ix(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(rT);new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ix(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(oT))(nT),new oT(Hx);var iT=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return ix(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(Hx);new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ix(e,t),e}(oT))(iT);var aT=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return ix(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=Mx.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);e.actions.some((function(t){return t.id===n}))||(Mx.cancelAnimationFrame(n),e._scheduled=void 0)},e}(Hx);new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ix(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(oT))(aT),function(t){function e(e,n){void 0===e&&(e=cT),void 0===n&&(n=1/0);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}ix(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(oT);var sT,cT=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var o=t.call(this,e,n)||this;return o.scheduler=e,o.work=n,o.index=r,o.active=!0,o.index=e.index=r,o}return ix(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var o=new e(this.scheduler,this.work);return this.add(o),o.schedule(n,r)}return dx.EMPTY},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var o=t.actions;return o.push(this),o.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,n){},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(Hx);new kx((function(t){return t.complete()})),function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(sT||(sT={})),lx((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),lx((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),lx((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),lx((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}})),lx((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}})),new kx(gx);class uT extends nx{constructor(){super(...arguments),this.stateChanges=new Jx}get[Symbol.toStringTag](){return this.constructor.name}observeStateChanges(){return this.stateChanges}send(t){const e=this.state;super.send(t);const r=this.state;this.stateChanges.next({event:t,oldState:e,newState:r}),n.isEmptyObject(this.schema[r])&&this.stateChanges.complete()}}class lT{constructor(t=[]){this.indexToValue=[];const e=[];if(t.length>0)for(const[n,r]of t.entries())e[r]=n;this.valueToIndex=e}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.iterator](){return this.indexToValue[Symbol.iterator]()}values(){return this.indexToValue[Symbol.iterator]()}has(t){return t in this.valueToIndex}add(t){if(!this.has(t)){const e=this.indexToValue.length;this.indexToValue.push(t),this.valueToIndex[t]=e}}delete(t){if(this.has(t)){const e=this.indexToValue.pop();if(t===e)delete this.valueToIndex[t];else{const n=this.valueToIndex[t];this.indexToValue[n]=e,this.valueToIndex[e]=n,delete this.valueToIndex[t]}return!0}return!1}}class fT{constructor(){this.keyToIndex=[],this.indexToKey=[],this.indexToValue=[]}get[Symbol.toStringTag](){return this.constructor.name}get size(){return this.indexToKey.length}get internalArray(){return this.indexToValue}*entries(){for(let t=0;t<this.indexToKey.length;t++)yield[this.indexToKey[t],this.indexToValue[t]]}keys(){return this.indexToKey.values()}values(){return this.indexToValue.values()}getInternalIndexOfKey(t){return this.keyToIndex[t]}has(t){return t in this.keyToIndex}get(t){if(this.has(t)){const e=this.keyToIndex[t];return this.indexToValue[e]}}set(t,e){if(this.has(t)){const n=this.keyToIndex[t];this.indexToValue[n]=e}else{const n=this.indexToKey.length;this.indexToKey.push(t),this.indexToValue.push(e),this.keyToIndex[t]=n}}delete(t){if(this.has(t)){const e=this.indexToKey.pop(),n=this.indexToValue.pop();if(t===e)delete this.keyToIndex[t];else{const r=this.keyToIndex[t];this.indexToKey[r]=e,this.indexToValue[r]=n,this.keyToIndex[e]=r,delete this.keyToIndex[t]}}}}class yT{constructor(t){this.keyToIndex=[],this.indexToKey=[],Mt.assert(0===t.length,"array should be empty"),this.indexToValue=t}get[Symbol.toStringTag](){return this.constructor.name}get size(){return this.indexToKey.length}get internalTypedArray(){return this.indexToValue.internalTypedArray}*entries(){for(let t=0;t<this.indexToKey.length;t++)yield[this.indexToKey[t],this.indexToValue.internalTypedArray[t]]}keys(){return this.indexToKey.values()}*values(){for(let t=0;t<this.indexToKey.length;t++)yield this.indexToValue.internalTypedArray[t]}getInternalIndexOfKey(t){return this.keyToIndex[t]}has(t){const e=this.keyToIndex[t];return this.indexToKey[e]===t}get(t){const e=this.keyToIndex[t];return this.indexToKey[e]===t?this.indexToValue.internalTypedArray[e]:void 0}set(t,e){const n=this.keyToIndex[t];if(this.indexToKey[n]===t)this.indexToValue.internalTypedArray[n]=e;else{const n=this.indexToKey.length;this.indexToKey.push(t),this.indexToValue.push(e),this.keyToIndex[t]=n}}delete(t){const e=this.keyToIndex[t];if(this.indexToKey[e]===t){const n=this.indexToKey.pop(),r=this.indexToValue.pop();t!==n&&(this.indexToKey[e]=n,this.indexToValue.internalTypedArray[e]=r,this.keyToIndex[n]=e)}}}class dT{constructor(t){const e=[];if(t.length>0)for(const[n,r]of t.internalTypedArray.entries())e[r]=n;this.indexToValue=t,this.valueToIndex=e}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.iterator](){return this.values()}*values(){for(let t=0;t<this.indexToValue.length;t++)yield this.indexToValue.internalTypedArray[t]}has(t){const e=this.valueToIndex[t];return this.indexToValue.internalTypedArray[e]===t}add(t){if(!this.has(t)){const e=this.indexToValue.length;this.indexToValue.push(t),this.valueToIndex[t]=e}}delete(t){const e=this.valueToIndex[t];if(this.indexToValue.internalTypedArray[e]===t){const n=this.indexToValue.pop();return t!==n&&(this.indexToValue.internalTypedArray[e]=n,this.valueToIndex[n]=e),!0}return!1}}class vT{constructor(t,{capacity:e=0,growthFactor:n=1.5}={}){this.typedArrayConstructor=t,this._length=0,Mt.assert(Number.isInteger(e),"capacity must be an integer"),Mt.assert(e>=0,"capacity must be greater than or equal to 0"),Mt.assert(n>=1,"growthFactory must be greater than or equal to 1"),this.array=new t(e),this.growthFactor=n}get internalTypedArray(){return this.array}get[Symbol.toStringTag](){return this.constructor.name}get capacity(){return this.array.length}get length(){return this._length}set(t,e){if(t>=this.capacity){const e=hT(this.capacity,t+1,this.growthFactor);this.resize(e)}t>=this._length&&(this._length=t+1),this.array[t]=e}get(t){return t<this._length?this.array[t]:void 0}push(...t){const e=this._length+t.length;if(e>this.capacity){const t=hT(this.capacity,e,this.growthFactor);this.resize(t)}for(const e of t)this.array[this._length++]=e}pop(){if(this._length>0){const t=this.array[this._length-1];this._length--;const e=hT(this.capacity,this.length,this.growthFactor);return this.resize(e),t}}sort(t){const e=this.capacity;this.resize(this.length),this.array.sort(t),this.resize(e)}resize(t){if(this.array.length!==t)if(this.array.length<t){const e=new this.typedArrayConstructor(t);e.set(this.array),this.array=e}else if(this.array.length>t){const e=new this.typedArrayConstructor(t);for(let n=t;n--;)e[n]=this.array[n];this.array=e}}}function hT(t,e,n){if(1===n)return e;if(t===e)return e;if(t<e){let r=Math.max(t,1);for(;r<e;)r*=n;return Math.floor(r)}if(0===e)return 0;{let r=t;for(;;){const t=r/n;if(t<e)break;r=t}return Math.floor(r)}}class pT{constructor(t){this.value=t,this.previous=null,this.next=null,this.up=null,this.down=null}}class mT{constructor(t){this.compare=t,this.head=new pT(null),this.tail=new pT(null),this.height=0,this._size=0,this.head.next=this.tail,this.tail.previous=this.head}get size(){return this._size}*elements(){let t=this.head;for(;t.down;)t=t.down;for(;t.next&&n.isntNull(t.next.value);)t=t.next,yield t}dumpList(){const t=[];let e=this.head;do{t.push([]);let n=e;do{t[t.length-1].push(n.value),n=n.next}while(n)}while(e=e.down);return t}delete(t){let e=this.findNode(t);for(;e;)e.previous.next=e.next,e.next.previous=e.previous,e=e.down;this._size--}has(t){return n.isntNull(this.findNode(t))}findNode(t){let e=this.head;for(;;){for(;e.next&&n.isntNull(e.next.value);){const n=this.compare(e.next.value,t);if(0===n)return e.next;if(!(n<0))break;e=e.next}if(!e.down)return null;e=e.down}}add(t){let e=this.findPreviousNode(t);if(e.next&&n.isntNull(e.next.value)&&0===this.compare(e.next.value,t))return;let r=new pT(t);e.next&&(r.next=e.next,e.next.previous=r),e.next=r,r.previous=e;let o=0;for(;Math.random()<.5;){if(o===this.height){const t=new pT(null),e=new pT(null);t.next=e,t.down=this.head,e.previous=t,e.down=this.tail,this.head.up=t,this.tail.up=e,this.head=t,this.tail=e,this.height++}for(;!e.up;)e=e.previous;e=e.up;const n=new pT(t);e.next&&(n.next=e.next,e.next.previous=n),e.next=n,n.previous=e,n.down=r,r.up=n,r=n,o++}this._size++}findPreviousNode(t){let e=this.head;for(;;){for(;e.next&&n.isntNull(e.next.value);){if(this.compare(e.next.value,t)>=0)break;e=e.next}if(!e.down)return e;e=e.down}}}class bT{constructor(t){this.skipList=new mT(t)}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.iterator](){return this.values()}values(){return pc.map(this.skipList.elements(),(t=>t.value))}has(t){return this.skipList.has(t)}add(t){this.skipList.add(t)}delete(t){this.skipList.delete(t)}}class gT{constructor(){this.array=new vT(Uint8Array),this.length=0}get[Symbol.toStringTag](){return this.constructor.name}get size(){return this.length}[Symbol.iterator](){return this.values()}*values(){if(this.length>0){const t=Math.ceil(this.length/gT.bitsPerElement),e=gT.bitsPerElement-(t*gT.bitsPerElement-this.length),n=t-1;for(let t=0;t<n;t++){const e=this.array.internalTypedArray[t];for(let n=0;n<gT.bitsPerElement;n++){const r=this.getMask(n);(e&r)===r&&(yield t*gT.bitsPerElement+n)}}const r=this.array.internalTypedArray[t-1];for(let t=0;t<e;t++){const e=this.getMask(t);(r&e)===e&&(yield n*gT.bitsPerElement+t)}}}_dumpBinaryStrings(){const t=[];for(let e=0;e<this.array.length;e++){const n=this.array.internalTypedArray[e].toString(2);n.length<gT.bitsPerElement?t.push("0".repeat(gT.bitsPerElement-n.length)+n):t.push(n)}return t}has(t){var e;const[n,r]=this.getPosition(t);return((null!==(e=this.array.get(n))&&void 0!==e?e:0)&r)===r}add(t){var e;Mt.assert(t>=0,"value must be greater than or equal to 0"),t>=this.length&&(this.length=t+1);const[n,r]=this.getPosition(t);this.array.set(n,(null!==(e=this.array.get(n))&&void 0!==e?e:0)|r)}delete(t){var e;const[n,r]=this.getPosition(t),o=null!==(e=this.array.get(n))&&void 0!==e?e:0;return this.array.set(n,o&~r),(o&r)===r}clear(){for(let t=this.array.length;t--;)this.array.set(t,0)}getPosition(t){const e=t%gT.bitsPerElement;return[(t-e)/gT.bitsPerElement,this.getMask(e)]}getMask(t){return Math.pow(2,t)}}gT.bitsPerElement=8*Uint8Array.BYTES_PER_ELEMENT;export{rx as BadEventError,gT as BitSet,t as Box,vT as DynamicTypedArray,Rt as Emitter,QS as ExpirableMap,nx as FiniteStateMachine,zt as HashMap,Ut as HashSet,GS as LRUMap,uT as ObservableFiniteStateMachine,Dt as Queue,bT as SortedSet,fT as SparseMap,lT as SparseSet,ZS as TLRUMap,ex as TrieMap,yT as TypedSparseMap,dT as TypedSparseSet,Ct as convertArrayToCons,qt as convertConsToArray};
16
16
  //# sourceMappingURL=index.min.mjs.map