UNPKG

hy-push-state

Version:

Turn static web sites into dynamic web apps

34 lines 104 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),r.d(e,"WEBCOMPONENT_FEATURE_TESTS",(function(){return jo})),r.d(e,"Set",(function(){return n})),r.d(e,"HyPushStateElement",(function(){return xo}));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}var C,I=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"])),N=null;function L(){var t="function"==typeof window.HTMLElement?window.HTMLElement:function(){};return Reflect.construct(t,[],this.__proto__.constructor)}Object.setPrototypeOf&&(Object.setPrototypeOf(L.prototype,HTMLElement.prototype),Object.setPrototypeOf(L,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 F(t){setTimeout((function(){throw t}),0)}var V={closed:!0,next:function(t){},error:function(t){if(H.useDeprecatedSynchronousErrorHandling)throw t;F(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 B(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 W=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(B(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=V;break;case 1:if(!r){i.destination=V;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}(W),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!==V&&(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):F(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;F(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;F(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):(F(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(V)}(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}(W),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),W.EMPTY):this.isStopped?(t.complete(),W.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):W.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}(W)),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 W,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=W.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 Nt(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 Lt(this,r)}}function Lt(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=Nt(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 Ft=function(t){if(null==t)return null;var e=(t.trim&&t.trim()||t).match(/^\/?(.*?)(\/([gimy]*))?$/);return new RegExp(e[1],e[3])};Ft.stringify=function(t){return t&&t.toString()||null};var Vt=function(t){return t};Vt.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 Bt=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(Bt.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 Wt(){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,F),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=B(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 W;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 W;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 W;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 Ne(t))}}var Ne=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var r=this.connectable;r._refCount++;var n=new Le(t,r),o=e.subscribe(n);return n.closed||(n.connection=r.connect()),o},t}(),Le=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 W).add(this.source.subscribe(new Me(this.getSubject(),this))),t.closed&&(this._connection=null,t=W.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 Fe(){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 Ve(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(Ve(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 Be(t))}}var Be=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 We(t))}}var We=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){return this.destination.error(t)}else this.hasKey=!0;n||(this.key=e,this.destination.next(t))},e}(J);var Je=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new Qe(t,this.observables,this.project))},t}(),Qe=function(t){function e(e,r,n){var o=t.call(this,e)||this;o.observables=r,o.project=n,o.toRespond=[];var i=r.length;o.values=new Array(i);for(var u=0;u<i;u++)o.toRespond.push(u);for(u=0;u<i;u++){var c=r[u];o.add(ue(o,c,c,u))}return o}return q(e,t),e.prototype.notifyNext=function(t,e,r,n,o){this.values[r]=e;var i=this.toRespond;if(i.length>0){var u=i.indexOf(r);-1!==u&&i.splice(u,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(ce);function tr(t){return function(e){var r=new er(t),n=e.lift(r);return r.caught=n}}var er=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new rr(t,this.selector,this.caught))},t}(),rr=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.selector=r,o.caught=n,o}return q(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=void 0;try{r=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var n=new te(this,void 0,void 0);this.add(n);var o=ue(this,r,void 0,void 0,n);o!==n&&this.add(o)}},e}(ce);function nr(t){return(nr="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 or(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ir(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ir(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ir(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}function ur(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cr(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 sr(t,e){return(sr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ar(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=lr(t);if(e){var o=lr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return fr(this,r)}}function fr(t,e){return!e||"object"!==nr(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 lr(t){return(lr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var pr=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&&sr(t,e)}(i,t);var e,r,n,o=ar(i);function i(){return ur(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"histId",value:function(){return this.el.id||this.constructor.componentName}},{key:"shouldLoadAnchor",value:function(t,e){return t&&""===t.target&&(!e||-1!==t.href.search(e))}},{key:"isPushEvent",value:function(t){var e=t.url,r=t.anchor,n=t.event,o=n.metaKey,i=n.ctrlKey;return!o&&!i&&this.shouldLoadAnchor(r,this.hrefRegex)&&!zt(e,this)}},{key:"isHintEvent",value:function(t){var e=t.url,r=t.anchor;return this.shouldLoadAnchor(r,this.hrefRegex)&&!zt(e,this)&&!function(t){var e=t.hash,r=t.origin,n=t.pathname,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location;return""!==e&&r===o.origin&&n===o.pathname}(e,this)}},{key:"isHashChange",value:function(t){var e=or(t,2),r=e[0].url.pathname,n=e[1],o=n.url,i=o.pathname,u=o.hash,c=n.type;return i===r&&("pop"===c||c===Gt&&""!==u)}}])&&cr(e.prototype,r),n&&cr(e,n),i}(t)};function hr(t){return(hr="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 yr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function br(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 dr(t,e){return(dr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function vr(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=wr(t);if(e){var o=wr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return mr(this,r)}}function mr(t,e){return!e||"object"!==hr(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 wr(t){return(wr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var gr=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&&dr(t,e)}(i,t);var e,r,n,o=vr(i);function i(){return yr(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"assignScrollPosition",value:function(t){var e,r,n,o,i,u,c=this.histId();return Object.assign(t,(e={},r=c,n=Object.assign(t[c]||{},{scrollTop:Wt(),scrollHeight:(o=document.documentElement,i=document.body,u="scrollHeight",o[u]||i[u])}),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e))}},{key:"manageScrollPostion",value:function(t){var e=t.type,r=t.url.hash;switch(e){case Gt:this.scrollHashIntoView(r,{behavior:"smooth",block:"start",inline:"nearest"});break;case"pop":this.restoreScrollPostion();break;case INIT:}}},{key:"scrollHashIntoView",value:function(t,e){if(t){var r=document.getElementById(decodeURIComponent(t.substr(1)));r&&r.scrollIntoView(e)}else window.scroll(window.pageXOffset,0)}},{key:"restoreScrollPostion",value:function(){var t=this.histId(),e=window.history.state&&window.history.state[t]||{},r=e.scrollTop;e.scrollHeight,null!=r&&window.scroll(window.pageXOffset,r)}},{key:"restoreScrollPostionOnReload",value:function(){0!=Wt()||this.restoreScrollPostion()}}])&&br(e.prototype,r),n&&br(e,n),i}(t)};function Sr(t){return(Sr="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 _r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Or(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 jr(t,e){return(jr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function xr(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=Pr(t);if(e){var o=Pr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Rr(this,r)}}function Rr(t,e){return!e||"object"!==Sr(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 Pr(t){return(Pr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var kr=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&&jr(t,e)}(i,t);var e,r,n,o=xr(i);function i(){return Er(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"updateHistoryState",value:function(t){var e=t.type,r=t.replace,n=t.url.href;if(!zt(this))switch(e){case"init":case Gt:var o=this.histId(),i=r||n===window.location.href?"replaceState":"pushState",u=Object.assign(window.history.state||{},_r({},o,{}));window.history[i](u,document.title,n)}}},{key:"updateHistoryStateHash",value:function(t){var e=t.type,r=t.url;if(!zt(this)&&e===Gt){var n=this.histId();window.history.pushState(_r({},n,{}),document.title,r)}}},{key:"updateHistoryTitle",value:function(t){var e=t.type,r=t.title;document.title=r,zt(this)||e!==Gt||window.history.replaceState(window.history.state,r,window.location)}},{key:"saveScrollPosition",value:function(){if(!zt(this)){var t=this.assignScrollPosition(window.history.state||{});window.history.replaceState(t,document.title,window.location)}}}])&&Or(e.prototype,r),n&&Or(e,n),i}(gr(t))};var Tr=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new Ar(t,this.resultSelector))},t}(),Ar=function(t){function e(e,r,n){void 0===n&&(n=Object.create(null));var o=t.call(this,e)||this;return o.iterators=[],o.active=0,o.resultSelector="function"==typeof r?r:null,o.values=n,o}return q(e,t),e.prototype._next=function(t){var e=this.iterators;$(t)?e.push(new Ir(t)):"function"==typeof t[re]?e.push(new Cr(t[re]())):e.push(new Nr(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var r=0;r<e;r++){var n=t[r];if(n.stillUnsubscribed)this.destination.add(n.subscribe(n,r));else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,r=this.destination,n=0;n<e;n++){if("function"==typeof(u=t[n]).hasValue&&!u.hasValue())return}var o=!1,i=[];for(n=0;n<e;n++){var u,c=(u=t[n]).next();if(u.hasCompleted()&&(o=!0),c.done)return void r.complete();i.push(c.value)}this.resultSelector?this._tryresultSelector(i):r.next(i),o&&r.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(J),Cr=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return t&&t.done},t}(),Ir=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[re]=function(){return this},t.prototype.next=function(t){var e=this.index++,r=this.array;return e<this.length?{value:r[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),Nr=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.parent=r,o.observable=n,o.stillUnsubscribed=!0,o.buffer=[],o.isComplete=!1,o}return q(e,t),e.prototype[re]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,o){this.buffer.push(e),this.parent.checkIterators()},e.prototype.subscribe=function(t,e){return ue(this,this.observable,this,e)},e}(ce),Lr=r(0);function Dr(t,e){return void 0===e&&(e=null),new $r({method:"GET",url:t,headers:e})}function qr(t,e,r){return new $r({method:"POST",url:t,body:e,headers:r})}function Mr(t,e){return new $r({method:"DELETE",url:t,headers:e})}function Ur(t,e,r){return new $r({method:"PUT",url:t,body:e,headers:r})}function Hr(t,e,r){return new $r({method:"PATCH",url:t,body:e,headers:r})}var Fr=Kt((function(t,e){return t.response}));function Vr(t,e){return Fr(new $r({method:"GET",url:t,responseType:"json",headers:e}))}var $r=function(t){function e(e){var r=t.call(this)||this,n={async:!0,createXHR:function(){return this.crossDomain?function(){if(Lr.a.XMLHttpRequest)return new Lr.a.XMLHttpRequest;if(Lr.a.XDomainRequest)return new Lr.a.XDomainRequest;throw new Error("CORS is not supported by your browser")}():function(){if(Lr.a.XMLHttpRequest)return new Lr.a.XMLHttpRequest;var t=void 0;try{for(var e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;r<3;r++)try{if(t=e[r],new Lr.a.ActiveXObject(t))break}catch(t){}return new Lr.a.ActiveXObject(t)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}()},crossDomain:!0,withCredentials:!1,headers:{},method:"GET",responseType:"json",timeout:0};if("string"==typeof e)n.url=e;else for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);return r.request=n,r}var r;return q(e,t),e.prototype._subscribe=function(t){return new Xr(t,this.request)},e.create=((r=function(t){return new e(t)}).get=Dr,r.post=qr,r.delete=Mr,r.put=Ur,r.patch=Hr,r.getJSON=Vr,r),e}(nt),Xr=function(t){function e(e,r){var n=t.call(this,e)||this;n.request=r,n.done=!1;var o=r.headers=r.headers||{};return r.crossDomain||n.getHeader(o,"X-Requested-With")||(o["X-Requested-With"]="XMLHttpRequest"),n.getHeader(o,"Content-Type")||Lr.a.FormData&&r.body instanceof Lr.a.FormData||void 0===r.body||(o["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"),r.body=n.serializeBody(r.body,n.getHeader(r.headers,"Content-Type")),n.send(),n}return q(e,t),e.prototype.next=function(t){this.done=!0;var e,r=this.xhr,n=this.request,o=this.destination;try{e=new Br(t,r,n)}catch(t){return o.error(t)}o.next(e)},e.prototype.send=function(){var t=this.request,e=this.request,r=e.user,n=e.method,o=e.url,i=e.async,u=e.password,c=e.headers,s=e.body;try{var a=this.xhr=t.createXHR();this.setupEvents(a,t),r?a.open(n,o,i,r,u):a.open(n,o,i),i&&(a.timeout=t.timeout,a.responseType=t.responseType),"withCredentials"in a&&(a.withCredentials=!!t.withCredentials),this.setHeaders(a,c),s?a.send(s):a.send()}catch(t){this.error(t)}},e.prototype.serializeBody=function(t,e){if(!t||"string"==typeof t)return t;if(Lr.a.FormData&&t instanceof Lr.a.FormData)return t;if(e){var r=e.indexOf(";");-1!==r&&(e=e.substring(0,r))}switch(e){case"application/x-www-form-urlencoded":return Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&");case"application/json":return JSON.stringify(t);default:return t}},e.prototype.setHeaders=function(t,e){for(var r in e)e.hasOwnProperty(r)&&t.setRequestHeader(r,e[r])},e.prototype.getHeader=function(t,e){for(var r in t)if(r.toLowerCase()===e.toLowerCase())return t[r]},e.prototype.setupEvents=function(t,e){var r=e.progressSubscriber;function n(t){var e,r=n,o=r.subscriber,i=r.progressSubscriber,u=r.request;i&&i.error(t);try{e=new Wr(this,u)}catch(t){e=t}o.error(e)}if(t.ontimeout=n,n.request=e,n.subscriber=this,n.progressSubscriber=r,t.upload&&"withCredentials"in t){var o,i;if(r)o=function(t){o.progressSubscriber.next(t)},Lr.a.XDomainRequest?t.onprogress=o:t.upload.onprogress=o,o.progressSubscriber=r;i=function(t){var e,r=i,n=r.progressSubscriber,o=r.subscriber,u=r.request;n&&n.error(t);try{e=new Yr("ajax error",this,u)}catch(t){e=t}o.error(e)},t.onerror=i,i.request=e,i.subscriber=this,i.progressSubscriber=r}function u(t){}function c(t){var e=c,r=e.subscriber,n=e.progressSubscriber,o=e.request;if(4===this.readyState){var i=1223===this.status?204:this.status,u="text"===this.responseType?this.response||this.responseText:this.response;if(0===i&&(i=u?200:0),i<400)n&&n.complete(),r.next(t),r.complete();else{n&&n.error(t);var s=void 0;try{s=new Yr("ajax error "+i,this,o)}catch(t){s=t}r.error(s)}}}t.onreadystatechange=u,u.subscriber=this,u.progressSubscriber=r,u.request=e,t.onload=c,c.subscriber=this,c.progressSubscriber=r,c.request=e},e.prototype.unsubscribe=function(){var e=this.done,r=this.xhr;!e&&r&&4!==r.readyState&&"function"==typeof r.abort&&r.abort(),t.prototype.unsubscribe.call(this)},e}(J),Br=function(){return function(t,e,r){this.originalEvent=t,this.xhr=e,this.request=r,this.status=e.status,this.responseType=e.responseType||r.responseType,this.response=zr(this.responseType,e)}}(),Yr=function(){function t(t,e,r){return Error.call(this),this.message=t,this.name="AjaxError",this.xhr=e,this.request=r,this.status=e.status,this.responseType=e.responseType||r.responseType,this.response=zr(this.responseType,e),this}return t.prototype=Object.create(Error.prototype),t}();function zr(t,e){switch(t){case"json":return function(t){return"response"in t?t.responseType?t.response:JSON.parse(t.response||t.responseText||"null"):JSON.parse(t.responseText||"null")}(e);case"xml":return e.responseXML;case"text":default:return"response"in e?e.response:e.responseText}}var Wr=function(t,e){return Yr.call(this,"ajax timeout",t,e),this.name="AjaxTimeoutError",this},Gr=function(){return $r.create}(),Kr=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}();var Zr=function(){function t(t){if(this.total=t,this.total<0)throw new Kr}return t.prototype.call=function(t,e){return e.subscribe(new Jr(t,this.total))},t}(),Jr=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return q(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(J);function Qr(t){return(Qr="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 tn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return en(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return en(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function en(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}function rn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nn(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 on(t,e){return(on=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function un(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=sn(t);if(e){var o=sn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return cn(this,r)}}function cn(t,e){return!e||"object"!==Qr(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 sn(t){return(sn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var an=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&&on(t,e)}(i,t);var e,r,n,o=un(i);function i(){return rn(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"makeRequest",value:function(t){var e=this;return Gr({method:"GET",responseType:"text",url:t.url,crossDomain:zt(this),headers:{Accept:"text/html"}}).pipe(Kt((function(e){var r=e.response;return Object.assign(t,{response:r})})),tr((function(r){return e.recoverIfResponse(t,r)})))}},{key:"recoverIfResponse",value:function(t,e){var r=e.status,n=e.xhr;return n&&n.response&&r>400&&r<598?_t(Object.assign(t,{response:n.response})):_t(Object.assign(t,{error:e}))}},{key:"getFetch$",value:function(t,e,r){var n;return t.url.href===e.url.href&&null==e.error?_t(e):r.pipe((n=1,function(t){return 0===n?dt():t.lift(new Zr(n))}))}},{key:"getResponse",value:function(t,e){var r=tn(e,2),n=r[0],o=r[1];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[t.length-1];return"function"==typeof r&&t.pop(),St(t,void 0).lift(new Tr(r))}(this.getFetch$(n,o,t).pipe(Kt((function(t){return Object.assign(t,n)}))),this.animPromise,(function(t){return t}))}}])&&nn(e.prototype,r),n&&nn(e,n),i}(t)};function fn(t){return(fn="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 ln(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return pn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pn(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pn(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}function hn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yn(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 bn(t,e){return(bn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function dn(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=mn(t);if(e){var o=mn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return vn(this,r)}}function vn(t,e){return!e||"object"!==fn(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 mn(t){return(mn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var wn=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&&bn(t,e)}(i,t);var e,r,n,o=dn(i);function i(){return hn(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"tempRemoveScriptTags",value:function(t){var e=this,r=[];return t.forEach((function(t){return Array.from(t.querySelectorAll(e.scriptSelector)).forEach((function(t){var e=[t,t.previousSibling];t.parentNode.removeChild(t),r.push(e)}))})),r}},{key:"insertScript",value:function(t){var e=ln(t,2),r=e[0],n=e[1],o=document.write;return document.write=function(){for(var t=document.createElement("div"),e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];t.innerHTML=r.join(),Array.from(t.childNodes).forEach((function(t){n.parentNode.insertBefore(t,n.nextSibling)}))},""!==r.src?nt.create((function(t){r.addEventListener("load",(function(e){document.write=o,t.complete(e)})),r.addEventListener("error",(function(e){document.write=o,t.error(e)})),n.parentNode.insertBefore(r,n.nextSibling)})):_t({}).pipe(je((function(){n.parentNode.insertBefore(r,n.nextSibling),document.write=o})))}},{key:"reinsertScriptTags",value:function(t){return this.scriptSelector?fe(t.scripts).pipe((e=this.insertScript.bind(this),le(e,r,1)),tr((function(e){throw Object.assign(t,{error:e})}))).toPromise().then((function(){return t})):_t(t);var e,r}}])&&yn(e.prototype,r),n&&yn(e,n),i}(t)};function gn(t){return(gn="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 Sn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return _n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _n(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}function En(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function On(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 jn(t,e){return(jn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function xn(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=Pn(t);if(e){var o=Pn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Rn(this,r)}}function Rn(t,e){return!e||"object"!==gn(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 Pn(t){return(Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var kn=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&&jn(t,e)}(i,t);var e,r,n,o=xn(i);function i(){return En(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"getTitle",value:function(t){return(t.querySelector("title")||{}).textContent}},{key:"getReplaceElements",value:function(t){if(this.replaceIds.length>0)return this.replaceIds.map((function(e){return t.getElementById(e)}));if(this.el.id)return[t.getElementById(this.el.id)];var e=Array.from(document.getElementsByTagName(this.el.tagName)).indexOf(this.el);return[t.querySelectorAll(this.el.tagName)[e]]}},{key:"responseToContent",value:function(t){var e,r=t.response,n=(e=r,document.createRange().createContextualFragment(e)),o=this.getTitle(n),i=this.getReplaceElements(n);if(i.some((function(t){return null==t})))throw Object.assign(t,{replaceElMissing:!0});var u=this.scriptSelector?this.tempRemoveScriptTags(i):[];return Object.assign(t,{documentFragment:n,title:o,replaceEls:i,scripts:u})}},{key:"replaceContentByIds",value:function(t){this.replaceIds.map((function(t){return document.getElementById(t)})).forEach((function(e,r){return e.parentNode.replaceChild(t[r],e)}))}},{key:"replaceContentWholesale",value:function(t){var e=Sn(t,1)[0];this.el.innerHTML=e.innerHTML}},{key:"replaceContent",value:function(t){this.replaceIds.length>0?this.replaceContentByIds(t):this.replaceContentWholesale(t)}},{key:"updateDOM",value:function(t){try{var e=t.replaceEls;this.updateHistoryTitle(t),zt(this)&&this.rewriteURLs(e),this.replaceContent(e)}catch(e){throw Object.assign(t,{error:e})}}},{key:"rewriteURLs",value:function(t){var e=this;t.forEach((function(t){t.querySelectorAll("[href]").forEach(e.rewriteURL("href")),t.querySelectorAll("[src]").forEach(e.rewriteURL("src")),t.querySelectorAll("img[srcset]").forEach(e.rewriteURLSrcSet("srcset")),t.querySelectorAll("blockquote[cite]").forEach(e.rewriteURL("cite")),t.querySelectorAll("del[cite]").forEach(e.rewriteURL("cite")),t.querySelectorAll("ins[cite]").forEach(e.rewriteURL("cite")),t.querySelectorAll("q[cite]").forEach(e.rewriteURL("cite")),t.querySelectorAll("img[longdesc]").forEach(e.rewriteURL("longdesc")),t.querySelectorAll("frame[longdesc]").forEach(e.rewriteURL("longdesc")),t.querySelectorAll("iframe[longdesc]").forEach(e.rewriteURL("longdesc")),t.querySelectorAll("img[usemap]").forEach(e.rewriteURL("usemap")),t.querySelectorAll("input[usemap]").forEach(e.rewriteURL("usemap")),t.querySelectorAll("object[usemap]").forEach(e.rewriteURL("usemap")),t.querySelectorAll("form[action]").forEach(e.rewriteURL("action")),t.querySelectorAll("button[formaction]").forEach(e.rewriteURL("formaction")),t.querySelectorAll("input[formaction]").forEach(e.rewriteURL("formaction")),t.querySelectorAll("video[poster]").forEach(e.rewriteURL("poster")),t.querySelectorAll("object[data]").forEach(e.rewriteURL("data")),t.querySelectorAll("object[codebase]").forEach(e.rewriteURL("codebase")),t.querySelectorAll("object[archive]").forEach(e.rewriteURLList("archive"))}))}},{key:"rewriteURL",value:function(t){var e=this;return function(r){try{r.setAttribute(t,new URL(r.getAttribute(t),e.href).href)}catch(t){}}}},{key:"rewriteURLSrcSet",value:function(t){var e=this;return function(r){try{r.setAttribute(t,r.getAttribute(t).split(/\s*,\s*/).map((function(t){var r=t.split(/\s+/);return r[0]=new URL(r[0],e.href).href,r.join(" ")})).join(", "))}catch(t){}}}},{key:"rewriteURLList",value:function(t){var e=this;return function(r){try{r.setAttribute(t,r.getAttribute(t).split(/[\s,]+/).map((function(t){return new URL(t,e.href).href})).join(", "))}catch(t){}}}}])&&On(e.prototype,r),n&&On(e,n),i}(wn(t))},Tn=new ht(ft);function An(t){return!$(t)&&t-parseFloat(t)+1>=0}function Cn(t){var e=t.index,r=t.period,n=t.subscriber;if(n.next(e),!n.closed){if(-1===r)return n.complete();t.index=e+1,this.schedule(t,r)}}function In(t){return(In="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 Nn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ln(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 Dn(t,e){return(Dn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function qn(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=Un(t);if(e){var o=Un(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Mn(this,r)}}function Mn(t,e){return!e||"object"!==In(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 Un(t){return(Un=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Hn=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&&Dn(t,e)}(i,t);var e,r,n,o=qn(i);function i(){return Nn(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"onStart",value:function(t){var e=this;this.animPromise=function(t,e,r){void 0===t&&(t=0);var n=-1;return An(e)?n=Number(e)<1?1:Number(e):vt(e)&&(r=e),vt(r)||(r=Tn),new nt((function(e){var o=An(t)?t:+t-r.now();return r.schedule(Cn,o,{index:0,period:n,subscriber:e})}))}(this.duration),this.fireEvent("start",{detail:Object.assign(t,{transitionUntil:function(t){e.animPromise=t}})})}},{key:"onDOMError",value:function(t){var e=t.replaceElMissing,r=t.url;e?(window.history.back(),setTimeout((function(){document.location.href=r}),100)):this.fireEvent("error",{detail:t})}},{key:"onNetworkError",value:function(t){this.fireEvent("networkerror",{detail:t})}},{key:"onError",value:function(t){this.fireEvent("error",{detail:t})}},{key:"onReady",value:function(t){this.fireEvent("ready",{detail:t})}},{key:"onAfter",value:function(t){this.fireEvent("after",{detail:t})}},{key:"onProgress",value:function(t){this.fireEvent("progress",{detail:t})}},{key:"onLoad",value:function(t){this.fireEvent("load",{detail:t})}}])&&Ln(e.prototype,r),n&&Ln(e,n),i}(t)};function Fn(t){return(Fn="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 Vn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $n(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 Xn(t,e){return(Xn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Bn(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=zn(t);if(e){var o=zn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Yn(this,r)}}function Yn(t,e){return!e||"object"!==Fn(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 zn(t){return(zn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Wn=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&&Xn(t,e)}(i,t);var e,r,n,o=Bn(i);function i(){return Vn(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"setupEventListeners",value:function(){var t,e=this;if("MutationObserver"in window&&"WeakSet"in window){var r=new WeakSet,n=this.pushSubject.next.bind(this.pushSubject),o=this.hintSubject.next.bind(this.hintSubject),i=function(t){r.has(t)||(r.add(t),t.addEventListener("click",n),t.addEventListener("mouseenter",o,{passive:!0}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("focus",o,{passive:!0}))},u=function(t){t instanceof Element&&(Bt.call(t,e.linkSelector)?i(t):Array.from(t.querySelectorAll(e.linkSelector)).forEach(i))},c=function(t){r.delete(t),t.removeEventListener("click",n),t.removeEventListener("mouseenter",o,{passive:!0}),t.removeEventListener("touchstart",o,{passive:!0}),t.removeEventListener("focus",o,{passive:!0})},s=function(t){t instanceof Element&&(Bt.call(t,e.linkSelector)?c(t):Array.from(t.querySelectorAll(e.linkSelector)).forEach(c))};(t=MutationObserver,function(e,r,n){return nt.create((function(o){var i=o.next.bind(o),u=new t((function(t){return Array.from(t).forEach(i)}),r);return u.observe(e,n),function(){u.unobserve(e)}}))})(this.el,{},{childList:!0,subtree:!0}).subscribe((function(t){var r=t.addedNodes,n=t.removedNodes;Array.from(n).forEach(s.bind(e)),Array.from(r).forEach(u.bind(e))})),this.subjects.linkSelector.subscribe((function(){Array.from(r).forEach(c),u.call(e,e.el)}))}else this.el.addEventListener("click",(function(t){var r=Yt.call(t.target,e.linkSelector);r&&r.href&&(t.currentTarget=r,pushSubject.next(t))}))}}])&&$n(e.prototype,r),n&&$n(e,n),i}(t)};function Gn(t){return(Gn="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 Kn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(n=(u=c.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Zn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zn(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zn(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}function Jn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qn(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 to(t,e){return(to=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function eo(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=no(t);if(e){var o=no(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ro(this,r)}}function ro(t,e){return!e||"object"!==Gn(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 no(t){return(no=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var oo=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&&to(t,e)}(i,t);var e,r,n,o=eo(i);function i(){return Jn(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"compareContext",value:function(t,e){return t.url.href===e.url.href&&t.error===e.error&&t.cacheNr===e.cacheNr}},{key:"setupObservables",value:function(){var t=this;this.cacheNr=1,this.pushSubject=new st,this.hintSubject=new st;var e,r,n=be(this.pushSubject.pipe(we(this.subjects.disconnect),Kt((function(e){return{type:Gt,url:new $t(e.currentTarget.href,t.href),anchor:e.currentTarget,event:e,cacheNr:t.cacheNr}})),_e(this.isPushEvent.bind(this)),je((function(e){e.event.preventDefault(),t.saveScrollPosition()}))),Qt(window,"popstate").pipe(we(this.subjects.disconnect),_e((function(){return window.history.state&&window.history.state[t.histId()]})),Kt((function(e){return{type:"pop",url:new $t(window.location,t.href),event:e,cacheNr:t.cacheNr}}))),this.reload$.pipe(we(this.subjects.disconnect))).pipe(Te({url:new $t(this.initialHref)}),je((function(e){var r=e.url;return t._url=r})),(function(t){return t.lift(new Ae)}),Fe(),$e(this.isHashChange)).map((function(t){return t.pipe(Kt((function(t){return Kn(t,2)[1]})),Fe())})),o=Kn(n,2),i=o[0],u=o[1],c=this.subjects.prefetch.pipe(Xe((function(e){if(!e)return ve;var r=me((function(){return be(u.pipe(ze(!0)),t.fetch$.pipe(ze(!1)))})).pipe(Te(!1),Fe());return t.hintSubject.pipe(we(t.subjects.disconnect),function(t){return function(e){return t.pipe(Xe((function(t){return t?ve:e})))}}(r),Kt((function(e){return{type:"hint",url:new $t(e.currentTarget.href,t.href),anchor:e.currentTarget,event:e,cacheNr:t.cacheNr}})),_e(t.isHintEvent.bind(t)))}))),s=be(c,u).pipe((e=this.compareContext.bind(this),function(t){return t.lift(new Ke(e,r))}),Xe(this.makeRequest.bind(this)),Te({url:{}}),Fe());this.fetch$=u.pipe(je((function(e){t.updateHistoryState(e),t.onStart(e)})),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var r;"function"==typeof t[t.length-1]&&(r=t.pop());var n=t;return e.lift(new Je(n,r))}}(s),Xe(this.getResponse.bind(this,s)),Fe());var a=Kn(this.fetch$.pipe($e((function(t){return!t.error}))),2),f=a[0],l=a[1];f.pipe(Kt(this.responseToContent.bind(this)),je((function(e){t.onReady(e),t.updateDOM(e),t.onAfter(e),t.manageScrollPostion(e)})),je({error:function(e){return t.onDOMError(e)}}),tr((function(t,e){return e})),Xe(this.reinsertScriptTags.bind(this)),je({error:function(e){return t.onError(e)}}),tr((function(t,e){return e}))).subscribe(this.onLoad.bind(this)),i.subscribe((function(e){t.updateHistoryStateHash(e),t.manageScrollPostion(e)})),l.subscribe(this.onNetworkError.bind(this)),u.pipe(Xe((function(e){return me((function(){return t.animPromise})).pipe(we(t.fetch$),ze(e))}))).subscribe(this.onProgress.bind(this)),this.setupEventListeners()}}])&&Qn(e.prototype,r),n&&Qn(e,n),i}(Wn(Hn(kn(an(kr(pr(t)))))))};function io(t){return(io="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 uo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function co(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 so(t,e,r){return(so="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=po(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 ao(t,e){return(ao=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function fo(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=po(t);if(e){var o=po(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return lo(this,r)}}function lo(t,e){return!e||"object"!==io(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 po(t){return(po=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ho(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}var yo=new n([].concat(function(t){return function(t){if(Array.isArray(t))return ho(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return ho(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ho(t,e)}(t)||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.")}()}(d),["documentfragment","eventlistener","history","promises","queryselector","requestanimationframe"]));DocumentFragment.prototype.getElementById=DocumentFragment.prototype.getElementById||function(t){return this.querySelector("#".concat(t))};function bo(t){return(bo="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 vo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mo(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 wo(t,e){return(wo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function go(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=_o(t);if(e){var o=_o(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return So(this,r)}}function So(t,e){return!e||"object"!==bo(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 _o(t){return(_o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Eo(t){return function(t){if(Array.isArray(t))return Oo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Oo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Oo(t,e)}(t)||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.")}()}function Oo(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}var jo=new n([].concat(Eo(I),Eo(yo))),xo=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&&wo(t,e)}(i,t);var e,r,n,o=go(i);function i(){return vo(this,i),o.apply(this,arguments)}return e=i,n=[{key:"observedAttributes",get:function(){return this.getObservedAttributes()}}],(r=[{key:"getTemplate",value:function(){return null}}])&&mo(e.prototype,r),n&&mo(e,n),i}(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&&(N=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(N===t)N=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(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&&ao(t,e)}(i,t);var e,r,n,o=fo(i);function i(){return uo(this,i),o.apply(this,arguments)}return e=i,n=[{key:"componentName",get:function(){return"hy-push-state"}},{key:"types",get:function(){return{replaceIds:Mt,linkSelector:Vt,duration:Ht,hrefRegex:Ft,scriptSelector:Vt,initialHref:Vt,prefetch:Ut}}},{key:"defaults",get:function(){return{replaceIds:[],linkSelector:"a[href]:not(.no-push-state)",duration:0,hrefRegex:null,scriptSelector:null,initialHref:window.location.href,prefetch:!1}}}],(r=[{key:"setupComponent",value:function(t,e){so(po(i.prototype),"setupComponent",this).call(this,t,e),this.saveScrollPosition=this.saveScrollPosition.bind(this),this.reload$=new st}},{key:"setupShadowDOM",value:function(t){return t}},{key:"connectComponent",value:function(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),this.restoreScrollPostionOnReload(),window.addEventListener("beforeunload",this.saveScrollPosition),this.setupObservables(),so(po(i.prototype),"connectComponent",this).call(this);var t=new $t(this.initialHref);this.updateHistoryState({type:"init",replace:!0,url:t});var e=this.getReplaceElements(document);zt(this)&&this.rewriteURLs(e),this.fireEvent("init"),this.onLoad({type:"init",title:this.getTitle(document),replaceEls:e,url:t,cacheNr:this.cacheNr})}},{key:"disconnectComponent",value:function(){so(po(i.prototype),"disconnectComponent",this).call(this),window.removeEventListener("beforeunload",this.saveScrollPosition)}},{key:"assign",value:function(t){this.reload$.next({type:Gt,url:new $t(t,this.href),cacheNr:++this.cacheNr})}},{key:"reload",value:function(){this.reload$.next({type:Gt,url:new $t(this.href),cacheNr:++this.cacheNr,replace:!0})}},{key:"replace",value:function(t){this.reload$.next({type:Gt,url:new $t(t,this.href),cacheNr:++this.cacheNr,replace:!0})}},{key:"hash",get:function(){return this._url.hash}},{key:"host",get:function(){return this._url.host}},{key:"hostname",get:function(){return this._url.hostname}},{key:"href",get:function(){return this._url.href}},{key:"origin",get:function(){return this._url.origin}},{key:"pathname",get:function(){return this._url.pathname}},{key:"port",get:function(){return this._url.port}},{key:"protocol",get:function(){return this._url.protocol}},{key:"search",get:function(){return this._url.search}}])&&co(e.prototype,r),n&&co(e,n),i}(oo(qt(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;return function(t){f(r,t);var e=p(r);function r(){return b(this,r),e.apply(this,arguments)}return a(r,[{key:"setupComponent",value:function(t,e){var r=this.constructor.defaults;this[w]=Object.assign({},r,e),this.setupProperties(this),this[m]=this.setupShadowDOM(t)}},{key:"setupShadowDOM",value:function(t){return t}},{key:"connectComponent",value:function(){}},{key:"disconnectComponent",value:function(){}},{key:"adoptComponent",value:function(){}},{key:"getRoot",value:function(){return this[m]}},{key:"getEl",value:function(){return this[m]}},{key:"fireEvent",value:function(t,e){var r=this.constructor.componentName,n=new CustomEvent("".concat(r,"-").concat(t),e);this.el.dispatchEvent(n)}},{key:"setInternalState",value:function(t,e){this[w][t]=e}},{key:"setupProperties",value:function(){var t=this,e=this.constructor.sideEffects;Object.keys(this[w]).forEach((function(r){var n=e[r];t.setupProperty(r,n)}))}},{key:"setupProperty",value:function(t,e){var r=this;Object.defineProperty(this,t,{get:function(){return r[w][t]},set:function(n){var o=r[w][t];r.setInternalState(t,n),e&&e.call(r,n,o)},enumerable:!0,configurable:!0})}},{key:"sroot",get:function(){return this.getRoot()}},{key:"el",get:function(){return this.getEl()}}]),r}(t)}(L))))))}])}));
//# sourceMappingURL=index.js.map