@quick-threejs/reactive 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app.module-Dy3P3_8R.mjs → app.module-BHCAJZLN.mjs} +811 -809
- package/dist/{app.module-Bhlwvbrt.js → app.module-DRE0SP1g.js} +7 -7
- package/dist/common/interfaces/loader.interface.d.ts +2 -3
- package/dist/core/app/debug/debug.module.d.ts +2 -2
- package/dist/core/app/debug/debug.service.d.ts +1 -1
- package/dist/core/register/loader/loader.module.d.ts +4 -5
- package/dist/core/register/loader/loader.service.d.ts +4 -4
- package/dist/main.js +3 -3
- package/dist/main.mjs +1081 -1060
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Pi=Object.defineProperty;var Ci=(t,e,r)=>e in t?Pi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>Ci(t,typeof e!="symbol"?e+"":e,r);const O=require("three");var
|
|
1
|
+
"use strict";var Pi=Object.defineProperty;var Ci=(t,e,r)=>e in t?Pi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>Ci(t,typeof e!="symbol"?e+"":e,r);const O=require("three");var Ir=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ei(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var zr={};/*! *****************************************************************************
|
|
2
2
|
Copyright (C) Microsoft. All rights reserved.
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
4
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -11,7 +11,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
11
11
|
|
|
12
12
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
13
|
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var Lr;function Oi(){if(Lr)return Fr;Lr=1;var t;return function(e){(function(r){var n=typeof globalThis=="object"?globalThis:typeof zr=="object"?zr:typeof self=="object"?self:typeof this=="object"?this:c(),i=s(e);typeof n.Reflect<"u"&&(i=s(n.Reflect,i)),r(i,n),typeof n.Reflect>"u"&&(n.Reflect=e);function s(u,l){return function(f,m){Object.defineProperty(u,f,{configurable:!0,writable:!0,value:m}),l&&l(f,m)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return o()||a()}})(function(r,n){var i=Object.prototype.hasOwnProperty,s=typeof Symbol=="function",o=s&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=s&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",u={__proto__:[]}instanceof Array,l=!c&&!u,f={create:c?function(){return Rt(Object.create(null))}:u?function(){return Rt({__proto__:null})}:function(){return Rt({})},has:l?function(h,d){return i.call(h,d)}:function(h,d){return d in h},get:l?function(h,d){return i.call(h,d)?h[d]:void 0}:function(h,d){return h[d]}},m=Object.getPrototypeOf(Function),w=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_i(),F=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:bi(),A=typeof WeakMap=="function"?WeakMap:wi(),L=s?Symbol.for("@reflect-metadata:registry"):void 0,_=vi(),C=mi(_);function S(h,d,v,P){if(I(v)){if(!Rr(h))throw new TypeError;if(!jr(d))throw new TypeError;return ne(h,d)}else{if(!Rr(h))throw new TypeError;if(!K(d))throw new TypeError;if(!K(P)&&!I(P)&&!Ae(P))throw new TypeError;return Ae(P)&&(P=void 0),v=ce(v),B(h,d,v,P)}}r("decorate",S);function R(h,d){function v(P,x){if(!K(P))throw new TypeError;if(!I(x)&&!di(x))throw new TypeError;ue(h,d,P,x)}return v}r("metadata",R);function g(h,d,v,P){if(!K(v))throw new TypeError;return I(P)||(P=ce(P)),ue(h,d,v,P)}r("defineMetadata",g);function b(h,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),Q(h,d,v)}r("hasMetadata",b);function D(h,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),he(h,d,v)}r("hasOwnMetadata",D);function H(h,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),st(h,d,v)}r("getMetadata",H);function y(h,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),xe(h,d,v)}r("getOwnMetadata",y);function $(h,d){if(!K(h))throw new TypeError;return I(d)||(d=ce(d)),De(h,d)}r("getMetadataKeys",$);function k(h,d){if(!K(h))throw new TypeError;return I(d)||(d=ce(d)),Or(h,d)}r("getOwnMetadataKeys",k);function U(h,d,v){if(!K(d))throw new TypeError;if(I(v)||(v=ce(v)),!K(d))throw new TypeError;I(v)||(v=ce(v));var P=He(d,v,!1);return I(P)?!1:P.OrdinaryDeleteMetadata(h,d,v)}r("deleteMetadata",U);function ne(h,d){for(var v=h.length-1;v>=0;--v){var P=h[v],x=P(d);if(!I(x)&&!Ae(x)){if(!jr(x))throw new TypeError;d=x}}return d}function B(h,d,v,P){for(var x=h.length-1;x>=0;--x){var ee=h[x],X=ee(d,v,P);if(!I(X)&&!Ae(X)){if(!K(X))throw new TypeError;P=X}}return P}function Q(h,d,v){var P=he(h,d,v);if(P)return!0;var x=Mt(d);return Ae(x)?!1:Q(h,x,v)}function he(h,d,v){var P=He(d,v,!1);return I(P)?!1:Mr(P.OrdinaryHasOwnMetadata(h,d,v))}function st(h,d,v){var P=he(h,d,v);if(P)return xe(h,d,v);var x=Mt(d);if(!Ae(x))return st(h,x,v)}function xe(h,d,v){var P=He(d,v,!1);if(!I(P))return P.OrdinaryGetOwnMetadata(h,d,v)}function ue(h,d,v,P){var x=He(v,P,!0);x.OrdinaryDefineOwnMetadata(h,d,v,P)}function De(h,d){var v=Or(h,d),P=Mt(h);if(P===null)return v;var x=De(P,d);if(x.length<=0)return v;if(v.length<=0)return x;for(var ee=new F,X=[],W=0,E=v;W<E.length;W++){var T=E[W],M=ee.has(T);M||(ee.add(T),X.push(T))}for(var j=0,N=x;j<N.length;j++){var T=N[j],M=ee.has(T);M||(ee.add(T),X.push(T))}return X}function Or(h,d){var v=He(h,d,!1);return v?v.OrdinaryOwnMetadataKeys(h,d):[]}function Tr(h){if(h===null)return 1;switch(typeof h){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return h===null?1:6;default:return 6}}function I(h){return h===void 0}function Ae(h){return h===null}function ci(h){return typeof h=="symbol"}function K(h){return typeof h=="object"?h!==null:typeof h=="function"}function li(h,d){switch(Tr(h)){case 0:return h;case 1:return h;case 2:return h;case 3:return h;case 4:return h;case 5:return h}var v="string",P=$r(h,o);if(P!==void 0){var x=P.call(h,v);if(K(x))throw new TypeError;return x}return hi(h)}function hi(h,d){var v,P;{var x=h.toString;if(ot(x)){var P=x.call(h);if(!K(P))return P}var v=h.valueOf;if(ot(v)){var P=v.call(h);if(!K(P))return P}}throw new TypeError}function Mr(h){return!!h}function fi(h){return""+h}function ce(h){var d=li(h);return ci(d)?d:fi(d)}function Rr(h){return Array.isArray?Array.isArray(h):h instanceof Object?h instanceof Array:Object.prototype.toString.call(h)==="[object Array]"}function ot(h){return typeof h=="function"}function jr(h){return typeof h=="function"}function di(h){switch(Tr(h)){case 3:return!0;case 4:return!0;default:return!1}}function Tt(h,d){return h===d||h!==h&&d!==d}function $r(h,d){var v=h[d];if(v!=null){if(!ot(v))throw new TypeError;return v}}function xr(h){var d=$r(h,a);if(!ot(d))throw new TypeError;var v=d.call(h);if(!K(v))throw new TypeError;return v}function Dr(h){return h.value}function Ar(h){var d=h.next();return d.done?!1:d}function kr(h){var d=h.return;d&&d.call(h)}function Mt(h){var d=Object.getPrototypeOf(h);if(typeof h!="function"||h===m||d!==m)return d;var v=h.prototype,P=v&&Object.getPrototypeOf(v);if(P==null||P===Object.prototype)return d;var x=P.constructor;return typeof x!="function"||x===h?d:x}function pi(){var h;!I(L)&&typeof n.Reflect<"u"&&!(L in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(h=yi(n.Reflect));var d,v,P,x=new A,ee={registerProvider:X,getProvider:E,setProvider:M};return ee;function X(j){if(!Object.isExtensible(ee))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case h===j:break;case I(d):d=j;break;case d===j:break;case I(v):v=j;break;case v===j:break;default:P===void 0&&(P=new F),P.add(j);break}}function W(j,N){if(!I(d)){if(d.isProviderFor(j,N))return d;if(!I(v)){if(v.isProviderFor(j,N))return d;if(!I(P))for(var V=xr(P);;){var Z=Ar(V);if(!Z)return;var ae=Dr(Z);if(ae.isProviderFor(j,N))return kr(V),ae}}}if(!I(h)&&h.isProviderFor(j,N))return h}function E(j,N){var V=x.get(j),Z;return I(V)||(Z=V.get(N)),I(Z)&&(Z=W(j,N),I(Z)||(I(V)&&(V=new w,x.set(j,V)),V.set(N,Z))),Z}function T(j){if(I(j))throw new TypeError;return d===j||v===j||!I(P)&&P.has(j)}function M(j,N,V){if(!T(V))throw new Error("Metadata provider not registered.");var Z=E(j,N);if(Z!==V){if(!I(Z))return!1;var ae=x.get(j);I(ae)&&(ae=new w,x.set(j,ae)),ae.set(N,V)}return!0}}function vi(){var h;return!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&(h=n.Reflect[L]),I(h)&&(h=pi()),!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,L,{enumerable:!1,configurable:!1,writable:!1,value:h}),h}function mi(h){var d=new A,v={isProviderFor:function(T,M){var j=d.get(T);return I(j)?!1:j.has(M)},OrdinaryDefineOwnMetadata:X,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:W,OrdinaryDeleteMetadata:E};return _.registerProvider(v),v;function P(T,M,j){var N=d.get(T),V=!1;if(I(N)){if(!j)return;N=new w,d.set(T,N),V=!0}var Z=N.get(M);if(I(Z)){if(!j)return;if(Z=new w,N.set(M,Z),!h.setProvider(T,M,v))throw N.delete(M),V&&d.delete(T),new Error("Wrong provider for target.")}return Z}function x(T,M,j){var N=P(M,j,!1);return I(N)?!1:Mr(N.has(T))}function ee(T,M,j){var N=P(M,j,!1);if(!I(N))return N.get(T)}function X(T,M,j,N){var V=P(j,N,!0);V.set(T,M)}function W(T,M){var j=[],N=P(T,M,!1);if(I(N))return j;for(var V=N.keys(),Z=xr(V),ae=0;;){var Ir=Ar(Z);if(!Ir)return j.length=ae,j;var gi=Dr(Ir);try{j[ae]=gi}catch(Si){try{kr(Z)}finally{throw Si}}ae++}}function E(T,M,j){var N=P(M,j,!1);if(I(N)||!N.delete(T))return!1;if(N.size===0){var V=d.get(M);I(V)||(V.delete(j),V.size===0&&d.delete(V))}return!0}}function yi(h){var d=h.defineMetadata,v=h.hasOwnMetadata,P=h.getOwnMetadata,x=h.getOwnMetadataKeys,ee=h.deleteMetadata,X=new A,W={isProviderFor:function(E,T){var M=X.get(E);return!I(M)&&M.has(T)?!0:x(E,T).length?(I(M)&&(M=new F,X.set(E,M)),M.add(T),!0):!1},OrdinaryDefineOwnMetadata:d,OrdinaryHasOwnMetadata:v,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:x,OrdinaryDeleteMetadata:ee};return W}function He(h,d,v){var P=_.getProvider(h,d);if(!I(P))return P;if(v){if(_.setProvider(h,d,C))return C;throw new Error("Illegal state.")}}function _i(){var h={},d=[],v=function(){function W(E,T,M){this._index=0,this._keys=E,this._values=T,this._selector=M}return W.prototype["@@iterator"]=function(){return this},W.prototype[a]=function(){return this},W.prototype.next=function(){var E=this._index;if(E>=0&&E<this._keys.length){var T=this._selector(this._keys[E],this._values[E]);return E+1>=this._keys.length?(this._index=-1,this._keys=d,this._values=d):this._index++,{value:T,done:!1}}return{value:void 0,done:!0}},W.prototype.throw=function(E){throw this._index>=0&&(this._index=-1,this._keys=d,this._values=d),E},W.prototype.return=function(E){return this._index>=0&&(this._index=-1,this._keys=d,this._values=d),{value:E,done:!0}},W}(),P=function(){function W(){this._keys=[],this._values=[],this._cacheKey=h,this._cacheIndex=-2}return Object.defineProperty(W.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),W.prototype.has=function(E){return this._find(E,!1)>=0},W.prototype.get=function(E){var T=this._find(E,!1);return T>=0?this._values[T]:void 0},W.prototype.set=function(E,T){var M=this._find(E,!0);return this._values[M]=T,this},W.prototype.delete=function(E){var T=this._find(E,!1);if(T>=0){for(var M=this._keys.length,j=T+1;j<M;j++)this._keys[j-1]=this._keys[j],this._values[j-1]=this._values[j];return this._keys.length--,this._values.length--,Tt(E,this._cacheKey)&&(this._cacheKey=h,this._cacheIndex=-2),!0}return!1},W.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=h,this._cacheIndex=-2},W.prototype.keys=function(){return new v(this._keys,this._values,x)},W.prototype.values=function(){return new v(this._keys,this._values,ee)},W.prototype.entries=function(){return new v(this._keys,this._values,X)},W.prototype["@@iterator"]=function(){return this.entries()},W.prototype[a]=function(){return this.entries()},W.prototype._find=function(E,T){if(!Tt(this._cacheKey,E)){this._cacheIndex=-1;for(var M=0;M<this._keys.length;M++)if(Tt(this._keys[M],E)){this._cacheIndex=M;break}}return this._cacheIndex<0&&T&&(this._cacheIndex=this._keys.length,this._keys.push(E),this._values.push(void 0)),this._cacheIndex},W}();return P;function x(W,E){return W}function ee(W,E){return E}function X(W,E){return[W,E]}}function bi(){var h=function(){function d(){this._map=new w}return Object.defineProperty(d.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),d.prototype.has=function(v){return this._map.has(v)},d.prototype.add=function(v){return this._map.set(v,v),this},d.prototype.delete=function(v){return this._map.delete(v)},d.prototype.clear=function(){this._map.clear()},d.prototype.keys=function(){return this._map.keys()},d.prototype.values=function(){return this._map.keys()},d.prototype.entries=function(){return this._map.entries()},d.prototype["@@iterator"]=function(){return this.keys()},d.prototype[a]=function(){return this.keys()},d}();return h}function wi(){var h=16,d=f.create(),v=P();return function(){function E(){this._key=P()}return E.prototype.has=function(T){var M=x(T,!1);return M!==void 0?f.has(M,this._key):!1},E.prototype.get=function(T){var M=x(T,!1);return M!==void 0?f.get(M,this._key):void 0},E.prototype.set=function(T,M){var j=x(T,!0);return j[this._key]=M,this},E.prototype.delete=function(T){var M=x(T,!1);return M!==void 0?delete M[this._key]:!1},E.prototype.clear=function(){this._key=P()},E}();function P(){var E;do E="@@WeakMap@@"+W();while(f.has(d,E));return d[E]=!0,E}function x(E,T){if(!i.call(E,v)){if(!T)return;Object.defineProperty(E,v,{value:f.create()})}return E[v]}function ee(E,T){for(var M=0;M<T;++M)E[M]=Math.random()*255|0;return E}function X(E){if(typeof Uint8Array=="function"){var T=new Uint8Array(E);return typeof crypto<"u"?crypto.getRandomValues(T):typeof msCrypto<"u"?msCrypto.getRandomValues(T):ee(T,E),T}return ee(new Array(E),E)}function W(){var E=X(h);E[6]=E[6]&79|64,E[8]=E[8]&191|128;for(var T="",M=0;M<h;++M){var j=E[M];(M===4||M===6||M===8)&&(T+="-"),j<16&&(T+="0"),T+=j.toString(16).toLowerCase()}return T}}function Rt(h){return h.__=void 0,delete h.__,h}})}(t||(t={})),Fr}Oi();var Yt;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Yt||(Yt={}));const te=Yt;/*! *****************************************************************************
|
|
14
|
+
***************************************************************************** */var Fr;function Oi(){if(Fr)return zr;Fr=1;var t;return function(e){(function(r){var n=typeof globalThis=="object"?globalThis:typeof Ir=="object"?Ir:typeof self=="object"?self:typeof this=="object"?this:c(),i=s(e);typeof n.Reflect<"u"&&(i=s(n.Reflect,i)),r(i,n),typeof n.Reflect>"u"&&(n.Reflect=e);function s(u,l){return function(h,m){Object.defineProperty(u,h,{configurable:!0,writable:!0,value:m}),l&&l(h,m)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return o()||a()}})(function(r,n){var i=Object.prototype.hasOwnProperty,s=typeof Symbol=="function",o=s&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=s&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",u={__proto__:[]}instanceof Array,l=!c&&!u,h={create:c?function(){return Rt(Object.create(null))}:u?function(){return Rt({__proto__:null})}:function(){return Rt({})},has:l?function(f,d){return i.call(f,d)}:function(f,d){return d in f},get:l?function(f,d){return i.call(f,d)?f[d]:void 0}:function(f,d){return f[d]}},m=Object.getPrototypeOf(Function),w=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_i(),F=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:bi(),A=typeof WeakMap=="function"?WeakMap:wi(),L=s?Symbol.for("@reflect-metadata:registry"):void 0,_=vi(),C=mi(_);function S(f,d,v,P){if(I(v)){if(!Mr(f))throw new TypeError;if(!Rr(d))throw new TypeError;return ne(f,d)}else{if(!Mr(f))throw new TypeError;if(!K(d))throw new TypeError;if(!K(P)&&!I(P)&&!Ae(P))throw new TypeError;return Ae(P)&&(P=void 0),v=ce(v),B(f,d,v,P)}}r("decorate",S);function R(f,d){function v(P,x){if(!K(P))throw new TypeError;if(!I(x)&&!di(x))throw new TypeError;ue(f,d,P,x)}return v}r("metadata",R);function g(f,d,v,P){if(!K(v))throw new TypeError;return I(P)||(P=ce(P)),ue(f,d,v,P)}r("defineMetadata",g);function b(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),Q(f,d,v)}r("hasMetadata",b);function D(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),he(f,d,v)}r("hasOwnMetadata",D);function H(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),st(f,d,v)}r("getMetadata",H);function y(f,d,v){if(!K(d))throw new TypeError;return I(v)||(v=ce(v)),xe(f,d,v)}r("getOwnMetadata",y);function $(f,d){if(!K(f))throw new TypeError;return I(d)||(d=ce(d)),De(f,d)}r("getMetadataKeys",$);function k(f,d){if(!K(f))throw new TypeError;return I(d)||(d=ce(d)),Er(f,d)}r("getOwnMetadataKeys",k);function U(f,d,v){if(!K(d))throw new TypeError;if(I(v)||(v=ce(v)),!K(d))throw new TypeError;I(v)||(v=ce(v));var P=He(d,v,!1);return I(P)?!1:P.OrdinaryDeleteMetadata(f,d,v)}r("deleteMetadata",U);function ne(f,d){for(var v=f.length-1;v>=0;--v){var P=f[v],x=P(d);if(!I(x)&&!Ae(x)){if(!Rr(x))throw new TypeError;d=x}}return d}function B(f,d,v,P){for(var x=f.length-1;x>=0;--x){var ee=f[x],X=ee(d,v,P);if(!I(X)&&!Ae(X)){if(!K(X))throw new TypeError;P=X}}return P}function Q(f,d,v){var P=he(f,d,v);if(P)return!0;var x=Mt(d);return Ae(x)?!1:Q(f,x,v)}function he(f,d,v){var P=He(d,v,!1);return I(P)?!1:Tr(P.OrdinaryHasOwnMetadata(f,d,v))}function st(f,d,v){var P=he(f,d,v);if(P)return xe(f,d,v);var x=Mt(d);if(!Ae(x))return st(f,x,v)}function xe(f,d,v){var P=He(d,v,!1);if(!I(P))return P.OrdinaryGetOwnMetadata(f,d,v)}function ue(f,d,v,P){var x=He(v,P,!0);x.OrdinaryDefineOwnMetadata(f,d,v,P)}function De(f,d){var v=Er(f,d),P=Mt(f);if(P===null)return v;var x=De(P,d);if(x.length<=0)return v;if(v.length<=0)return x;for(var ee=new F,X=[],W=0,E=v;W<E.length;W++){var T=E[W],M=ee.has(T);M||(ee.add(T),X.push(T))}for(var j=0,N=x;j<N.length;j++){var T=N[j],M=ee.has(T);M||(ee.add(T),X.push(T))}return X}function Er(f,d){var v=He(f,d,!1);return v?v.OrdinaryOwnMetadataKeys(f,d):[]}function Or(f){if(f===null)return 1;switch(typeof f){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return f===null?1:6;default:return 6}}function I(f){return f===void 0}function Ae(f){return f===null}function ci(f){return typeof f=="symbol"}function K(f){return typeof f=="object"?f!==null:typeof f=="function"}function li(f,d){switch(Or(f)){case 0:return f;case 1:return f;case 2:return f;case 3:return f;case 4:return f;case 5:return f}var v="string",P=jr(f,o);if(P!==void 0){var x=P.call(f,v);if(K(x))throw new TypeError;return x}return hi(f)}function hi(f,d){var v,P;{var x=f.toString;if(ot(x)){var P=x.call(f);if(!K(P))return P}var v=f.valueOf;if(ot(v)){var P=v.call(f);if(!K(P))return P}}throw new TypeError}function Tr(f){return!!f}function fi(f){return""+f}function ce(f){var d=li(f);return ci(d)?d:fi(d)}function Mr(f){return Array.isArray?Array.isArray(f):f instanceof Object?f instanceof Array:Object.prototype.toString.call(f)==="[object Array]"}function ot(f){return typeof f=="function"}function Rr(f){return typeof f=="function"}function di(f){switch(Or(f)){case 3:return!0;case 4:return!0;default:return!1}}function Tt(f,d){return f===d||f!==f&&d!==d}function jr(f,d){var v=f[d];if(v!=null){if(!ot(v))throw new TypeError;return v}}function $r(f){var d=jr(f,a);if(!ot(d))throw new TypeError;var v=d.call(f);if(!K(v))throw new TypeError;return v}function xr(f){return f.value}function Dr(f){var d=f.next();return d.done?!1:d}function Ar(f){var d=f.return;d&&d.call(f)}function Mt(f){var d=Object.getPrototypeOf(f);if(typeof f!="function"||f===m||d!==m)return d;var v=f.prototype,P=v&&Object.getPrototypeOf(v);if(P==null||P===Object.prototype)return d;var x=P.constructor;return typeof x!="function"||x===f?d:x}function pi(){var f;!I(L)&&typeof n.Reflect<"u"&&!(L in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(f=yi(n.Reflect));var d,v,P,x=new A,ee={registerProvider:X,getProvider:E,setProvider:M};return ee;function X(j){if(!Object.isExtensible(ee))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case f===j:break;case I(d):d=j;break;case d===j:break;case I(v):v=j;break;case v===j:break;default:P===void 0&&(P=new F),P.add(j);break}}function W(j,N){if(!I(d)){if(d.isProviderFor(j,N))return d;if(!I(v)){if(v.isProviderFor(j,N))return d;if(!I(P))for(var V=$r(P);;){var Z=Dr(V);if(!Z)return;var ae=xr(Z);if(ae.isProviderFor(j,N))return Ar(V),ae}}}if(!I(f)&&f.isProviderFor(j,N))return f}function E(j,N){var V=x.get(j),Z;return I(V)||(Z=V.get(N)),I(Z)&&(Z=W(j,N),I(Z)||(I(V)&&(V=new w,x.set(j,V)),V.set(N,Z))),Z}function T(j){if(I(j))throw new TypeError;return d===j||v===j||!I(P)&&P.has(j)}function M(j,N,V){if(!T(V))throw new Error("Metadata provider not registered.");var Z=E(j,N);if(Z!==V){if(!I(Z))return!1;var ae=x.get(j);I(ae)&&(ae=new w,x.set(j,ae)),ae.set(N,V)}return!0}}function vi(){var f;return!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&(f=n.Reflect[L]),I(f)&&(f=pi()),!I(L)&&K(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,L,{enumerable:!1,configurable:!1,writable:!1,value:f}),f}function mi(f){var d=new A,v={isProviderFor:function(T,M){var j=d.get(T);return I(j)?!1:j.has(M)},OrdinaryDefineOwnMetadata:X,OrdinaryHasOwnMetadata:x,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:W,OrdinaryDeleteMetadata:E};return _.registerProvider(v),v;function P(T,M,j){var N=d.get(T),V=!1;if(I(N)){if(!j)return;N=new w,d.set(T,N),V=!0}var Z=N.get(M);if(I(Z)){if(!j)return;if(Z=new w,N.set(M,Z),!f.setProvider(T,M,v))throw N.delete(M),V&&d.delete(T),new Error("Wrong provider for target.")}return Z}function x(T,M,j){var N=P(M,j,!1);return I(N)?!1:Tr(N.has(T))}function ee(T,M,j){var N=P(M,j,!1);if(!I(N))return N.get(T)}function X(T,M,j,N){var V=P(j,N,!0);V.set(T,M)}function W(T,M){var j=[],N=P(T,M,!1);if(I(N))return j;for(var V=N.keys(),Z=$r(V),ae=0;;){var kr=Dr(Z);if(!kr)return j.length=ae,j;var gi=xr(kr);try{j[ae]=gi}catch(Si){try{Ar(Z)}finally{throw Si}}ae++}}function E(T,M,j){var N=P(M,j,!1);if(I(N)||!N.delete(T))return!1;if(N.size===0){var V=d.get(M);I(V)||(V.delete(j),V.size===0&&d.delete(V))}return!0}}function yi(f){var d=f.defineMetadata,v=f.hasOwnMetadata,P=f.getOwnMetadata,x=f.getOwnMetadataKeys,ee=f.deleteMetadata,X=new A,W={isProviderFor:function(E,T){var M=X.get(E);return!I(M)&&M.has(T)?!0:x(E,T).length?(I(M)&&(M=new F,X.set(E,M)),M.add(T),!0):!1},OrdinaryDefineOwnMetadata:d,OrdinaryHasOwnMetadata:v,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:x,OrdinaryDeleteMetadata:ee};return W}function He(f,d,v){var P=_.getProvider(f,d);if(!I(P))return P;if(v){if(_.setProvider(f,d,C))return C;throw new Error("Illegal state.")}}function _i(){var f={},d=[],v=function(){function W(E,T,M){this._index=0,this._keys=E,this._values=T,this._selector=M}return W.prototype["@@iterator"]=function(){return this},W.prototype[a]=function(){return this},W.prototype.next=function(){var E=this._index;if(E>=0&&E<this._keys.length){var T=this._selector(this._keys[E],this._values[E]);return E+1>=this._keys.length?(this._index=-1,this._keys=d,this._values=d):this._index++,{value:T,done:!1}}return{value:void 0,done:!0}},W.prototype.throw=function(E){throw this._index>=0&&(this._index=-1,this._keys=d,this._values=d),E},W.prototype.return=function(E){return this._index>=0&&(this._index=-1,this._keys=d,this._values=d),{value:E,done:!0}},W}(),P=function(){function W(){this._keys=[],this._values=[],this._cacheKey=f,this._cacheIndex=-2}return Object.defineProperty(W.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),W.prototype.has=function(E){return this._find(E,!1)>=0},W.prototype.get=function(E){var T=this._find(E,!1);return T>=0?this._values[T]:void 0},W.prototype.set=function(E,T){var M=this._find(E,!0);return this._values[M]=T,this},W.prototype.delete=function(E){var T=this._find(E,!1);if(T>=0){for(var M=this._keys.length,j=T+1;j<M;j++)this._keys[j-1]=this._keys[j],this._values[j-1]=this._values[j];return this._keys.length--,this._values.length--,Tt(E,this._cacheKey)&&(this._cacheKey=f,this._cacheIndex=-2),!0}return!1},W.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=f,this._cacheIndex=-2},W.prototype.keys=function(){return new v(this._keys,this._values,x)},W.prototype.values=function(){return new v(this._keys,this._values,ee)},W.prototype.entries=function(){return new v(this._keys,this._values,X)},W.prototype["@@iterator"]=function(){return this.entries()},W.prototype[a]=function(){return this.entries()},W.prototype._find=function(E,T){if(!Tt(this._cacheKey,E)){this._cacheIndex=-1;for(var M=0;M<this._keys.length;M++)if(Tt(this._keys[M],E)){this._cacheIndex=M;break}}return this._cacheIndex<0&&T&&(this._cacheIndex=this._keys.length,this._keys.push(E),this._values.push(void 0)),this._cacheIndex},W}();return P;function x(W,E){return W}function ee(W,E){return E}function X(W,E){return[W,E]}}function bi(){var f=function(){function d(){this._map=new w}return Object.defineProperty(d.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),d.prototype.has=function(v){return this._map.has(v)},d.prototype.add=function(v){return this._map.set(v,v),this},d.prototype.delete=function(v){return this._map.delete(v)},d.prototype.clear=function(){this._map.clear()},d.prototype.keys=function(){return this._map.keys()},d.prototype.values=function(){return this._map.keys()},d.prototype.entries=function(){return this._map.entries()},d.prototype["@@iterator"]=function(){return this.keys()},d.prototype[a]=function(){return this.keys()},d}();return f}function wi(){var f=16,d=h.create(),v=P();return function(){function E(){this._key=P()}return E.prototype.has=function(T){var M=x(T,!1);return M!==void 0?h.has(M,this._key):!1},E.prototype.get=function(T){var M=x(T,!1);return M!==void 0?h.get(M,this._key):void 0},E.prototype.set=function(T,M){var j=x(T,!0);return j[this._key]=M,this},E.prototype.delete=function(T){var M=x(T,!1);return M!==void 0?delete M[this._key]:!1},E.prototype.clear=function(){this._key=P()},E}();function P(){var E;do E="@@WeakMap@@"+W();while(h.has(d,E));return d[E]=!0,E}function x(E,T){if(!i.call(E,v)){if(!T)return;Object.defineProperty(E,v,{value:h.create()})}return E[v]}function ee(E,T){for(var M=0;M<T;++M)E[M]=Math.random()*255|0;return E}function X(E){if(typeof Uint8Array=="function"){var T=new Uint8Array(E);return typeof crypto<"u"?crypto.getRandomValues(T):typeof msCrypto<"u"?msCrypto.getRandomValues(T):ee(T,E),T}return ee(new Array(E),E)}function W(){var E=X(f);E[6]=E[6]&79|64,E[8]=E[8]&191|128;for(var T="",M=0;M<f;++M){var j=E[M];(M===4||M===6||M===8)&&(T+="-"),j<16&&(T+="0"),T+=j.toString(16).toLowerCase()}return T}}function Rt(f){return f.__=void 0,delete f.__,f}})}(t||(t={})),zr}Oi();var Vt;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Vt||(Vt={}));const te=Vt;/*! *****************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -24,11 +24,11 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
24
24
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
-
***************************************************************************** */var
|
|
27
|
+
***************************************************************************** */var Yt=function(t,e){return Yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Yt(t,e)};function pr(t,e){Yt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ti(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,[])).next())})}function Mi(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function at(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function mt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Te(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(mt(arguments[e]));return t}var Bt="injectionTokens";function Ri(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(Bt,t)||{};return Object.keys(r).forEach(function(n){e[+n]=r[n]}),e}function ji(t,e){return function(r,n,i){var s=Reflect.getOwnMetadata(Bt,r)||{};s[i]=t,Reflect.defineMetadata(Bt,s,r)}}function jn(t){return!!t.useClass}function Zt(t){return!!t.useFactory}var $n=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,n={},i=!1,s,o=function(){return i||(s=e(r.wrap()),i=!0),s};return new Proxy(n,this.createHandler(o))},t.prototype.createHandler=function(e){var r={},n=function(i){r[i]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];s[0]=e();var a=Reflect[i];return a.apply(void 0,Te(s))}};return this.reflectMethods.forEach(n),r},t}();function ke(t){return typeof t=="string"||typeof t=="symbol"}function $i(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function Lr(t){return typeof t=="object"&&"token"in t&&"transform"in t}function xi(t){return typeof t=="function"||t instanceof $n}function ft(t){return!!t.useToken}function dt(t){return t.useValue!=null}function Di(t){return jn(t)||dt(t)||ft(t)||Zt(t)}var vr=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t}(),Ai=function(t){pr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(vr),Wr=function(){function t(){this.scopedResolutions=new Map}return t}();function ki(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function Ii(t,e,r){return r===void 0&&(r=" "),Te([t],e.message.split(`
|
|
28
28
|
`).map(function(n){return r+n})).join(`
|
|
29
|
-
`)}function zi(t,e,r){var n=mt(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=ki(s,e);return Ii("Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',r)}function Fi(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Li=function(t){vr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Wi=function(t){vr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(mr),Ni=function(){function t(){this.preResolution=new Li,this.postResolution=new Wi}return t}(),xn=new Map,Hi=function(){function t(e){this.parent=e,this._registry=new Ai,this.interceptors=new Ni,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,n){n===void 0&&(n={lifecycle:te.Transient}),this.ensureNotDisposed();var i;if(Di(r)?i=r:i={useClass:r},ft(i))for(var s=[e],o=i;o!=null;){var a=o.useToken;if(s.includes(a))throw new Error("Token registration cycle detected! "+Te(s,[a]).join(" -> "));s.push(a);var c=this._registry.get(a);c&&ft(c.provider)?o=c.provider:o=null}if((n.lifecycle===te.Singleton||n.lifecycle==te.ContainerScoped||n.lifecycle==te.ResolutionScoped)&&(dt(i)||Gt(i)))throw new Error('Cannot use lifecycle "'+te[n.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:n}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),ke(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),ke(e)){if(ke(r))return this.register(e,{useToken:r},{lifecycle:te.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:te.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var n=e;return r&&!ke(r)&&(n=r),this.register(e,{useClass:n},{lifecycle:te.Singleton})},t.prototype.resolve=function(e,r){r===void 0&&(r=new Nr),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&ke(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(xi(e)){var i=this.construct(e,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var n,i;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=at(this.interceptors.preResolution.getAll(e)),a=o.next();!a.done;a=o.next()){var c=a.value;c.options.frequency!="Once"&&s.push(c),c.callback(e,r)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.interceptors.preResolution.setAll(e,s)}},t.prototype.executePostResolutionInterceptor=function(e,r,n){var i,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var a=at(this.interceptors.postResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var u=c.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,r,n)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,o)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===te.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var n=e.options.lifecycle===te.Singleton,i=e.options.lifecycle===te.ContainerScoped,s=n||i,o;return dt(e.provider)?o=e.provider.useValue:ft(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):jn(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Gt(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,r),e.options.lifecycle===te.ResolutionScoped&&r.scopedResolutions.set(e,o),o},t.prototype.resolveAll=function(e,r){var n=this;r===void 0&&(r=new Nr),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ke(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var s=i.map(function(a){return n.resolveRegistration(a,r)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,o,"All"),o},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var n=at(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=mt(i.value,2),o=s[0],a=s[1];this._registry.setAll(o,a.filter(function(c){return!dt(c.provider)}).map(function(c){return c.instance=void 0,c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var n=new t(this);try{for(var i=at(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=mt(s.value,2),a=o[0],c=o[1];c.some(function(u){var l=u.options;return l.lifecycle===te.ContainerScoped})&&n._registry.setAll(a,c.map(function(u){return u.options.lifecycle===te.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},t.prototype.beforeResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:n})},t.prototype.afterResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:n})},t.prototype.dispose=function(){return Ti(this,void 0,void 0,function(){var e;return Mi(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(n){var i=n.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var n=this;if(e instanceof $n)return e.createProxy(function(s){return n.resolve(s,r)});var i=function(){var s=xn.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var o=s.map(n.resolveParams(r,e));return new(e.bind.apply(e,Te([void 0],o)))}();return Fi(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,r){var n=this;return function(i,s){var o,a,c;try{return $i(i)?Wr(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Te([n.resolveAll(i.token)],i.transformArgs)):(a=n.resolve(i.transform)).transform.apply(a,Te([n.resolve(i.token,e)],i.transformArgs)):i.multiple?n.resolveAll(i.token):n.resolve(i.token,e):Wr(i)?(c=n.resolve(i.transform,e)).transform.apply(c,Te([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(u){throw new Error(zi(r,s,u))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),yr=new Hi;function z(t){return ji(t)}function Dn(){return function(t){xn.set(t,Ri(t))}}function G(){return function(t){Dn()(t),yr.registerSingleton(t)}}function Ct(t,e){return function(r){Dn()(r),yr.register(r,r,{lifecycle:t})}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);const Ui=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],_r=["contextmenu","resize","mousedown","mousemove","mouseup","pointerdown","pointermove","pointercancel","pointerup","touchstart","touchmove","touchend","wheel","keydown"];var yt=(t=>(t[t.PERSPECTIVE=0]="PERSPECTIVE",t[t.ORTHOGRAPHIC=1]="ORTHOGRAPHIC",t))(yt||{});class An{constructor(){p(this,"contextmenu$$");p(this,"resize$$");p(this,"mousedown$$");p(this,"mousemove$$");p(this,"mouseup$$");p(this,"pointerdown$$");p(this,"pointermove$$");p(this,"pointercancel$$");p(this,"pointerup$$");p(this,"touchstart$$");p(this,"touchmove$$");p(this,"touchend$$");p(this,"wheel$$");p(this,"keydown$$")}}class kn extends An{constructor(){super(...arguments);p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$")}}class In extends kn{constructor(){super(...arguments);p(this,"contextmenu");p(this,"resize");p(this,"mousedown");p(this,"mousemove");p(this,"mouseup");p(this,"pointerdown");p(this,"pointermove");p(this,"pointercancel");p(this,"pointerup");p(this,"touchstart");p(this,"touchmove");p(this,"touchend");p(this,"wheel");p(this,"keydown")}}class zn{constructor(){p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$");p(this,"contextmenu");p(this,"resize");p(this,"mousedown");p(this,"mousemove");p(this,"mouseup");p(this,"pointerdown");p(this,"pointermove");p(this,"pointercancel");p(this,"pointerup");p(this,"touchstart");p(this,"touchmove");p(this,"touchend");p(this,"wheel");p(this,"keydown")}}class qi{constructor(){p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$")}}const Vi="CONTAINER",Fn="LOADER_SERIALIZED_LOAD";var Qt=function(t,e){return Qt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Qt(t,e)};function Je(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Qt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Yi(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function Ln(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ze(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _e(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Me(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function Ie(t){return this instanceof Ie?(this.v=t,this):new Ie(t)}function Bi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(w){return function(F){return Promise.resolve(F).then(w,f)}}function a(w,F){n[w]&&(i[w]=function(A){return new Promise(function(L,_){s.push([w,A,L,_])>1||c(w,A)})},F&&(i[w]=F(i[w])))}function c(w,F){try{u(n[w](F))}catch(A){m(s[0][3],A)}}function u(w){w.value instanceof Ie?Promise.resolve(w.value.v).then(l,f):m(s[0][2],w)}function l(w){c("next",w)}function f(w){c("throw",w)}function m(w,F){w(F),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Zi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ze=="function"?ze(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function Y(t){return typeof t=="function"}function Wn(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var jt=Wn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
29
|
+
`)}function zi(t,e,r){var n=mt(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,o=ki(s,e);return Ii("Cannot inject the dependency "+o+' of "'+t.name+'" constructor. Reason:',r)}function Fi(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Li=function(t){pr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(vr),Wi=function(t){pr(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(vr),Ni=function(){function t(){this.preResolution=new Li,this.postResolution=new Wi}return t}(),xn=new Map,Hi=function(){function t(e){this.parent=e,this._registry=new Ai,this.interceptors=new Ni,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,n){n===void 0&&(n={lifecycle:te.Transient}),this.ensureNotDisposed();var i;if(Di(r)?i=r:i={useClass:r},ft(i))for(var s=[e],o=i;o!=null;){var a=o.useToken;if(s.includes(a))throw new Error("Token registration cycle detected! "+Te(s,[a]).join(" -> "));s.push(a);var c=this._registry.get(a);c&&ft(c.provider)?o=c.provider:o=null}if((n.lifecycle===te.Singleton||n.lifecycle==te.ContainerScoped||n.lifecycle==te.ResolutionScoped)&&(dt(i)||Zt(i)))throw new Error('Cannot use lifecycle "'+te[n.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:n}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),ke(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),ke(e)){if(ke(r))return this.register(e,{useToken:r},{lifecycle:te.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:te.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var n=e;return r&&!ke(r)&&(n=r),this.register(e,{useClass:n},{lifecycle:te.Singleton})},t.prototype.resolve=function(e,r){r===void 0&&(r=new Wr),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&ke(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(xi(e)){var i=this.construct(e,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var n,i;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=at(this.interceptors.preResolution.getAll(e)),a=o.next();!a.done;a=o.next()){var c=a.value;c.options.frequency!="Once"&&s.push(c),c.callback(e,r)}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.interceptors.preResolution.setAll(e,s)}},t.prototype.executePostResolutionInterceptor=function(e,r,n){var i,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var a=at(this.interceptors.postResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var u=c.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,r,n)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,o)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===te.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var n=e.options.lifecycle===te.Singleton,i=e.options.lifecycle===te.ContainerScoped,s=n||i,o;return dt(e.provider)?o=e.provider.useValue:ft(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):jn(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Zt(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,r),e.options.lifecycle===te.ResolutionScoped&&r.scopedResolutions.set(e,o),o},t.prototype.resolveAll=function(e,r){var n=this;r===void 0&&(r=new Wr),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&ke(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),i){var s=i.map(function(a){return n.resolveRegistration(a,r)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,o,"All"),o},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var n=at(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=mt(i.value,2),o=s[0],a=s[1];this._registry.setAll(o,a.filter(function(c){return!dt(c.provider)}).map(function(c){return c.instance=void 0,c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var n=new t(this);try{for(var i=at(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=mt(s.value,2),a=o[0],c=o[1];c.some(function(u){var l=u.options;return l.lifecycle===te.ContainerScoped})&&n._registry.setAll(a,c.map(function(u){return u.options.lifecycle===te.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},t.prototype.beforeResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:n})},t.prototype.afterResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:n})},t.prototype.dispose=function(){return Ti(this,void 0,void 0,function(){var e;return Mi(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(n){var i=n.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var n=this;if(e instanceof $n)return e.createProxy(function(s){return n.resolve(s,r)});var i=function(){var s=xn.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var o=s.map(n.resolveParams(r,e));return new(e.bind.apply(e,Te([void 0],o)))}();return Fi(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,r){var n=this;return function(i,s){var o,a,c;try{return $i(i)?Lr(i)?i.multiple?(o=n.resolve(i.transform)).transform.apply(o,Te([n.resolveAll(i.token)],i.transformArgs)):(a=n.resolve(i.transform)).transform.apply(a,Te([n.resolve(i.token,e)],i.transformArgs)):i.multiple?n.resolveAll(i.token):n.resolve(i.token,e):Lr(i)?(c=n.resolve(i.transform,e)).transform.apply(c,Te([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(u){throw new Error(zi(r,s,u))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),mr=new Hi;function z(t){return ji(t)}function Dn(){return function(t){xn.set(t,Ri(t))}}function G(){return function(t){Dn()(t),mr.registerSingleton(t)}}function Ct(t,e){return function(r){Dn()(r),mr.register(r,r,{lifecycle:t})}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);const Ui=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yr=["contextmenu","resize","mousedown","mousemove","mouseup","pointerdown","pointermove","pointercancel","pointerup","touchstart","touchmove","touchend","wheel","keydown"];var yt=(t=>(t[t.PERSPECTIVE=0]="PERSPECTIVE",t[t.ORTHOGRAPHIC=1]="ORTHOGRAPHIC",t))(yt||{});class An{constructor(){p(this,"contextmenu$$");p(this,"resize$$");p(this,"mousedown$$");p(this,"mousemove$$");p(this,"mouseup$$");p(this,"pointerdown$$");p(this,"pointermove$$");p(this,"pointercancel$$");p(this,"pointerup$$");p(this,"touchstart$$");p(this,"touchmove$$");p(this,"touchend$$");p(this,"wheel$$");p(this,"keydown$$")}}class kn extends An{constructor(){super(...arguments);p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$")}}class In extends kn{constructor(){super(...arguments);p(this,"contextmenu");p(this,"resize");p(this,"mousedown");p(this,"mousemove");p(this,"mouseup");p(this,"pointerdown");p(this,"pointermove");p(this,"pointercancel");p(this,"pointerup");p(this,"touchstart");p(this,"touchmove");p(this,"touchend");p(this,"wheel");p(this,"keydown")}}class zn{constructor(){p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$");p(this,"contextmenu");p(this,"resize");p(this,"mousedown");p(this,"mousemove");p(this,"mouseup");p(this,"pointerdown");p(this,"pointermove");p(this,"pointercancel");p(this,"pointerup");p(this,"touchstart");p(this,"touchmove");p(this,"touchend");p(this,"wheel");p(this,"keydown")}}class qi{constructor(){p(this,"contextmenu$");p(this,"resize$");p(this,"mousedown$");p(this,"mousemove$");p(this,"mouseup$");p(this,"pointerdown$");p(this,"pointermove$");p(this,"pointercancel$");p(this,"pointerup$");p(this,"touchstart$");p(this,"touchmove$");p(this,"touchend$");p(this,"wheel$");p(this,"keydown$")}}const Vi="CONTAINER",Fn="LOADER_SERIALIZED_LOAD";var Gt=function(t,e){return Gt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Gt(t,e)};function Je(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Gt(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Yi(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function Ln(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ze(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _e(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Me(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function Ie(t){return this instanceof Ie?(this.v=t,this):new Ie(t)}function Bi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(w){return function(F){return Promise.resolve(F).then(w,h)}}function a(w,F){n[w]&&(i[w]=function(A){return new Promise(function(L,_){s.push([w,A,L,_])>1||c(w,A)})},F&&(i[w]=F(i[w])))}function c(w,F){try{u(n[w](F))}catch(A){m(s[0][3],A)}}function u(w){w.value instanceof Ie?Promise.resolve(w.value.v).then(l,h):m(s[0][2],w)}function l(w){c("next",w)}function h(w){c("throw",w)}function m(w,F){w(F),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Zi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ze=="function"?ze(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function Y(t){return typeof t=="function"}function Wn(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var jt=Wn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
30
30
|
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
31
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function Kt(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var et=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=ze(o),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(A){e={error:A}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(Y(l))try{l()}catch(A){s=A instanceof jt?A.errors:[A]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var m=ze(f),w=m.next();!w.done;w=m.next()){var F=w.value;try{Hr(F)}catch(A){s=s??[],A instanceof jt?s=Me(Me([],_e(s)),_e(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{w&&!w.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}}if(s)throw new jt(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Hr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Kt(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Kt(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Nn=et.EMPTY;function Hn(t){return t instanceof et||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function Hr(t){Y(t)?t():t.unsubscribe()}var Un={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qn={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Me([t,e],_e(r)))},clearTimeout:function(t){var e=qn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Vn(t){qn.setTimeout(function(){throw t})}function Ur(){}function pt(t){t()}var br=function(t){Je(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hn(r)&&r.add(n)):n.destination=Xi,n}return e.create=function(r,n,i){return new Ge(r,n,i)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(et),Gi=Function.prototype.bind;function $t(t,e){return Gi.call(t,e)}var Qi=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){ut(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){ut(n)}else ut(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){ut(r)}},t}(),Ge=function(t){Je(e,t);function e(r,n,i){var s=t.call(this)||this,o;if(Y(r)||!r)o={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;s&&Un.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return s.unsubscribe()},o={next:r.next&&$t(r.next,a),error:r.error&&$t(r.error,a),complete:r.complete&&$t(r.complete,a)}):o=r}return s.destination=new Qi(o),s}return e}(br);function ut(t){Vn(t)}function Ki(t){throw t}var Xi={closed:!0,next:Ur,error:Ki,complete:Ur},wr=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Yn(t){return t}function Ji(t){return t.length===0?Yn:t.length===1?t[0]:function(r){return t.reduce(function(n,i){return i(n)},r)}}var le=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var i=this,s=ts(e)?e:new Ge(e,r,n);return pt(function(){var o=i,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=qr(r),new r(function(i,s){var o=new Ge({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});n.subscribe(o)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[wr]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Ji(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=qr(e),new e(function(n,i){var s;r.subscribe(function(o){return s=o},function(o){return i(o)},function(){return n(s)})})},t.create=function(e){return new t(e)},t}();function qr(t){var e;return(e=t??Un.Promise)!==null&&e!==void 0?e:Promise}function es(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function ts(t){return t&&t instanceof br||es(t)&&Hn(t)}function rs(t){return Y(t==null?void 0:t.lift)}function Ne(t){return function(e){if(rs(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Fe(t,e,r,n,i){return new ns(t,e,r,n,i)}var ns=function(t){Je(e,t);function e(r,n,i,s,o,a){var c=t.call(this,r)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(l){r.error(l)}}:t.prototype._next,c._error=s?function(u){try{s(u)}catch(l){r.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e}(br),is={now:function(){return performance.now()},delegate:void 0},Xt={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=Xt.delegate;n&&(e=n.requestAnimationFrame,r=n.cancelAnimationFrame);var i=e(function(s){r=void 0,t(s)});return new et(function(){return r==null?void 0:r(i)})},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return requestAnimationFrame.apply(void 0,Me([],_e(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,Me([],_e(t)))},delegate:void 0};function ss(t){return t?Bn(t):os}function Bn(t){return new le(function(e){var r=t||is,n=r.now(),i=0,s=function(){e.closed||(i=Xt.requestAnimationFrame(function(o){i=0;var a=r.now();e.next({timestamp:t?a:o,elapsed:a-n}),s()}))};return s(),function(){i&&Xt.cancelAnimationFrame(i)}})}var os=Bn(),as=Wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),tt=function(t){Je(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new Vr(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new as},e.prototype.next=function(r){var n=this;pt(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=ze(n.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(r){var n=this;pt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},e.prototype.complete=function(){var r=this;pt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?Nn:(this.currentObservers=null,a.push(r),new et(function(){n.currentObservers=null,Kt(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,s=n.thrownError,o=n.isStopped;i?r.error(s):o&&r.complete()},e.prototype.asObservable=function(){var r=new le;return r.source=this,r},e.create=function(r,n){return new Vr(r,n)},e}(le),Vr=function(t){Je(e,t);function e(r,n){var i=t.call(this)||this;return i.destination=r,i.source=n,i}return e.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},e.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Nn},e}(tt),Zn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function us(t){return Y(t==null?void 0:t.then)}function cs(t){return Y(t[wr])}function ls(t){return Symbol.asyncIterator&&Y(t==null?void 0:t[Symbol.asyncIterator])}function hs(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fs(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ds=fs();function ps(t){return Y(t==null?void 0:t[ds])}function vs(t){return Bi(this,arguments,function(){var r,n,i,s;return Ln(this,function(o){switch(o.label){case 0:r=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Ie(r.read())];case 3:return n=o.sent(),i=n.value,s=n.done,s?[4,Ie(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Ie(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ms(t){return Y(t==null?void 0:t.getReader)}function rt(t){if(t instanceof le)return t;if(t!=null){if(cs(t))return ys(t);if(Zn(t))return _s(t);if(us(t))return bs(t);if(ls(t))return Gn(t);if(ps(t))return ws(t);if(ms(t))return gs(t)}throw hs(t)}function ys(t){return new le(function(e){var r=t[wr]();if(Y(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function _s(t){return new le(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function bs(t){return new le(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Vn)})}function ws(t){return new le(function(e){var r,n;try{for(var i=ze(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.complete()})}function Gn(t){return new le(function(e){Ss(t,e).catch(function(r){return e.error(r)})})}function gs(t){return Gn(vs(t))}function Ss(t,e){var r,n,i,s;return Yi(this,void 0,void 0,function(){var o,a;return Ln(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Zi(t),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function nt(t,e){return Ne(function(r,n){var i=0;r.subscribe(Fe(n,function(s){n.next(t.call(e,s,i++))}))})}var Ps=Array.isArray;function Cs(t,e){return Ps(e)?t.apply(void 0,Me([],_e(e))):t(e)}function Es(t){return nt(function(e){return Cs(t,e)})}function Os(t,e,r,n,i,s,o,a){var c=[],u=0,l=0,f=!1,m=function(){f&&!c.length&&!u&&e.complete()},w=function(A){return u<n?F(A):c.push(A)},F=function(A){u++;var L=!1;rt(r(A,l++)).subscribe(Fe(e,function(_){e.next(_)},function(){L=!0},void 0,function(){if(L)try{u--;for(var _=function(){var C=c.shift();o||F(C)};c.length&&u<n;)_();m()}catch(C){e.error(C)}}))};return t.subscribe(Fe(e,w,function(){f=!0,m()})),function(){}}function Qn(t,e,r){return r===void 0&&(r=1/0),Y(e)?Qn(function(n,i){return nt(function(s,o){return e(n,s,i,o)})(rt(t(n,i)))},r):(typeof e=="number"&&(r=e),Ne(function(n,i){return Os(n,i,t,r)}))}var Ts=["addListener","removeListener"],Ms=["addEventListener","removeEventListener"],Rs=["on","off"];function _t(t,e,r,n){if(Y(r)&&(n=r,r=void 0),n)return _t(t,e,r).pipe(Es(n));var i=_e(xs(t)?Ms.map(function(a){return function(c){return t[a](e,c,r)}}):js(t)?Ts.map(Yr(t,e)):$s(t)?Rs.map(Yr(t,e)):[],2),s=i[0],o=i[1];if(!s&&Zn(t))return Qn(function(a){return _t(a,e,r)})(rt(t));if(!s)throw new TypeError("Invalid event target");return new le(function(a){var c=function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];return a.next(1<u.length?u:u[0])};return s(c),function(){return o(c)}})}function Yr(t,e){return function(r){return function(n){return t[r](e,n)}}}function js(t){return Y(t.addListener)&&Y(t.removeListener)}function $s(t){return Y(t.on)&&Y(t.off)}function xs(t){return Y(t.addEventListener)&&Y(t.removeEventListener)}function ye(t,e){return Ne(function(r,n){var i=0;r.subscribe(Fe(n,function(s){return t.call(e,s,i++)&&n.next(s)}))})}function gr(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new tt}:e,n=t.resetOnError,i=n===void 0?!0:n,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var l,f,m,w=0,F=!1,A=!1,L=function(){f==null||f.unsubscribe(),f=void 0},_=function(){L(),l=m=void 0,F=A=!1},C=function(){var S=l;_(),S==null||S.unsubscribe()};return Ne(function(S,R){w++,!A&&!F&&L();var g=m=m??r();R.add(function(){w--,w===0&&!A&&!F&&(f=xt(C,c))}),g.subscribe(R),!l&&w>0&&(l=new Ge({next:function(b){return g.next(b)},error:function(b){A=!0,L(),f=xt(_,i,b),g.error(b)},complete:function(){F=!0,L(),f=xt(_,o),g.complete()}}),rt(S).subscribe(l))})(u)}}function xt(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var i=new Ge({next:function(){i.unsubscribe(),t()}});return rt(e.apply(void 0,Me([],_e(r)))).subscribe(i)}}function Ds(t,e){return e===void 0&&(e=!1),Ne(function(r,n){var i=0;r.subscribe(Fe(n,function(s){var o=t(s,i++);(o||e)&&n.next(s),!o&&n.complete()}))})}function As(t,e,r){var n=Y(t)||e||r?{next:t,error:e,complete:r}:t;return n?Ne(function(i,s){var o;(o=n.subscribe)===null||o===void 0||o.call(n);var a=!0;i.subscribe(Fe(s,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),s.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),s.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),s.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Yn}var ge={},fe={},Se={},Br;function Kn(){if(Br)return Se;Br=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.DefaultSerializer=Se.extendSerializer=void 0;function t(n,i){const s=n.deserialize.bind(n),o=n.serialize.bind(n);return{deserialize(a){return i.deserialize(a,s)},serialize(a){return i.serialize(a,o)}}}Se.extendSerializer=t;const e={deserialize(n){return Object.assign(Error(n.message),{name:n.name,stack:n.stack})},serialize(n){return{__error_marker:"$$error",message:n.message,name:n.name,stack:n.stack}}},r=n=>n&&typeof n=="object"&&"__error_marker"in n&&n.__error_marker==="$$error";return Se.DefaultSerializer={deserialize(n){return r(n)?e.deserialize(n):n},serialize(n){return n instanceof Error?e.serialize(n):n}},Se}var Zr;function Qe(){if(Zr)return fe;Zr=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.serialize=fe.deserialize=fe.registerSerializer=void 0;const t=Kn();let e=t.DefaultSerializer;function r(s){e=t.extendSerializer(e,s)}fe.registerSerializer=r;function n(s){return e.deserialize(s)}fe.deserialize=n;function i(s){return e.serialize(s)}return fe.serialize=i,fe}var Dt={},de={},Pe={},Gr;function ks(){if(Gr)return Pe;Gr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.getBundleURL=Pe.getBaseURL=void 0;let t;function e(){return t||(t=r()),t}Pe.getBundleURL=e;function r(){try{throw new Error}catch(i){const s=(""+i.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(s)return n(s[0])}return"/"}function n(i){return(""+i).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}return Pe.getBaseURL=n,Pe}var Qr;function Xn(){if(Qr)return de;Qr=1,Object.defineProperty(de,"__esModule",{value:!0}),de.isWorkerRuntime=de.getWorkerImplementation=de.defaultPoolSize=void 0;const t=ks();de.defaultPoolSize=typeof navigator<"u"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const e=a=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a);function r(a){const c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function n(){if(typeof Worker>"u")return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class a extends Worker{constructor(l,f){var m,w;typeof l=="string"&&f&&f._baseURL?l=new URL(l,f._baseURL):typeof l=="string"&&!e(l)&&t.getBundleURL().match(/^file:\/\//i)&&(l=new URL(l,t.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((m=f==null?void 0:f.CORSWorkaround)!==null&&m!==void 0)||m)&&(l=r(`importScripts(${JSON.stringify(l)});`))),typeof l=="string"&&e(l)&&(!((w=f==null?void 0:f.CORSWorkaround)!==null&&w!==void 0)||w)&&(l=r(`importScripts(${JSON.stringify(l)});`)),super(l,f)}}class c extends a{constructor(l,f){const m=window.URL.createObjectURL(l);super(m,f)}static fromText(l,f){const m=new window.Blob([l],{type:"text/javascript"});return new c(m,f)}}return{blob:c,default:a}}let i;function s(){return i||(i=n()),i}de.getWorkerImplementation=s;function o(){const a=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!a)}return de.isWorkerRuntime=o,de}var Ce={},ct={exports:{}},At,Kr;function Is(){if(Kr)return At;Kr=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,s=n*365.25;At=function(l,f){f=f||{};var m=typeof l;if(m==="string"&&l.length>0)return o(l);if(m==="number"&&isFinite(l))return f.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(f){var m=parseFloat(f[1]),w=(f[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return m*s;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*r;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function a(l){var f=Math.abs(l);return f>=n?Math.round(l/n)+"d":f>=r?Math.round(l/r)+"h":f>=e?Math.round(l/e)+"m":f>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var f=Math.abs(l);return f>=n?u(l,f,n,"day"):f>=r?u(l,f,r,"hour"):f>=e?u(l,f,e,"minute"):f>=t?u(l,f,t,"second"):l+" ms"}function u(l,f,m,w){var F=f>=m*1.5;return Math.round(l/m)+" "+w+(F?"s":"")}return At}var kt,Xr;function zs(){if(Xr)return kt;Xr=1;function t(e){n.debug=n,n.default=n,n.coerce=u,n.disable=o,n.enable=s,n.enabled=a,n.humanize=Is(),n.destroy=l,Object.keys(e).forEach(f=>{n[f]=e[f]}),n.names=[],n.skips=[],n.formatters={};function r(f){let m=0;for(let w=0;w<f.length;w++)m=(m<<5)-m+f.charCodeAt(w),m|=0;return n.colors[Math.abs(m)%n.colors.length]}n.selectColor=r;function n(f){let m,w=null,F,A;function L(..._){if(!L.enabled)return;const C=L,S=Number(new Date),R=S-(m||S);C.diff=R,C.prev=m,C.curr=S,m=S,_[0]=n.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let g=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(D,H)=>{if(D==="%%")return"%";g++;const y=n.formatters[H];if(typeof y=="function"){const $=_[g];D=y.call(C,$),_.splice(g,1),g--}return D}),n.formatArgs.call(C,_),(C.log||n.log).apply(C,_)}return L.namespace=f,L.useColors=n.useColors(),L.color=n.selectColor(f),L.extend=i,L.destroy=n.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(F!==n.namespaces&&(F=n.namespaces,A=n.enabled(f)),A),set:_=>{w=_}}),typeof n.init=="function"&&n.init(L),L}function i(f,m){const w=n(this.namespace+(typeof m>"u"?":":m)+f);return w.log=this.log,w}function s(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];let m;const w=(typeof f=="string"?f:"").split(/[\s,]+/),F=w.length;for(m=0;m<F;m++)w[m]&&(f=w[m].replace(/\*/g,".*?"),f[0]==="-"?n.skips.push(new RegExp("^"+f.slice(1)+"$")):n.names.push(new RegExp("^"+f+"$")))}function o(){const f=[...n.names.map(c),...n.skips.map(c).map(m=>"-"+m)].join(",");return n.enable(""),f}function a(f){if(f[f.length-1]==="*")return!0;let m,w;for(m=0,w=n.skips.length;m<w;m++)if(n.skips[m].test(f))return!1;for(m=0,w=n.names.length;m<w;m++)if(n.names[m].test(f))return!0;return!1}function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function u(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return kt=t,kt}var Jr;function Sr(){return Jr||(Jr=1,function(t,e){e.formatArgs=n,e.save=i,e.load=s,e.useColors=r,e.storage=o(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,f=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(l++,m==="%c"&&(f=l))}),c.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}t.exports=zs()(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(ct,ct.exports)),ct.exports}var Fs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};class Et{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(e=>this._baseObserver.error(e))}error(e){this._baseObserver.error(e)}schedule(e){const r=Promise.all(this._pendingPromises),n=[],i=o=>n.push(o),s=Promise.resolve().then(()=>Fs(this,void 0,void 0,function*(){yield r,yield e(i),this._pendingPromises.delete(s);for(const o of n)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(s),this._baseObserver.error(o)});this._pendingPromises.add(s)}}const Jn=()=>typeof Symbol=="function",it=t=>Jn()&&!!Symbol[t],Pr=t=>it(t)?Symbol[t]:"@@"+t;it("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Ls=Pr("iterator"),Jt=Pr("observable"),ei=Pr("species");function bt(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Ue(t){let e=t.constructor;return e!==void 0&&(e=e[ei],e===null&&(e=void 0)),e!==void 0?e:re}function Ws(t){return t instanceof re}function Le(t){Le.log?Le.log(t):setTimeout(()=>{throw t},0)}function vt(t){Promise.resolve().then(()=>{try{t()}catch(e){Le(e)}})}function ti(t){const e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const r=bt(e,"unsubscribe");r&&r.call(e)}}catch(r){Le(r)}}function er(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Ns(t){const e=t._queue;if(e){t._queue=void 0,t._state="ready";for(const r of e)if(ri(t,r.type,r.value),t._state==="closed")break}}function ri(t,e,r){t._state="running";const n=t._observer;try{const i=n?bt(n,e):void 0;switch(e){case"next":i&&i.call(n,r);break;case"error":if(er(t),i)i.call(n,r);else throw r;break;case"complete":er(t),i&&i.call(n);break}}catch(i){Le(i)}t._state==="closed"?ti(t):t._state==="running"&&(t._state="ready")}function It(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue=t._queue||[],t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],vt(()=>Ns(t));return}ri(t,e,r)}}class Hs{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new Us(this);try{this._cleanup=r.call(void 0,n)}catch(i){n.error(i)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(er(this),ti(this))}}class Us{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){It(this._subscription,"next",e)}error(e){It(this._subscription,"error",e)}complete(){It(this._subscription,"complete")}}class re{constructor(e){if(!(this instanceof re))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,r,n){return(typeof e!="object"||e===null)&&(e={next:e,error:r,complete:n}),new Hs(e,this._subscriber)}pipe(e,...r){let n=this;for(const i of[e,...r])n=i(n);return n}tap(e,r,n){const i=typeof e!="object"||e===null?{next:e,error:r,complete:n}:e;return new re(s=>this.subscribe({next(o){i.next&&i.next(o),s.next(o)},error(o){i.error&&i.error(o),s.error(o)},complete(){i.complete&&i.complete(),s.complete()},start(o){i.start&&i.start(o)}}))}forEach(e){return new Promise((r,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function i(){s.unsubscribe(),r(void 0)}const s=this.subscribe({next(o){try{e(o,i)}catch(a){n(a),s.unsubscribe()}},error(o){n(o)},complete(){r(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Ue(this);return new r(n=>this.subscribe({next(i){let s=i;try{s=e(i)}catch(o){return n.error(o)}n.next(s)},error(i){n.error(i)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Ue(this);return new r(n=>this.subscribe({next(i){try{if(!e(i))return}catch(s){return n.error(s)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}reduce(e,r){if(typeof e!="function")throw new TypeError(e+" is not a function");const n=Ue(this),i=arguments.length>1;let s=!1,o=r;return new n(a=>this.subscribe({next(c){const u=!s;if(s=!0,!u||i)try{o=e(o,c)}catch(l){return a.error(l)}else o=c},error(c){a.error(c)},complete(){if(!s&&!i)return a.error(new TypeError("Cannot reduce an empty sequence"));a.next(o),a.complete()}}))}concat(...e){const r=Ue(this);return new r(n=>{let i,s=0;function o(a){i=a.subscribe({next(c){n.next(c)},error(c){n.error(c)},complete(){s===e.length?(i=void 0,n.complete()):o(r.from(e[s++]))}})}return o(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Ue(this);return new r(n=>{const i=[],s=this.subscribe({next(a){let c;if(e)try{c=e(a)}catch(l){return n.error(l)}else c=a;const u=r.from(c).subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){const l=i.indexOf(u);l>=0&&i.splice(l,1),o()}});i.push(u)},error(a){n.error(a)},complete(){o()}});function o(){s.closed&&i.length===0&&n.complete()}return()=>{i.forEach(a=>a.unsubscribe()),s.unsubscribe()}})}[Jt](){return this}static from(e){const r=typeof this=="function"?this:re;if(e==null)throw new TypeError(e+" is not an object");const n=bt(e,Jt);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ws(i)&&i.constructor===r?i:new r(s=>i.subscribe(s))}if(it("iterator")){const i=bt(e,Ls);if(i)return new r(s=>{vt(()=>{if(!s.closed){for(const o of i.call(e))if(s.next(o),s.closed)return;s.complete()}})})}if(Array.isArray(e))return new r(i=>{vt(()=>{if(!i.closed){for(const s of e)if(i.next(s),i.closed)return;i.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){const r=typeof this=="function"?this:re;return new r(n=>{vt(()=>{if(!n.closed){for(const i of e)if(n.next(i),n.closed)return;n.complete()}})})}static get[ei](){return this}}Jn()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:Jt,hostReportError:Le},configurable:!0});function $e(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}var qs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Vs(t){return e=>new re(r=>{const n=new Et(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>qs(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>$e(i)})}function Ys(t){return t&&it("asyncIterator")&&t[Symbol.asyncIterator]}function Bs(t){return t&&it("iterator")&&t[Symbol.iterator]}var Zs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Gs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}};function Qs(t){return e=>new re(r=>{const n=new Et(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Zs(this,void 0,void 0,function*(){var a,c;const u=yield t(s);if(Bs(u)||Ys(u))try{for(var l=Gs(u),f;f=yield l.next(),!f.done;){const m=f.value;o(m)}}catch(m){a={error:m}}finally{try{f&&!f.done&&(c=l.return)&&(yield c.call(l))}finally{if(a)throw a.error}}else u.map(m=>o(m))}))}});return()=>$e(i)})}function Ks(t){return new re(e=>{let r=0;const n=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(n)})}var Xs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Js(t){return e=>new re(r=>{const n=new Et(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Xs(this,void 0,void 0,function*(){const a=yield t(s);o(a)}))}});return()=>$e(i)})}function eo(...t){return t.length===0?re.from([]):new re(e=>{let r=0;const n=t.map(s=>s.subscribe({error(o){e.error(o),i()},next(o){e.next(o)},complete(){++r===t.length&&(e.complete(),i())}})),i=()=>{n.forEach(s=>$e(s))};return i})}class ni extends re{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const r of this._observers)r.next(e)}error(e){for(const r of this._observers)r.error(e)}complete(){for(const e of this._observers)e.complete()}}function to(t){const e=new ni;let r,n=0;return new re(i=>{r||(r=t.subscribe(e));const s=e.subscribe(i);return n++,()=>{n--,s.unsubscribe(),n===0&&($e(r),r=void 0)}})}var ro=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function no(t,e){return r=>new re(n=>{let i,s=0;const o=new Et(n),a=r.subscribe({complete(){o.complete()},error(c){o.error(c)},next(c){o.schedule(u=>ro(this,void 0,void 0,function*(){i=yield t(s===0?typeof e>"u"?c:e:i,c,s++),u(i)}))}});return()=>$e(a)})}const io=Object.freeze(Object.defineProperty({__proto__:null,Observable:re,Subject:ni,filter:Vs,flatMap:Qs,interval:Ks,map:Js,merge:eo,multicast:to,scan:no,unsubscribe:$e},Symbol.toStringTag,{value:"Module"})),Ot=Ei(io);var qe={},en;function so(){if(en)return qe;en=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.allSettled=void 0;function t(e){return Promise.all(e.map(r=>{const n=o=>({status:"fulfilled",value:o}),i=o=>({status:"rejected",reason:o}),s=Promise.resolve(r);try{return s.then(n,i)}catch(o){return Promise.reject(o)}}))}return qe.allSettled=t,qe}var zt={},tn;function oo(){return tn||(tn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PoolEventType=void 0,function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(t.PoolEventType||(t.PoolEventType={}))}(zt)),zt}var Ve={},oe={},rn;function Cr(){return rn||(rn=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.$worker=oe.$transferable=oe.$terminate=oe.$events=oe.$errors=void 0,oe.$errors=Symbol("thread.errors"),oe.$events=Symbol("thread.events"),oe.$terminate=Symbol("thread.terminate"),oe.$transferable=Symbol("thread.transferable"),oe.$worker=Symbol("thread.worker")),oe}var nn;function ii(){if(nn)return Ve;nn=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.Thread=void 0;const t=Cr();function e(r){throw Error(r)}return Ve.Thread={errors(r){return r[t.$errors]||e("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},events(r){return r[t.$events]||e("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},terminate(r){return r[t.$terminate]()}},Ve}var sn;function ao(){return sn||(sn=1,function(t){var e=Ce&&Ce.__awaiter||function(_,C,S,R){function g(b){return b instanceof S?b:new S(function(D){D(b)})}return new(S||(S=Promise))(function(b,D){function H(k){try{$(R.next(k))}catch(U){D(U)}}function y(k){try{$(R.throw(k))}catch(U){D(U)}}function $(k){k.done?b(k.value):g(k.value).then(H,y)}$((R=R.apply(_,C||[])).next())})},r=Ce&&Ce.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(t,"__esModule",{value:!0}),t.Pool=t.Thread=t.PoolEventType=void 0;const n=r(Sr()),i=Ot,s=so(),o=Xn(),a=oo();Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return a.PoolEventType}});const c=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return c.Thread}});let u=1;function l(_){const C=[];for(let S=0;S<_;S++)C.push(S);return C}function f(_){return new Promise(C=>setTimeout(C,_))}function m(_,C){return _.reduce((S,R)=>[...S,...C(R)],[])}function w(_){return _.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function F(_,C){return l(C).map(()=>({init:_(),runningTasks:[]}))}class A{constructor(C,S){this.eventSubject=new i.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const R=typeof S=="number"?{size:S}:S||{},{size:g=o.defaultPoolSize}=R;this.debug=n.default(`threads:pool:${w(R.name||String(u++))}`),this.options=R,this.workers=F(C,g),this.eventObservable=i.multicast(i.Observable.from(this.eventSubject)),Promise.all(this.workers.map(b=>b.init)).then(()=>this.eventSubject.next({type:a.PoolEventType.initialized,size:this.workers.length}),b=>{this.debug("Error while initializing pool worker:",b),this.eventSubject.error(b),this.initErrors.push(b)})}findIdlingWorker(){const{concurrency:C=1}=this.options;return this.workers.find(S=>S.runningTasks.length<C)}runPoolTask(C,S){return e(this,void 0,void 0,function*(){const R=this.workers.indexOf(C)+1;this.debug(`Running task #${S.id} on worker #${R}...`),this.eventSubject.next({type:a.PoolEventType.taskStart,taskID:S.id,workerID:R});try{const g=yield S.run(yield C.init);this.debug(`Task #${S.id} completed successfully`),this.eventSubject.next({type:a.PoolEventType.taskCompleted,returnValue:g,taskID:S.id,workerID:R})}catch(g){this.debug(`Task #${S.id} failed`),this.eventSubject.next({type:a.PoolEventType.taskFailed,taskID:S.id,error:g,workerID:R})}})}run(C,S){return e(this,void 0,void 0,function*(){const R=e(this,void 0,void 0,function*(){const g=()=>{C.runningTasks=C.runningTasks.filter(b=>b!==R)};yield f(0);try{yield this.runPoolTask(C,S)}finally{g(),this.isClosing||this.scheduleWork()}});C.runningTasks.push(R)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const C=this.findIdlingWorker();if(!C)return;const S=this.taskQueue.shift();if(!S){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(C,S)}taskCompletion(C){return new Promise((S,R)=>{const g=this.events().subscribe(b=>{b.type===a.PoolEventType.taskCompleted&&b.taskID===C?(g.unsubscribe(),S(b.returnValue)):b.type===a.PoolEventType.taskFailed&&b.taskID===C?(g.unsubscribe(),R(b.error)):b.type===a.PoolEventType.terminated&&(g.unsubscribe(),R(Error("Pool has been terminated before task was run.")))})})}settled(C=!1){return e(this,void 0,void 0,function*(){const S=()=>m(this.workers,b=>b.runningTasks),R=[],g=this.eventObservable.subscribe(b=>{b.type===a.PoolEventType.taskFailed&&R.push(b.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):C&&this.taskQueue.length===0?(yield s.allSettled(S()),R):(yield new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained&&(H.unsubscribe(),b(void 0))},error:D})}),yield s.allSettled(S()),g.unsubscribe(),R)})}completed(C=!1){return e(this,void 0,void 0,function*(){const S=this.settled(C),R=new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained?(H.unsubscribe(),b(S)):y.type===a.PoolEventType.taskFailed&&(H.unsubscribe(),D(y.error))},error:D})}),g=yield Promise.race([S,R]);if(g.length>0)throw g[0]})}events(){return this.eventObservable}queue(C){const{maxQueuedJobs:S=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const R=this.nextTaskID++,g=this.taskCompletion(R);g.catch(D=>{this.debug(`Task #${R} errored:`,D)});const b={id:R,run:C,cancel:()=>{this.taskQueue.indexOf(b)!==-1&&(this.taskQueue=this.taskQueue.filter(D=>D!==b),this.eventSubject.next({type:a.PoolEventType.taskCanceled,taskID:b.id}))},then:g.then.bind(g)};if(this.taskQueue.length>=S)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.
|
|
32
|
-
This usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${b.id}...`),this.taskQueue.push(b),this.eventSubject.next({type:a.PoolEventType.taskQueued,taskID:b.id}),this.scheduleWork(),b}terminate(C){return e(this,void 0,void 0,function*(){this.isClosing=!0,C||(yield this.completed(!0)),this.eventSubject.next({type:a.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(S=>e(this,void 0,void 0,function*(){return c.Thread.terminate(yield S.init)})))})}}A.EventType=a.PoolEventType;function L(_,C){return new A(_,C)}L.EventType=a.PoolEventType,t.Pool=L}(Ce)),Ce}var pe={},Ye={},on;function uo(){if(on)return Ye;on=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.createPromiseWithResolver=void 0;const t=()=>{};function e(){let r=!1,n,i=t;return[new Promise(a=>{r?a(n):i=a}),a=>{r=!0,n=a,i(n)}]}return Ye.createPromiseWithResolver=e,Ye}var Ft={},an;function co(){return an||(an=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerEventType=void 0,function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(t.WorkerEventType||(t.WorkerEventType={}))}(Ft)),Ft}var ve={},Be={},un;function lo(){if(un)return Be;un=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.ObservablePromise=void 0;const t=Ot,e=()=>{},r=a=>a,n=a=>Promise.resolve().then(a);function i(a){throw a}function s(a){return a&&typeof a.then=="function"}class o extends t.Observable{constructor(c){super(u=>{const l=this,f=Object.assign(Object.assign({},u),{complete(){u.complete(),l.onCompletion()},error(m){u.error(m),l.onError(m)},next(m){u.next(m),l.onNext(m)}});try{return this.initHasRun=!0,c(f)}catch(m){f.error(m)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(c){this.firstValueSet||(this.firstValue=c,this.firstValueSet=!0)}onError(c){this.state="rejected",this.rejection=c;for(const u of this.rejectionCallbacks)n(()=>u(c))}onCompletion(){this.state="fulfilled";for(const c of this.fulfillmentCallbacks)n(()=>c(this.firstValue))}then(c,u){const l=c||r,f=u||i;let m=!1;return new Promise((w,F)=>{const A=_=>{if(!m){m=!0;try{w(f(_))}catch(C){F(C)}}},L=_=>{try{w(l(_))}catch(C){A(C)}};if(this.initHasRun||this.subscribe({error:A}),this.state==="fulfilled")return w(l(this.firstValue));if(this.state==="rejected")return m=!0,w(f(this.rejection));this.fulfillmentCallbacks.push(L),this.rejectionCallbacks.push(A)})}catch(c){return this.then(void 0,c)}finally(c){const u=c||e;return this.then(l=>(u(),l),()=>u())}static from(c){return s(c)?new o(u=>{const l=m=>{u.next(m),u.complete()},f=m=>{u.error(m)};c.then(l,f)}):super.from(c)}}return Be.ObservablePromise=o,Be}var Ee={},cn;function wt(){if(cn)return Ee;cn=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Transfer=Ee.isTransferDescriptor=void 0;const t=Cr();function e(i){return!(!i||typeof i!="object")}function r(i){return i&&typeof i=="object"&&i[t.$transferable]}Ee.isTransferDescriptor=r;function n(i,s){if(!s){if(!e(i))throw Error();s=[i]}return{[t.$transferable]:!0,send:i,transferables:s}}return Ee.Transfer=n,Ee}var Lt={},ln;function si(){return ln||(ln=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerMessageType=t.MasterMessageType=void 0,function(e){e.cancel="cancel",e.run="run"}(t.MasterMessageType||(t.MasterMessageType={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(t.WorkerMessageType||(t.WorkerMessageType={}))}(Lt)),Lt}var hn;function ho(){if(hn)return ve;hn=1;var t=ve&&ve.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ve,"__esModule",{value:!0}),ve.createProxyModule=ve.createProxyFunction=void 0;const e=t(Sr()),r=Ot,n=Qe(),i=lo(),s=wt(),o=si(),a=e.default("threads:master:messages");let c=1;const u=_=>Array.from(new Set(_)),l=_=>_&&_.type===o.WorkerMessageType.error,f=_=>_&&_.type===o.WorkerMessageType.result,m=_=>_&&_.type===o.WorkerMessageType.running;function w(_,C){return new r.Observable(S=>{let R;const g=b=>{if(a("Message from worker:",b.data),!(!b.data||b.data.uid!==C)){if(m(b.data))R=b.data.resultType;else if(f(b.data))R==="promise"?(typeof b.data.payload<"u"&&S.next(n.deserialize(b.data.payload)),S.complete(),_.removeEventListener("message",g)):(b.data.payload&&S.next(n.deserialize(b.data.payload)),b.data.complete&&(S.complete(),_.removeEventListener("message",g)));else if(l(b.data)){const D=n.deserialize(b.data.error);S.error(D),_.removeEventListener("message",g)}}};return _.addEventListener("message",g),()=>{if(R==="observable"||!R){const b={type:o.MasterMessageType.cancel,uid:C};_.postMessage(b)}_.removeEventListener("message",g)}})}function F(_){if(_.length===0)return{args:[],transferables:[]};const C=[],S=[];for(const R of _)s.isTransferDescriptor(R)?(C.push(n.serialize(R.send)),S.push(...R.transferables)):C.push(n.serialize(R));return{args:C,transferables:S.length===0?S:u(S)}}function A(_,C){return(...S)=>{const R=c++,{args:g,transferables:b}=F(S),D={type:o.MasterMessageType.run,uid:R,method:C,args:g};a("Sending command to run function to worker:",D);try{_.postMessage(D,b)}catch(H){return i.ObservablePromise.from(Promise.reject(H))}return i.ObservablePromise.from(r.multicast(w(_,R)))}}ve.createProxyFunction=A;function L(_,C){const S={};for(const R of C)S[R]=A(_,R);return S}return ve.createProxyModule=L,ve}var fn;function fo(){if(fn)return pe;fn=1;var t=pe&&pe.__awaiter||function(g,b,D,H){function y($){return $ instanceof D?$:new D(function(k){k($)})}return new(D||(D=Promise))(function($,k){function U(Q){try{B(H.next(Q))}catch(he){k(he)}}function ne(Q){try{B(H.throw(Q))}catch(he){k(he)}}function B(Q){Q.done?$(Q.value):y(Q.value).then(U,ne)}B((H=H.apply(g,b||[])).next())})},e=pe&&pe.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.spawn=void 0;const r=e(Sr()),n=Ot,i=Qe(),s=uo(),o=Cr(),a=co(),c=ho(),u=r.default("threads:master:messages"),l=r.default("threads:master:spawn"),f=r.default("threads:master:thread-utils"),m=g=>g&&g.type==="init",w=g=>g&&g.type==="uncaughtError",F=typeof process<"u"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function A(g,b,D){return t(this,void 0,void 0,function*(){let H;const y=new Promise((k,U)=>{H=setTimeout(()=>U(Error(D)),b)}),$=yield Promise.race([g,y]);return clearTimeout(H),$})}function L(g){return new Promise((b,D)=>{const H=y=>{u("Message from worker before finishing initialization:",y.data),m(y.data)?(g.removeEventListener("message",H),b(y.data)):w(y.data)&&(g.removeEventListener("message",H),D(i.deserialize(y.data.error)))};g.addEventListener("message",H)})}function _(g,b){return new n.Observable(D=>{const H=$=>{const k={type:a.WorkerEventType.message,data:$.data};D.next(k)},y=$=>{f("Unhandled promise rejection event in thread:",$);const k={type:a.WorkerEventType.internalError,error:Error($.reason)};D.next(k)};g.addEventListener("message",H),g.addEventListener("unhandledrejection",y),b.then(()=>{const $={type:a.WorkerEventType.termination};g.removeEventListener("message",H),g.removeEventListener("unhandledrejection",y),D.next($),D.complete()})})}function C(g){const[b,D]=s.createPromiseWithResolver();return{terminate:()=>t(this,void 0,void 0,function*(){f("Terminating worker"),yield g.terminate(),D()}),termination:b}}function S(g,b,D,H){const y=D.filter($=>$.type===a.WorkerEventType.internalError).map($=>$.error);return Object.assign(g,{[o.$errors]:y,[o.$events]:D,[o.$terminate]:H,[o.$worker]:b})}function R(g,b){return t(this,void 0,void 0,function*(){l("Initializing new thread");const D=b&&b.timeout?b.timeout:F,y=(yield A(L(g),D,`Timeout: Did not receive an init message from worker after ${D}ms. Make sure the worker calls expose().`)).exposed,{termination:$,terminate:k}=C(g),U=_(g,$);if(y.type==="function"){const ne=c.createProxyFunction(g);return S(ne,g,U,k)}else if(y.type==="module"){const ne=c.createProxyModule(g,y.methods);return S(ne,g,U,k)}else{const ne=y.type;throw Error(`Worker init message states unexpected type of expose(): ${ne}`)}})}return pe.spawn=R,pe}var dn;function po(){return dn||(dn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Worker=t.BlobWorker=t.isWorkerRuntime=t.Thread=t.spawn=t.Pool=void 0;const e=Xn();Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return e.isWorkerRuntime}});var r=ao();Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return r.Pool}});var n=fo();Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return n.spawn}});var i=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return i.Thread}}),t.BlobWorker=e.getWorkerImplementation().blob,t.Worker=e.getWorkerImplementation().default}(Dt)),Dt}var Oe={},Wt,pn;function vo(){return pn||(pn=1,Wt=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1),Wt}var lt={},vn;function mo(){if(vn)return lt;vn=1,Object.defineProperty(lt,"__esModule",{value:!0});const t=function(){const i=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!i)},e=function(i,s){self.postMessage(i,s)},r=function(i){const s=a=>{i(a.data)},o=()=>{self.removeEventListener("message",s)};return self.addEventListener("message",s),o};return lt.default={isWorkerRuntime:t,postMessageToMaster:e,subscribeToMasterMessages:r},lt}var mn;function oi(){return mn||(mn=1,function(t){var e=Oe&&Oe.__awaiter||function(y,$,k,U){function ne(B){return B instanceof k?B:new k(function(Q){Q(B)})}return new(k||(k=Promise))(function(B,Q){function he(ue){try{xe(U.next(ue))}catch(De){Q(De)}}function st(ue){try{xe(U.throw(ue))}catch(De){Q(De)}}function xe(ue){ue.done?B(ue.value):ne(ue.value).then(he,st)}xe((U=U.apply(y,$||[])).next())})},r=Oe&&Oe.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(t,"__esModule",{value:!0}),t.expose=t.isWorkerRuntime=t.Transfer=t.registerSerializer=void 0;const n=r(vo()),i=Qe(),s=wt(),o=si(),a=r(mo());var c=Qe();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return c.registerSerializer}});var u=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return u.Transfer}}),t.isWorkerRuntime=a.default.isWorkerRuntime;let l=!1;const f=new Map,m=y=>y&&y.type===o.MasterMessageType.cancel,w=y=>y&&y.type===o.MasterMessageType.run,F=y=>n.default(y)||A(y);function A(y){return y&&typeof y=="object"&&typeof y.subscribe=="function"}function L(y){return s.isTransferDescriptor(y)?{payload:y.send,transferables:y.transferables}:{payload:y,transferables:void 0}}function _(){const y={type:o.WorkerMessageType.init,exposed:{type:"function"}};a.default.postMessageToMaster(y)}function C(y){const $={type:o.WorkerMessageType.init,exposed:{type:"module",methods:y}};a.default.postMessageToMaster($)}function S(y,$){const{payload:k,transferables:U}=L($),ne={type:o.WorkerMessageType.error,uid:y,error:i.serialize(k)};a.default.postMessageToMaster(ne,U)}function R(y,$,k){const{payload:U,transferables:ne}=L(k),B={type:o.WorkerMessageType.result,uid:y,complete:$?!0:void 0,payload:U};a.default.postMessageToMaster(B,ne)}function g(y,$){const k={type:o.WorkerMessageType.running,uid:y,resultType:$};a.default.postMessageToMaster(k)}function b(y){try{const $={type:o.WorkerMessageType.uncaughtError,error:i.serialize(y)};a.default.postMessageToMaster($)}catch($){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.
|
|
31
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function Qt(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var et=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=ze(o),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(A){e={error:A}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(Y(l))try{l()}catch(A){s=A instanceof jt?A.errors:[A]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var m=ze(h),w=m.next();!w.done;w=m.next()){var F=w.value;try{Nr(F)}catch(A){s=s??[],A instanceof jt?s=Me(Me([],_e(s)),_e(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{w&&!w.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}}if(s)throw new jt(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Nr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Qt(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Qt(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Nn=et.EMPTY;function Hn(t){return t instanceof et||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function Nr(t){Y(t)?t():t.unsubscribe()}var Un={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qn={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Me([t,e],_e(r)))},clearTimeout:function(t){var e=qn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Vn(t){qn.setTimeout(function(){throw t})}function Hr(){}function pt(t){t()}var _r=function(t){Je(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hn(r)&&r.add(n)):n.destination=Xi,n}return e.create=function(r,n,i){return new Ge(r,n,i)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(et),Gi=Function.prototype.bind;function $t(t,e){return Gi.call(t,e)}var Qi=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){ut(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){ut(n)}else ut(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){ut(r)}},t}(),Ge=function(t){Je(e,t);function e(r,n,i){var s=t.call(this)||this,o;if(Y(r)||!r)o={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;s&&Un.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return s.unsubscribe()},o={next:r.next&&$t(r.next,a),error:r.error&&$t(r.error,a),complete:r.complete&&$t(r.complete,a)}):o=r}return s.destination=new Qi(o),s}return e}(_r);function ut(t){Vn(t)}function Ki(t){throw t}var Xi={closed:!0,next:Hr,error:Ki,complete:Hr},br=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Yn(t){return t}function Ji(t){return t.length===0?Yn:t.length===1?t[0]:function(r){return t.reduce(function(n,i){return i(n)},r)}}var le=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var i=this,s=ts(e)?e:new Ge(e,r,n);return pt(function(){var o=i,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=Ur(r),new r(function(i,s){var o=new Ge({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});n.subscribe(o)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[br]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Ji(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Ur(e),new e(function(n,i){var s;r.subscribe(function(o){return s=o},function(o){return i(o)},function(){return n(s)})})},t.create=function(e){return new t(e)},t}();function Ur(t){var e;return(e=t??Un.Promise)!==null&&e!==void 0?e:Promise}function es(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function ts(t){return t&&t instanceof _r||es(t)&&Hn(t)}function rs(t){return Y(t==null?void 0:t.lift)}function Ne(t){return function(e){if(rs(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Fe(t,e,r,n,i){return new ns(t,e,r,n,i)}var ns=function(t){Je(e,t);function e(r,n,i,s,o,a){var c=t.call(this,r)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(l){r.error(l)}}:t.prototype._next,c._error=s?function(u){try{s(u)}catch(l){r.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e}(_r),is={now:function(){return performance.now()},delegate:void 0},Kt={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=Kt.delegate;n&&(e=n.requestAnimationFrame,r=n.cancelAnimationFrame);var i=e(function(s){r=void 0,t(s)});return new et(function(){return r==null?void 0:r(i)})},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return requestAnimationFrame.apply(void 0,Me([],_e(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,Me([],_e(t)))},delegate:void 0};function ss(t){return t?Bn(t):os}function Bn(t){return new le(function(e){var r=t||is,n=r.now(),i=0,s=function(){e.closed||(i=Kt.requestAnimationFrame(function(o){i=0;var a=r.now();e.next({timestamp:t?a:o,elapsed:a-n}),s()}))};return s(),function(){i&&Kt.cancelAnimationFrame(i)}})}var os=Bn(),as=Wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),tt=function(t){Je(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new qr(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new as},e.prototype.next=function(r){var n=this;pt(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=ze(n.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(r){var n=this;pt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},e.prototype.complete=function(){var r=this;pt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?Nn:(this.currentObservers=null,a.push(r),new et(function(){n.currentObservers=null,Qt(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,s=n.thrownError,o=n.isStopped;i?r.error(s):o&&r.complete()},e.prototype.asObservable=function(){var r=new le;return r.source=this,r},e.create=function(r,n){return new qr(r,n)},e}(le),qr=function(t){Je(e,t);function e(r,n){var i=t.call(this)||this;return i.destination=r,i.source=n,i}return e.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},e.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Nn},e}(tt),Zn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function us(t){return Y(t==null?void 0:t.then)}function cs(t){return Y(t[br])}function ls(t){return Symbol.asyncIterator&&Y(t==null?void 0:t[Symbol.asyncIterator])}function hs(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fs(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ds=fs();function ps(t){return Y(t==null?void 0:t[ds])}function vs(t){return Bi(this,arguments,function(){var r,n,i,s;return Ln(this,function(o){switch(o.label){case 0:r=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Ie(r.read())];case 3:return n=o.sent(),i=n.value,s=n.done,s?[4,Ie(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Ie(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ms(t){return Y(t==null?void 0:t.getReader)}function rt(t){if(t instanceof le)return t;if(t!=null){if(cs(t))return ys(t);if(Zn(t))return _s(t);if(us(t))return bs(t);if(ls(t))return Gn(t);if(ps(t))return ws(t);if(ms(t))return gs(t)}throw hs(t)}function ys(t){return new le(function(e){var r=t[br]();if(Y(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function _s(t){return new le(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function bs(t){return new le(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Vn)})}function ws(t){return new le(function(e){var r,n;try{for(var i=ze(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.complete()})}function Gn(t){return new le(function(e){Ss(t,e).catch(function(r){return e.error(r)})})}function gs(t){return Gn(vs(t))}function Ss(t,e){var r,n,i,s;return Yi(this,void 0,void 0,function(){var o,a;return Ln(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Zi(t),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(o=n.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function nt(t,e){return Ne(function(r,n){var i=0;r.subscribe(Fe(n,function(s){n.next(t.call(e,s,i++))}))})}var Ps=Array.isArray;function Cs(t,e){return Ps(e)?t.apply(void 0,Me([],_e(e))):t(e)}function Es(t){return nt(function(e){return Cs(t,e)})}function Os(t,e,r,n,i,s,o,a){var c=[],u=0,l=0,h=!1,m=function(){h&&!c.length&&!u&&e.complete()},w=function(A){return u<n?F(A):c.push(A)},F=function(A){u++;var L=!1;rt(r(A,l++)).subscribe(Fe(e,function(_){e.next(_)},function(){L=!0},void 0,function(){if(L)try{u--;for(var _=function(){var C=c.shift();o||F(C)};c.length&&u<n;)_();m()}catch(C){e.error(C)}}))};return t.subscribe(Fe(e,w,function(){h=!0,m()})),function(){}}function Qn(t,e,r){return r===void 0&&(r=1/0),Y(e)?Qn(function(n,i){return nt(function(s,o){return e(n,s,i,o)})(rt(t(n,i)))},r):(typeof e=="number"&&(r=e),Ne(function(n,i){return Os(n,i,t,r)}))}var Ts=["addListener","removeListener"],Ms=["addEventListener","removeEventListener"],Rs=["on","off"];function _t(t,e,r,n){if(Y(r)&&(n=r,r=void 0),n)return _t(t,e,r).pipe(Es(n));var i=_e(xs(t)?Ms.map(function(a){return function(c){return t[a](e,c,r)}}):js(t)?Ts.map(Vr(t,e)):$s(t)?Rs.map(Vr(t,e)):[],2),s=i[0],o=i[1];if(!s&&Zn(t))return Qn(function(a){return _t(a,e,r)})(rt(t));if(!s)throw new TypeError("Invalid event target");return new le(function(a){var c=function(){for(var u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];return a.next(1<u.length?u:u[0])};return s(c),function(){return o(c)}})}function Vr(t,e){return function(r){return function(n){return t[r](e,n)}}}function js(t){return Y(t.addListener)&&Y(t.removeListener)}function $s(t){return Y(t.on)&&Y(t.off)}function xs(t){return Y(t.addEventListener)&&Y(t.removeEventListener)}function ye(t,e){return Ne(function(r,n){var i=0;r.subscribe(Fe(n,function(s){return t.call(e,s,i++)&&n.next(s)}))})}function wr(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new tt}:e,n=t.resetOnError,i=n===void 0?!0:n,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var l,h,m,w=0,F=!1,A=!1,L=function(){h==null||h.unsubscribe(),h=void 0},_=function(){L(),l=m=void 0,F=A=!1},C=function(){var S=l;_(),S==null||S.unsubscribe()};return Ne(function(S,R){w++,!A&&!F&&L();var g=m=m??r();R.add(function(){w--,w===0&&!A&&!F&&(h=xt(C,c))}),g.subscribe(R),!l&&w>0&&(l=new Ge({next:function(b){return g.next(b)},error:function(b){A=!0,L(),h=xt(_,i,b),g.error(b)},complete:function(){F=!0,L(),h=xt(_,o),g.complete()}}),rt(S).subscribe(l))})(u)}}function xt(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var i=new Ge({next:function(){i.unsubscribe(),t()}});return rt(e.apply(void 0,Me([],_e(r)))).subscribe(i)}}function Ds(t,e){return e===void 0&&(e=!1),Ne(function(r,n){var i=0;r.subscribe(Fe(n,function(s){var o=t(s,i++);(o||e)&&n.next(s),!o&&n.complete()}))})}function As(t,e,r){var n=Y(t)||e||r?{next:t,error:e,complete:r}:t;return n?Ne(function(i,s){var o;(o=n.subscribe)===null||o===void 0||o.call(n);var a=!0;i.subscribe(Fe(s,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),s.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),s.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),s.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Yn}var ge={},fe={},Se={},Yr;function Kn(){if(Yr)return Se;Yr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.DefaultSerializer=Se.extendSerializer=void 0;function t(n,i){const s=n.deserialize.bind(n),o=n.serialize.bind(n);return{deserialize(a){return i.deserialize(a,s)},serialize(a){return i.serialize(a,o)}}}Se.extendSerializer=t;const e={deserialize(n){return Object.assign(Error(n.message),{name:n.name,stack:n.stack})},serialize(n){return{__error_marker:"$$error",message:n.message,name:n.name,stack:n.stack}}},r=n=>n&&typeof n=="object"&&"__error_marker"in n&&n.__error_marker==="$$error";return Se.DefaultSerializer={deserialize(n){return r(n)?e.deserialize(n):n},serialize(n){return n instanceof Error?e.serialize(n):n}},Se}var Br;function Qe(){if(Br)return fe;Br=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.serialize=fe.deserialize=fe.registerSerializer=void 0;const t=Kn();let e=t.DefaultSerializer;function r(s){e=t.extendSerializer(e,s)}fe.registerSerializer=r;function n(s){return e.deserialize(s)}fe.deserialize=n;function i(s){return e.serialize(s)}return fe.serialize=i,fe}var Dt={},de={},Pe={},Zr;function ks(){if(Zr)return Pe;Zr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.getBundleURL=Pe.getBaseURL=void 0;let t;function e(){return t||(t=r()),t}Pe.getBundleURL=e;function r(){try{throw new Error}catch(i){const s=(""+i.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(s)return n(s[0])}return"/"}function n(i){return(""+i).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}return Pe.getBaseURL=n,Pe}var Gr;function Xn(){if(Gr)return de;Gr=1,Object.defineProperty(de,"__esModule",{value:!0}),de.isWorkerRuntime=de.getWorkerImplementation=de.defaultPoolSize=void 0;const t=ks();de.defaultPoolSize=typeof navigator<"u"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const e=a=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a);function r(a){const c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function n(){if(typeof Worker>"u")return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class a extends Worker{constructor(l,h){var m,w;typeof l=="string"&&h&&h._baseURL?l=new URL(l,h._baseURL):typeof l=="string"&&!e(l)&&t.getBundleURL().match(/^file:\/\//i)&&(l=new URL(l,t.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((m=h==null?void 0:h.CORSWorkaround)!==null&&m!==void 0)||m)&&(l=r(`importScripts(${JSON.stringify(l)});`))),typeof l=="string"&&e(l)&&(!((w=h==null?void 0:h.CORSWorkaround)!==null&&w!==void 0)||w)&&(l=r(`importScripts(${JSON.stringify(l)});`)),super(l,h)}}class c extends a{constructor(l,h){const m=window.URL.createObjectURL(l);super(m,h)}static fromText(l,h){const m=new window.Blob([l],{type:"text/javascript"});return new c(m,h)}}return{blob:c,default:a}}let i;function s(){return i||(i=n()),i}de.getWorkerImplementation=s;function o(){const a=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!a)}return de.isWorkerRuntime=o,de}var Ce={},ct={exports:{}},At,Qr;function Is(){if(Qr)return At;Qr=1;var t=1e3,e=t*60,r=e*60,n=r*24,i=n*7,s=n*365.25;At=function(l,h){h=h||{};var m=typeof l;if(m==="string"&&l.length>0)return o(l);if(m==="number"&&isFinite(l))return h.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(h){var m=parseFloat(h[1]),w=(h[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return m*s;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*r;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function a(l){var h=Math.abs(l);return h>=n?Math.round(l/n)+"d":h>=r?Math.round(l/r)+"h":h>=e?Math.round(l/e)+"m":h>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var h=Math.abs(l);return h>=n?u(l,h,n,"day"):h>=r?u(l,h,r,"hour"):h>=e?u(l,h,e,"minute"):h>=t?u(l,h,t,"second"):l+" ms"}function u(l,h,m,w){var F=h>=m*1.5;return Math.round(l/m)+" "+w+(F?"s":"")}return At}var kt,Kr;function zs(){if(Kr)return kt;Kr=1;function t(e){n.debug=n,n.default=n,n.coerce=u,n.disable=o,n.enable=s,n.enabled=a,n.humanize=Is(),n.destroy=l,Object.keys(e).forEach(h=>{n[h]=e[h]}),n.names=[],n.skips=[],n.formatters={};function r(h){let m=0;for(let w=0;w<h.length;w++)m=(m<<5)-m+h.charCodeAt(w),m|=0;return n.colors[Math.abs(m)%n.colors.length]}n.selectColor=r;function n(h){let m,w=null,F,A;function L(..._){if(!L.enabled)return;const C=L,S=Number(new Date),R=S-(m||S);C.diff=R,C.prev=m,C.curr=S,m=S,_[0]=n.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let g=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(D,H)=>{if(D==="%%")return"%";g++;const y=n.formatters[H];if(typeof y=="function"){const $=_[g];D=y.call(C,$),_.splice(g,1),g--}return D}),n.formatArgs.call(C,_),(C.log||n.log).apply(C,_)}return L.namespace=h,L.useColors=n.useColors(),L.color=n.selectColor(h),L.extend=i,L.destroy=n.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(F!==n.namespaces&&(F=n.namespaces,A=n.enabled(h)),A),set:_=>{w=_}}),typeof n.init=="function"&&n.init(L),L}function i(h,m){const w=n(this.namespace+(typeof m>"u"?":":m)+h);return w.log=this.log,w}function s(h){n.save(h),n.namespaces=h,n.names=[],n.skips=[];let m;const w=(typeof h=="string"?h:"").split(/[\s,]+/),F=w.length;for(m=0;m<F;m++)w[m]&&(h=w[m].replace(/\*/g,".*?"),h[0]==="-"?n.skips.push(new RegExp("^"+h.slice(1)+"$")):n.names.push(new RegExp("^"+h+"$")))}function o(){const h=[...n.names.map(c),...n.skips.map(c).map(m=>"-"+m)].join(",");return n.enable(""),h}function a(h){if(h[h.length-1]==="*")return!0;let m,w;for(m=0,w=n.skips.length;m<w;m++)if(n.skips[m].test(h))return!1;for(m=0,w=n.names.length;m<w;m++)if(n.names[m].test(h))return!0;return!1}function c(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function u(h){return h instanceof Error?h.stack||h.message:h}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return kt=t,kt}var Xr;function gr(){return Xr||(Xr=1,function(t,e){e.formatArgs=n,e.save=i,e.load=s,e.useColors=r,e.storage=o(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,h=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(l++,m==="%c"&&(h=l))}),c.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}t.exports=zs()(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}(ct,ct.exports)),ct.exports}var Fs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};class Et{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(e=>this._baseObserver.error(e))}error(e){this._baseObserver.error(e)}schedule(e){const r=Promise.all(this._pendingPromises),n=[],i=o=>n.push(o),s=Promise.resolve().then(()=>Fs(this,void 0,void 0,function*(){yield r,yield e(i),this._pendingPromises.delete(s);for(const o of n)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(s),this._baseObserver.error(o)});this._pendingPromises.add(s)}}const Jn=()=>typeof Symbol=="function",it=t=>Jn()&&!!Symbol[t],Sr=t=>it(t)?Symbol[t]:"@@"+t;it("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const Ls=Sr("iterator"),Xt=Sr("observable"),ei=Sr("species");function bt(t,e){const r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Ue(t){let e=t.constructor;return e!==void 0&&(e=e[ei],e===null&&(e=void 0)),e!==void 0?e:re}function Ws(t){return t instanceof re}function Le(t){Le.log?Le.log(t):setTimeout(()=>{throw t},0)}function vt(t){Promise.resolve().then(()=>{try{t()}catch(e){Le(e)}})}function ti(t){const e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{const r=bt(e,"unsubscribe");r&&r.call(e)}}catch(r){Le(r)}}function Jt(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Ns(t){const e=t._queue;if(e){t._queue=void 0,t._state="ready";for(const r of e)if(ri(t,r.type,r.value),t._state==="closed")break}}function ri(t,e,r){t._state="running";const n=t._observer;try{const i=n?bt(n,e):void 0;switch(e){case"next":i&&i.call(n,r);break;case"error":if(Jt(t),i)i.call(n,r);else throw r;break;case"complete":Jt(t),i&&i.call(n);break}}catch(i){Le(i)}t._state==="closed"?ti(t):t._state==="running"&&(t._state="ready")}function It(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue=t._queue||[],t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],vt(()=>Ns(t));return}ri(t,e,r)}}class Hs{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const n=new Us(this);try{this._cleanup=r.call(void 0,n)}catch(i){n.error(i)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Jt(this),ti(this))}}class Us{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){It(this._subscription,"next",e)}error(e){It(this._subscription,"error",e)}complete(){It(this._subscription,"complete")}}class re{constructor(e){if(!(this instanceof re))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,r,n){return(typeof e!="object"||e===null)&&(e={next:e,error:r,complete:n}),new Hs(e,this._subscriber)}pipe(e,...r){let n=this;for(const i of[e,...r])n=i(n);return n}tap(e,r,n){const i=typeof e!="object"||e===null?{next:e,error:r,complete:n}:e;return new re(s=>this.subscribe({next(o){i.next&&i.next(o),s.next(o)},error(o){i.error&&i.error(o),s.error(o)},complete(){i.complete&&i.complete(),s.complete()},start(o){i.start&&i.start(o)}}))}forEach(e){return new Promise((r,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function i(){s.unsubscribe(),r(void 0)}const s=this.subscribe({next(o){try{e(o,i)}catch(a){n(a),s.unsubscribe()}},error(o){n(o)},complete(){r(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Ue(this);return new r(n=>this.subscribe({next(i){let s=i;try{s=e(i)}catch(o){return n.error(o)}n.next(s)},error(i){n.error(i)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Ue(this);return new r(n=>this.subscribe({next(i){try{if(!e(i))return}catch(s){return n.error(s)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}reduce(e,r){if(typeof e!="function")throw new TypeError(e+" is not a function");const n=Ue(this),i=arguments.length>1;let s=!1,o=r;return new n(a=>this.subscribe({next(c){const u=!s;if(s=!0,!u||i)try{o=e(o,c)}catch(l){return a.error(l)}else o=c},error(c){a.error(c)},complete(){if(!s&&!i)return a.error(new TypeError("Cannot reduce an empty sequence"));a.next(o),a.complete()}}))}concat(...e){const r=Ue(this);return new r(n=>{let i,s=0;function o(a){i=a.subscribe({next(c){n.next(c)},error(c){n.error(c)},complete(){s===e.length?(i=void 0,n.complete()):o(r.from(e[s++]))}})}return o(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");const r=Ue(this);return new r(n=>{const i=[],s=this.subscribe({next(a){let c;if(e)try{c=e(a)}catch(l){return n.error(l)}else c=a;const u=r.from(c).subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){const l=i.indexOf(u);l>=0&&i.splice(l,1),o()}});i.push(u)},error(a){n.error(a)},complete(){o()}});function o(){s.closed&&i.length===0&&n.complete()}return()=>{i.forEach(a=>a.unsubscribe()),s.unsubscribe()}})}[Xt](){return this}static from(e){const r=typeof this=="function"?this:re;if(e==null)throw new TypeError(e+" is not an object");const n=bt(e,Xt);if(n){const i=n.call(e);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ws(i)&&i.constructor===r?i:new r(s=>i.subscribe(s))}if(it("iterator")){const i=bt(e,Ls);if(i)return new r(s=>{vt(()=>{if(!s.closed){for(const o of i.call(e))if(s.next(o),s.closed)return;s.complete()}})})}if(Array.isArray(e))return new r(i=>{vt(()=>{if(!i.closed){for(const s of e)if(i.next(s),i.closed)return;i.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){const r=typeof this=="function"?this:re;return new r(n=>{vt(()=>{if(!n.closed){for(const i of e)if(n.next(i),n.closed)return;n.complete()}})})}static get[ei](){return this}}Jn()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:Xt,hostReportError:Le},configurable:!0});function $e(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}var qs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Vs(t){return e=>new re(r=>{const n=new Et(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>qs(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>$e(i)})}function Ys(t){return t&&it("asyncIterator")&&t[Symbol.asyncIterator]}function Bs(t){return t&&it("iterator")&&t[Symbol.iterator]}var Zs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Gs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}};function Qs(t){return e=>new re(r=>{const n=new Et(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Zs(this,void 0,void 0,function*(){var a,c;const u=yield t(s);if(Bs(u)||Ys(u))try{for(var l=Gs(u),h;h=yield l.next(),!h.done;){const m=h.value;o(m)}}catch(m){a={error:m}}finally{try{h&&!h.done&&(c=l.return)&&(yield c.call(l))}finally{if(a)throw a.error}}else u.map(m=>o(m))}))}});return()=>$e(i)})}function Ks(t){return new re(e=>{let r=0;const n=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(n)})}var Xs=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function Js(t){return e=>new re(r=>{const n=new Et(r),i=e.subscribe({complete(){n.complete()},error(s){n.error(s)},next(s){n.schedule(o=>Xs(this,void 0,void 0,function*(){const a=yield t(s);o(a)}))}});return()=>$e(i)})}function eo(...t){return t.length===0?re.from([]):new re(e=>{let r=0;const n=t.map(s=>s.subscribe({error(o){e.error(o),i()},next(o){e.next(o)},complete(){++r===t.length&&(e.complete(),i())}})),i=()=>{n.forEach(s=>$e(s))};return i})}class ni extends re{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const r of this._observers)r.next(e)}error(e){for(const r of this._observers)r.error(e)}complete(){for(const e of this._observers)e.complete()}}function to(t){const e=new ni;let r,n=0;return new re(i=>{r||(r=t.subscribe(e));const s=e.subscribe(i);return n++,()=>{n--,s.unsubscribe(),n===0&&($e(r),r=void 0)}})}var ro=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})};function no(t,e){return r=>new re(n=>{let i,s=0;const o=new Et(n),a=r.subscribe({complete(){o.complete()},error(c){o.error(c)},next(c){o.schedule(u=>ro(this,void 0,void 0,function*(){i=yield t(s===0?typeof e>"u"?c:e:i,c,s++),u(i)}))}});return()=>$e(a)})}const io=Object.freeze(Object.defineProperty({__proto__:null,Observable:re,Subject:ni,filter:Vs,flatMap:Qs,interval:Ks,map:Js,merge:eo,multicast:to,scan:no,unsubscribe:$e},Symbol.toStringTag,{value:"Module"})),Ot=Ei(io);var qe={},Jr;function so(){if(Jr)return qe;Jr=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.allSettled=void 0;function t(e){return Promise.all(e.map(r=>{const n=o=>({status:"fulfilled",value:o}),i=o=>({status:"rejected",reason:o}),s=Promise.resolve(r);try{return s.then(n,i)}catch(o){return Promise.reject(o)}}))}return qe.allSettled=t,qe}var zt={},en;function oo(){return en||(en=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PoolEventType=void 0,function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(t.PoolEventType||(t.PoolEventType={}))}(zt)),zt}var Ve={},oe={},tn;function Pr(){return tn||(tn=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.$worker=oe.$transferable=oe.$terminate=oe.$events=oe.$errors=void 0,oe.$errors=Symbol("thread.errors"),oe.$events=Symbol("thread.events"),oe.$terminate=Symbol("thread.terminate"),oe.$transferable=Symbol("thread.transferable"),oe.$worker=Symbol("thread.worker")),oe}var rn;function ii(){if(rn)return Ve;rn=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.Thread=void 0;const t=Pr();function e(r){throw Error(r)}return Ve.Thread={errors(r){return r[t.$errors]||e("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},events(r){return r[t.$events]||e("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},terminate(r){return r[t.$terminate]()}},Ve}var nn;function ao(){return nn||(nn=1,function(t){var e=Ce&&Ce.__awaiter||function(_,C,S,R){function g(b){return b instanceof S?b:new S(function(D){D(b)})}return new(S||(S=Promise))(function(b,D){function H(k){try{$(R.next(k))}catch(U){D(U)}}function y(k){try{$(R.throw(k))}catch(U){D(U)}}function $(k){k.done?b(k.value):g(k.value).then(H,y)}$((R=R.apply(_,C||[])).next())})},r=Ce&&Ce.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(t,"__esModule",{value:!0}),t.Pool=t.Thread=t.PoolEventType=void 0;const n=r(gr()),i=Ot,s=so(),o=Xn(),a=oo();Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return a.PoolEventType}});const c=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return c.Thread}});let u=1;function l(_){const C=[];for(let S=0;S<_;S++)C.push(S);return C}function h(_){return new Promise(C=>setTimeout(C,_))}function m(_,C){return _.reduce((S,R)=>[...S,...C(R)],[])}function w(_){return _.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function F(_,C){return l(C).map(()=>({init:_(),runningTasks:[]}))}class A{constructor(C,S){this.eventSubject=new i.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const R=typeof S=="number"?{size:S}:S||{},{size:g=o.defaultPoolSize}=R;this.debug=n.default(`threads:pool:${w(R.name||String(u++))}`),this.options=R,this.workers=F(C,g),this.eventObservable=i.multicast(i.Observable.from(this.eventSubject)),Promise.all(this.workers.map(b=>b.init)).then(()=>this.eventSubject.next({type:a.PoolEventType.initialized,size:this.workers.length}),b=>{this.debug("Error while initializing pool worker:",b),this.eventSubject.error(b),this.initErrors.push(b)})}findIdlingWorker(){const{concurrency:C=1}=this.options;return this.workers.find(S=>S.runningTasks.length<C)}runPoolTask(C,S){return e(this,void 0,void 0,function*(){const R=this.workers.indexOf(C)+1;this.debug(`Running task #${S.id} on worker #${R}...`),this.eventSubject.next({type:a.PoolEventType.taskStart,taskID:S.id,workerID:R});try{const g=yield S.run(yield C.init);this.debug(`Task #${S.id} completed successfully`),this.eventSubject.next({type:a.PoolEventType.taskCompleted,returnValue:g,taskID:S.id,workerID:R})}catch(g){this.debug(`Task #${S.id} failed`),this.eventSubject.next({type:a.PoolEventType.taskFailed,taskID:S.id,error:g,workerID:R})}})}run(C,S){return e(this,void 0,void 0,function*(){const R=e(this,void 0,void 0,function*(){const g=()=>{C.runningTasks=C.runningTasks.filter(b=>b!==R)};yield h(0);try{yield this.runPoolTask(C,S)}finally{g(),this.isClosing||this.scheduleWork()}});C.runningTasks.push(R)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const C=this.findIdlingWorker();if(!C)return;const S=this.taskQueue.shift();if(!S){this.debug("Task queue is empty"),this.eventSubject.next({type:a.PoolEventType.taskQueueDrained});return}this.run(C,S)}taskCompletion(C){return new Promise((S,R)=>{const g=this.events().subscribe(b=>{b.type===a.PoolEventType.taskCompleted&&b.taskID===C?(g.unsubscribe(),S(b.returnValue)):b.type===a.PoolEventType.taskFailed&&b.taskID===C?(g.unsubscribe(),R(b.error)):b.type===a.PoolEventType.terminated&&(g.unsubscribe(),R(Error("Pool has been terminated before task was run.")))})})}settled(C=!1){return e(this,void 0,void 0,function*(){const S=()=>m(this.workers,b=>b.runningTasks),R=[],g=this.eventObservable.subscribe(b=>{b.type===a.PoolEventType.taskFailed&&R.push(b.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):C&&this.taskQueue.length===0?(yield s.allSettled(S()),R):(yield new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained&&(H.unsubscribe(),b(void 0))},error:D})}),yield s.allSettled(S()),g.unsubscribe(),R)})}completed(C=!1){return e(this,void 0,void 0,function*(){const S=this.settled(C),R=new Promise((b,D)=>{const H=this.eventObservable.subscribe({next(y){y.type===a.PoolEventType.taskQueueDrained?(H.unsubscribe(),b(S)):y.type===a.PoolEventType.taskFailed&&(H.unsubscribe(),D(y.error))},error:D})}),g=yield Promise.race([S,R]);if(g.length>0)throw g[0]})}events(){return this.eventObservable}queue(C){const{maxQueuedJobs:S=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const R=this.nextTaskID++,g=this.taskCompletion(R);g.catch(D=>{this.debug(`Task #${R} errored:`,D)});const b={id:R,run:C,cancel:()=>{this.taskQueue.indexOf(b)!==-1&&(this.taskQueue=this.taskQueue.filter(D=>D!==b),this.eventSubject.next({type:a.PoolEventType.taskCanceled,taskID:b.id}))},then:g.then.bind(g)};if(this.taskQueue.length>=S)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.
|
|
32
|
+
This usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${b.id}...`),this.taskQueue.push(b),this.eventSubject.next({type:a.PoolEventType.taskQueued,taskID:b.id}),this.scheduleWork(),b}terminate(C){return e(this,void 0,void 0,function*(){this.isClosing=!0,C||(yield this.completed(!0)),this.eventSubject.next({type:a.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(S=>e(this,void 0,void 0,function*(){return c.Thread.terminate(yield S.init)})))})}}A.EventType=a.PoolEventType;function L(_,C){return new A(_,C)}L.EventType=a.PoolEventType,t.Pool=L}(Ce)),Ce}var pe={},Ye={},sn;function uo(){if(sn)return Ye;sn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.createPromiseWithResolver=void 0;const t=()=>{};function e(){let r=!1,n,i=t;return[new Promise(a=>{r?a(n):i=a}),a=>{r=!0,n=a,i(n)}]}return Ye.createPromiseWithResolver=e,Ye}var Ft={},on;function co(){return on||(on=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerEventType=void 0,function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(t.WorkerEventType||(t.WorkerEventType={}))}(Ft)),Ft}var ve={},Be={},an;function lo(){if(an)return Be;an=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.ObservablePromise=void 0;const t=Ot,e=()=>{},r=a=>a,n=a=>Promise.resolve().then(a);function i(a){throw a}function s(a){return a&&typeof a.then=="function"}class o extends t.Observable{constructor(c){super(u=>{const l=this,h=Object.assign(Object.assign({},u),{complete(){u.complete(),l.onCompletion()},error(m){u.error(m),l.onError(m)},next(m){u.next(m),l.onNext(m)}});try{return this.initHasRun=!0,c(h)}catch(m){h.error(m)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(c){this.firstValueSet||(this.firstValue=c,this.firstValueSet=!0)}onError(c){this.state="rejected",this.rejection=c;for(const u of this.rejectionCallbacks)n(()=>u(c))}onCompletion(){this.state="fulfilled";for(const c of this.fulfillmentCallbacks)n(()=>c(this.firstValue))}then(c,u){const l=c||r,h=u||i;let m=!1;return new Promise((w,F)=>{const A=_=>{if(!m){m=!0;try{w(h(_))}catch(C){F(C)}}},L=_=>{try{w(l(_))}catch(C){A(C)}};if(this.initHasRun||this.subscribe({error:A}),this.state==="fulfilled")return w(l(this.firstValue));if(this.state==="rejected")return m=!0,w(h(this.rejection));this.fulfillmentCallbacks.push(L),this.rejectionCallbacks.push(A)})}catch(c){return this.then(void 0,c)}finally(c){const u=c||e;return this.then(l=>(u(),l),()=>u())}static from(c){return s(c)?new o(u=>{const l=m=>{u.next(m),u.complete()},h=m=>{u.error(m)};c.then(l,h)}):super.from(c)}}return Be.ObservablePromise=o,Be}var Ee={},un;function wt(){if(un)return Ee;un=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Transfer=Ee.isTransferDescriptor=void 0;const t=Pr();function e(i){return!(!i||typeof i!="object")}function r(i){return i&&typeof i=="object"&&i[t.$transferable]}Ee.isTransferDescriptor=r;function n(i,s){if(!s){if(!e(i))throw Error();s=[i]}return{[t.$transferable]:!0,send:i,transferables:s}}return Ee.Transfer=n,Ee}var Lt={},cn;function si(){return cn||(cn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerMessageType=t.MasterMessageType=void 0,function(e){e.cancel="cancel",e.run="run"}(t.MasterMessageType||(t.MasterMessageType={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(t.WorkerMessageType||(t.WorkerMessageType={}))}(Lt)),Lt}var ln;function ho(){if(ln)return ve;ln=1;var t=ve&&ve.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(ve,"__esModule",{value:!0}),ve.createProxyModule=ve.createProxyFunction=void 0;const e=t(gr()),r=Ot,n=Qe(),i=lo(),s=wt(),o=si(),a=e.default("threads:master:messages");let c=1;const u=_=>Array.from(new Set(_)),l=_=>_&&_.type===o.WorkerMessageType.error,h=_=>_&&_.type===o.WorkerMessageType.result,m=_=>_&&_.type===o.WorkerMessageType.running;function w(_,C){return new r.Observable(S=>{let R;const g=b=>{if(a("Message from worker:",b.data),!(!b.data||b.data.uid!==C)){if(m(b.data))R=b.data.resultType;else if(h(b.data))R==="promise"?(typeof b.data.payload<"u"&&S.next(n.deserialize(b.data.payload)),S.complete(),_.removeEventListener("message",g)):(b.data.payload&&S.next(n.deserialize(b.data.payload)),b.data.complete&&(S.complete(),_.removeEventListener("message",g)));else if(l(b.data)){const D=n.deserialize(b.data.error);S.error(D),_.removeEventListener("message",g)}}};return _.addEventListener("message",g),()=>{if(R==="observable"||!R){const b={type:o.MasterMessageType.cancel,uid:C};_.postMessage(b)}_.removeEventListener("message",g)}})}function F(_){if(_.length===0)return{args:[],transferables:[]};const C=[],S=[];for(const R of _)s.isTransferDescriptor(R)?(C.push(n.serialize(R.send)),S.push(...R.transferables)):C.push(n.serialize(R));return{args:C,transferables:S.length===0?S:u(S)}}function A(_,C){return(...S)=>{const R=c++,{args:g,transferables:b}=F(S),D={type:o.MasterMessageType.run,uid:R,method:C,args:g};a("Sending command to run function to worker:",D);try{_.postMessage(D,b)}catch(H){return i.ObservablePromise.from(Promise.reject(H))}return i.ObservablePromise.from(r.multicast(w(_,R)))}}ve.createProxyFunction=A;function L(_,C){const S={};for(const R of C)S[R]=A(_,R);return S}return ve.createProxyModule=L,ve}var hn;function fo(){if(hn)return pe;hn=1;var t=pe&&pe.__awaiter||function(g,b,D,H){function y($){return $ instanceof D?$:new D(function(k){k($)})}return new(D||(D=Promise))(function($,k){function U(Q){try{B(H.next(Q))}catch(he){k(he)}}function ne(Q){try{B(H.throw(Q))}catch(he){k(he)}}function B(Q){Q.done?$(Q.value):y(Q.value).then(U,ne)}B((H=H.apply(g,b||[])).next())})},e=pe&&pe.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.spawn=void 0;const r=e(gr()),n=Ot,i=Qe(),s=uo(),o=Pr(),a=co(),c=ho(),u=r.default("threads:master:messages"),l=r.default("threads:master:spawn"),h=r.default("threads:master:thread-utils"),m=g=>g&&g.type==="init",w=g=>g&&g.type==="uncaughtError",F=typeof process<"u"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function A(g,b,D){return t(this,void 0,void 0,function*(){let H;const y=new Promise((k,U)=>{H=setTimeout(()=>U(Error(D)),b)}),$=yield Promise.race([g,y]);return clearTimeout(H),$})}function L(g){return new Promise((b,D)=>{const H=y=>{u("Message from worker before finishing initialization:",y.data),m(y.data)?(g.removeEventListener("message",H),b(y.data)):w(y.data)&&(g.removeEventListener("message",H),D(i.deserialize(y.data.error)))};g.addEventListener("message",H)})}function _(g,b){return new n.Observable(D=>{const H=$=>{const k={type:a.WorkerEventType.message,data:$.data};D.next(k)},y=$=>{h("Unhandled promise rejection event in thread:",$);const k={type:a.WorkerEventType.internalError,error:Error($.reason)};D.next(k)};g.addEventListener("message",H),g.addEventListener("unhandledrejection",y),b.then(()=>{const $={type:a.WorkerEventType.termination};g.removeEventListener("message",H),g.removeEventListener("unhandledrejection",y),D.next($),D.complete()})})}function C(g){const[b,D]=s.createPromiseWithResolver();return{terminate:()=>t(this,void 0,void 0,function*(){h("Terminating worker"),yield g.terminate(),D()}),termination:b}}function S(g,b,D,H){const y=D.filter($=>$.type===a.WorkerEventType.internalError).map($=>$.error);return Object.assign(g,{[o.$errors]:y,[o.$events]:D,[o.$terminate]:H,[o.$worker]:b})}function R(g,b){return t(this,void 0,void 0,function*(){l("Initializing new thread");const D=b&&b.timeout?b.timeout:F,y=(yield A(L(g),D,`Timeout: Did not receive an init message from worker after ${D}ms. Make sure the worker calls expose().`)).exposed,{termination:$,terminate:k}=C(g),U=_(g,$);if(y.type==="function"){const ne=c.createProxyFunction(g);return S(ne,g,U,k)}else if(y.type==="module"){const ne=c.createProxyModule(g,y.methods);return S(ne,g,U,k)}else{const ne=y.type;throw Error(`Worker init message states unexpected type of expose(): ${ne}`)}})}return pe.spawn=R,pe}var fn;function po(){return fn||(fn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Worker=t.BlobWorker=t.isWorkerRuntime=t.Thread=t.spawn=t.Pool=void 0;const e=Xn();Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return e.isWorkerRuntime}});var r=ao();Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return r.Pool}});var n=fo();Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return n.spawn}});var i=ii();Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return i.Thread}}),t.BlobWorker=e.getWorkerImplementation().blob,t.Worker=e.getWorkerImplementation().default}(Dt)),Dt}var Oe={},Wt,dn;function vo(){return dn||(dn=1,Wt=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1),Wt}var lt={},pn;function mo(){if(pn)return lt;pn=1,Object.defineProperty(lt,"__esModule",{value:!0});const t=function(){const i=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!i)},e=function(i,s){self.postMessage(i,s)},r=function(i){const s=a=>{i(a.data)},o=()=>{self.removeEventListener("message",s)};return self.addEventListener("message",s),o};return lt.default={isWorkerRuntime:t,postMessageToMaster:e,subscribeToMasterMessages:r},lt}var vn;function oi(){return vn||(vn=1,function(t){var e=Oe&&Oe.__awaiter||function(y,$,k,U){function ne(B){return B instanceof k?B:new k(function(Q){Q(B)})}return new(k||(k=Promise))(function(B,Q){function he(ue){try{xe(U.next(ue))}catch(De){Q(De)}}function st(ue){try{xe(U.throw(ue))}catch(De){Q(De)}}function xe(ue){ue.done?B(ue.value):ne(ue.value).then(he,st)}xe((U=U.apply(y,$||[])).next())})},r=Oe&&Oe.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(t,"__esModule",{value:!0}),t.expose=t.isWorkerRuntime=t.Transfer=t.registerSerializer=void 0;const n=r(vo()),i=Qe(),s=wt(),o=si(),a=r(mo());var c=Qe();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return c.registerSerializer}});var u=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return u.Transfer}}),t.isWorkerRuntime=a.default.isWorkerRuntime;let l=!1;const h=new Map,m=y=>y&&y.type===o.MasterMessageType.cancel,w=y=>y&&y.type===o.MasterMessageType.run,F=y=>n.default(y)||A(y);function A(y){return y&&typeof y=="object"&&typeof y.subscribe=="function"}function L(y){return s.isTransferDescriptor(y)?{payload:y.send,transferables:y.transferables}:{payload:y,transferables:void 0}}function _(){const y={type:o.WorkerMessageType.init,exposed:{type:"function"}};a.default.postMessageToMaster(y)}function C(y){const $={type:o.WorkerMessageType.init,exposed:{type:"module",methods:y}};a.default.postMessageToMaster($)}function S(y,$){const{payload:k,transferables:U}=L($),ne={type:o.WorkerMessageType.error,uid:y,error:i.serialize(k)};a.default.postMessageToMaster(ne,U)}function R(y,$,k){const{payload:U,transferables:ne}=L(k),B={type:o.WorkerMessageType.result,uid:y,complete:$?!0:void 0,payload:U};a.default.postMessageToMaster(B,ne)}function g(y,$){const k={type:o.WorkerMessageType.running,uid:y,resultType:$};a.default.postMessageToMaster(k)}function b(y){try{const $={type:o.WorkerMessageType.uncaughtError,error:i.serialize(y)};a.default.postMessageToMaster($)}catch($){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.
|
|
33
33
|
Latest error:`,$,`
|
|
34
|
-
Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let U;try{U=$(...k)}catch(B){return S(y,B)}const ne=F(U)?"observable":"promise";if(g(y,ne),F(U)){const B=U.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{S(y,i.serialize(Q)),f.delete(y)},()=>{R(y,!0),f.delete(y)});f.set(y,B)}else try{const B=yield U;R(y,!0,i.serialize(B))}catch(B){S(y,i.serialize(B))}})}function H(y){if(!a.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(l)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(l=!0,typeof y=="function")a.default.subscribeToMasterMessages($=>{w($)&&!$.method&&D($.uid,y,$.args.map(i.deserialize))}),_();else if(typeof y=="object"&&y){a.default.subscribeToMasterMessages(k=>{w(k)&&k.method&&D(k.uid,y[k.method],k.args.map(i.deserialize))});const $=Object.keys(y).filter(k=>typeof y[k]=="function");C($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(m($)){const k=$.uid,U=f.get(k);U&&(U.unsubscribe(),f.delete(k))}})}t.expose=H,typeof self<"u"&&typeof self.addEventListener=="function"&&a.default.isWorkerRuntime()&&(self.addEventListener("error",y=>{setTimeout(()=>b(y.error||y),250)}),self.addEventListener("unhandledrejection",y=>{const $=y.reason;$&&typeof $.message=="string"&&setTimeout(()=>b($),250)})),typeof process<"u"&&typeof process.on=="function"&&a.default.isWorkerRuntime()&&(process.on("uncaughtException",y=>{setTimeout(()=>b(y),250)}),process.on("unhandledRejection",y=>{y&&typeof y.message=="string"&&setTimeout(()=>b(y),250)}))}(Oe)),Oe}var yn;function yo(){return yn||(yn=1,function(t){var e=ge&&ge.__createBinding||(Object.create?function(a,c,u,l){l===void 0&&(l=u),Object.defineProperty(a,l,{enumerable:!0,get:function(){return c[u]}})}:function(a,c,u,l){l===void 0&&(l=u),a[l]=c[u]}),r=ge&&ge.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var n=Qe();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(po(),t);var i=oi();Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return i.expose}});var s=Kn();Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return s.DefaultSerializer}});var o=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(ge)),ge}var _o=yo();const we=Rn(_o);we.registerSerializer;const bo=we.spawn;we.BlobWorker;we.DefaultSerializer;we.Pool;const wo=we.Thread;we.Transfer;const go=we.Worker;var So=Object.defineProperty,Po=(t,e,r)=>e in t?So(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>Po(t,typeof e!="symbol"?e+"":e,r);class Co extends O.EventDispatcher{constructor(){super(),se(this,"style",{}),se(this,"width",0),se(this,"height",0),se(this,"left",0),se(this,"top",0),this.getRootNode=this.getRootNode.bind(this),this.handleEvent=this.handleEvent.bind(this)}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getRootNode(){return this}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height}}handleEvent(e){if(e.type==="resize"){this.left=e.left??0,this.top=e.top??0,this.width=e.width??0,this.height=e.height??0;return}e.preventDefault=()=>{},e.stopPropagation=()=>{},this.dispatchEvent(e)}focus(){}}const Eo=()=>{try{if(window){if(navigator!=null&&navigator.hardwareConcurrency)return navigator.hardwareConcurrency;throw new Error("Unable to determine the number of cores")}else return require("os").cpus().length}catch(t){return console.error("🛑 Unable to detect available cores",t),2}},Oo=()=>Eo()-1,To="TERMINATE_THREAD_FROM_WORKER";let Mo=-1;class Ro{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",Mo+=1),se(this,"idle",!0),se(this,"worker"),se(this,"thread"),this._handleTerminate=e==null?void 0:e.onTerminate,this._handleError=e==null?void 0:e.onError}_handleMessages(e){var r;e instanceof MessageEvent&&((r=e.data)==null?void 0:r.token)===To&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new go(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await bo(this.worker,{timeout:1e4,...i==null?void 0:i.spawn}),this._task=e,this.worker.postMessage(n.subject,n.transferSubject),this.worker.addEventListener("message",this._handleMessages.bind(this)),{worker:this.worker,thread:this.thread}}catch(n){(r=this._handleError)==null||r.call(this,n);return}}get task(){return this._task}async terminate(){var e,r,n;(e=this.worker)==null||e.removeEventListener("message",this._handleMessages.bind(this)),this.thread&&await wo.terminate(this.thread),await((r=this.worker)==null?void 0:r.terminate()),this.worker=void 0,this.thread=void 0,this._task=void 0,this.idle=!0,(n=this._handleTerminate)==null||n.call(this)}}class jo{constructor(e,r,n){se(this,"_workerThreads",[]),se(this,"_tasksQueue",[]),this.maxWorkersCount=e,this.debugMode=r,this.onWorkerThreadRun=n;for(let i=0;i<this.maxWorkersCount;i++)this._workerThreads.push(this._createWorkerThread())}_handleWorkerThreadTerminate(e){this.debugMode&&console.log(`WorkerThread #${e.id} freed`),this.runNext()}_handleWorkerThreadError(e,r){console.error(`Error from worker #${r.id}:`,e),this.runNext()}_createWorkerThread(){const e=new Ro({onTerminate:()=>this._handleWorkerThreadTerminate(e),onError:r=>this._handleWorkerThreadError(r,e)});return e}get workerThreads(){return this._workerThreads}get tasksQueue(){return this._tasksQueue}get nextAvailableWorkerThread(){return this._workerThreads.find(e=>e.idle)}getAvailableWorkerThreads(e=!1){return this._workerThreads.filter(r=>e?!r.idle:r.idle)}async runNext(){if(!this.nextAvailableWorkerThread||this._tasksQueue.length===0)return;const e=this._tasksQueue.shift();e&&await this.run(e)}async run(e,r=!1){var n;if(r){const o=this._createWorkerThread();return this.debugMode&&console.log(`Running On Untracked Thread #${o==null?void 0:o.id}. Task:`,e),[await o.run(e),!1]}const i=this.nextAvailableWorkerThread;if(!i)return this._tasksQueue.push(e),this.debugMode&&console.log("Queued Thread Task:",e),[void 0,!0];this.debugMode&&console.log(`Running On Thread #${i==null?void 0:i.id}. Task:`,e);const s=await i.run(e);return(n=this.onWorkerThreadRun)==null||n.call(this,i),[s,!1]}async terminateAll(){this._tasksQueue=[],await Promise.all(this._workerThreads.map(e=>e.terminate()))}}const $o=(t,e)=>new jo(Oo(),!!e),xo=t=>t===void 0,Do=t=>typeof t=="boolean",Ao=t=>!!t&&typeof t=="function",ko=t=>{var e,r;const n=t.toJSON();return JSON.stringify({...n,object:{...n.object,position:["x","y","z"].map(i=>t.position[i]),rotation:["x","y","z","order"].map(i=>t.rotation[i]),children:((r=(e=n==null?void 0:n.object)==null?void 0:e.children)==null?void 0:r.map((i,s)=>({...typeof i=="object"?i:typeof i=="string"?JSON.parse(i):{},position:["x","y","z"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.position[o]}),rotation:["x","y","z","order"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.rotation[o]})})))??[]},isSerialized:!0})},Nt=(t,e=new O.ObjectLoader)=>{const r=JSON.parse(t);if(r!=null&&r.metadata&&r.object&&r.isSerialized){const n=e.parse(r);return n.position.set(...r.object.position),n.rotation.set(...r.object.rotation),n.children.map((i,s)=>{i.position.set(...r.object.children[s].position)}),n.children.map((i,s)=>{i.rotation.set(...r.object.children[s].rotation)}),n}return r},Io=(t,e)=>{const r={type:t==null?void 0:t.type};for(const n of e)t[n]!==void 0&&(r[n]=t[n]);return r},tr=(t,e)=>{const r={type:t==null?void 0:t.type};for(const[n,i]of Object.entries(t))e.includes(n)||(r[n]=i);return r};var zo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Lo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Fo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&zo(e,r,i),i};let Ke=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new Co);p(this,"initialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Ke=Lo([G()],Ke);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Ho=(t,e,r,n)=>{for(var i=n>1?void 0:n?No(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Wo(e,r,i),i},Uo=(t,e)=>(r,n)=>e(r,n,t);let gt=class extends In{constructor(t){super(),this._service=t;for(const e of _r)this[`${e}$$`]=new tt,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};gt=Ho([G(),Uo(0,z(Ke))],gt);var qo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Yo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Vo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&qo(e,r,i),i};let St=class{constructor(){p(this,"frame",1e3/60);p(this,"initialTime",Date.now());p(this,"currentTime",0);p(this,"deltaTime",0);p(this,"deltaRatio",0);p(this,"elapsedTime",0);p(this,"enabled",!1)}step(){const t=Date.now();this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime=t-this.initialTime,this.deltaRatio=this.deltaTime/this.frame}};St=Yo([G()],St);var Bo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Go=(t,e,r,n)=>{for(var i=n>1?void 0:n?Zo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Bo(e,r,i),i},Qo=(t,e)=>(r,n)=>e(r,n,t);let We=class{constructor(t){p(this,"beforeStep$$",new tt);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",ss().pipe(As(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(tr(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),Ds(()=>this._service.enabled),nt(()=>tr(this._service,[])),gr()));this._service=t}};We=Go([G(),Qo(0,z(St))],We);var Ko=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Jo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Xo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ko(e,r,i),i},_n=(t,e)=>(r,n)=>e(r,n,t);let rr=class{constructor(t,e){p(this,"_initialAnimationFrameId");p(this,"_subscriptions",[]);this._controller=t,this._service=e,this._subscriptions.push(this._controller.step$.subscribe(this._service.step.bind(this._service)))}init(t){this.enabled(t)}frame(){return this._service.frame}deltaTime(t){return typeof t=="number"&&(this._service.deltaTime=t),this._service.deltaTime}deltaRatio(t){return typeof t=="number"&&(this._service.deltaRatio=t),this._service.deltaRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}dispose(){this._initialAnimationFrameId!==void 0&&cancelAnimationFrame(this._initialAnimationFrameId),this._service.enabled=!1}beforeStep$(){return this._controller.beforeStep$}step$(){return this._controller.step$}};rr=Jo([G(),_n(0,z(We)),_n(1,z(St))],rr);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ra=(t,e,r,n)=>{for(var i=n>1?void 0:n?ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ea(e,r,i),i};let be=class{constructor(){p(this,"width",0);p(this,"height",0);p(this,"aspect",0);p(this,"pixelRatio",0);p(this,"frustrum",5);p(this,"enabled",!0)}init(t,e){this.height=Number(t.height??this.height),this.width=Number(t.width??this.width),this.aspect=this.width/this.height,this.enabled=e===void 0?!0:!!e}};be=ra([G()],be);var na=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ia(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&na(e,r,i),i},oa=(t,e)=>(r,n)=>e(r,n,t);let Re=class{constructor(t){p(this,"instance");p(this,"enabled",!0);this._sizesService=t}set aspectRatio(t){var e;this.instance instanceof O.PerspectiveCamera&&(this.instance.aspect=t),(this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&((e=this.instance)==null||e.updateProjectionMatrix())}set quaternion(t){var e;(e=this.instance)==null||e.quaternion.copy(t)}set position(t){var e;(e=this.instance)==null||e.position.copy(t)}set rotation(t){var e;(e=this.instance)==null||e.rotation.copy(t)}init(t){if(this.dispose(),t===yt.PERSPECTIVE||t===void 0){this.instance=new O.PerspectiveCamera(70,this._sizesService.width/this._sizesService.height,1e-4,100),this.instance.position.z=8;return}t===yt.ORTHOGRAPHIC&&(this.instance=new O.OrthographicCamera(-this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.frustrum/2,-this._sizesService.frustrum/2,-50,50))}dispose(){this.instance instanceof O.Camera&&((this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&this.instance.clearViewOffset(),this.instance.clear(),this.instance=void 0)}};Re=sa([G(),oa(0,z(be))],Re);var aa=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var i=n>1?void 0:n?ua(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&aa(e,r,i),i},bn=(t,e)=>(r,n)=>e(r,n,t);let nr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};nr=ca([G(),bn(0,z(We)),bn(1,z(Re))],nr);var la=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ha(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&la(e,r,i),i},Ht=(t,e)=>(r,n)=>e(r,n,t);let ir=class{constructor(t,e,r){p(this,"_subscriptions",[]);this._sizesService=t,this._controller=e,this._service=r}init(){this._service.init(),this._subscriptions.push(this._controller.step$.subscribe(()=>{var t;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((t=this._service.instance)==null||t.updateProjectionMatrix()))}))}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}instance(t){return t&&(this._service.instance=t),this._service.instance}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}dispose(){this._subscriptions.forEach(t=>t.unsubscribe()),this._service.dispose()}};ir=fa([G(),Ht(0,z(be)),Ht(1,z(nr)),Ht(2,z(Re))],ir);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?pa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&da(e,r,i),i};let Xe=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Xe=va([G()],Xe);var ai=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ya=(t,e,r)=>e in t?ai(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ma(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ai(e,r,i),i},Ut=(t,e)=>(r,n)=>e(r,n,t),ba=(t,e,r)=>ya(t,e+"",r);let je=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r}setWebGLRenderer(t){this.instance=new O.WebGLRenderer({canvas:t,context:t.getContext("webgl2",{stencil:!0,powerPreference:"high-performance"}),powerPreference:"high-performance",depth:!0,antialias:!0}),this.instance.autoClear=!1,this.instance.setPixelRatio(je.RENDERER_PIXEL_RATIO),this.instance.setClearColor(0,0),this.instance.shadowMap.enabled=!0,this.instance.shadowMap.type=O.PCFSoftShadowMap,this.instance.outputColorSpace=O.SRGBColorSpace,this.instance.toneMapping=O.CineonToneMapping,this.instance.toneMappingExposure=1.75}setSize(t,e){var r;(r=this.instance)==null||r.setSize(t,e)}render(){this.enabled&&this._cameraService.instance instanceof O.Camera&&this.instance instanceof O.WebGLRenderer&&(this.instance.setViewport(0,0,this._sizesService.width,this._sizesService.height),this.instance.render(this._worldService.scene,this._cameraService.instance))}};ba(je,"RENDERER_PIXEL_RATIO",1);je=_a([G(),Ut(0,z(Xe)),Ut(1,z(Re)),Ut(2,z(be))],je);var wa=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,Sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ga(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&wa(e,r,i),i},wn=(t,e)=>(r,n)=>e(r,n,t);let Pt=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};Pt=Sa([G(),wn(0,z(gt)),wn(1,z(be))],Pt);var Pa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,Ea=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ca(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Pa(e,r,i),i},qt=(t,e)=>(r,n)=>e(r,n,t);let sr=class{constructor(t,e,r){p(this,"step$");p(this,"resize$");this._service=t,this.timerController=e,this.sizesController=r,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled)),this.resize$=this.sizesController.resize$.pipe(ye(()=>this._service.enabled))}};sr=Ea([G(),qt(0,z(je)),qt(1,z(We)),qt(2,z(Pt))],sr);var Oa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ma=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Oa(e,r,i),i},gn=(t,e)=>(r,n)=>e(r,n,t);let or=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.step$.subscribe(()=>this._service.render()),this._controller.resize$.subscribe(e=>this._service.setSize(e.windowWidth,e.windowHeight)),this._service.setWebGLRenderer(t)}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(){return this._service.instance}setSize(t){return this._service.setSize(t.x,t.y)}render(){return this._service.render()}dispose(){var t;(t=this._service.instance)==null||t.dispose(),this._service.instance=void 0}};or=Ma([G(),gn(0,z(sr)),gn(1,z(je))],or);var Ra=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,$a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ra(e,r,i),i},Sn=(t,e)=>(r,n)=>e(r,n,t);let ar=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.resize$.subscribe(e=>{this._service.width=e.windowWidth,this._service.height=e.windowHeight,this._service.aspect=e.windowWidth/e.windowHeight}),this._service.init(t)}dispose(){}aspect(t){return typeof t=="number"&&(this._service.aspect=t),this._service.aspect}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}frustrum(t){return typeof t=="number"&&(this._service.frustrum=t),this._service.frustrum}height(t){return typeof t=="number"&&(this._service.height=t),this._service.height}pixelRatio(t){return typeof t=="number"&&(this._service.pixelRatio=t),this._service.pixelRatio}width(t){return typeof t=="number"&&(this._service.width=t),this._service.width}resize$(){return this._controller.resize$}};ar=$a([G(),Sn(0,z(Pt)),Sn(1,z(be))],ar);var xa=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?Da(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&xa(e,r,i),i},ka=(t,e)=>(r,n)=>e(r,n,t);let ur=class{constructor(t){this._service=t}init(){}dispose(){}scene(t){return t instanceof O.Scene&&(this._service.scene=t),this._service.scene}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}};ur=Aa([G(),ka(0,z(Xe))],ur);const Pn={type:"change"},Er={type:"start"},ui={type:"end"},ht=new O.Ray,Cn=new O.Plane,Ia=Math.cos(70*O.MathUtils.DEG2RAD),J=new O.Vector3,ie=2*Math.PI,q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Vt=1e-6;class En extends O.Controls{constructor(e,r=null){super(e,r),this.state=q.NONE,this.enabled=!0,this.target=new O.Vector3,this.cursor=new O.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:O.MOUSE.ROTATE,MIDDLE:O.MOUSE.DOLLY,RIGHT:O.MOUSE.PAN},this.touches={ONE:O.TOUCH.ROTATE,TWO:O.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new O.Vector3,this._lastQuaternion=new O.Quaternion,this._lastTargetPosition=new O.Vector3,this._quat=new O.Quaternion().setFromUnitVectors(e.up,new O.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new O.Spherical,this._sphericalDelta=new O.Spherical,this._scale=1,this._panOffset=new O.Vector3,this._rotateStart=new O.Vector2,this._rotateEnd=new O.Vector2,this._rotateDelta=new O.Vector2,this._panStart=new O.Vector2,this._panEnd=new O.Vector2,this._panDelta=new O.Vector2,this._dollyStart=new O.Vector2,this._dollyEnd=new O.Vector2,this._dollyDelta=new O.Vector2,this._dollyDirection=new O.Vector3,this._mouse=new O.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Fa.bind(this),this._onPointerDown=za.bind(this),this._onPointerUp=La.bind(this),this._onContextMenu=Ya.bind(this),this._onMouseWheel=Ha.bind(this),this._onKeyDown=Ua.bind(this),this._onTouchStart=qa.bind(this),this._onTouchMove=Va.bind(this),this._onMouseDown=Wa.bind(this),this._onMouseMove=Na.bind(this),this._interceptControlDown=Ba.bind(this),this._interceptControlUp=Za.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Pn),this.update(),this.state=q.NONE}update(e=null){const r=this.object.position;J.copy(r).sub(this.target),J.applyQuaternion(this._quat),this._spherical.setFromVector3(J),this.autoRotate&&this.state===q.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=ie:n>Math.PI&&(n-=ie),i<-Math.PI?i+=ie:i>Math.PI&&(i-=ie),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(J.setFromSpherical(this._spherical),J.applyQuaternion(this._quatInverse),r.copy(this.target).add(J),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=J.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const a=new O.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new O.Vector3(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(a),this.object.updateMatrixWorld(),o=J.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(ht.origin.copy(this.object.position),ht.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ht.direction))<Ia?this.object.lookAt(this.target):(Cn.setFromNormalAndCoplanarPoint(this.object.up,this.target),ht.intersectPlane(Cn,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Vt||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Vt||this._lastTargetPosition.distanceToSquared(this.target)>Vt?(this.dispatchEvent(Pn),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ie/60*this.autoRotateSpeed*e:ie/60/60*this.autoRotateSpeed}_getZoomScale(e){const r=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*r)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,r){J.setFromMatrixColumn(r,0),J.multiplyScalar(-e),this._panOffset.add(J)}_panUp(e,r){this.screenSpacePanning===!0?J.setFromMatrixColumn(r,1):(J.setFromMatrixColumn(r,0),J.crossVectors(this.object.up,J)),J.multiplyScalar(e),this._panOffset.add(J)}_pan(e,r){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;J.copy(i).sub(this.target);let s=J.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*r*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,r){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=r-n.top,o=n.width,a=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let r=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),r=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),r=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),r=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),r=!0;break}r&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+r.x)*.5,a=(e.pageY+r.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId){this._pointers.splice(r,1);return}}_isTrackingPointer(e){for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId)return!0;return!1}_trackPointer(e){let r=this._pointerPositions[e.pointerId];r===void 0&&(r=new O.Vector2,this._pointerPositions[e.pointerId]=r),r.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const r=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[r]}_customWheelEvent(e){const r=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(r){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function za(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Fa(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function La(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(ui),this.state=q.NONE;break;case 1:const e=this._pointers[0],r=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:r.x,pageY:r.y});break}}function Wa(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case O.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=q.DOLLY;break;case O.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}break;case O.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Er)}function Na(t){switch(this.state){case q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function Ha(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Er),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(ui))}function Ua(t){this.enabled!==!1&&this._handleKeyDown(t)}function qa(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case O.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=q.TOUCH_ROTATE;break;case O.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=q.TOUCH_PAN;break;default:this.state=q.NONE}break;case 2:switch(this.touches.TWO){case O.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=q.TOUCH_DOLLY_PAN;break;case O.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=q.TOUCH_DOLLY_ROTATE;break;default:this.state=q.NONE}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Er)}function Va(t){switch(this._trackPointer(t),this.state){case q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=q.NONE}}function Ya(t){this.enabled!==!1&&t.preventDefault()}function Ba(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Za(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var Ga=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Ka=(t,e,r,n)=>{for(var i=n>1?void 0:n?Qa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ga(e,r,i),i},Ze=(t,e)=>(r,n)=>e(r,n,t);let cr=class{constructor(t,e,r,n,i){p(this,"enabled",!1);p(this,"cameraControls");p(this,"miniCamera");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._sizesService=e,this._rendererService=r,this._cameraService=n,this._worldService=i}_renderMiniCamera(){var t,e,r,n,i;!this.enabled||!this.miniCamera||((t=this._rendererService.instance)==null||t.setScissorTest(!0),(e=this._rendererService.instance)==null||e.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(r=this._rendererService.instance)==null||r.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(n=this._rendererService.instance)==null||n.render(this._worldService.scene,this.miniCamera),(i=this._rendererService.instance)==null||i.setScissorTest(!1))}initMiniCamera(){this.disposeMiniCamera(),this.enabled&&(this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5)}initOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose()),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new En(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}initMiniCameraOrbitControls(){this.miniCameraControls&&this.miniCameraControls.dispose(),!(!this.enabled||!this.miniCamera)&&(this.miniCameraControls=new En(this.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}initCameraHelper(){this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),!(!this.enabled||!this._cameraService.instance)&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}initAxesHelper(t){if(!this.enabled)return;const e=new O.AxesHelper(t);this._worldService.scene.add(e)}initGridHelper(t){if(this.gridHelper&&this._worldService.scene.remove(this.gridHelper),!this.enabled)return;const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}disposeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update(),this._renderMiniCamera()}dispose(){var t,e,r,n,i;this.disposeMiniCamera(),(t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0,(e=this.miniCameraControls)==null||e.dispose(),this.miniCameraControls=void 0,this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),(r=this.cameraHelper)==null||r.dispose(),this.cameraHelper=void 0,this.axesHelper&&this._worldService.scene.remove(this.axesHelper),(n=this.axesHelper)==null||n.dispose(),this.axesHelper=void 0,this.gridHelper&&this._worldService.scene.remove(this.gridHelper),(i=this.gridHelper)==null||i.dispose(),this.gridHelper=void 0}};cr=Ka([G(),Ze(0,z(Ke)),Ze(1,z(be)),Ze(2,z(je)),Ze(3,z(Re)),Ze(4,z(Xe))],cr);var Xa=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,eu=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Xa(e,r,i),i},On=(t,e)=>(r,n)=>e(r,n,t);let lr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};lr=eu([G(),On(0,z(We)),On(1,z(Re))],lr);var tu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,nu=(t,e,r,n)=>{for(var i=n>1?void 0:n?ru(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&tu(e,r,i),i},Tn=(t,e)=>(r,n)=>e(r,n,t);let hr=class{constructor(t,e){p(this,"_subscriptions",[]);this._service=t,this._controller=e}init(t){this._service.enabled=!!t.enableDebug,this._service.enabled&&(t.withMiniCamera&&this._service.initMiniCamera(),t.enableControls&&(this._service.initOrbitControl(),this._service.initMiniCameraOrbitControls()),t.withCameraHelper&&this._service.initCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._service.initAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._service.initGridHelper(t.gridSizes),this._subscriptions.push(this._controller.step$.subscribe(()=>{this._service.update()})))}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}getAxesHelper(){return this._service.axesHelper}getCameraControls(){return this._service.cameraControls}getCameraHelper(){return this._service.cameraHelper}getGridHelper(){return this._service.gridHelper}getMiniCameraControls(){return this._service.miniCameraControls}getStep$(){return this._controller.step$}dispose(){this._service.dispose(),this._subscriptions.forEach(t=>t.unsubscribe())}};hr=nu([G(),Tn(0,z(cr)),Tn(1,z(lr))],hr);var iu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,ou=(t,e,r,n)=>{for(var i=n>1?void 0:n?su(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&iu(e,r,i),i};let fr=class{constructor(){p(this,"load$",_t(self,"message").pipe(ye(t=>{var e,r,n;return((e=t.data)==null?void 0:e.token)===Fn&&!!((n=(r=t.data)==null?void 0:r.payload)!=null&&n.resource)}),nt(t=>{var r,n,i;const{payload:e}=t.data||{};if(e!=null&&e.resource&&e.source.type==="gltfModel"){const s=e.resource,o=(r=s.animations)==null?void 0:r.map(l=>O.AnimationClip.parse(l)),a=(n=s.cameras)==null?void 0:n.map(l=>Nt(l)),c=Nt((s==null?void 0:s.scene)||""),u=(i=s.scenes)==null?void 0:i.map(l=>Nt(l));return{...e,resource:{...s,animations:o,cameras:a,scene:c,scenes:u}}}return e}),gr()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>(t==null?void 0:t.toLoadCount)===t.loadedCount)))}};fr=ou([Ct(te.ResolutionScoped)],fr);var au=Object.defineProperty,uu=Object.getOwnPropertyDescriptor,cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?uu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&au(e,r,i),i};let dr=class{constructor(){p(this,"loadedResources",{});p(this,"toLoadCount",0);p(this,"loadedCount",0)}handleLoad(t){const{source:e,resource:r,loadedCount:n,toLoadCount:i}=t;r&&(this.loadedResources[e.name]=r,this.toLoadCount=n,this.loadedCount=i)}};dr=cu([Ct(te.ResolutionScoped)],dr);var lu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,fu=(t,e,r,n)=>{for(var i=n>1?void 0:n?hu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&lu(e,r,i),i},Mn=(t,e)=>(r,n)=>e(r,n,t);let pr=class{constructor(t,e){p(this,"_subscriptions",[]);this._controller=t,this._service=e}init(){this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}getLoadedResources(){return this._service.loadedResources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}dispose(){this._subscriptions.forEach(t=>t.unsubscribe())}};pr=fu([G(),Mn(0,z(fr)),Mn(1,z(dr))],pr);var du=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,vu=(t,e,r,n)=>{for(var i=n>1?void 0:n?pu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&du(e,r,i),i},me=(t,e)=>(r,n)=>e(r,n,t);exports.AppModule=class extends zn{constructor(e,r,n,i,s,o,a,c,u){super(),this._controller=e,this._service=r,this.timer=n,this.sizes=i,this.camera=s,this.world=o,this.renderer=a,this.loader=c,this.debug=u,this._initProxyEvents()}_initProxyEvents(){_r.forEach(e=>{this[`${e}$`]=()=>{var r;return(r=this._controller)==null?void 0:r[`${e}$`]},this[e]=r=>{var n,i;return(i=(n=this._controller)==null?void 0:n[e])==null?void 0:i.call(n,r)}})}init(e){this._service.initialized||!(e!=null&&e.canvas)||!(this._service.canvas=e.canvas)||(this._service.initialized=!0,this.sizes.init(this._service.canvas),this.camera.init(),this.world.init(),this.renderer.init(this._service.canvas),this.timer.init(e.startTimer),this.loader.init(),this.debug.init(e))}isInitialized(){return this._service.initialized}beforeStep$(){return this.timer.beforeStep$()}step$(){return this.timer.step$()}dispose(){this.sizes.dispose(),this.camera.dispose(),this.world.dispose(),this.renderer.dispose(),this.timer.dispose(),this.loader.dispose(),this.debug.dispose()}};exports.AppModule=vu([Ct(te.ContainerScoped),me(0,z(gt)),me(1,z(Ke)),me(2,z(rr)),me(3,z(ar)),me(4,z(ir)),me(5,z(ur)),me(6,z(or)),me(7,z(pr)),me(8,z(hr))],exports.AppModule);exports.A=xo;exports.AppProxyEventHandlersBlueprint=zn;exports.C=$o;exports.CONTAINER_TOKEN=Vi;exports.D=Do;exports.DefaultCameraType=yt;exports.J=Io;exports.KEYBOARD_EVENT_CODES=Ui;exports.LOADER_SERIALIZED_LOAD_TOKEN=Fn;exports.Lifecycle=te;exports.PROXY_EVENT_LISTENERS=_r;exports.ProxyEventHandlersBlueprint=In;exports.ProxyEventObservablesBlueprint=kn;exports.ProxyEventSubjectsBlueprint=An;exports.Q=Ao;exports.RegisterProxyEventHandlersBlueprint=qi;exports.Subject=tt;exports.U=tr;exports.W=ko;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Rn;exports.inject=z;exports.instance=yr;exports.map=nt;exports.requireWorker=oi;exports.scoped=Ct;exports.share=gr;exports.singleton=G;
|
|
34
|
+
Original error:`,y)}}function D(y,$,k){return e(this,void 0,void 0,function*(){let U;try{U=$(...k)}catch(B){return S(y,B)}const ne=F(U)?"observable":"promise";if(g(y,ne),F(U)){const B=U.subscribe(Q=>R(y,!1,i.serialize(Q)),Q=>{S(y,i.serialize(Q)),h.delete(y)},()=>{R(y,!0),h.delete(y)});h.set(y,B)}else try{const B=yield U;R(y,!0,i.serialize(B))}catch(B){S(y,i.serialize(B))}})}function H(y){if(!a.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(l)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(l=!0,typeof y=="function")a.default.subscribeToMasterMessages($=>{w($)&&!$.method&&D($.uid,y,$.args.map(i.deserialize))}),_();else if(typeof y=="object"&&y){a.default.subscribeToMasterMessages(k=>{w(k)&&k.method&&D(k.uid,y[k.method],k.args.map(i.deserialize))});const $=Object.keys(y).filter(k=>typeof y[k]=="function");C($)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${y}`);a.default.subscribeToMasterMessages($=>{if(m($)){const k=$.uid,U=h.get(k);U&&(U.unsubscribe(),h.delete(k))}})}t.expose=H,typeof self<"u"&&typeof self.addEventListener=="function"&&a.default.isWorkerRuntime()&&(self.addEventListener("error",y=>{setTimeout(()=>b(y.error||y),250)}),self.addEventListener("unhandledrejection",y=>{const $=y.reason;$&&typeof $.message=="string"&&setTimeout(()=>b($),250)})),typeof process<"u"&&typeof process.on=="function"&&a.default.isWorkerRuntime()&&(process.on("uncaughtException",y=>{setTimeout(()=>b(y),250)}),process.on("unhandledRejection",y=>{y&&typeof y.message=="string"&&setTimeout(()=>b(y),250)}))}(Oe)),Oe}var mn;function yo(){return mn||(mn=1,function(t){var e=ge&&ge.__createBinding||(Object.create?function(a,c,u,l){l===void 0&&(l=u),Object.defineProperty(a,l,{enumerable:!0,get:function(){return c[u]}})}:function(a,c,u,l){l===void 0&&(l=u),a[l]=c[u]}),r=ge&&ge.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&e(c,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var n=Qe();Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return n.registerSerializer}}),r(po(),t);var i=oi();Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return i.expose}});var s=Kn();Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return s.DefaultSerializer}});var o=wt();Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return o.Transfer}})}(ge)),ge}var _o=yo();const we=Rn(_o);we.registerSerializer;const bo=we.spawn;we.BlobWorker;we.DefaultSerializer;we.Pool;const wo=we.Thread;we.Transfer;const go=we.Worker;var So=Object.defineProperty,Po=(t,e,r)=>e in t?So(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>Po(t,typeof e!="symbol"?e+"":e,r);class Co extends O.EventDispatcher{constructor(){super(),se(this,"style",{}),se(this,"width",0),se(this,"height",0),se(this,"left",0),se(this,"top",0),this.getRootNode=this.getRootNode.bind(this),this.handleEvent=this.handleEvent.bind(this)}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getRootNode(){return this}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height}}handleEvent(e){if(e.type==="resize"){this.left=e.left??0,this.top=e.top??0,this.width=e.width??0,this.height=e.height??0;return}e.preventDefault=()=>{},e.stopPropagation=()=>{},this.dispatchEvent(e)}focus(){}}const Eo=()=>{try{if(window){if(navigator!=null&&navigator.hardwareConcurrency)return navigator.hardwareConcurrency;throw new Error("Unable to determine the number of cores")}else return require("os").cpus().length}catch(t){return console.error("🛑 Unable to detect available cores",t),2}},Oo=()=>Eo()-1,To="TERMINATE_THREAD_FROM_WORKER";let Mo=-1;class Ro{constructor(e){se(this,"_handleTerminate"),se(this,"_handleError"),se(this,"_task"),se(this,"id",Mo+=1),se(this,"idle",!0),se(this,"worker"),se(this,"thread"),this._handleTerminate=e==null?void 0:e.onTerminate,this._handleError=e==null?void 0:e.onError}_handleMessages(e){var r;e instanceof MessageEvent&&((r=e.data)==null?void 0:r.token)===To&&this.terminate()}async run(e){var r;try{const{payload:n,options:i}=e;return this.idle=!1,this.worker=new go(n.path,{type:"module",...i==null?void 0:i.worker}),this.thread=await bo(this.worker,{timeout:1e4,...i==null?void 0:i.spawn}),this._task=e,this.worker.postMessage(n.subject,n.transferSubject),this.worker.addEventListener("message",this._handleMessages.bind(this)),{worker:this.worker,thread:this.thread}}catch(n){(r=this._handleError)==null||r.call(this,n);return}}get task(){return this._task}async terminate(){var e,r,n;(e=this.worker)==null||e.removeEventListener("message",this._handleMessages.bind(this)),this.thread&&await wo.terminate(this.thread),await((r=this.worker)==null?void 0:r.terminate()),this.worker=void 0,this.thread=void 0,this._task=void 0,this.idle=!0,(n=this._handleTerminate)==null||n.call(this)}}class jo{constructor(e,r,n){se(this,"_workerThreads",[]),se(this,"_tasksQueue",[]),this.maxWorkersCount=e,this.debugMode=r,this.onWorkerThreadRun=n;for(let i=0;i<this.maxWorkersCount;i++)this._workerThreads.push(this._createWorkerThread())}_handleWorkerThreadTerminate(e){this.debugMode&&console.log(`WorkerThread #${e.id} freed`),this.runNext()}_handleWorkerThreadError(e,r){console.error(`Error from worker #${r.id}:`,e),this.runNext()}_createWorkerThread(){const e=new Ro({onTerminate:()=>this._handleWorkerThreadTerminate(e),onError:r=>this._handleWorkerThreadError(r,e)});return e}get workerThreads(){return this._workerThreads}get tasksQueue(){return this._tasksQueue}get nextAvailableWorkerThread(){return this._workerThreads.find(e=>e.idle)}getAvailableWorkerThreads(e=!1){return this._workerThreads.filter(r=>e?!r.idle:r.idle)}async runNext(){if(!this.nextAvailableWorkerThread||this._tasksQueue.length===0)return;const e=this._tasksQueue.shift();e&&await this.run(e)}async run(e,r=!1){var n;if(r){const o=this._createWorkerThread();return this.debugMode&&console.log(`Running On Untracked Thread #${o==null?void 0:o.id}. Task:`,e),[await o.run(e),!1]}const i=this.nextAvailableWorkerThread;if(!i)return this._tasksQueue.push(e),this.debugMode&&console.log("Queued Thread Task:",e),[void 0,!0];this.debugMode&&console.log(`Running On Thread #${i==null?void 0:i.id}. Task:`,e);const s=await i.run(e);return(n=this.onWorkerThreadRun)==null||n.call(this,i),[s,!1]}async terminateAll(){this._tasksQueue=[],await Promise.all(this._workerThreads.map(e=>e.terminate()))}}const $o=(t,e)=>new jo(Oo(),!!e),xo=t=>t===void 0,Do=t=>typeof t=="boolean",Ao=t=>!!t&&typeof t=="function",ko=t=>{var e,r;const n=t.toJSON();return JSON.stringify({...n,object:{...n.object,position:["x","y","z"].map(i=>t.position[i]),rotation:["x","y","z","order"].map(i=>t.rotation[i]),children:((r=(e=n==null?void 0:n.object)==null?void 0:e.children)==null?void 0:r.map((i,s)=>({...typeof i=="object"?i:typeof i=="string"?JSON.parse(i):{},position:["x","y","z"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.position[o]}),rotation:["x","y","z","order"].map(o=>{var a;return(a=t.children[s])==null?void 0:a.rotation[o]})})))??[]},isSerialized:!0})},yn=(t,e=new O.ObjectLoader)=>{const r=JSON.parse(t);if(r!=null&&r.metadata&&r.object&&r.isSerialized){const n=e.parse(r);return n.position.set(...r.object.position),n.rotation.set(...r.object.rotation),n.children.map((i,s)=>{i.position.set(...r.object.children[s].position)}),n.children.map((i,s)=>{i.rotation.set(...r.object.children[s].rotation)}),n}return r},Io=(t,e)=>{const r={type:t==null?void 0:t.type};for(const n of e)t[n]!==void 0&&(r[n]=t[n]);return r},er=(t,e)=>{const r={type:t==null?void 0:t.type};for(const[n,i]of Object.entries(t))e.includes(n)||(r[n]=i);return r};var zo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Lo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Fo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&zo(e,r,i),i};let Ke=class{constructor(){p(this,"_canvas");p(this,"proxyReceiver",new Co);p(this,"initialized",!1)}get canvas(){return this._canvas}set canvas(t){t.style={width:t.width+"",height:t.height+""},this._canvas=t}};Ke=Lo([G()],Ke);var Wo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Ho=(t,e,r,n)=>{for(var i=n>1?void 0:n?No(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Wo(e,r,i),i},Uo=(t,e)=>(r,n)=>e(r,n,t);let gt=class extends In{constructor(t){super(),this._service=t;for(const e of yr)this[`${e}$$`]=new tt,this[`${e}$`]=this[`${e}$$`].pipe(),this[e]=r=>{this._service.proxyReceiver.handleEvent({...r,type:r.type||e}),this[`${e}$$`].next(r)}}};gt=Ho([G(),Uo(0,z(Ke))],gt);var qo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Yo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Vo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&qo(e,r,i),i};let St=class{constructor(){p(this,"frame",1e3/60);p(this,"initialTime",Date.now());p(this,"currentTime",0);p(this,"deltaTime",0);p(this,"deltaRatio",0);p(this,"elapsedTime",0);p(this,"enabled",!1)}step(){const t=Date.now();this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime=t-this.initialTime,this.deltaRatio=this.deltaTime/this.frame}};St=Yo([G()],St);var Bo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Go=(t,e,r,n)=>{for(var i=n>1?void 0:n?Zo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Bo(e,r,i),i},Qo=(t,e)=>(r,n)=>e(r,n,t);let We=class{constructor(t){p(this,"beforeStep$$",new tt);p(this,"_previousTime",0);p(this,"beforeStep$",this.beforeStep$$.asObservable());p(this,"step$",ss().pipe(As(({elapsed:t})=>{var e;this._previousTime!==t&&((e=this.beforeStep$$)==null||e.next(er(this._service,[])),this._previousTime=t)}),ye(()=>this._service.enabled),Ds(()=>this._service.enabled),nt(()=>er(this._service,[])),wr()));this._service=t}};We=Go([G(),Qo(0,z(St))],We);var Ko=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Jo=(t,e,r,n)=>{for(var i=n>1?void 0:n?Xo(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ko(e,r,i),i},_n=(t,e)=>(r,n)=>e(r,n,t);let tr=class{constructor(t,e){p(this,"_initialAnimationFrameId");p(this,"_subscriptions",[]);this._controller=t,this._service=e,this._subscriptions.push(this._controller.step$.subscribe(this._service.step.bind(this._service)))}init(t){this.enabled(t)}frame(){return this._service.frame}deltaTime(t){return typeof t=="number"&&(this._service.deltaTime=t),this._service.deltaTime}deltaRatio(t){return typeof t=="number"&&(this._service.deltaRatio=t),this._service.deltaRatio}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}dispose(){this._initialAnimationFrameId!==void 0&&cancelAnimationFrame(this._initialAnimationFrameId),this._service.enabled=!1}beforeStep$(){return this._controller.beforeStep$}step$(){return this._controller.step$}};tr=Jo([G(),_n(0,z(We)),_n(1,z(St))],tr);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ra=(t,e,r,n)=>{for(var i=n>1?void 0:n?ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ea(e,r,i),i};let be=class{constructor(){p(this,"width",0);p(this,"height",0);p(this,"aspect",0);p(this,"pixelRatio",0);p(this,"frustrum",5);p(this,"enabled",!0)}init(t,e){this.height=Number(t.height??this.height),this.width=Number(t.width??this.width),this.aspect=this.width/this.height,this.enabled=e===void 0?!0:!!e}};be=ra([G()],be);var na=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ia(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&na(e,r,i),i},oa=(t,e)=>(r,n)=>e(r,n,t);let Re=class{constructor(t){p(this,"instance");p(this,"enabled",!0);this._sizesService=t}set aspectRatio(t){var e;this.instance instanceof O.PerspectiveCamera&&(this.instance.aspect=t),(this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&((e=this.instance)==null||e.updateProjectionMatrix())}set quaternion(t){var e;(e=this.instance)==null||e.quaternion.copy(t)}set position(t){var e;(e=this.instance)==null||e.position.copy(t)}set rotation(t){var e;(e=this.instance)==null||e.rotation.copy(t)}init(t){if(this.dispose(),t===yt.PERSPECTIVE||t===void 0){this.instance=new O.PerspectiveCamera(70,this._sizesService.width/this._sizesService.height,1e-4,100),this.instance.position.z=8;return}t===yt.ORTHOGRAPHIC&&(this.instance=new O.OrthographicCamera(-this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.aspect*this._sizesService.frustrum/2,this._sizesService.frustrum/2,-this._sizesService.frustrum/2,-50,50))}dispose(){this.instance instanceof O.Camera&&((this.instance instanceof O.PerspectiveCamera||this.instance instanceof O.OrthographicCamera)&&this.instance.clearViewOffset(),this.instance.clear(),this.instance=void 0)}};Re=sa([G(),oa(0,z(be))],Re);var aa=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var i=n>1?void 0:n?ua(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&aa(e,r,i),i},bn=(t,e)=>(r,n)=>e(r,n,t);let rr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};rr=ca([G(),bn(0,z(We)),bn(1,z(Re))],rr);var la=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ha(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&la(e,r,i),i},Nt=(t,e)=>(r,n)=>e(r,n,t);let nr=class{constructor(t,e,r){p(this,"_subscriptions",[]);this._sizesService=t,this._controller=e,this._service=r}init(){this._service.init(),this._subscriptions.push(this._controller.step$.subscribe(()=>{var t;this._service.enabled&&(this._service.aspectRatio=this._sizesService.aspect,(this._service.instance instanceof O.PerspectiveCamera||this._service.instance instanceof O.OrthographicCamera)&&((t=this._service.instance)==null||t.updateProjectionMatrix()))}))}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}aspectRatio(t){return t&&(this._service.aspectRatio=t),this._service.aspectRatio}instance(t){return t&&(this._service.instance=t),this._service.instance}position(t){return t&&(this._service.position=t),this._service.position}quaternion(t){return t&&(this._service.quaternion=t),this._service.quaternion}dispose(){this._subscriptions.forEach(t=>t.unsubscribe()),this._service.dispose()}};nr=fa([G(),Nt(0,z(be)),Nt(1,z(rr)),Nt(2,z(Re))],nr);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?pa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&da(e,r,i),i};let Xe=class{constructor(){p(this,"scene",new O.Scene);p(this,"enabled",!0)}};Xe=va([G()],Xe);var ai=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ya=(t,e,r)=>e in t?ai(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ma(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&ai(e,r,i),i},Ht=(t,e)=>(r,n)=>e(r,n,t),ba=(t,e,r)=>ya(t,e+"",r);let je=class{constructor(t,e,r){p(this,"enabled",!0);p(this,"instance");this._worldService=t,this._cameraService=e,this._sizesService=r}setWebGLRenderer(t){this.instance=new O.WebGLRenderer({canvas:t,context:t.getContext("webgl2",{stencil:!0,powerPreference:"high-performance"}),powerPreference:"high-performance",depth:!0,antialias:!0}),this.instance.autoClear=!1,this.instance.setPixelRatio(je.RENDERER_PIXEL_RATIO),this.instance.setClearColor(0,0),this.instance.shadowMap.enabled=!0,this.instance.shadowMap.type=O.PCFSoftShadowMap,this.instance.outputColorSpace=O.SRGBColorSpace,this.instance.toneMapping=O.CineonToneMapping,this.instance.toneMappingExposure=1.75}setSize(t,e){var r;(r=this.instance)==null||r.setSize(t,e)}render(){this.enabled&&this._cameraService.instance instanceof O.Camera&&this.instance instanceof O.WebGLRenderer&&(this.instance.setViewport(0,0,this._sizesService.width,this._sizesService.height),this.instance.render(this._worldService.scene,this._cameraService.instance))}};ba(je,"RENDERER_PIXEL_RATIO",1);je=_a([G(),Ht(0,z(Xe)),Ht(1,z(Re)),Ht(2,z(be))],je);var wa=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,Sa=(t,e,r,n)=>{for(var i=n>1?void 0:n?ga(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&wa(e,r,i),i},wn=(t,e)=>(r,n)=>e(r,n,t);let Pt=class{constructor(t,e){p(this,"resize$");this._appController=t,this._service=e,this.resize$=this._appController.resize$$.pipe(ye(()=>this._service.enabled))}};Pt=Sa([G(),wn(0,z(gt)),wn(1,z(be))],Pt);var Pa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,Ea=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ca(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Pa(e,r,i),i},Ut=(t,e)=>(r,n)=>e(r,n,t);let ir=class{constructor(t,e,r){p(this,"step$");p(this,"resize$");this._service=t,this.timerController=e,this.sizesController=r,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled)),this.resize$=this.sizesController.resize$.pipe(ye(()=>this._service.enabled))}};ir=Ea([G(),Ut(0,z(je)),Ut(1,z(We)),Ut(2,z(Pt))],ir);var Oa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ma=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ta(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Oa(e,r,i),i},gn=(t,e)=>(r,n)=>e(r,n,t);let sr=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.step$.subscribe(()=>this._service.render()),this._controller.resize$.subscribe(e=>this._service.setSize(e.windowWidth,e.windowHeight)),this._service.setWebGLRenderer(t)}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}instance(){return this._service.instance}setSize(t){return this._service.setSize(t.x,t.y)}render(){return this._service.render()}dispose(){var t;(t=this._service.instance)==null||t.dispose(),this._service.instance=void 0}};sr=Ma([G(),gn(0,z(ir)),gn(1,z(je))],sr);var Ra=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,$a=(t,e,r,n)=>{for(var i=n>1?void 0:n?ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ra(e,r,i),i},Sn=(t,e)=>(r,n)=>e(r,n,t);let or=class{constructor(t,e){this._controller=t,this._service=e}init(t){this._controller.resize$.subscribe(e=>{this._service.width=e.windowWidth,this._service.height=e.windowHeight,this._service.aspect=e.windowWidth/e.windowHeight}),this._service.init(t)}dispose(){}aspect(t){return typeof t=="number"&&(this._service.aspect=t),this._service.aspect}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}frustrum(t){return typeof t=="number"&&(this._service.frustrum=t),this._service.frustrum}height(t){return typeof t=="number"&&(this._service.height=t),this._service.height}pixelRatio(t){return typeof t=="number"&&(this._service.pixelRatio=t),this._service.pixelRatio}width(t){return typeof t=="number"&&(this._service.width=t),this._service.width}resize$(){return this._controller.resize$}};or=$a([G(),Sn(0,z(Pt)),Sn(1,z(be))],or);var xa=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,Aa=(t,e,r,n)=>{for(var i=n>1?void 0:n?Da(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&xa(e,r,i),i},ka=(t,e)=>(r,n)=>e(r,n,t);let ar=class{constructor(t){this._service=t}init(){}dispose(){}scene(t){return t instanceof O.Scene&&(this._service.scene=t),this._service.scene}enabled(t){return typeof t=="boolean"&&(this._service.enabled=t),this._service.enabled}};ar=Aa([G(),ka(0,z(Xe))],ar);const Pn={type:"change"},Cr={type:"start"},ui={type:"end"},ht=new O.Ray,Cn=new O.Plane,Ia=Math.cos(70*O.MathUtils.DEG2RAD),J=new O.Vector3,ie=2*Math.PI,q={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},qt=1e-6;class En extends O.Controls{constructor(e,r=null){super(e,r),this.state=q.NONE,this.enabled=!0,this.target=new O.Vector3,this.cursor=new O.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:O.MOUSE.ROTATE,MIDDLE:O.MOUSE.DOLLY,RIGHT:O.MOUSE.PAN},this.touches={ONE:O.TOUCH.ROTATE,TWO:O.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new O.Vector3,this._lastQuaternion=new O.Quaternion,this._lastTargetPosition=new O.Vector3,this._quat=new O.Quaternion().setFromUnitVectors(e.up,new O.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new O.Spherical,this._sphericalDelta=new O.Spherical,this._scale=1,this._panOffset=new O.Vector3,this._rotateStart=new O.Vector2,this._rotateEnd=new O.Vector2,this._rotateDelta=new O.Vector2,this._panStart=new O.Vector2,this._panEnd=new O.Vector2,this._panDelta=new O.Vector2,this._dollyStart=new O.Vector2,this._dollyEnd=new O.Vector2,this._dollyDelta=new O.Vector2,this._dollyDirection=new O.Vector3,this._mouse=new O.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Fa.bind(this),this._onPointerDown=za.bind(this),this._onPointerUp=La.bind(this),this._onContextMenu=Ya.bind(this),this._onMouseWheel=Ha.bind(this),this._onKeyDown=Ua.bind(this),this._onTouchStart=qa.bind(this),this._onTouchMove=Va.bind(this),this._onMouseDown=Wa.bind(this),this._onMouseMove=Na.bind(this),this._interceptControlDown=Ba.bind(this),this._interceptControlUp=Za.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Pn),this.update(),this.state=q.NONE}update(e=null){const r=this.object.position;J.copy(r).sub(this.target),J.applyQuaternion(this._quat),this._spherical.setFromVector3(J),this.autoRotate&&this.state===q.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=ie:n>Math.PI&&(n-=ie),i<-Math.PI?i+=ie:i>Math.PI&&(i-=ie),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(J.setFromSpherical(this._spherical),J.applyQuaternion(this._quatInverse),r.copy(this.target).add(J),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=J.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const a=new O.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const u=new O.Vector3(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(a),this.object.updateMatrixWorld(),o=J.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(ht.origin.copy(this.object.position),ht.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ht.direction))<Ia?this.object.lookAt(this.target):(Cn.setFromNormalAndCoplanarPoint(this.object.up,this.target),ht.intersectPlane(Cn,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>qt||8*(1-this._lastQuaternion.dot(this.object.quaternion))>qt||this._lastTargetPosition.distanceToSquared(this.target)>qt?(this.dispatchEvent(Pn),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ie/60*this.autoRotateSpeed*e:ie/60/60*this.autoRotateSpeed}_getZoomScale(e){const r=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*r)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,r){J.setFromMatrixColumn(r,0),J.multiplyScalar(-e),this._panOffset.add(J)}_panUp(e,r){this.screenSpacePanning===!0?J.setFromMatrixColumn(r,1):(J.setFromMatrixColumn(r,0),J.crossVectors(this.object.up,J)),J.multiplyScalar(e),this._panOffset.add(J)}_pan(e,r){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;J.copy(i).sub(this.target);let s=J.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*r*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,r){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=r-n.top,o=n.width,a=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let r=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),r=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),r=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),r=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ie*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),r=!0;break}r&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const r=this.domElement;this._rotateLeft(ie*this._rotateDelta.x/r.clientHeight),this._rotateUp(ie*this._rotateDelta.y/r.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),n=.5*(e.pageX+r.x),i=.5*(e.pageY+r.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const r=this._getSecondPointerPosition(e),n=e.pageX-r.x,i=e.pageY-r.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+r.x)*.5,a=(e.pageY+r.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId){this._pointers.splice(r,1);return}}_isTrackingPointer(e){for(let r=0;r<this._pointers.length;r++)if(this._pointers[r]==e.pointerId)return!0;return!1}_trackPointer(e){let r=this._pointerPositions[e.pointerId];r===void 0&&(r=new O.Vector2,this._pointerPositions[e.pointerId]=r),r.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const r=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[r]}_customWheelEvent(e){const r=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(r){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function za(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Fa(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function La(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(ui),this.state=q.NONE;break;case 1:const e=this._pointers[0],r=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:r.x,pageY:r.y});break}}function Wa(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case O.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=q.DOLLY;break;case O.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}break;case O.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=q.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=q.PAN}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Na(t){switch(this.state){case q.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case q.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case q.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function Ha(t){this.enabled===!1||this.enableZoom===!1||this.state!==q.NONE||(t.preventDefault(),this.dispatchEvent(Cr),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(ui))}function Ua(t){this.enabled!==!1&&this._handleKeyDown(t)}function qa(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case O.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=q.TOUCH_ROTATE;break;case O.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=q.TOUCH_PAN;break;default:this.state=q.NONE}break;case 2:switch(this.touches.TWO){case O.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=q.TOUCH_DOLLY_PAN;break;case O.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=q.TOUCH_DOLLY_ROTATE;break;default:this.state=q.NONE}break;default:this.state=q.NONE}this.state!==q.NONE&&this.dispatchEvent(Cr)}function Va(t){switch(this._trackPointer(t),this.state){case q.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case q.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case q.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case q.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=q.NONE}}function Ya(t){this.enabled!==!1&&t.preventDefault()}function Ba(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Za(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var Ga=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Ka=(t,e,r,n)=>{for(var i=n>1?void 0:n?Qa(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Ga(e,r,i),i},Ze=(t,e)=>(r,n)=>e(r,n,t);let ur=class{constructor(t,e,r,n,i){p(this,"enabled",!1);p(this,"cameraControls");p(this,"miniCamera");p(this,"miniCameraControls");p(this,"cameraHelper");p(this,"axesHelper");p(this,"gridHelper");this._appService=t,this._sizesService=e,this._rendererService=r,this._cameraService=n,this._worldService=i}_renderMiniCamera(){var t,e,r,n,i;!this.enabled||!this.miniCamera||((t=this._rendererService.instance)==null||t.setScissorTest(!0),(e=this._rendererService.instance)==null||e.setViewport(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(r=this._rendererService.instance)==null||r.setScissor(this._sizesService.width-this._sizesService.width/3,this._sizesService.height-this._sizesService.height/3,this._sizesService.width/3,this._sizesService.height/3),(n=this._rendererService.instance)==null||n.render(this._worldService.scene,this.miniCamera),(i=this._rendererService.instance)==null||i.setScissorTest(!1))}initMiniCamera(){this.disposeMiniCamera(),this.enabled&&(this.miniCamera=new O.PerspectiveCamera(75,this._sizesService.width/this._sizesService.height,.1,500),this.miniCamera.position.z=10,this.miniCamera.position.x=-5)}initOrbitControl(){var t;this.cameraControls&&((t=this.cameraControls)==null||t.dispose()),!(!this.enabled||!(this._cameraService.instance instanceof O.Camera))&&this._cameraService.instance instanceof O.Camera&&(this.cameraControls=new En(this._cameraService.instance,this._appService.proxyReceiver),this.cameraControls.rotateSpeed=.1,this.cameraControls.enableDamping=!0)}initMiniCameraOrbitControls(){this.miniCameraControls&&this.miniCameraControls.dispose(),!(!this.enabled||!this.miniCamera)&&(this.miniCameraControls=new En(this.miniCamera,this._appService.proxyReceiver),this.miniCameraControls.rotateSpeed=.15,this.miniCameraControls.enableDamping=!0)}initCameraHelper(){this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),!(!this.enabled||!this._cameraService.instance)&&(this.cameraHelper=new O.CameraHelper(this._cameraService.instance),this._worldService.scene.add(this.cameraHelper))}initAxesHelper(t){if(!this.enabled)return;const e=new O.AxesHelper(t);this._worldService.scene.add(e)}initGridHelper(t){if(this.gridHelper&&this._worldService.scene.remove(this.gridHelper),!this.enabled)return;const e=new O.GridHelper(t,t);this._worldService.scene.add(e)}disposeMiniCamera(){this.miniCamera instanceof O.Camera&&(this.miniCamera.clearViewOffset(),this.miniCamera.clear(),this.miniCamera=void 0)}update(){var t,e;(t=this.cameraControls)==null||t.update(),(e=this.miniCameraControls)==null||e.update(),this._renderMiniCamera()}dispose(){var t,e,r,n,i;this.disposeMiniCamera(),(t=this.cameraControls)==null||t.dispose(),this.cameraControls=void 0,(e=this.miniCameraControls)==null||e.dispose(),this.miniCameraControls=void 0,this.cameraHelper&&this._worldService.scene.remove(this.cameraHelper),(r=this.cameraHelper)==null||r.dispose(),this.cameraHelper=void 0,this.axesHelper&&this._worldService.scene.remove(this.axesHelper),(n=this.axesHelper)==null||n.dispose(),this.axesHelper=void 0,this.gridHelper&&this._worldService.scene.remove(this.gridHelper),(i=this.gridHelper)==null||i.dispose(),this.gridHelper=void 0}};ur=Ka([G(),Ze(0,z(Ke)),Ze(1,z(be)),Ze(2,z(je)),Ze(3,z(Re)),Ze(4,z(Xe))],ur);var Xa=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,eu=(t,e,r,n)=>{for(var i=n>1?void 0:n?Ja(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&Xa(e,r,i),i},On=(t,e)=>(r,n)=>e(r,n,t);let cr=class{constructor(t,e){p(this,"step$");this.timerController=t,this._service=e,this.step$=this.timerController.step$.pipe(ye(()=>this._service.enabled))}};cr=eu([G(),On(0,z(We)),On(1,z(Re))],cr);var tu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,nu=(t,e,r,n)=>{for(var i=n>1?void 0:n?ru(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&tu(e,r,i),i},Tn=(t,e)=>(r,n)=>e(r,n,t);let lr=class{constructor(t,e){p(this,"_subscriptions",[]);this._service=t,this._controller=e}init(t){this._service.enabled=!!t.enableDebug,this._service.enabled&&(t.withMiniCamera&&this._service.initMiniCamera(),t.enableControls&&(this._service.initOrbitControl(),this._service.initMiniCameraOrbitControls()),t.withCameraHelper&&this._service.initCameraHelper(),typeof(t==null?void 0:t.axesSizes)=="number"&&this._service.initAxesHelper(t.axesSizes),typeof(t==null?void 0:t.gridSizes)=="number"&&this._service.initGridHelper(t.gridSizes),this._subscriptions.push(this._controller.step$.subscribe(()=>{this._service.update()})))}enabled(t){return t&&(this._service.enabled=t),this._service.enabled}miniCamera(t){return t&&(this._service.miniCamera=t),this._service.miniCamera}getAxesHelper(){return this._service.axesHelper}getCameraControls(){return this._service.cameraControls}getCameraHelper(){return this._service.cameraHelper}getGridHelper(){return this._service.gridHelper}getMiniCameraControls(){return this._service.miniCameraControls}getStep$(){return this._controller.step$}dispose(){this._service.dispose(),this._subscriptions.forEach(t=>t.unsubscribe())}};lr=nu([G(),Tn(0,z(ur)),Tn(1,z(cr))],lr);var iu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,ou=(t,e,r,n)=>{for(var i=n>1?void 0:n?su(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&iu(e,r,i),i};let hr=class{constructor(){p(this,"load$",_t(self,"message").pipe(ye(t=>{var e,r,n;return((e=t.data)==null?void 0:e.token)===Fn&&!!((n=(r=t.data)==null?void 0:r.payload)!=null&&n.resource)}),nt(t=>{var r,n,i,s;const{payload:e}=t.data||{};if(((r=e==null?void 0:e.source)==null?void 0:r.type)==="gltf"){const o=e.resource,a=(n=o.animations)==null?void 0:n.map(h=>O.AnimationClip.parse(h)),c=(i=o.cameras)==null?void 0:i.map(h=>yn(h)),u=(s=o.scenes)==null?void 0:s.map(h=>yn(h)),l=u==null?void 0:u[0];return{...e,resource:{...o,animations:a,cameras:c,scene:l,scenes:u}}}return e}),wr()));p(this,"loadCompleted$",this.load$.pipe(ye(t=>!!t&&t.toLoadCount===t.loadedCount)))}};hr=ou([Ct(te.ResolutionScoped)],hr);var au=Object.defineProperty,uu=Object.getOwnPropertyDescriptor,cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?uu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&au(e,r,i),i};let fr=class{constructor(){p(this,"loadedResources",{});p(this,"toLoadCount",0);p(this,"loadedCount",0)}handleLoad(t){const{source:e,resource:r,loadedCount:n,toLoadCount:i}=t;r&&(this.loadedResources[e.name]=r,this.toLoadCount=n,this.loadedCount=i)}};fr=cu([Ct(te.ResolutionScoped)],fr);var lu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,fu=(t,e,r,n)=>{for(var i=n>1?void 0:n?hu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&lu(e,r,i),i},Mn=(t,e)=>(r,n)=>e(r,n,t);let dr=class{constructor(t,e){p(this,"_subscriptions",[]);this._controller=t,this._service=e}init(){this._subscriptions.push(this._controller.load$.subscribe(this._service.handleLoad.bind(this._service)))}getLoadedResources(){return this._service.loadedResources}getLoadedCount(){return this._service.loadedCount}getToLoadCount(){return this._service.toLoadCount}getLoad$(){return this._controller.load$}getLoadCompleted$(){return this._controller.loadCompleted$}dispose(){this._subscriptions.forEach(t=>t.unsubscribe())}};dr=fu([G(),Mn(0,z(hr)),Mn(1,z(fr))],dr);var du=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,vu=(t,e,r,n)=>{for(var i=n>1?void 0:n?pu(e,r):e,s=t.length-1,o;s>=0;s--)(o=t[s])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&du(e,r,i),i},me=(t,e)=>(r,n)=>e(r,n,t);exports.AppModule=class extends zn{constructor(e,r,n,i,s,o,a,c,u){super(),this._controller=e,this._service=r,this.timer=n,this.sizes=i,this.camera=s,this.world=o,this.renderer=a,this.loader=c,this.debug=u,this._initProxyEvents()}_initProxyEvents(){yr.forEach(e=>{this[`${e}$`]=()=>{var r;return(r=this._controller)==null?void 0:r[`${e}$`]},this[e]=r=>{var n,i;return(i=(n=this._controller)==null?void 0:n[e])==null?void 0:i.call(n,r)}})}init(e){this._service.initialized||!(e!=null&&e.canvas)||!(this._service.canvas=e.canvas)||(this._service.initialized=!0,this.sizes.init(this._service.canvas),this.camera.init(),this.world.init(),this.renderer.init(this._service.canvas),this.timer.init(e.startTimer),this.loader.init(),this.debug.init(e))}isInitialized(){return this._service.initialized}beforeStep$(){return this.timer.beforeStep$()}step$(){return this.timer.step$()}dispose(){this.sizes.dispose(),this.camera.dispose(),this.world.dispose(),this.renderer.dispose(),this.timer.dispose(),this.loader.dispose(),this.debug.dispose()}};exports.AppModule=vu([Ct(te.ContainerScoped),me(0,z(gt)),me(1,z(Ke)),me(2,z(tr)),me(3,z(or)),me(4,z(nr)),me(5,z(ar)),me(6,z(sr)),me(7,z(dr)),me(8,z(lr))],exports.AppModule);exports.A=xo;exports.AppProxyEventHandlersBlueprint=zn;exports.C=$o;exports.CONTAINER_TOKEN=Vi;exports.D=Do;exports.DefaultCameraType=yt;exports.J=Io;exports.KEYBOARD_EVENT_CODES=Ui;exports.LOADER_SERIALIZED_LOAD_TOKEN=Fn;exports.Lifecycle=te;exports.PROXY_EVENT_LISTENERS=yr;exports.ProxyEventHandlersBlueprint=In;exports.ProxyEventObservablesBlueprint=kn;exports.ProxyEventSubjectsBlueprint=An;exports.Q=Ao;exports.RegisterProxyEventHandlersBlueprint=qi;exports.Subject=tt;exports.U=er;exports.W=ko;exports.filter=ye;exports.fromEvent=_t;exports.getDefaultExportFromCjs=Rn;exports.inject=z;exports.instance=mr;exports.map=nt;exports.requireWorker=oi;exports.scoped=Ct;exports.share=wr;exports.singleton=G;
|