var __extends=this&&this.__extends||function(){var e=function(t,r){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]};return e(t,r)};return function(t,r){if(typeof r!=="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();import{O as Observable,s as subscribeToArray,c as scheduleArray,d as async,S as Subscriber}from"./scheduleArray-b9669898.js";function isScheduler(e){return e&&typeof e.schedule==="function"}function fromArray(e,t){if(!t){return new Observable(subscribeToArray(e))}else{return scheduleArray(e,t)}}function of(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e[e.length-1];if(isScheduler(r)){e.pop();return scheduleArray(e,r)}else{return fromArray(e)}}function isDate(e){return e instanceof Date&&!isNaN(+e)}var EMPTY=new Observable((function(e){return e.complete()}));function empty(e){return e?emptyScheduled(e):EMPTY}function emptyScheduled(e){return new Observable((function(t){return e.schedule((function(){return t.complete()}))}))}function throwError(e,t){if(!t){return new Observable((function(t){return t.error(e)}))}else{return new Observable((function(r){return t.schedule(dispatch,0,{error:e,subscriber:r})}))}}function dispatch(e){var t=e.error,r=e.subscriber;r.error(t)}var NotificationKind;(function(e){e["NEXT"]="N";e["ERROR"]="E";e["COMPLETE"]="C"})(NotificationKind||(NotificationKind={}));var Notification=function(){function e(e,t,r){this.kind=e;this.value=t;this.error=r;this.hasValue=e==="N"}e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}};e.prototype.do=function(e,t,r){var n=this.kind;switch(n){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}};e.prototype.accept=function(e,t,r){if(e&&typeof e.next==="function"){return this.observe(e)}else{return this.do(e,t,r)}};e.prototype.toObservable=function(){var e=this.kind;switch(e){case"N":return of(this.value);case"E":return throwError(this.error);case"C":return empty()}throw new Error("unexpected notification kind value")};e.createNext=function(t){if(typeof t!=="undefined"){return new e("N",t)}return e.undefinedValueNotification};e.createError=function(t){return new e("E",undefined,t)};e.createComplete=function(){return e.completeNotification};return e}();Notification.completeNotification=new Notification("C");Notification.undefinedValueNotification=new Notification("N",undefined);function delay(e,t){if(t===void 0){t=async}var r=isDate(e);var n=r?+e-t.now():Math.abs(e);return function(e){return e.lift(new DelayOperator(n,t))}}var DelayOperator=function(){function e(e,t){this.delay=e;this.scheduler=t}e.prototype.call=function(e,t){return t.subscribe(new DelaySubscriber(e,this.delay,this.scheduler))};return e}();var DelaySubscriber=function(e){__extends(t,e);function t(t,r,n){var i=e.call(this,t)||this;i.delay=r;i.scheduler=n;i.queue=[];i.active=false;i.errored=false;return i}t.dispatch=function(e){var t=e.source;var r=t.queue;var n=e.scheduler;var i=e.destination;while(r.length>0&&r[0].time-n.now()<=0){r.shift().notification.observe(i)}if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(e,o)}else{this.unsubscribe();t.active=false}};t.prototype._schedule=function(e){this.active=true;var r=this.destination;r.add(e.schedule(t.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))};t.prototype.scheduleNotification=function(e){if(this.errored===true){return}var t=this.scheduler;var r=new DelayMessage(t.now()+this.delay,e);this.queue.push(r);if(this.active===false){this._schedule(t)}};t.prototype._next=function(e){this.scheduleNotification(Notification.createNext(e))};t.prototype._error=function(e){this.errored=true;this.queue=[];this.destination.error(e);this.unsubscribe()};t.prototype._complete=function(){this.scheduleNotification(Notification.createComplete());this.unsubscribe()};return t}(Subscriber);var DelayMessage=function(){function e(e,t){this.time=e;this.notification=t}return e}();export{Notification as N,delay as d,empty as e,isScheduler as i,of as o};