@micro-lc/preview 0.5.0-rc8 → 0.5.0-rc9
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@micro-lc/preview",
|
3
|
-
"version": "0.5.0-
|
3
|
+
"version": "0.5.0-rc9",
|
4
4
|
"module": "./dist/index.js",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"files": [
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"build:app:dev": "vite build --mode development",
|
18
18
|
"build:app:prod": "vite build --mode production",
|
19
19
|
"build:service-worker:dev": "esbuild service-worker.ts --bundle --outdir=website/development --allow-overwrite --define:process.env.MODE=\\\"development\\\"",
|
20
|
-
"build:service-worker:prod": "esbuild service-worker.ts --minify --bundle --outdir=website --allow-overwrite",
|
20
|
+
"build:service-worker:prod": "esbuild service-worker.ts --minify --bundle --outdir=website --allow-overwrite --define:process.env.MODE=\\\"production\\\"",
|
21
21
|
"build": "yarn run -T run-p build:types build:app:dev build:app:prod build:service-worker:dev build:service-worker:prod",
|
22
22
|
"preview": "vite preview"
|
23
23
|
},
|
@@ -1,3 +1,3 @@
|
|
1
|
-
"use strict";(()=>{var X=function(r,t){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])},X(r,t)};function v(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");X(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function
|
1
|
+
"use strict";(()=>{var X=function(r,t){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])},X(r,t)};function v(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");X(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function dr(r,t,e,o){function n(i){return i instanceof e?i:new e(function(s){s(i)})}return new(e||(e=Promise))(function(i,s){function a(p){try{c(o.next(p))}catch(m){s(m)}}function f(p){try{c(o.throw(p))}catch(m){s(m)}}function c(p){p.done?i(p.value):n(p.value).then(a,f)}c((o=o.apply(r,t||[])).next())})}function B(r,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(p){return f([c,p])}}function f(c){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(e=0)),e;)try{if(o=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,n=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){e.label=c[1];break}if(c[0]===6&&e.label<i[1]){e.label=i[1],i=c;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(c);break}i[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(r,e)}catch(p){c=[6,p],n=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function E(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],o=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var o=e.call(r),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(s)throw s.error}}return i}function _(r,t,e){if(e||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return r.concat(i||Array.prototype.slice.call(t))}function P(r){return this instanceof P?(this.v=r,this):new P(r)}function vr(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=e.apply(r,t||[]),n,i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(l){o[l]&&(n[l]=function(h){return new Promise(function(x,d){i.push([l,h,x,d])>1||a(l,h)})})}function a(l,h){try{f(o[l](h))}catch(x){m(i[0][3],x)}}function f(l){l.value instanceof P?Promise.resolve(l.value.v).then(c,p):m(i[0][2],l)}function c(l){a("next",l)}function p(l){a("throw",l)}function m(l,h){l(h),i.shift(),i.length&&a(i[0][0],i[0][1])}}function br(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof E=="function"?E(r):r[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(i){e[i]=r[i]&&function(s){return new Promise(function(a,f){s=r[i](s),n(a,f,s.done,s.value)})}}function n(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function u(r){return typeof r=="function"}function j(r){var t=function(o){Error.call(o),o.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var N=j(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription:
|
2
2
|
`+e.map(function(o,n){return n+1+") "+o.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function I(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var g=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,o,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=E(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(h){t={error:h}}finally{try{f&&!f.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(p(u))try{u()}catch(h){i=h instanceof N?h.errors:[h]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var l=E(m),d=l.next();!d.done;d=l.next()){var x=d.value;try{yr(x)}catch(h){i=i??[],h instanceof N?i=_(_([],y(i)),y(h.errors)):i.push(h)}}}catch(h){o={error:h}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}}if(i)throw new N(i)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)yr(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&I(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&I(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var Z=g.EMPTY;function z(r){return r instanceof g||r&&"closed"in r&&p(r.remove)&&p(r.add)&&p(r.unsubscribe)}function yr(r){p(r)?r():r.unsubscribe()}var w={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var k={setTimeout:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=k.delegate;return n?.setTimeout?n.setTimeout.apply(n,_([r,t],y(e))):setTimeout.apply(void 0,_([r,t],y(e)))},clearTimeout:function(r){var t=k.delegate;return(t?.clearTimeout||clearTimeout)(r)},delegate:void 0};function G(r){k.setTimeout(function(){var t=w.onUnhandledError;if(t)t(r);else throw r})}function rr(){}var xr=function(){return er("C",void 0,void 0)}();function _r(r){return er("E",void 0,r)}function gr(r){return er("N",r,void 0)}function er(r,t,e){return{kind:r,value:t,error:e}}var A=null;function C(r){if(w.useDeprecatedSynchronousErrorHandling){var t=!A;if(t&&(A={errorThrown:!1,error:null}),r(),t){var e=A,o=e.errorThrown,n=e.error;if(A=null,o)throw n}}else r()}function wr(r){w.useDeprecatedSynchronousErrorHandling&&A&&(A.errorThrown=!0,A.error=r)}var $=function(r){v(t,r);function t(e){var o=r.call(this)||this;return o.isStopped=!1,e?(o.destination=e,z(e)&&e.add(o)):o.destination=oe,o}return t.create=function(e,o,n){return new R(e,o,n)},t.prototype.next=function(e){this.isStopped?or(gr(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?or(_r(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?or(xr,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(g);var re=Function.prototype.bind;function tr(r,t){return re.call(r,t)}var ee=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(o){K(o)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(o){K(o)}else K(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){K(e)}},r}(),R=function(r){v(t,r);function t(e,o,n){var i=r.call(this)||this,s;if(p(e)||!e)s={next:e??void 0,error:o??void 0,complete:n??void 0};else{var a;i&&w.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return i.unsubscribe()},s={next:e.next&&tr(e.next,a),error:e.error&&tr(e.error,a),complete:e.complete&&tr(e.complete,a)}):s=e}return i.destination=new ee(s),i}return t}($);function K(r){w.useDeprecatedSynchronousErrorHandling?wr(r):G(r)}function te(r){throw r}function or(r,t){var e=w.onStoppedNotification;e&&k.setTimeout(function(){return e(r,t)})}var oe={closed:!0,next:rr,error:te,complete:rr};var W=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Sr(r){return r}function Er(r){return r.length===0?Sr:r.length===1?r[0]:function(e){return r.reduce(function(o,n){return n(o)},e)}}var b=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,o){var n=this,i=ie(t)?t:new R(t,e,o);return C(function(){var s=n,a=s.operator,f=s.source;i.add(a?a.call(i,f):f?n._subscribe(i):n._trySubscribe(i))}),i},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var o=this;return e=Or(e),new e(function(n,i){var s=new R({next:function(a){try{t(a)}catch(f){i(f),s.unsubscribe()}},error:i,complete:n});o.subscribe(s)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[W]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Er(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Or(t),new t(function(o,n){var i;e.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)})})},r.create=function(t){return new r(t)},r}();function Or(r){var t;return(t=r??w.Promise)!==null&&t!==void 0?t:Promise}function ne(r){return r&&p(r.next)&&p(r.error)&&p(r.complete)}function ie(r){return r&&r instanceof $||ne(r)&&z(r)}function se(r){return p(r?.lift)}function M(r){return function(t){if(se(t))return t.lift(function(e){try{return r(e,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function O(r,t,e,o,n){return new ae(r,t,e,o,n)}var ae=function(r){v(t,r);function t(e,o,n,i,s,a){var f=r.call(this,e)||this;return f.onFinalize=s,f.shouldUnsubscribe=a,f._next=o?function(c){try{o(c)}catch(u){e.error(u)}}:r.prototype._next,f._error=i?function(c){try{i(c)}catch(u){e.error(u)}finally{this.unsubscribe()}}:r.prototype._error,f._complete=n?function(){try{n()}catch(c){e.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,f}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}($);var Tr=j(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var nr=function(r){v(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var o=new Mr(this,this);return o.operator=e,o},t.prototype._throwIfClosed=function(){if(this.closed)throw new Tr},t.prototype.next=function(e){var o=this;C(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=E(o.currentObservers),a=s.next();!a.done;a=s.next()){var f=a.value;f.next(e)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var o=this;C(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=e;for(var n=o.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;C(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var o=e.observers;o.length;)o.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Z:(this.currentObservers=null,a.push(e),new g(function(){o.currentObservers=null,I(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?e.error(i):s&&e.complete()},t.prototype.asObservable=function(){var e=new b;return e.source=this,e},t.create=function(e,o){return new Mr(e,o)},t}(b);var Mr=function(r){v(t,r);function t(e,o){var n=r.call(this)||this;return n.destination=e,n.source=o,n}return t.prototype.next=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,e)},t.prototype.error=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,e)},t.prototype.complete=function(){var e,o;(o=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||o===void 0||o.call(e)},t.prototype._subscribe=function(e){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(e))!==null&&n!==void 0?n:Z},t}(nr);var q={now:function(){return(q.delegate||Date).now()},delegate:void 0};var F=function(r){v(t,r);function t(e,o,n){e===void 0&&(e=1/0),o===void 0&&(o=1/0),n===void 0&&(n=q);var i=r.call(this)||this;return i._bufferSize=e,i._windowTime=o,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=o===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,o),i}return t.prototype.next=function(e){var o=this,n=o.isStopped,i=o._buffer,s=o._infiniteTimeWindow,a=o._timestampProvider,f=o._windowTime;n||(i.push(e),!s&&i.push(a.now()+f)),this._trimBuffer(),r.prototype.next.call(this,e)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(e),n=this,i=n._infiniteTimeWindow,s=n._buffer,a=s.slice(),f=0;f<a.length&&!e.closed;f+=i?1:2)e.next(a[f]);return this._checkFinalizedStatuses(e),o},t.prototype._trimBuffer=function(){var e=this,o=e._bufferSize,n=e._timestampProvider,i=e._buffer,s=e._infiniteTimeWindow,a=(s?1:2)*o;if(o<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var f=n.now(),c=0,u=1;u<i.length&&i[u]<=f;u+=2)c=u;c&&i.splice(0,c+1)}},t}(nr);var Pr=function(r){v(t,r);function t(e,o){return r.call(this)||this}return t.prototype.schedule=function(e,o){return o===void 0&&(o=0),this},t}(g);var V={setInterval:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=V.delegate;return n?.setInterval?n.setInterval.apply(n,_([r,t],y(e))):setInterval.apply(void 0,_([r,t],y(e)))},clearInterval:function(r){var t=V.delegate;return(t?.clearInterval||clearInterval)(r)},delegate:void 0};var Ir=function(r){v(t,r);function t(e,o){var n=r.call(this,e,o)||this;return n.scheduler=e,n.work=o,n.pending=!1,n}return t.prototype.schedule=function(e,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=e;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(s,this.id,o),this},t.prototype.requestAsyncId=function(e,o,n){return n===void 0&&(n=0),V.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&V.clearInterval(o)},t.prototype.execute=function(e,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,o){var n=!1,i;try{this.work(e)}catch(s){n=!0,i=s||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,o=e.id,n=e.scheduler,i=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,I(i,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},t}(Pr);var ir=function(){function r(t,e){e===void 0&&(e=r.now),this.schedulerActionCtor=t,this.now=e}return r.prototype.schedule=function(t,e,o){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(o,e)},r.now=q.now,r}();var Ar=function(r){v(t,r);function t(e,o){o===void 0&&(o=ir.now);var n=r.call(this,e,o)||this;return n.actions=[],n._active=!1,n}return t.prototype.flush=function(e){var o=this.actions;if(this._active){o.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=o.shift());if(this._active=!1,n){for(;e=o.shift();)e.unsubscribe();throw n}},t}(ir);var sr=new Ar(Ir),jr=sr;var kr=new b(function(r){return r.complete()});function Cr(r){return r&&p(r.schedule)}var J=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function Rr(r){return p(r?.then)}function Wr(r){return p(r[W])}function Fr(r){return Symbol.asyncIterator&&p(r?.[Symbol.asyncIterator])}function Ur(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ce(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Lr=ce();function Dr(r){return p(r?.[Lr])}function $r(r){return vr(this,arguments,function(){var e,o,n,i;return B(this,function(s){switch(s.label){case 0:e=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,P(e.read())];case 3:return o=s.sent(),n=o.value,i=o.done,i?[4,P(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,P(n)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function qr(r){return p(r?.getReader)}function U(r){if(r instanceof b)return r;if(r!=null){if(Wr(r))return fe(r);if(J(r))return ue(r);if(Rr(r))return pe(r);if(Fr(r))return Vr(r);if(Dr(r))return le(r);if(qr(r))return me(r)}throw Ur(r)}function fe(r){return new b(function(t){var e=r[W]();if(p(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ue(r){return new b(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()})}function pe(r){return new b(function(t){r.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,G)})}function le(r){return new b(function(t){var e,o;try{for(var n=E(r),i=n.next();!i.done;i=n.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){e={error:a}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(e)throw e.error}}t.complete()})}function Vr(r){return new b(function(t){de(r,t).catch(function(e){return t.error(e)})})}function me(r){return Vr($r(r))}function de(r,t){var e,o,n,i;return hr(this,void 0,void 0,function(){var s,a;return B(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),e=br(r),f.label=1;case 1:return[4,e.next()];case 2:if(o=f.sent(),!!o.done)return[3,4];if(s=o.value,t.next(s),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=f.sent(),n={error:a},[3,11];case 6:return f.trys.push([6,,9,10]),o&&!o.done&&(i=e.return)?[4,i.call(e)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Hr(r,t,e,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=t.schedule(function(){e(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(i),!n)return i}var Yr=j(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function ar(r,t){var e=typeof t=="object";return new Promise(function(o,n){var i=new R({next:function(s){o(s),i.unsubscribe()},error:n,complete:function(){e?o(t.defaultValue):n(new Yr)}});r.subscribe(i)})}function Br(r){return r instanceof Date&&!isNaN(r)}function T(r,t){return M(function(e,o){var n=0;e.subscribe(O(o,function(i){o.next(r.call(t,i,n++))}))})}var he=Array.isArray;function ve(r,t){return he(t)?r.apply(void 0,_([],y(t))):r(t)}function Nr(r){return T(function(t){return ve(r,t)})}function zr(r,t,e,o,n,i,s,a){var f=[],c=0,u=0,m=!1,l=function(){m&&!f.length&&!c&&t.complete()},d=function(h){return c<o?x(h):f.push(h)},x=function(h){i&&t.next(h),c++;var dr=!1;U(e(h,u++)).subscribe(O(t,function(D){n?.(D),i?d(D):t.next(D)},function(){dr=!0},void 0,function(){if(dr)try{c--;for(var D=function(){var Y=f.shift();s?Hr(t,s,function(){return x(Y)}):x(Y)};f.length&&c<o;)D();l()}catch(Y){t.error(Y)}}))};return r.subscribe(O(t,d,function(){m=!0,l()})),function(){a?.()}}function cr(r,t,e){return e===void 0&&(e=1/0),p(t)?cr(function(o,n){return T(function(i,s){return t(o,i,n,s)})(U(r(o,n)))},e):(typeof t=="number"&&(e=t),M(function(o,n){return zr(o,n,r,e)}))}var be=["addListener","removeListener"],ye=["addEventListener","removeEventListener"],xe=["on","off"];function H(r,t,e,o){if(p(e)&&(o=e,e=void 0),o)return H(r,t,e).pipe(Nr(o));var n=y(we(r)?ye.map(function(a){return function(f){return r[a](t,f,e)}}):_e(r)?be.map(Gr(r,t)):ge(r)?xe.map(Gr(r,t)):[],2),i=n[0],s=n[1];if(!i&&J(r))return cr(function(a){return H(a,t,e)})(U(r));if(!i)throw new TypeError("Invalid event target");return new b(function(a){var f=function(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];return a.next(1<c.length?c:c[0])};return i(f),function(){return s(f)}})}function Gr(r,t){return function(e){return function(o){return r[e](t,o)}}}function _e(r){return p(r.addListener)&&p(r.removeListener)}function ge(r){return p(r.on)&&p(r.off)}function we(r){return p(r.addEventListener)&&p(r.removeEventListener)}function Kr(r,t,e){r===void 0&&(r=0),e===void 0&&(e=jr);var o=-1;return t!=null&&(Cr(t)?e=t:o=t),new b(function(n){var i=Br(r)?+r-e.now():r;i<0&&(i=0);var s=0;return e.schedule(function(){n.closed||(n.next(s++),0<=o?this.schedule(void 0,o):n.complete())},i)})}function fr(r,t){return r===void 0&&(r=0),t===void 0&&(t=sr),r<0&&(r=0),Kr(r,r,t)}function S(r,t){return M(function(e,o){var n=0;e.subscribe(O(o,function(i){return r.call(t,i,n++)&&o.next(i)}))})}function L(r){return r<=0?function(){return kr}:M(function(t,e){var o=0;t.subscribe(O(e,function(n){++o<=r&&(e.next(n),r<=o&&e.complete())}))})}var Jr=(r,t)=>e=>({postMessage:o=>{let{errorCatcher:n=()=>()=>{},...i}=t??{};r.clients.get(e).then(s=>s?.postMessage(o,i)).catch(n(e,o))}});var Qr=(r=>(r.Ack="ack",r.Syn="syn",r))(Qr||{}),Se=Object.values(Qr),ur=r=>r.data,pr=r=>t=>t.type===r.toString(),Ee=r=>{let t=r.data;return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"instance"in t&&typeof t.instance=="string"&&"content"in t},Oe=()=>{let r="#";for(let t=0;t<3;t++)r+=`0${Math.floor(Math.random()*Math.pow(16,2)/2).toString(16)}`.slice(-2);return r},Te=class{__generateId;__instance;__colors;__listener;__log;__receiver;__subscription;__okToWrite;__write$;__recv$;__connect(r,t){let e=fr(t).subscribe(()=>this.__receiver.postMessage({content:r,instance:r,type:"syn".toString()}));this.__subscription.add(e),this.__subscription.add(this.__recv$.pipe(T(ur),S(pr("ack")),S(({content:o})=>o===r),L(1)).subscribe(({instance:o})=>{this.__okToWrite.next(0),this.__subscription.add(this.__recv$.pipe(S(({data:{type:n,instance:i}})=>!Se.includes(n)&&i===o)).subscribe(n=>{this.__listener(n);let{data:i}=n;i._id!==void 0&&this.__receiver.postMessage({...i,content:i,instance:r,type:"ack"})})),e.unsubscribe()})),this.__subscription.add(this.__recv$.pipe(T(ur),S(pr("syn")),S(({instance:o})=>o!==r),L(1)).subscribe(({content:o})=>{this.__receiver.postMessage({content:o,instance:r,type:"ack"})}))}__write(r,t){let e={};t!==void 0&&(e._id=t),this.__subscription.add(this.__write$.subscribe(()=>{let o=Object.assign(r,{instance:this.__instance,...e});this.__receiver.postMessage(o),this.__log?.(o)}))}constructor(r,t,e,o){this.__generateId=()=>globalThis.crypto.randomUUID();let n=this.__generateId(),i=new F,s=H(t,"message").pipe(S(Ee)).subscribe(i);this.__subscription=new g,this.__subscription.add(s),this.__okToWrite=new F(1),this.__write$=this.__okToWrite.pipe(L(1)),this.__recv$=i.asObservable(),this.__listener=r,this.__log=o?.log&&o.log.bind(this),this.__instance=n;let a=Oe();this.__colors={bg:`${a}22`,fg:a},this.__receiver=e,this.__connect(n,o?.period?o.period:10)}disconnect(){this.__subscription.unsubscribe()}send(r){this.__write(r)}ackSend(r){let t,e=new Promise(n=>{t=n}),o=this.__generateId();return this.__subscription.add(this.__recv$.pipe(T(ur),S(pr("ack")),S(({_id:n})=>n===o),L(1)).subscribe(()=>t())),this.__write(r,o),e}get instance(){return this.__instance}get colors(){return this.__colors}get ready(){return ar(this.__write$).then(()=>{})}},Xr=Te;var Q=new Map,lr=new Map,mr=new Map,Zr=(r,t)=>{let e=t.keys(),o,{done:n=!1,value:i}=e.next();for(;!n&&o===void 0;){i!==void 0&&r.startsWith(i)&&(o=i,n=!0);let{value:s,done:a=!1}=e.next();n=a,i=s}return o},Me=r=>r!==null&&"id"in r,Pe=r=>t=>console.error(`[SW]: error on ${r} - ${String(t)}`),Ie=Jr(self,{errorCatcher:Pe}),Ae=r=>function({data:e}){let o=e;switch(o.type){case"set-source-map":{let{content:n}=o,i=Object.entries(n).reduce((s,[a,f])=>{let{clientSourceMap:c,clientTosMap:u}=s,{headers:m={}}=f;return Object.keys(m).length>0&&u.set(encodeURI(f.to),m),c.set(encodeURI(a),f),s},{clientSourceMap:new Map,clientTosMap:new Map});lr.set(r,i.clientSourceMap),mr.set(r,i.clientTosMap);break}case"unload-client":{lr.delete(r),mr.delete(r),Q.delete(r),this.disconnect();break}default:break}},je=r=>{let t=new Map,e=new F,o={addEventListener(n,i){t.set(i,e.subscribe(s=>i(s)))},removeEventListener(n,i){t.get(i)?.unsubscribe(),t.delete(i)}};return{buffer:e,channel:new Xr(Ae(r),o,Ie(r))}},ke=r=>{let t=Q.get(r);return t||(t=je(r),Q.set(r,t)),t};self.addEventListener("install",()=>{self.skipWaiting().catch(r=>console.error(`[SW] error while skipWaiting - ${String(r)}`))});self.addEventListener("activate",r=>{r.waitUntil(self.clients.claim())});self.addEventListener("message",r=>{let{source:t}=r;if(!Me(t))return;let{id:e}=t;ke(e).buffer.next(r)});self.addEventListener("fetch",r=>{let t=r.clientId!==""?r.clientId:r.resultingClientId,e=lr.get(t);if(!e)return r.respondWith(self.fetch(r.request));let o=mr.get(t),{request:{url:n}}=r,i=Zr(n,e),s=Zr(n,o),a=new Headers(r.request.headers),f={};if(i!==void 0){let m=e.get(i)?.to,l=e.get(i)?.headers??{},d=n.substring(i.length);f=e.get(i)?.query??{},n=`${m}${d}`,Object.entries(l).forEach(([x,h])=>a.set(x,h))}if(s!==void 0){let m=o.get(s)??{};Object.entries(m).forEach(([l,d])=>a.set(l,d))}let c;try{let m=new URL(n);Object.entries(f).forEach(([l,d])=>m.searchParams.set(l,d)),c=m.href}catch{c=n}let u=Q.get(t)?.channel;if(u!==void 0&&process.env.MODE==="development"){let m={background:u.colors.bg,color:u.colors.fg};console.groupCollapsed("%c Fetch from Service Worker ",Object.entries(m).map(([l,d])=>`${l}: ${d}`).join("; ")),console.info(`sw is fetching %c ${c}`,"background: lightgreen; color: darkgreen"),console.log({clientId:t,clientSourceMap:e,request:r.request}),console.groupEnd()}r.respondWith(self.fetch(c,{...r.request,headers:a}).catch(m=>(console.error(m),Promise.reject(m))))});})();
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function I(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var g=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,o,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=E(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(d){t={error:d}}finally{try{f&&!f.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(u(p))try{p()}catch(d){i=d instanceof N?d.errors:[d]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var l=E(m),h=l.next();!h.done;h=l.next()){var x=h.value;try{yr(x)}catch(d){i=i??[],d instanceof N?i=_(_([],y(i)),y(d.errors)):i.push(d)}}}catch(d){o={error:d}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}}if(i)throw new N(i)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)yr(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&I(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&I(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var Z=g.EMPTY;function z(r){return r instanceof g||r&&"closed"in r&&u(r.remove)&&u(r.add)&&u(r.unsubscribe)}function yr(r){u(r)?r():r.unsubscribe()}var w={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var k={setTimeout:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=k.delegate;return n?.setTimeout?n.setTimeout.apply(n,_([r,t],y(e))):setTimeout.apply(void 0,_([r,t],y(e)))},clearTimeout:function(r){var t=k.delegate;return(t?.clearTimeout||clearTimeout)(r)},delegate:void 0};function G(r){k.setTimeout(function(){var t=w.onUnhandledError;if(t)t(r);else throw r})}function rr(){}var xr=function(){return er("C",void 0,void 0)}();function _r(r){return er("E",void 0,r)}function gr(r){return er("N",r,void 0)}function er(r,t,e){return{kind:r,value:t,error:e}}var A=null;function C(r){if(w.useDeprecatedSynchronousErrorHandling){var t=!A;if(t&&(A={errorThrown:!1,error:null}),r(),t){var e=A,o=e.errorThrown,n=e.error;if(A=null,o)throw n}}else r()}function wr(r){w.useDeprecatedSynchronousErrorHandling&&A&&(A.errorThrown=!0,A.error=r)}var $=function(r){v(t,r);function t(e){var o=r.call(this)||this;return o.isStopped=!1,e?(o.destination=e,z(e)&&e.add(o)):o.destination=oe,o}return t.create=function(e,o,n){return new R(e,o,n)},t.prototype.next=function(e){this.isStopped?or(gr(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?or(_r(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?or(xr,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(g);var re=Function.prototype.bind;function tr(r,t){return re.call(r,t)}var ee=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(o){K(o)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(o){K(o)}else K(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){K(e)}},r}(),R=function(r){v(t,r);function t(e,o,n){var i=r.call(this)||this,s;if(u(e)||!e)s={next:e??void 0,error:o??void 0,complete:n??void 0};else{var a;i&&w.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return i.unsubscribe()},s={next:e.next&&tr(e.next,a),error:e.error&&tr(e.error,a),complete:e.complete&&tr(e.complete,a)}):s=e}return i.destination=new ee(s),i}return t}($);function K(r){w.useDeprecatedSynchronousErrorHandling?wr(r):G(r)}function te(r){throw r}function or(r,t){var e=w.onStoppedNotification;e&&k.setTimeout(function(){return e(r,t)})}var oe={closed:!0,next:rr,error:te,complete:rr};var W=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Sr(r){return r}function Er(r){return r.length===0?Sr:r.length===1?r[0]:function(e){return r.reduce(function(o,n){return n(o)},e)}}var b=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,o){var n=this,i=ie(t)?t:new R(t,e,o);return C(function(){var s=n,a=s.operator,f=s.source;i.add(a?a.call(i,f):f?n._subscribe(i):n._trySubscribe(i))}),i},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var o=this;return e=Or(e),new e(function(n,i){var s=new R({next:function(a){try{t(a)}catch(f){i(f),s.unsubscribe()}},error:i,complete:n});o.subscribe(s)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[W]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Er(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Or(t),new t(function(o,n){var i;e.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)})})},r.create=function(t){return new r(t)},r}();function Or(r){var t;return(t=r??w.Promise)!==null&&t!==void 0?t:Promise}function ne(r){return r&&u(r.next)&&u(r.error)&&u(r.complete)}function ie(r){return r&&r instanceof $||ne(r)&&z(r)}function se(r){return u(r?.lift)}function T(r){return function(t){if(se(t))return t.lift(function(e){try{return r(e,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function O(r,t,e,o,n){return new ae(r,t,e,o,n)}var ae=function(r){v(t,r);function t(e,o,n,i,s,a){var f=r.call(this,e)||this;return f.onFinalize=s,f.shouldUnsubscribe=a,f._next=o?function(c){try{o(c)}catch(p){e.error(p)}}:r.prototype._next,f._error=i?function(c){try{i(c)}catch(p){e.error(p)}finally{this.unsubscribe()}}:r.prototype._error,f._complete=n?function(){try{n()}catch(c){e.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,f}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}($);var Mr=j(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var nr=function(r){v(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var o=new Tr(this,this);return o.operator=e,o},t.prototype._throwIfClosed=function(){if(this.closed)throw new Mr},t.prototype.next=function(e){var o=this;C(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=E(o.currentObservers),a=s.next();!a.done;a=s.next()){var f=a.value;f.next(e)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var o=this;C(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=e;for(var n=o.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;C(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var o=e.observers;o.length;)o.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Z:(this.currentObservers=null,a.push(e),new g(function(){o.currentObservers=null,I(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?e.error(i):s&&e.complete()},t.prototype.asObservable=function(){var e=new b;return e.source=this,e},t.create=function(e,o){return new Tr(e,o)},t}(b);var Tr=function(r){v(t,r);function t(e,o){var n=r.call(this)||this;return n.destination=e,n.source=o,n}return t.prototype.next=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,e)},t.prototype.error=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,e)},t.prototype.complete=function(){var e,o;(o=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||o===void 0||o.call(e)},t.prototype._subscribe=function(e){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(e))!==null&&n!==void 0?n:Z},t}(nr);var q={now:function(){return(q.delegate||Date).now()},delegate:void 0};var F=function(r){v(t,r);function t(e,o,n){e===void 0&&(e=1/0),o===void 0&&(o=1/0),n===void 0&&(n=q);var i=r.call(this)||this;return i._bufferSize=e,i._windowTime=o,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=o===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,o),i}return t.prototype.next=function(e){var o=this,n=o.isStopped,i=o._buffer,s=o._infiniteTimeWindow,a=o._timestampProvider,f=o._windowTime;n||(i.push(e),!s&&i.push(a.now()+f)),this._trimBuffer(),r.prototype.next.call(this,e)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(e),n=this,i=n._infiniteTimeWindow,s=n._buffer,a=s.slice(),f=0;f<a.length&&!e.closed;f+=i?1:2)e.next(a[f]);return this._checkFinalizedStatuses(e),o},t.prototype._trimBuffer=function(){var e=this,o=e._bufferSize,n=e._timestampProvider,i=e._buffer,s=e._infiniteTimeWindow,a=(s?1:2)*o;if(o<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var f=n.now(),c=0,p=1;p<i.length&&i[p]<=f;p+=2)c=p;c&&i.splice(0,c+1)}},t}(nr);var Pr=function(r){v(t,r);function t(e,o){return r.call(this)||this}return t.prototype.schedule=function(e,o){return o===void 0&&(o=0),this},t}(g);var V={setInterval:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=V.delegate;return n?.setInterval?n.setInterval.apply(n,_([r,t],y(e))):setInterval.apply(void 0,_([r,t],y(e)))},clearInterval:function(r){var t=V.delegate;return(t?.clearInterval||clearInterval)(r)},delegate:void 0};var Ir=function(r){v(t,r);function t(e,o){var n=r.call(this,e,o)||this;return n.scheduler=e,n.work=o,n.pending=!1,n}return t.prototype.schedule=function(e,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=e;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(s,this.id,o),this},t.prototype.requestAsyncId=function(e,o,n){return n===void 0&&(n=0),V.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&V.clearInterval(o)},t.prototype.execute=function(e,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,o){var n=!1,i;try{this.work(e)}catch(s){n=!0,i=s||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,o=e.id,n=e.scheduler,i=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,I(i,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},t}(Pr);var ir=function(){function r(t,e){e===void 0&&(e=r.now),this.schedulerActionCtor=t,this.now=e}return r.prototype.schedule=function(t,e,o){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(o,e)},r.now=q.now,r}();var Ar=function(r){v(t,r);function t(e,o){o===void 0&&(o=ir.now);var n=r.call(this,e,o)||this;return n.actions=[],n._active=!1,n}return t.prototype.flush=function(e){var o=this.actions;if(this._active){o.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=o.shift());if(this._active=!1,n){for(;e=o.shift();)e.unsubscribe();throw n}},t}(ir);var sr=new Ar(Ir),jr=sr;var kr=new b(function(r){return r.complete()});function Cr(r){return r&&u(r.schedule)}var J=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function Rr(r){return u(r?.then)}function Wr(r){return u(r[W])}function Fr(r){return Symbol.asyncIterator&&u(r?.[Symbol.asyncIterator])}function Ur(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ce(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Lr=ce();function Dr(r){return u(r?.[Lr])}function $r(r){return vr(this,arguments,function(){var e,o,n,i;return B(this,function(s){switch(s.label){case 0:e=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,P(e.read())];case 3:return o=s.sent(),n=o.value,i=o.done,i?[4,P(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,P(n)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function qr(r){return u(r?.getReader)}function U(r){if(r instanceof b)return r;if(r!=null){if(Wr(r))return fe(r);if(J(r))return ue(r);if(Rr(r))return pe(r);if(Fr(r))return Vr(r);if(Dr(r))return le(r);if(qr(r))return me(r)}throw Ur(r)}function fe(r){return new b(function(t){var e=r[W]();if(u(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ue(r){return new b(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()})}function pe(r){return new b(function(t){r.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,G)})}function le(r){return new b(function(t){var e,o;try{for(var n=E(r),i=n.next();!i.done;i=n.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){e={error:a}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(e)throw e.error}}t.complete()})}function Vr(r){return new b(function(t){he(r,t).catch(function(e){return t.error(e)})})}function me(r){return Vr($r(r))}function he(r,t){var e,o,n,i;return dr(this,void 0,void 0,function(){var s,a;return B(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),e=br(r),f.label=1;case 1:return[4,e.next()];case 2:if(o=f.sent(),!!o.done)return[3,4];if(s=o.value,t.next(s),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=f.sent(),n={error:a},[3,11];case 6:return f.trys.push([6,,9,10]),o&&!o.done&&(i=e.return)?[4,i.call(e)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Hr(r,t,e,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=t.schedule(function(){e(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(i),!n)return i}var Yr=j(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function ar(r,t){var e=typeof t=="object";return new Promise(function(o,n){var i=new R({next:function(s){o(s),i.unsubscribe()},error:n,complete:function(){e?o(t.defaultValue):n(new Yr)}});r.subscribe(i)})}function Br(r){return r instanceof Date&&!isNaN(r)}function M(r,t){return T(function(e,o){var n=0;e.subscribe(O(o,function(i){o.next(r.call(t,i,n++))}))})}var de=Array.isArray;function ve(r,t){return de(t)?r.apply(void 0,_([],y(t))):r(t)}function Nr(r){return M(function(t){return ve(r,t)})}function zr(r,t,e,o,n,i,s,a){var f=[],c=0,p=0,m=!1,l=function(){m&&!f.length&&!c&&t.complete()},h=function(d){return c<o?x(d):f.push(d)},x=function(d){i&&t.next(d),c++;var hr=!1;U(e(d,p++)).subscribe(O(t,function(D){n?.(D),i?h(D):t.next(D)},function(){hr=!0},void 0,function(){if(hr)try{c--;for(var D=function(){var Y=f.shift();s?Hr(t,s,function(){return x(Y)}):x(Y)};f.length&&c<o;)D();l()}catch(Y){t.error(Y)}}))};return r.subscribe(O(t,h,function(){m=!0,l()})),function(){a?.()}}function cr(r,t,e){return e===void 0&&(e=1/0),u(t)?cr(function(o,n){return M(function(i,s){return t(o,i,n,s)})(U(r(o,n)))},e):(typeof t=="number"&&(e=t),T(function(o,n){return zr(o,n,r,e)}))}var be=["addListener","removeListener"],ye=["addEventListener","removeEventListener"],xe=["on","off"];function H(r,t,e,o){if(u(e)&&(o=e,e=void 0),o)return H(r,t,e).pipe(Nr(o));var n=y(we(r)?ye.map(function(a){return function(f){return r[a](t,f,e)}}):_e(r)?be.map(Gr(r,t)):ge(r)?xe.map(Gr(r,t)):[],2),i=n[0],s=n[1];if(!i&&J(r))return cr(function(a){return H(a,t,e)})(U(r));if(!i)throw new TypeError("Invalid event target");return new b(function(a){var f=function(){for(var c=[],p=0;p<arguments.length;p++)c[p]=arguments[p];return a.next(1<c.length?c:c[0])};return i(f),function(){return s(f)}})}function Gr(r,t){return function(e){return function(o){return r[e](t,o)}}}function _e(r){return u(r.addListener)&&u(r.removeListener)}function ge(r){return u(r.on)&&u(r.off)}function we(r){return u(r.addEventListener)&&u(r.removeEventListener)}function Kr(r,t,e){r===void 0&&(r=0),e===void 0&&(e=jr);var o=-1;return t!=null&&(Cr(t)?e=t:o=t),new b(function(n){var i=Br(r)?+r-e.now():r;i<0&&(i=0);var s=0;return e.schedule(function(){n.closed||(n.next(s++),0<=o?this.schedule(void 0,o):n.complete())},i)})}function fr(r,t){return r===void 0&&(r=0),t===void 0&&(t=sr),r<0&&(r=0),Kr(r,r,t)}function S(r,t){return T(function(e,o){var n=0;e.subscribe(O(o,function(i){return r.call(t,i,n++)&&o.next(i)}))})}function L(r){return r<=0?function(){return kr}:T(function(t,e){var o=0;t.subscribe(O(e,function(n){++o<=r&&(e.next(n),r<=o&&e.complete())}))})}var Jr=(r,t)=>e=>({postMessage:o=>{let{errorCatcher:n=()=>()=>{},...i}=t??{};r.clients.get(e).then(s=>s?.postMessage(o,i)).catch(n(e,o))}});var Qr=(r=>(r.Ack="ack",r.Syn="syn",r))(Qr||{}),Se=Object.values(Qr),ur=r=>r.data,pr=r=>t=>t.type===r.toString(),Ee=r=>{let t=r.data;return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"instance"in t&&typeof t.instance=="string"&&"content"in t},Oe=()=>{let r="#";for(let t=0;t<3;t++)r+=`0${Math.floor(Math.random()*Math.pow(16,2)/2).toString(16)}`.slice(-2);return r},Me=class{__generateId;__instance;__colors;__listener;__log;__receiver;__subscription;__okToWrite;__write$;__recv$;__connect(r,t){let e=fr(t).subscribe(()=>this.__receiver.postMessage({content:r,instance:r,type:"syn".toString()}));this.__subscription.add(e),this.__subscription.add(this.__recv$.pipe(M(ur),S(pr("ack")),S(({content:o})=>o===r),L(1)).subscribe(({instance:o})=>{this.__okToWrite.next(0),this.__subscription.add(this.__recv$.pipe(S(({data:{type:n,instance:i}})=>!Se.includes(n)&&i===o)).subscribe(n=>{this.__listener(n);let{data:i}=n;i._id!==void 0&&this.__receiver.postMessage({...i,content:i,instance:r,type:"ack"})})),e.unsubscribe()})),this.__subscription.add(this.__recv$.pipe(M(ur),S(pr("syn")),S(({instance:o})=>o!==r),L(1)).subscribe(({content:o})=>{this.__receiver.postMessage({content:o,instance:r,type:"ack"})}))}__write(r,t){let e={};t!==void 0&&(e._id=t),this.__subscription.add(this.__write$.subscribe(()=>{let o=Object.assign(r,{instance:this.__instance,...e});this.__receiver.postMessage(o),this.__log?.(o)}))}constructor(r,t,e,o){this.__generateId=()=>globalThis.crypto.randomUUID();let n=this.__generateId(),i=new F,s=H(t,"message").pipe(S(Ee)).subscribe(i);this.__subscription=new g,this.__subscription.add(s),this.__okToWrite=new F(1),this.__write$=this.__okToWrite.pipe(L(1)),this.__recv$=i.asObservable(),this.__listener=r,this.__log=o?.log&&o.log.bind(this),this.__instance=n;let a=Oe();this.__colors={bg:`${a}22`,fg:a},this.__receiver=e,this.__connect(n,o?.period?o.period:10)}disconnect(){this.__subscription.unsubscribe()}send(r){this.__write(r)}ackSend(r){let t,e=new Promise(n=>{t=n}),o=this.__generateId();return this.__subscription.add(this.__recv$.pipe(M(ur),S(pr("ack")),S(({_id:n})=>n===o),L(1)).subscribe(()=>t())),this.__write(r,o),e}get instance(){return this.__instance}get colors(){return this.__colors}get ready(){return ar(this.__write$).then(()=>{})}},Xr=Me;var Q=new Map,lr=new Map,mr=new Map,Zr=(r,t)=>{let e=t.keys(),o,{done:n=!1,value:i}=e.next();for(;!n&&o===void 0;){i!==void 0&&r.startsWith(i)&&(o=i,n=!0);let{value:s,done:a=!1}=e.next();n=a,i=s}return o},Te=r=>r!==null&&"id"in r,Pe=r=>t=>console.error(`[SW]: error on ${r} - ${String(t)}`),Ie=Jr(self,{errorCatcher:Pe}),Ae=r=>function({data:e}){let o=e;switch(o.type){case"set-source-map":{let{content:n}=o,i=Object.entries(n).reduce((s,[a,f])=>{let{clientSourceMap:c,clientTosMap:p}=s,{headers:m={}}=f;return Object.keys(m).length>0&&p.set(encodeURI(f.to),m),c.set(encodeURI(a),f),s},{clientSourceMap:new Map,clientTosMap:new Map});lr.set(r,i.clientSourceMap),mr.set(r,i.clientTosMap);break}case"unload-client":{lr.delete(r),mr.delete(r),Q.delete(r),this.disconnect();break}default:break}},je=r=>{let t=new Map,e=new F,o={addEventListener(n,i){t.set(i,e.subscribe(s=>i(s)))},removeEventListener(n,i){t.get(i)?.unsubscribe(),t.delete(i)}};return{buffer:e,channel:new Xr(Ae(r),o,Ie(r))}},ke=r=>{let t=Q.get(r);return t||(t=je(r),Q.set(r,t)),t};self.addEventListener("install",()=>{self.skipWaiting().catch(r=>console.error(`[SW] error while skipWaiting - ${String(r)}`))});self.addEventListener("activate",r=>{r.waitUntil(self.clients.claim())});self.addEventListener("message",r=>{let{source:t}=r;if(!Te(t))return;let{id:e}=t;ke(e).buffer.next(r)});self.addEventListener("fetch",r=>{let t=r.clientId!==""?r.clientId:r.resultingClientId,e=lr.get(t);if(!e)return r.respondWith(self.fetch(r.request));let o=mr.get(t),{request:{url:n}}=r,i=Zr(n,e),s=Zr(n,o),a=new Headers(r.request.headers),f={};if(i!==void 0){let m=e.get(i)?.to,l=e.get(i)?.headers??{},h=n.substring(i.length);f=e.get(i)?.query??{},n=`${m}${h}`,Object.entries(l).forEach(([x,d])=>a.set(x,d))}if(s!==void 0){let m=o.get(s)??{};Object.entries(m).forEach(([l,h])=>a.set(l,h))}let c;try{let m=new URL(n);Object.entries(f).forEach(([l,h])=>m.searchParams.set(l,h)),c=m.href}catch{c=n}let p=Q.get(t)?.channel;r.respondWith(self.fetch(c,{...r.request,headers:a}).catch(m=>(console.error(m),Promise.reject(m))))});})();
|