UNPKG

hy-push-state

Version:

Turn static web sites into dynamic web apps

33 lines (31 loc) 103 kB
/*! * Copyright (c) 2018 Florian Klampfer <https://qwtel.com/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("hyPushState",[],e):"object"==typeof exports?exports.hyPushState=e():t.hyPushState=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=4)}([function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return i}));var n="undefined"!=typeof window&&window,o="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,i=n||void 0!==t&&t||o}).call(this,r(3))},,,function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}t.exports=n},function(t,e,r){"use strict";r.r(e);var n="undefined"!=typeof Set&&1===new Set([1]).size?Set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(t=t.filter((function(e,r){return r===t.indexOf(e)}))).size=t.length,t.has=function(e){return t.indexOf(e)>-1},t.add=function(e){return t.has(e)||(t.size++,t.push(e)),t},t.delete=function(e){var r;return(r=t.has(e))&&(t.size--,t.splice(t.indexOf(e),1)),r},t.clear=function(){for(;t.pop(););t.size=0},t};function o(t,e){return t?t(e):e}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return t.replace(/([a-z\d])([A-Z])/g,"$1".concat(e,"$2")).replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1".concat(e,"$2")).toLowerCase()}function u(t){for(var e=t,r=!1,n=!1,o=!1,i=0;i<e.length;i++){var u=e.charAt(i);r&&/[a-zA-Z]/.test(u)&&u.toUpperCase()===u?(e="".concat(e.substr(0,i),"-").concat(e.substr(i)),r=!1,o=n,n=!0,i++):n&&o&&/[a-zA-Z]/.test(u)&&u.toLowerCase()===u?(e="".concat(e.substr(0,i-1),"-").concat(e.substr(i-1)),o=n,n=!1,r=!0):(r=u.toLowerCase()===u,o=n,n=u.toUpperCase()===u)}return e}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),t}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=y(t);if(e){var o=y(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}function h(t,e){return!e||"object"!==c(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var d=new n(["customevent"]),v=Symbol||function(t){return"_".concat(t)},m=v("sroot"),w=v("state");window.process=window.process||{},window.process.env=window.process.env||{},window.requestIdleCallback=window.requestIdleCallback||function(t){return window.setTimeout(t,0)},window.cancelIdleCallback=window.cancelIdleCallback||window.clearTimeout;var g=function t(){b(this,t)};function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e,r){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=T(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function O(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function j(t,e,r){return e&&O(t.prototype,e),r&&O(t,r),t}function x(t,e){return(x=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T(t);if(e){var o=T(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return P(this,r)}}function P(t,e){return!e||"object"!==S(e)&&"function"!=typeof e?k(t):e}function k(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(t){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}new n([].concat(function(t){if(Array.isArray(t))return A(t)}(C=d)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(C)||function(t,e){if(t){if("string"==typeof t)return A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(t,e):void 0}}(C)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),["template","customelements"]));var C,I=null,L=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&x(t,e)}(r,t);var e=R(r);function r(){var t;_(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return(t=e.call.apply(e,[this].concat(o))).setupComponent(k(t),t.getStateFromAttributes()),t}return j(r,null,[{key:"getObservedAttributes",value:function(){var t=this.types;return Object.keys(t).map((function(t){return i(t)}))}}]),j(r,[{key:"reflectAttribute",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=i(t);r&&(I=n);var o=this.constructor.types,u=o[t];var c=u.stringify(e);null==c?this.removeAttribute(n):this.setAttribute(n,c)}},{key:"getStateFromAttributes",value:function(){var t=this,e=this.constructor.types,r={};return Object.keys(e).forEach((function(n){var u=i(n),c=t.hasAttribute(u)?t.getAttribute(u):null,s=o(e[n],c);null!=s&&(r[n]=s)})),r}},{key:"connectedCallback",value:function(){this.connectComponent()}},{key:"disconnectedCallback",value:function(){this.disconnectComponent()}},{key:"adoptedCallback",value:function(){this.adoptComponent()}},{key:"attributeChangedCallback",value:function(t,e,r){if(I===t)I=null;else if(e!==r){var n=this.constructor.types,i=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=[].map.call(e,(function(t){return t.trim()})).filter((function(t){return t.length})).join("-");return 0===n.length?"":1===n.length?n.toLowerCase():(n=u(n)).replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(t,e){return e.toUpperCase()}))}(t),c=o(n[i],r);this[i]=null!=c?c:this.constructor.defaults[i]}}},{key:"setInternalState",value:function(t,e){E(T(r.prototype),"setInternalState",this).call(this,t,e),this.reflectAttribute(t,e,!0)}},{key:"setupShadowDOM",value:function(t){var e=this.getTemplate();if(e){if("attachShadow"in Element.prototype)return t.attachShadow({mode:"open"}),t.shadowRoot.appendChild(e),t.shadowRoot;throw Error("ShadowDOM API not supported")}return t}},{key:"getEl",value:function(){return this}},{key:"getTemplate",value:function(){var t=this.constructor.componentName;return document.querySelector('link[href*="'.concat(t,'"]')).import.querySelector("#".concat(t,"-template")).content.cloneNode(!0)}},{key:"template",get:function(){return this.getTemplate()}}]),r}(t)};function N(){var t="function"==typeof window.HTMLElement?window.HTMLElement:function(){};return Reflect.construct(t,[],this.__proto__.constructor)}Object.setPrototypeOf&&(Object.setPrototypeOf(N.prototype,HTMLElement.prototype),Object.setPrototypeOf(N,HTMLElement)); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var D=function(t,e){return(D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function q(t,e){function r(){this.constructor=t}D(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function M(t){return"function"==typeof t}var U=!1,H={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;U=t},get useDeprecatedSynchronousErrorHandling(){return U}};function V(t){setTimeout((function(){throw t}),0)}var F={closed:!0,next:function(t){},error:function(t){if(H.useDeprecatedSynchronousErrorHandling)throw t;V(t)},complete:function(){}},$=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function X(t){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function W(t){return null!==t&&"object"===X(t)}var Y=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();function z(t){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var B=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this._parentOrParents,n=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof t)r.remove(this);else if(null!==r)for(var i=0;i<r.length;++i){r[i].remove(this)}if(M(n))try{n.call(this)}catch(t){e=t instanceof Y?G(t.errors):[t]}if($(o)){i=-1;for(var u=o.length;++i<u;){var c=o[i];if(W(c))try{c.unsubscribe()}catch(t){e=e||[],t instanceof Y?e=e.concat(G(t.errors)):e.push(t)}}}if(e)throw new Y(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(z(e)){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function G(t){return t.reduce((function(t,e){return t.concat(e instanceof Y?e.errors:e)}),[])}var K=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}();function Z(t){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var J=function(t){function e(r,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=F;break;case 1:if(!r){i.destination=F;break}if("object"===Z(r)){r instanceof e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new Q(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new Q(i,r,n,o)}return i}return q(e,t),e.prototype[K]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},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))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(B),Q=function(t){function e(e,r,n,o){var i,u=t.call(this)||this;u._parentSubscriber=e;var c=u;return M(r)?i=r:r&&(i=r.next,n=r.error,o=r.complete,r!==F&&(M((c=Object.create(r)).unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=i,u._error=n,u._complete=o,u}return q(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;H.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=H.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):V(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;V(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};H.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),H.useDeprecatedSynchronousErrorHandling)throw t;V(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!H.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return H.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(V(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(J);var tt=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function et(t){return t}function rt(t){return 0===t.length?et:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var nt=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,o=function(t,e,r){if(t){if(t instanceof J)return t;if(t[K])return t[K]()}return t||e||r?new J(t,e,r):new J(F)}(t,e,r);if(n?o.add(n.call(o,this.source)):o.add(this.source||H.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),H.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){H.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof J?n:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=ot(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[tt]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:rt(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=ot(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function ot(t){if(t||(t=H.Promise||Promise),!t)throw new Error("no Promise impl found");return t}var it=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),ut=function(t){function e(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return q(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},e}(B),ct=function(t){function e(e){var r=t.call(this,e)||this;return r.destination=e,r}return q(e,t),e}(J),st=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return q(e,t),e.prototype[K]=function(){return new ct(this)},e.prototype.lift=function(t){var e=new at(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new it;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new it;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new it;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new it;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new it;return this.hasError?(t.error(this.thrownError),B.EMPTY):this.isStopped?(t.complete(),B.EMPTY):(this.observers.push(t),new ut(this,t))},e.prototype.asObservable=function(){var t=new nt;return t.source=this,t},e.create=function(t,e){return new at(t,e)},e}(nt),at=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return q(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):B.EMPTY},e}(st),ft=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n.pending=!1,n}return q(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){if(void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,r){return t.call(this)||this}return q(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(B)),lt=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return q(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(ft),pt=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=function(){return Date.now()},t}(),ht=function(t){function e(r,n){void 0===n&&(n=pt.now);var o=t.call(this,r,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():n()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return q(e,t),e.prototype.schedule=function(r,n,o){return void 0===n&&(n=0),e.delegate&&e.delegate!==this?e.delegate.schedule(r,n,o):t.prototype.schedule.call(this,r,n,o)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var r;this.active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(pt),yt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return q(e,t),e}(ht))(lt),bt=new nt((function(t){return t.complete()}));function dt(t){return t?function(t){return new nt((function(e){return t.schedule((function(){return e.complete()}))}))}(t):bt}function vt(t){return t&&"function"==typeof t.schedule}var mt,wt=function(t){return function(e){for(var r=0,n=t.length;r<n&&!e.closed;r++)e.next(t[r]);e.complete()}};function gt(t,e){return new nt((function(r){var n=new B,o=0;return n.add(e.schedule((function(){o!==t.length?(r.next(t[o++]),r.closed||n.add(this.schedule())):r.complete()}))),n}))}function St(t,e){return e?gt(t,e):new nt(wt(t))}function _t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[t.length-1];return vt(r)?(t.pop(),gt(t,r)):St(t)}function Et(t){var e=t.error;t.subscriber.error(e)}mt||(mt={});var Ot=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){var t,e;switch(this.kind){case"N":return _t(this.value);case"E":return t=this.error,new nt(e?function(r){return e.schedule(Et,0,{error:t,subscriber:r})}:function(e){return e.error(t)});case"C":return dt()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();var jt=function(t){function e(e,r,n){void 0===n&&(n=0);var o=t.call(this,e)||this;return o.scheduler=r,o.delay=n,o}return q(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new xt(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(Ot.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(Ot.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(Ot.createComplete()),this.unsubscribe()},e}(J),xt=function(){return function(t,e){this.notification=t,this.destination=e}}(),Rt=function(t){function e(e,r,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY);var o=t.call(this)||this;return o.scheduler=n,o._events=[],o._infiniteTimeWindow=!1,o._bufferSize=e<1?1:e,o._windowTime=r<1?1:r,r===Number.POSITIVE_INFINITY?(o._infiniteTimeWindow=!0,o.next=o.nextInfiniteTimeWindow):o.next=o.nextTimeWindow,o}return q(e,t),e.prototype.nextInfiniteTimeWindow=function(e){var r=this._events;r.push(e),r.length>this._bufferSize&&r.shift(),t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this._events.push(new Pt(this._getNow(),e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,r=this._infiniteTimeWindow,n=r?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,i=n.length;if(this.closed)throw new it;if(this.isStopped||this.hasError?e=B.EMPTY:(this.observers.push(t),e=new ut(this,t)),o&&t.add(t=new jt(t,o)),r)for(var u=0;u<i&&!t.closed;u++)t.next(n[u]);else for(u=0;u<i&&!t.closed;u++)t.next(n[u].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||yt).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,r=this._windowTime,n=this._events,o=n.length,i=0;i<o&&!(t-n[i].time<r);)i++;return o>e&&(i=Math.max(i,o-e)),i>0&&n.splice(0,i),n},e}(st),Pt=function(){return function(t,e){this.time=t,this.value=e}}();function kt(t){return(kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Tt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function At(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ct(t,e,r){return(Ct="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Dt(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function It(t,e){return(It=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Lt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Dt(t);if(e){var o=Dt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Nt(this,r)}}function Nt(t,e){return!e||"object"!==kt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Dt(t){return(Dt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var qt=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&It(t,e)}(i,t);var e,r,n,o=Lt(i);function i(){return Tt(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"setupComponent",value:function(t,e){var r=this,n={};this.subjects={},this.subjects.disconnect=new st,this.subjects.document=new Rt,Object.keys(this.constructor.types).map((function(t){r.subjects[t]=new Rt(1),n[t]=function(e){return r.subjects[t].next(e)}})),Object.defineProperty(this.constructor,"sideEffects",{get:function(){return n},set:function(){},enumerable:!0,configurable:!0}),Ct(Dt(i.prototype),"setupComponent",this).call(this,t,e)}},{key:"connectComponent",value:function(){var t=this;Ct(Dt(i.prototype),"connectComponent",this).call(this),this.subjects.document.next(document),Object.keys(this.constructor.types).map((function(e){return t.subjects[e].next(t[e])}))}},{key:"disconnectComponent",value:function(){Ct(Dt(i.prototype),"disconnectComponent",this).call(this),this.subjects.disconnect.next({})}},{key:"adaptComponent",value:function(){Ct(Dt(i.prototype),"adaptComponent",this).call(this),this.subjects.document.next(document)}}])&&At(e.prototype,r),n&&At(e,n),i}(t)},Mt=function(t){return null==t?null:t.trim().replace(/^\[?(.*?)\]?$/,"$1").split(",").map((function(t){return t.trim()}))||null};Mt.stringify=function(t){return t&&t.length>0?t.join(","):null};var Ut=function(t){if(null==t)return!1;var e=t.trim&&t.trim()||t;return!("false"===e||"null"===e||"undefined"===e||"0"===e||!1===e)};Ut.stringify=function(t){return t?"":null};var Ht=function(t){return null==t?null:Number(t)};Ht.stringify=function(t){return null==t?null:"".concat(t)};var Vt=function(t){if(null==t)return null;var e=(t.trim&&t.trim()||t).match(/^\/?(.*?)(\/([gimy]*))?$/);return new RegExp(e[1],e[3])};Vt.stringify=function(t){return t&&t.toString()||null};var Ft=function(t){return t};Ft.stringify=function(t){return t};var $t=window.URL;if(!$t||!$t.prototype||!("href"in $t.prototype)){($t=function(t,e){if(!t)throw new TypeError("Invalid argument");var r=document.implementation.createHTMLDocument("");if(e){var n=r.createElement("base");n.href=e,r.head.appendChild(n)}var o=r.createElement("a");if(o.href=t,r.body.appendChild(o),":"===o.protocol||!/:/.test(o.href))throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:o})}).prototype={toString:function(){return this.href},get href(){return this._anchorElement.href},set href(t){this._anchorElement.href=t},get protocol(){return this._anchorElement.protocol},set protocol(t){this._anchorElement.protocol=t},get host(){return this._anchorElement.host},set host(t){this._anchorElement.host=t},get hostname(){return this._anchorElement.hostname},set hostname(t){this._anchorElement.hostname=t},get port(){return this._anchorElement.port},set port(t){this._anchorElement.port=t},get pathname(){return this._anchorElement.pathname},set pathname(t){this._anchorElement.pathname=t},get search(){return this._anchorElement.search},set search(t){this._anchorElement.search=t},get hash(){return this._anchorElement.hash},set hash(t){this._anchorElement.hash=t}};var Xt=window.URL||window.webkitURL||window.mozURL;$t.createObjectURL=function(t){return Xt.createObjectURL.apply(Xt,arguments)},$t.revokeObjectURL=function(t){return Xt.revokeObjectURL.apply(Xt,arguments)},Object.defineProperty($t.prototype,"toString",{enumerable:!1})}var Wt=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector;function Yt(t){for(var e=this;e!==document&&e!==document.documentElement;){if(Wt.call(e,t))return e;e=e.parentNode}return null}function zt(t){var e=t.protocol,r=t.host,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location;return e!==n.protocol||r!==n.host}function Bt(){return window.pageYOffset||document.body.scrollTop}var Gt="push";function Kt(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new Zt(t,e))}}var Zt=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Jt(t,this.project,this.thisArg))},t}(),Jt=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return q(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(J);function Qt(t,e,r,n){return M(r)&&(n=r,r=void 0),n?Qt(t,e,r).pipe(Kt((function(t){return $(t)?n.apply(void 0,t):n(t)}))):new nt((function(n){!function t(e,r,n,o,i){var u;if(function(t){return t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(e)){var c=e;e.addEventListener(r,n,i),u=function(){return c.removeEventListener(r,n,i)}}else if(function(t){return t&&"function"==typeof t.on&&"function"==typeof t.off}(e)){var s=e;e.on(r,n),u=function(){return s.off(r,n)}}else if(function(t){return t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(e)){var a=e;e.addListener(r,n),u=function(){return a.removeListener(r,n)}}else{if(!e||!e.length)throw new TypeError("Invalid event target");for(var f=0,l=e.length;f<l;f++)t(e[f],r,n,o,i)}o.add(u)}(t,e,(function(t){arguments.length>1?n.next(Array.prototype.slice.call(arguments)):n.next(t)}),n,r)}))}var te=function(t){function e(e,r,n){var o=t.call(this)||this;return o.parent=e,o.outerValue=r,o.outerIndex=n,o.index=0,o}return q(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(J);function ee(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var re=ee(),ne=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function oe(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}var ie=function(t){if(t&&"function"==typeof t[tt])return n=t,function(t){var e=n[tt]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(ne(t))return wt(t);if(oe(t))return r=t,function(t){return r.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,V),t};if(t&&"function"==typeof t[re])return e=t,function(t){for(var r=e[re]();;){var n=r.next();if(n.done){t.complete();break}if(t.next(n.value),t.closed)break}return"function"==typeof r.return&&t.add((function(){r.return&&r.return()})),t};var e,r,n,o=W(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+o+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function ue(t,e,r,n,o){if(void 0===o&&(o=new te(t,r,n)),!o.closed)return e instanceof nt?e.subscribe(o):ie(e)(o)}var ce=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return q(e,t),e.prototype.notifyNext=function(t,e,r,n,o){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(J);function se(t){return(se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ae(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[tt]}(t))return function(t,e){return new nt((function(r){var n=new B;return n.add(e.schedule((function(){var o=t[tt]();n.add(o.subscribe({next:function(t){n.add(e.schedule((function(){return r.next(t)})))},error:function(t){n.add(e.schedule((function(){return r.error(t)})))},complete:function(){n.add(e.schedule((function(){return r.complete()})))}}))}))),n}))}(t,e);if(oe(t))return function(t,e){return new nt((function(r){var n=new B;return n.add(e.schedule((function(){return t.then((function(t){n.add(e.schedule((function(){r.next(t),n.add(e.schedule((function(){return r.complete()})))})))}),(function(t){n.add(e.schedule((function(){return r.error(t)})))}))}))),n}))}(t,e);if(ne(t))return gt(t,e);if(function(t){return t&&"function"==typeof t[re]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new nt((function(r){var n,o=new B;return o.add((function(){n&&"function"==typeof n.return&&n.return()})),o.add(e.schedule((function(){n=t[re](),o.add(e.schedule((function(){if(!r.closed){var t,e;try{var o=n.next();t=o.value,e=o.done}catch(t){return void r.error(t)}e?r.complete():(r.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&se(t)||t)+" is not observable")}function fe(t,e){return e?ae(t,e):t instanceof nt?t:new nt(ie(t))}function le(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof e?function(n){return n.pipe(le((function(r,n){return fe(t(r,n)).pipe(Kt((function(t,o){return e(r,t,n,o)})))}),r))}:("number"==typeof e&&(r=e),function(e){return e.lift(new pe(t,r))})}var pe=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new he(t,this.project,this.concurrent))},t}(),he=function(t){function e(e,r,n){void 0===n&&(n=Number.POSITIVE_INFINITY);var o=t.call(this,e)||this;return o.project=r,o.concurrent=n,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return q(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){var n=new te(this,e,r),o=this.destination;o.add(n);var i=ue(this,t,void 0,void 0,n);i!==n&&o.add(i)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t,e,r,n,o){this.destination.next(e)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(ce);function ye(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),le(et,t)}function be(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Number.POSITIVE_INFINITY,n=null,o=t[t.length-1];return vt(o)?(n=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(r=t.pop())):"number"==typeof o&&(r=t.pop()),null===n&&1===t.length&&t[0]instanceof nt?t[0]:ye(r)(St(t,n))}function de(){}var ve=new nt(de);function me(t){return new nt((function(e){var r;try{r=t()}catch(t){return void e.error(t)}return(r?fe(r):dt()).subscribe(e)}))}function we(t){return function(e){return e.lift(new ge(t))}}var ge=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var r=new Se(t),n=ue(r,this.notifier);return n&&!r.seenValue?(r.add(n),e.subscribe(r)):r},t}(),Se=function(t){function e(e){var r=t.call(this,e)||this;return r.seenValue=!1,r}return q(e,t),e.prototype.notifyNext=function(t,e,r,n,o){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(ce);function _e(t,e){return function(r){return r.lift(new Ee(t,e))}}var Ee=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Oe(t,this.predicate,this.thisArg))},t}(),Oe=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return q(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(J);function je(t,e,r){return function(n){return n.lift(new xe(t,e,r))}}var xe=function(){function t(t,e,r){this.nextOrObserver=t,this.error=e,this.complete=r}return t.prototype.call=function(t,e){return e.subscribe(new Re(t,this.nextOrObserver,this.error,this.complete))},t}(),Re=function(t){function e(e,r,n,o){var i=t.call(this,e)||this;return i._tapNext=de,i._tapError=de,i._tapComplete=de,i._tapError=n||de,i._tapComplete=o||de,M(r)?(i._context=i,i._tapNext=r):r&&(i._context=r,i._tapNext=r.next||de,i._tapError=r.error||de,i._tapComplete=r.complete||de),i}return q(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(J);function Pe(){return ye(1)}function ke(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Pe()(_t.apply(void 0,t))}function Te(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[t.length-1];return vt(r)?(t.pop(),function(e){return ke(t,e,r)}):function(e){return ke(t,e)}}var Ae=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Ce(t))},t}(),Ce=function(t){function e(e){var r=t.call(this,e)||this;return r.hasPrev=!1,r}return q(e,t),e.prototype._next=function(t){var e;this.hasPrev?e=[this.prev,t]:this.hasPrev=!0,this.prev=t,e&&this.destination.next(e)},e}(J);function Ie(){return function(t){return t.lift(new Le(t))}}var Le=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var r=this.connectable;r._refCount++;var n=new Ne(t,r),o=e.subscribe(n);return n.closed||(n.connection=r.connect()),o},t}(),Ne=function(t){function e(e,r){var n=t.call(this,e)||this;return n.connectable=r,n}return q(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var r=this.connection,n=t._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(J),De=function(t){function e(e,r){var n=t.call(this)||this;return n.source=e,n.subjectFactory=r,n._refCount=0,n._isComplete=!1,n}return q(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.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new B).add(this.source.subscribe(new Me(this.getSubject(),this))),t.closed&&(this._connection=null,t=B.EMPTY)),t},e.prototype.refCount=function(){return Ie()(this)},e}(nt),qe=function(){var t=De.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}}(),Me=function(t){function e(e,r){var n=t.call(this,e)||this;return n.connectable=r,n}return q(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(ct);var Ue=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var r=this.selector,n=this.subjectFactory(),o=r(n).subscribe(t);return o.add(e.subscribe(n)),o},t}();function He(){return new st}function Ve(){return function(t){return Ie()((e=He,function(t){var n;if(n="function"==typeof e?e:function(){return e},"function"==typeof r)return t.lift(new Ue(n,r));var o=Object.create(t,qe);return o.source=t,o.subjectFactory=n,o})(t));var e,r}}function Fe(t,e){function r(){return!r.pred.apply(r.thisArg,arguments)}return r.pred=t,r.thisArg=e,r}function $e(t,e){return function(r){return[_e(t,e)(r),_e(Fe(t,e))(r)]}}function Xe(t,e){return"function"==typeof e?function(r){return r.pipe(Xe((function(r,n){return fe(t(r,n)).pipe(Kt((function(t,o){return e(r,t,n,o)})))})))}:function(e){return e.lift(new We(t))}}var We=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new Ye(t,this.project))},t}(),Ye=function(t){function e(e,r){var n=t.call(this,e)||this;return n.project=r,n.index=0,n}return q(e,t),e.prototype._next=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){var n=this.innerSubscription;n&&n.unsubscribe();var o=new te(this,e,r),i=this.destination;i.add(o),this.innerSubscription=ue(this,t,void 0,void 0,o),this.innerSubscription!==o&&i.add(this.innerSubscription)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.destination.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,r,n,o){this.destination.next(e)},e}(ce);function ze(t){return function(e){return e.lift(new Be(t))}}var Be=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new Ge(t,this.value))},t}(),Ge=function(t){function e(e,r){var n=t.call(this,e)||this;return n.value=r,n}return q(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(J);var Ke=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Ze(t,this.compare,this.keySelector))},t}(),Ze=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.keySelector=n,o.hasKey=!1,"function"==typeof r&&(o.compare=r),o}return q(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var r=this.keySelector;e=r?r(t):t}catch(t){return this.destination.error(t)}var n=!1;if(this.hasKey)try{n=(0,this.compare)(this.key,e)}catch(t){ret