@ptrumpis/snap-camerakit-bridge
Version:
Library for calling the Snapchat Camera-Kit API in Node.js Hackerman style 🤓
1 lines • 582 kB
JavaScript
(()=>{var __webpack_modules__={18:function(l){!function webpackUniversalModuleDefinition(m,f){l.exports=f()}(0,(function(){return function(l){var m={};function __nested_webpack_require_536__(f){if(m[f])return m[f].exports;var g=m[f]={i:f,l:!1,exports:{}};return l[f].call(g.exports,g,g.exports,__nested_webpack_require_536__),g.l=!0,g.exports}return __nested_webpack_require_536__.m=l,__nested_webpack_require_536__.c=m,__nested_webpack_require_536__.i=function(l){return l},__nested_webpack_require_536__.d=function(l,m,f){__nested_webpack_require_536__.o(l,m)||Object.defineProperty(l,m,{configurable:!1,enumerable:!0,get:f})},__nested_webpack_require_536__.n=function(l){var m=l&&l.__esModule?function getDefault(){return l.default}:function getModuleExports(){return l};return __nested_webpack_require_536__.d(m,"a",m),m},__nested_webpack_require_536__.o=function(l,m){return Object.prototype.hasOwnProperty.call(l,m)},__nested_webpack_require_536__.p="",__nested_webpack_require_536__(__nested_webpack_require_536__.s=1)}([function(l,m,f){"use strict";Object.defineProperty(m,"__esModule",{value:!0});var g=f(3);var E=function(){function BrowserHeaders(l,m){void 0===l&&(l={}),void 0===m&&(m={splitValues:!1});var f=this;if(this.headersMap={},l)if("undefined"!=typeof Headers&&l instanceof Headers)g.getHeaderKeys(l).forEach((function(E){g.getHeaderValues(l,E).forEach((function(l){m.splitValues?f.append(E,g.splitHeaderValue(l)):f.append(E,l)}))}));else if(function isBrowserHeaders(l){return"object"==typeof l&&"object"==typeof l.headersMap&&"function"==typeof l.forEach}(l))l.forEach((function(l,m){f.append(l,m)}));else if("undefined"!=typeof Map&&l instanceof Map){l.forEach((function(l,m){f.append(m,l)}))}else"string"==typeof l?this.appendFromString(l):"object"==typeof l&&Object.getOwnPropertyNames(l).forEach((function(m){var g=l[m];Array.isArray(g)?g.forEach((function(l){f.append(m,l)})):f.append(m,g)}))}return BrowserHeaders.prototype.appendFromString=function(l){for(var m=l.split("\r\n"),f=0;f<m.length;f++){var g=m[f],E=g.indexOf(":");if(E>0){var v=g.substring(0,E).trim(),_=g.substring(E+1).trim();this.append(v,_)}}},BrowserHeaders.prototype.delete=function(l,m){var f=g.normalizeName(l);if(void 0===m)delete this.headersMap[f];else{var E=this.headersMap[f];if(E){var v=E.indexOf(m);v>=0&&E.splice(v,1),0===E.length&&delete this.headersMap[f]}}},BrowserHeaders.prototype.append=function(l,m){var f=this,E=g.normalizeName(l);Array.isArray(this.headersMap[E])||(this.headersMap[E]=[]),Array.isArray(m)?m.forEach((function(l){f.headersMap[E].push(g.normalizeValue(l))})):this.headersMap[E].push(g.normalizeValue(m))},BrowserHeaders.prototype.set=function(l,m){var f=g.normalizeName(l);if(Array.isArray(m)){var E=[];m.forEach((function(l){E.push(g.normalizeValue(l))})),this.headersMap[f]=E}else this.headersMap[f]=[g.normalizeValue(m)]},BrowserHeaders.prototype.has=function(l,m){var f=this.headersMap[g.normalizeName(l)];if(!Array.isArray(f))return!1;if(void 0!==m){var E=g.normalizeValue(m);return f.indexOf(E)>=0}return!0},BrowserHeaders.prototype.get=function(l){var m=this.headersMap[g.normalizeName(l)];return void 0!==m?m.concat():[]},BrowserHeaders.prototype.forEach=function(l){var m=this;Object.getOwnPropertyNames(this.headersMap).forEach((function(f){l(f,m.headersMap[f])}),this)},BrowserHeaders.prototype.toHeaders=function(){if("undefined"!=typeof Headers){var l=new Headers;return this.forEach((function(m,f){f.forEach((function(f){l.append(m,f)}))})),l}throw new Error("Headers class is not defined")},BrowserHeaders}();m.BrowserHeaders=E},function(l,m,f){"use strict";Object.defineProperty(m,"__esModule",{value:!0});var g=f(0);m.BrowserHeaders=g.BrowserHeaders},function(l,m,f){"use strict";Object.defineProperty(m,"__esModule",{value:!0}),m.iterateHeaders=function iterateHeaders(l,m){for(var f=l[Symbol.iterator](),g=f.next();!g.done;)m(g.value[0]),g=f.next()},m.iterateHeadersKeys=function iterateHeadersKeys(l,m){for(var f=l.keys(),g=f.next();!g.done;)m(g.value),g=f.next()}},function(l,m,f){"use strict";Object.defineProperty(m,"__esModule",{value:!0});var g=f(2);m.normalizeName=function normalizeName(l){if("string"!=typeof l&&(l=String(l)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()},m.normalizeValue=function normalizeValue(l){return"string"!=typeof l&&(l=String(l)),l},m.getHeaderValues=function getHeaderValues(l,m){var f=l;if(f instanceof Headers&&f.getAll)return f.getAll(m);var g=f.get(m);return g&&"string"==typeof g?[g]:g},m.getHeaderKeys=function getHeaderKeys(l){var m=l,f={},E=[];return m.keys?g.iterateHeadersKeys(m,(function(l){f[l]||(f[l]=!0,E.push(l))})):m.forEach?m.forEach((function(l,m){f[m]||(f[m]=!0,E.push(m))})):g.iterateHeaders(m,(function(l){var m=l[0];f[m]||(f[m]=!0,E.push(m))})),E},m.splitHeaderValue=function splitHeaderValue(l){var m=[];return l.split(", ").forEach((function(l){l.split(",").forEach((function(l){m.push(l)}))})),m}}])}))},225:(l,m,f)=>{"use strict";function isMemoized(l){return"function"==typeof l&&"function"==typeof l.delegate}function memoize(l,m){let f;const memoized=(...l)=>(void 0!==f||(f=m.apply(memoized.thisArg,l)),f);return memoized.delegate=m,memoized.thisArg=l,memoized}f.r(m),f.d(m,{CameraKitWeb:()=>CameraKitWeb,default:()=>_c});const entries=l=>Object.entries(l);function Injectable(l,m,f){const g=Array.isArray(m)?m:[],E="function"==typeof m?m:f;if(!E)throw new TypeError("[Injectable] Received invalid arguments. The factory function must be either the second or third argument.");if(E.length!==g.length)throw new TypeError(`[Injectable] Function arity does not match the number of dependencies. Function has arity ${E.length}, but ${g.length} dependencies were specified.\nDependencies: ${JSON.stringify(g)}`);const factory=(...l)=>E(...l);return factory.token=l,factory.dependencies=g,factory}function ClassInjectable(l,m){const factory=(...l)=>new m(...l);return factory.token=l,factory.dependencies=m.dependencies,factory}function ConcatInjectable(l,m,f){const g=Array.isArray(m)?m:[],E="function"==typeof m?m:f;if(!E)throw new TypeError("[ConcatInjectable] Received invalid arguments. The factory function must be either the second or third argument.");if(E.length!==g.length)throw new TypeError(`[Injectable] Function arity does not match the number of dependencies. Function has arity ${E.length}, but ${g.length} dependencies were specified.\nDependencies: ${JSON.stringify(g)}`);const factory=(l,...m)=>l.concat(E(...m));return factory.token=l,factory.dependencies=[l,...g],factory}class PartialContainer{injectables;constructor(l){this.injectables=l}provides(l){return new PartialContainer({...this.injectables,[l.token]:l})}providesValue=(l,m)=>this.provides(Injectable(l,[],(()=>m)));providesClass=(l,m)=>this.provides(ClassInjectable(l,m));getFactories(l){let m;return m=Object.fromEntries(entries(this.injectables).map((([f,g])=>[f,memoize(l,(()=>g(...g.dependencies.map((g=>g===f?l.get(g):m[g]?m[g]():l.get(g))))))])))}getTokens(){return Object.keys(this.injectables)}}const g="$container";class Container{static provides(l){return new Container({}).provides(l)}static providesValue(l,m){return new Container({}).providesValue(l,m)}static fromObject(l){return entries(l).reduce(((l,[m,f])=>l.providesValue(m,f)),new Container({}))}factories;constructor(l){const m={};for(const f in l){const g=l[f];isMemoized(g)?(m[f]=g,g.thisArg=this):m[f]=memoize(this,g)}this.factories=m}copy(l){const m={...this.factories};return(l||[]).forEach((l=>{m[l]=this.factories[l].delegate})),new Container(m)}get(l){if(l===g)return this;const m=this.factories[l];if(!m)throw new Error(`[Container::get] Could not find Service for Token "${String(l)}". This should've caused a compile-time error. If the Token is 'undefined', check all your calls to the Injectable function. Make sure you define dependencies using string literals or string constants that are definitely initialized before the call to Injectable.`);return m()}run(l){if(l instanceof PartialContainer){const m=this.provides(l);for(const f of l.getTokens())m.get(f)}else this.provides(l).get(l.token);return this}provides(l){if(l instanceof PartialContainer||l instanceof Container){const m=l instanceof PartialContainer?l.getFactories(this):l.factories;return new Container({...this.factories,...m})}return this.providesService(l)}providesClass=(l,m)=>this.providesService(ClassInjectable(l,m));providesValue=(l,m)=>this.providesService(Injectable(l,[],(()=>m)));appendValue=(l,m)=>this.providesService(ConcatInjectable(l,(()=>m)));appendClass=(l,m)=>this.providesService(ConcatInjectable(l,(()=>this.providesClass(l,m).get(l))));append=l=>this.providesService(ConcatInjectable(l.token,(()=>this.providesService(l).get(l.token))));providesService(l){const m=l.token,f=l.dependencies,g=-1===f.indexOf(m)?void 0:()=>this.get(m),E=memoize(this,(function(){return l(...f.map((l=>l===m?g():this.get(l))))})),v={...this.factories,[m]:E};return new Container(v)}}function copyDefinedProperties(l){return Object.fromEntries(Object.entries(l).filter((([l,m])=>void 0!==m)))}const E="__snap_camkit_override__";function getConfigurationOverrides(){if(!sessionStorage)return;const l=sessionStorage.getItem(E);return l&&JSON.parse(l)}["wasmEndpointOverride","logger","logLevel","userAgentFlavor"].forEach((l=>{!function defineWindowField(l){if("undefined"==typeof window)return;Object.defineProperty(window,`${E}${l}`,{get(){var m;return null===(m=getConfigurationOverrides())||void 0===m?void 0:m[l]},set(m){const f=Object.assign(Object.assign({},getConfigurationOverrides()),{[l]:m});Object.values(f).every((l=>void 0===l))?sessionStorage.removeItem(E):sessionStorage.setItem(E,JSON.stringify(f))},enumerable:!1,configurable:!0})}(l)}));const v={lensPerformance:{cluster:0,benchmarks:[],webglRendererInfo:"unknown"},logger:"noop",logLevel:"info",shouldUseWorker:!0,apiHostname:"camera-kit-api.snapar.com",userAgentFlavor:"release",fonts:[]},_="configuration";var extendStatics=function(l,m){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,m){l.__proto__=m}||function(l,m){for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(l[f]=m[f])},extendStatics(l,m)};function __extends(l,m){if("function"!=typeof m&&null!==m)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function __(){this.constructor=l}extendStatics(l,m),l.prototype=null===m?Object.create(m):(__.prototype=m.prototype,new __)}function __rest(l,m){var f={};for(var g in l)Object.prototype.hasOwnProperty.call(l,g)&&m.indexOf(g)<0&&(f[g]=l[g]);if(null!=l&&"function"==typeof Object.getOwnPropertySymbols){var E=0;for(g=Object.getOwnPropertySymbols(l);E<g.length;E++)m.indexOf(g[E])<0&&Object.prototype.propertyIsEnumerable.call(l,g[E])&&(f[g[E]]=l[g[E]])}return f}function __esDecorate(l,m,f,g,E,v){function accept(l){if(void 0!==l&&"function"!=typeof l)throw new TypeError("Function expected");return l}for(var _,h=g.kind,S="getter"===h?"get":"setter"===h?"set":"value",b=!m&&l?g.static?l:l.prototype:null,I=m||(b?Object.getOwnPropertyDescriptor(b,g.name):{}),T=!1,y=f.length-1;y>=0;y--){var A={};for(var C in g)A[C]="access"===C?{}:g[C];for(var C in g.access)A.access[C]=g.access[C];A.addInitializer=function(l){if(T)throw new TypeError("Cannot add initializers after decoration has completed");v.push(accept(l||null))};var P=(0,f[y])("accessor"===h?{get:I.get,set:I.set}:I[S],A);if("accessor"===h){if(void 0===P)continue;if(null===P||"object"!=typeof P)throw new TypeError("Object expected");(_=accept(P.get))&&(I.get=_),(_=accept(P.set))&&(I.set=_),(_=accept(P.init))&&E.unshift(_)}else(_=accept(P))&&("field"===h?E.unshift(_):I[S]=_)}b&&Object.defineProperty(b,g.name,I),T=!0}function __runInitializers(l,m,f){for(var g=arguments.length>2,E=0;E<m.length;E++)f=g?m[E].call(l,f):m[E].call(l);return g?f:void 0}function __awaiter(l,m,f,g){return new(f||(f=Promise))((function(E,v){function fulfilled(l){try{step(g.next(l))}catch(l){v(l)}}function rejected(l){try{step(g.throw(l))}catch(l){v(l)}}function step(l){l.done?E(l.value):function adopt(l){return l instanceof f?l:new f((function(m){m(l)}))}(l.value).then(fulfilled,rejected)}step((g=g.apply(l,m||[])).next())}))}function __generator(l,m){var f,g,E,v={label:0,sent:function(){if(1&E[0])throw E[1];return E[1]},trys:[],ops:[]},_=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return _.next=verb(0),_.throw=verb(1),_.return=verb(2),"function"==typeof Symbol&&(_[Symbol.iterator]=function(){return this}),_;function verb(h){return function(S){return function step(h){if(f)throw new TypeError("Generator is already executing.");for(;_&&(_=0,h[0]&&(v=0)),v;)try{if(f=1,g&&(E=2&h[0]?g.return:h[0]?g.throw||((E=g.return)&&E.call(g),0):g.next)&&!(E=E.call(g,h[1])).done)return E;switch(g=0,E&&(h=[2&h[0],E.value]),h[0]){case 0:case 1:E=h;break;case 4:return v.label++,{value:h[1],done:!1};case 5:v.label++,g=h[1],h=[0];continue;case 7:h=v.ops.pop(),v.trys.pop();continue;default:if(!(E=v.trys,(E=E.length>0&&E[E.length-1])||6!==h[0]&&2!==h[0])){v=0;continue}if(3===h[0]&&(!E||h[1]>E[0]&&h[1]<E[3])){v.label=h[1];break}if(6===h[0]&&v.label<E[1]){v.label=E[1],E=h;break}if(E&&v.label<E[2]){v.label=E[2],v.ops.push(h);break}E[2]&&v.ops.pop(),v.trys.pop();continue}h=m.call(l,v)}catch(l){h=[6,l],g=0}finally{f=E=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([h,S])}}}Object.create;function __values(l){var m="function"==typeof Symbol&&Symbol.iterator,f=m&&l[m],g=0;if(f)return f.call(l);if(l&&"number"==typeof l.length)return{next:function(){return l&&g>=l.length&&(l=void 0),{value:l&&l[g++],done:!l}}};throw new TypeError(m?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(l,m){var f="function"==typeof Symbol&&l[Symbol.iterator];if(!f)return l;var g,E,v=f.call(l),_=[];try{for(;(void 0===m||m-- >0)&&!(g=v.next()).done;)_.push(g.value)}catch(l){E={error:l}}finally{try{g&&!g.done&&(f=v.return)&&f.call(v)}finally{if(E)throw E.error}}return _}function __spreadArray(l,m,f){if(f||2===arguments.length)for(var g,E=0,v=m.length;E<v;E++)!g&&E in m||(g||(g=Array.prototype.slice.call(m,0,E)),g[E]=m[E]);return l.concat(g||Array.prototype.slice.call(m))}function __await(l){return this instanceof __await?(this.v=l,this):new __await(l)}function __asyncGenerator(l,m,f){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g,E=f.apply(l,m||[]),v=[];return g=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),verb("next"),verb("throw"),verb("return",(function awaitReturn(l){return function(m){return Promise.resolve(m).then(l,reject)}})),g[Symbol.asyncIterator]=function(){return this},g;function verb(l,m){E[l]&&(g[l]=function(m){return new Promise((function(f,g){v.push([l,m,f,g])>1||resume(l,m)}))},m&&(g[l]=m(g[l])))}function resume(l,m){try{!function step(l){l.value instanceof __await?Promise.resolve(l.value.v).then(fulfill,reject):settle(v[0][2],l)}(E[l](m))}catch(l){settle(v[0][3],l)}}function fulfill(l){resume("next",l)}function reject(l){resume("throw",l)}function settle(l,m){l(m),v.shift(),v.length&&resume(v[0][0],v[0][1])}}function __asyncValues(l){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m,f=l[Symbol.asyncIterator];return f?f.call(l):(l=__values(l),m={},verb("next"),verb("throw"),verb("return"),m[Symbol.asyncIterator]=function(){return this},m);function verb(f){m[f]=l[f]&&function(m){return new Promise((function(g,E){(function settle(l,m,f,g){Promise.resolve(g).then((function(m){l({value:m,done:f})}),m)})(g,E,(m=l[f](m)).done,m.value)}))}}}Object.create;"function"==typeof SuppressedError&&SuppressedError;function namedError(l){return(m,f)=>{const g=new Error(m,{cause:f});return g.name=l,g.stack=g.stack&&function cleanErrorStack(l){const[m,f,...g]=l.split("\n");return[m,...g].join("\n")}(g.stack),g}}const h=namedError("LegalError"),S=namedError("LensContentValidationError"),b=namedError("LensError"),I=namedError("CameraKitSourceError"),T=namedError("LensImagePickerError"),y=namedError("CacheKeyNotFoundError"),A=namedError("ConfigurationError"),C=(namedError("WebGLError"),namedError("BenchmarkError"),namedError("PlatformNotSupportedError")),P=namedError("LensExecutionError"),R=namedError("LensAbortError"),O=namedError("PersistentStoreError"),N=namedError("LensAssetError"),k=namedError("BootstrapError"),w=namedError("ArgumentValidationError");new Map([[34,1],[134,2],[385,3],[783,4],[1484,5],[2313,6]]);const createArrayBufferParsingHandler=()=>l=>(m,f)=>__awaiter(void 0,void 0,void 0,(function*(){const g=yield l(m,f);let E;try{E=yield g.arrayBuffer()}catch(l){E=new ArrayBuffer(0)}return[E,g]}));class HandlerChainBuilder{constructor(l){this.inner=l}get handler(){return this.inner}map(l){return new HandlerChainBuilder(((m,f)=>{var g;const E=new AbortController,v=E.signal;let _=!1;const maybeAbort=()=>{var l;v.aborted||_||(E.abort(),null===(l=null==f?void 0:f.signal)||void 0===l||l.removeEventListener("abort",maybeAbort))};null===(g=null==f?void 0:f.signal)||void 0===g||g.addEventListener("abort",maybeAbort);const h=new Proxy(this.inner,{apply:(l,m,f)=>{const[g,E]=f;(null==E?void 0:E.isSideEffect)&&(_=!0);const h=[];v.addEventListener=new Proxy(v.addEventListener,{apply:(l,m,f)=>(h.push(f[1]),Reflect.apply(l,m,f))});const S=Reflect.apply(l,m,[g,Object.assign(Object.assign({},E),{isSideEffect:!1,signal:v})]);return S.catch((()=>{})).then((()=>{var l;null===(l=null==E?void 0:E.signal)||void 0===l||l.removeEventListener("abort",maybeAbort),h.forEach((l=>v.removeEventListener("abort",l))),_=!0})),S}}),S=l(h)(m,f);return S.catch((()=>{})).then(maybeAbort),S}))}}function isFunction(l){return"function"==typeof l}function createErrorClass(l){var m=l((function(l){Error.call(l),l.stack=(new Error).stack}));return m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,m}var L=createErrorClass((function(l){return function UnsubscriptionErrorImpl(m){l(this),this.message=m?m.length+" errors occurred during unsubscription:\n"+m.map((function(l,m){return m+1+") "+l.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=m}}));function arrRemove(l,m){if(l){var f=l.indexOf(m);0<=f&&l.splice(f,1)}}var D=function(){function Subscription(l){this.initialTeardown=l,this.closed=!1,this._parentage=null,this._finalizers=null}return Subscription.prototype.unsubscribe=function(){var l,m,f,g,E;if(!this.closed){this.closed=!0;var v=this._parentage;if(v)if(this._parentage=null,Array.isArray(v))try{for(var _=__values(v),h=_.next();!h.done;h=_.next()){h.value.remove(this)}}catch(m){l={error:m}}finally{try{h&&!h.done&&(m=_.return)&&m.call(_)}finally{if(l)throw l.error}}else v.remove(this);var S=this.initialTeardown;if(isFunction(S))try{S()}catch(l){E=l instanceof L?l.errors:[l]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var I=__values(b),T=I.next();!T.done;T=I.next()){var y=T.value;try{execFinalizer(y)}catch(l){E=null!=E?E:[],l instanceof L?E=__spreadArray(__spreadArray([],__read(E)),__read(l.errors)):E.push(l)}}}catch(l){f={error:l}}finally{try{T&&!T.done&&(g=I.return)&&g.call(I)}finally{if(f)throw f.error}}}if(E)throw new L(E)}},Subscription.prototype.add=function(l){var m;if(l&&l!==this)if(this.closed)execFinalizer(l);else{if(l instanceof Subscription){if(l.closed||l._hasParent(this))return;l._addParent(this)}(this._finalizers=null!==(m=this._finalizers)&&void 0!==m?m:[]).push(l)}},Subscription.prototype._hasParent=function(l){var m=this._parentage;return m===l||Array.isArray(m)&&m.includes(l)},Subscription.prototype._addParent=function(l){var m=this._parentage;this._parentage=Array.isArray(m)?(m.push(l),m):m?[m,l]:l},Subscription.prototype._removeParent=function(l){var m=this._parentage;m===l?this._parentage=null:Array.isArray(m)&&arrRemove(m,l)},Subscription.prototype.remove=function(l){var m=this._finalizers;m&&arrRemove(m,l),l instanceof Subscription&&l._removeParent(this)},Subscription.EMPTY=function(){var l=new Subscription;return l.closed=!0,l}(),Subscription}(),M=D.EMPTY;function isSubscription(l){return l instanceof D||l&&"closed"in l&&isFunction(l.remove)&&isFunction(l.add)&&isFunction(l.unsubscribe)}function execFinalizer(l){isFunction(l)?l():l.unsubscribe()}var U={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},B={setTimeout:function(l,m){for(var f=[],g=2;g<arguments.length;g++)f[g-2]=arguments[g];var E=B.delegate;return(null==E?void 0:E.setTimeout)?E.setTimeout.apply(E,__spreadArray([l,m],__read(f))):setTimeout.apply(void 0,__spreadArray([l,m],__read(f)))},clearTimeout:function(l){var m=B.delegate;return((null==m?void 0:m.clearTimeout)||clearTimeout)(l)},delegate:void 0};function reportUnhandledError(l){B.setTimeout((function(){var m=U.onUnhandledError;if(!m)throw l;m(l)}))}function noop(){}var V=createNotification("C",void 0,void 0);function createNotification(l,m,f){return{kind:l,value:m,error:f}}var G=null;function errorContext(l){if(U.useDeprecatedSynchronousErrorHandling){var m=!G;if(m&&(G={errorThrown:!1,error:null}),l(),m){var f=G,g=f.errorThrown,E=f.error;if(G=null,g)throw E}}else l()}var F=function(l){function Subscriber(m){var f=l.call(this)||this;return f.isStopped=!1,m?(f.destination=m,isSubscription(m)&&m.add(f)):f.destination=W,f}return __extends(Subscriber,l),Subscriber.create=function(l,m,f){return new H(l,m,f)},Subscriber.prototype.next=function(l){this.isStopped?handleStoppedNotification(function nextNotification(l){return createNotification("N",l,void 0)}(l),this):this._next(l)},Subscriber.prototype.error=function(l){this.isStopped?handleStoppedNotification(function errorNotification(l){return createNotification("E",void 0,l)}(l),this):(this.isStopped=!0,this._error(l))},Subscriber.prototype.complete=function(){this.isStopped?handleStoppedNotification(V,this):(this.isStopped=!0,this._complete())},Subscriber.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,l.prototype.unsubscribe.call(this),this.destination=null)},Subscriber.prototype._next=function(l){this.destination.next(l)},Subscriber.prototype._error=function(l){try{this.destination.error(l)}finally{this.unsubscribe()}},Subscriber.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Subscriber}(D),j=Function.prototype.bind;function bind(l,m){return j.call(l,m)}var x=function(){function ConsumerObserver(l){this.partialObserver=l}return ConsumerObserver.prototype.next=function(l){var m=this.partialObserver;if(m.next)try{m.next(l)}catch(l){handleUnhandledError(l)}},ConsumerObserver.prototype.error=function(l){var m=this.partialObserver;if(m.error)try{m.error(l)}catch(l){handleUnhandledError(l)}else handleUnhandledError(l)},ConsumerObserver.prototype.complete=function(){var l=this.partialObserver;if(l.complete)try{l.complete()}catch(l){handleUnhandledError(l)}},ConsumerObserver}(),H=function(l){function SafeSubscriber(m,f,g){var E,v,_=l.call(this)||this;isFunction(m)||!m?E={next:null!=m?m:void 0,error:null!=f?f:void 0,complete:null!=g?g:void 0}:_&&U.useDeprecatedNextContext?((v=Object.create(m)).unsubscribe=function(){return _.unsubscribe()},E={next:m.next&&bind(m.next,v),error:m.error&&bind(m.error,v),complete:m.complete&&bind(m.complete,v)}):E=m;return _.destination=new x(E),_}return __extends(SafeSubscriber,l),SafeSubscriber}(F);function handleUnhandledError(l){U.useDeprecatedSynchronousErrorHandling?function captureError(l){U.useDeprecatedSynchronousErrorHandling&&G&&(G.errorThrown=!0,G.error=l)}(l):reportUnhandledError(l)}function handleStoppedNotification(l,m){var f=U.onStoppedNotification;f&&B.setTimeout((function(){return f(l,m)}))}var W={closed:!0,next:noop,error:function defaultErrorHandler(l){throw l},complete:noop},K="function"==typeof Symbol&&Symbol.observable||"@@observable";function identity(l){return l}function pipeFromArray(l){return 0===l.length?identity:1===l.length?l[0]:function piped(m){return l.reduce((function(l,m){return m(l)}),m)}}var Y=function(){function Observable(l){l&&(this._subscribe=l)}return Observable.prototype.lift=function(l){var m=new Observable;return m.source=this,m.operator=l,m},Observable.prototype.subscribe=function(l,m,f){var g=this,E=function isSubscriber(l){return l&&l instanceof F||function isObserver(l){return l&&isFunction(l.next)&&isFunction(l.error)&&isFunction(l.complete)}(l)&&isSubscription(l)}(l)?l:new H(l,m,f);return errorContext((function(){var l=g,m=l.operator,f=l.source;E.add(m?m.call(E,f):f?g._subscribe(E):g._trySubscribe(E))})),E},Observable.prototype._trySubscribe=function(l){try{return this._subscribe(l)}catch(m){l.error(m)}},Observable.prototype.forEach=function(l,m){var f=this;return new(m=getPromiseCtor(m))((function(m,g){var E=new H({next:function(m){try{l(m)}catch(l){g(l),E.unsubscribe()}},error:g,complete:m});f.subscribe(E)}))},Observable.prototype._subscribe=function(l){var m;return null===(m=this.source)||void 0===m?void 0:m.subscribe(l)},Observable.prototype[K]=function(){return this},Observable.prototype.pipe=function(){for(var l=[],m=0;m<arguments.length;m++)l[m]=arguments[m];return pipeFromArray(l)(this)},Observable.prototype.toPromise=function(l){var m=this;return new(l=getPromiseCtor(l))((function(l,f){var g;m.subscribe((function(l){return g=l}),(function(l){return f(l)}),(function(){return l(g)}))}))},Observable.create=function(l){return new Observable(l)},Observable}();function getPromiseCtor(l){var m;return null!==(m=null!=l?l:U.Promise)&&void 0!==m?m:Promise}var z=createErrorClass((function(l){return function ObjectUnsubscribedErrorImpl(){l(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),q=function(l){function Subject(){var m=l.call(this)||this;return m.closed=!1,m.currentObservers=null,m.observers=[],m.isStopped=!1,m.hasError=!1,m.thrownError=null,m}return __extends(Subject,l),Subject.prototype.lift=function(l){var m=new $(this,this);return m.operator=l,m},Subject.prototype._throwIfClosed=function(){if(this.closed)throw new z},Subject.prototype.next=function(l){var m=this;errorContext((function(){var f,g;if(m._throwIfClosed(),!m.isStopped){m.currentObservers||(m.currentObservers=Array.from(m.observers));try{for(var E=__values(m.currentObservers),v=E.next();!v.done;v=E.next()){v.value.next(l)}}catch(l){f={error:l}}finally{try{v&&!v.done&&(g=E.return)&&g.call(E)}finally{if(f)throw f.error}}}}))},Subject.prototype.error=function(l){var m=this;errorContext((function(){if(m._throwIfClosed(),!m.isStopped){m.hasError=m.isStopped=!0,m.thrownError=l;for(var f=m.observers;f.length;)f.shift().error(l)}}))},Subject.prototype.complete=function(){var l=this;errorContext((function(){if(l._throwIfClosed(),!l.isStopped){l.isStopped=!0;for(var m=l.observers;m.length;)m.shift().complete()}}))},Subject.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(Subject.prototype,"observed",{get:function(){var l;return(null===(l=this.observers)||void 0===l?void 0:l.length)>0},enumerable:!1,configurable:!0}),Subject.prototype._trySubscribe=function(m){return this._throwIfClosed(),l.prototype._trySubscribe.call(this,m)},Subject.prototype._subscribe=function(l){return this._throwIfClosed(),this._checkFinalizedStatuses(l),this._innerSubscribe(l)},Subject.prototype._innerSubscribe=function(l){var m=this,f=this,g=f.hasError,E=f.isStopped,v=f.observers;return g||E?M:(this.currentObservers=null,v.push(l),new D((function(){m.currentObservers=null,arrRemove(v,l)})))},Subject.prototype._checkFinalizedStatuses=function(l){var m=this,f=m.hasError,g=m.thrownError,E=m.isStopped;f?l.error(g):E&&l.complete()},Subject.prototype.asObservable=function(){var l=new Y;return l.source=this,l},Subject.create=function(l,m){return new $(l,m)},Subject}(Y),$=function(l){function AnonymousSubject(m,f){var g=l.call(this)||this;return g.destination=m,g.source=f,g}return __extends(AnonymousSubject,l),AnonymousSubject.prototype.next=function(l){var m,f;null===(f=null===(m=this.destination)||void 0===m?void 0:m.next)||void 0===f||f.call(m,l)},AnonymousSubject.prototype.error=function(l){var m,f;null===(f=null===(m=this.destination)||void 0===m?void 0:m.error)||void 0===f||f.call(m,l)},AnonymousSubject.prototype.complete=function(){var l,m;null===(m=null===(l=this.destination)||void 0===l?void 0:l.complete)||void 0===m||m.call(l)},AnonymousSubject.prototype._subscribe=function(l){var m,f;return null!==(f=null===(m=this.source)||void 0===m?void 0:m.subscribe(l))&&void 0!==f?f:M},AnonymousSubject}(q);const entries_entries=l=>Object.entries(l);let Z=new q;const J={error:3,warn:2,log:1,info:1,debug:0};function resetLogger(){return Z=new q}function getLogger(l){return entries_entries(J).reduce(((m,[f])=>(m[f]=(...m)=>{Z.next({time:new Date,module:l,level:f,messages:m})},m)),{})}const X=getLogger("retryingHandler"),logRetry=(l,m)=>{X.warn("Retrying handler got failed response:",l,`Waited ${m} millis, attempting retry now.`)},Q={backoffMultiple:3,baseSleep:500,maxSleep:5e3,maxRetries:10,retryPredicate:l=>!(l instanceof Response)||!l.ok};function ensureClonedRequest(l){return l instanceof Request?l.clone():l}const createRetryingHandler=(l={})=>{const m=copyDefinedProperties(l),{backoffMultiple:f,baseSleep:g,maxSleep:E,maxRetries:v,retryPredicate:_}=Object.assign(Object.assign({},Q),m);let h=-1;const jitterSleep=l=>__awaiter(void 0,void 0,void 0,(function*(){const m=Math.min(E,(v=g,_=l*f,Math.round(Math.random()*(_-v)+v)));var v,_,h;return yield(h=m,new Promise((l=>setTimeout(l,h)))),m})),makeRequestAttempt=(l,m=g)=>(f,g)=>__awaiter(void 0,void 0,void 0,(function*(){var E,S;h++;try{const S=yield l(ensureClonedRequest(f),g);if(h<v&&_(S,h)){const v=yield jitterSleep(m);return(null===(E=null==g?void 0:g.signal)||void 0===E?void 0:E.aborted)?S:(logRetry(S,v),makeRequestAttempt(l,v)(f,g))}return S}catch(E){if(!(E instanceof Error))throw new Error(`Invalid type caught by retrying handler. Handlers may only throw Errors. Got ${JSON.stringify(E)}`);if("AbortError"===E.name)throw E;if(h<v&&_(E,h)){const v=yield jitterSleep(m);if(null===(S=null==g?void 0:g.signal)||void 0===S?void 0:S.aborted)throw E;return logRetry(E,v),makeRequestAttempt(l,v)(f,g)}throw E}}));return l=>makeRequestAttempt(l)},ee=getLogger("noCorsRetryingFetchHandler"),createNoCorsRetryingFetchHandler=()=>{const l=new Map;return m=>(f,g={})=>__awaiter(void 0,void 0,void 0,(function*(){var E;let v="string"==typeof f?f:f.url;try{v=new URL(v,location.origin).host}catch(l){}try{return yield m(ensureClonedRequest(f),g)}catch(_){if(_ instanceof Error&&"AbortError"===_.name)throw _;(l=>{ee.warn("NoCorsRetrying handler got failed response:",l,'Retrying request with {mode: "no-cors"}.')})(_);const h=null!==(E=l.get(v))&&void 0!==E?E:m(ensureClonedRequest(f),Object.assign(Object.assign({},g),{mode:"no-cors"}));return l.set(v,h),yield h,l.delete(v),m(ensureClonedRequest(f),g)}}))};function isString(l){return"string"==typeof l}function isSafeString(l){return isString(l)&&encodeURIComponent(l)===l}function isNumber(l){return"number"==typeof l}function isValidNumber(l){return isNumber(l)&&!Number.isNaN(l)&&Number.isFinite(l)}function isValidNumberOrUndefined(l){return isUndefined(l)||isValidNumber(l)}function isArrayOfType(l,m){return Array.isArray(m)&&m.every((m=>l(m)))}function isSafeStringArray(l){return isArrayOfType(isSafeString,l)}function isStringOrUndefined(l){return isUndefined(l)||isString(l)}function isTypedArray(l){return l instanceof Object.getPrototypeOf(Uint8Array)}function isUndefined(l){return void 0===l}function isEmptyString(l){return""===l}function isRecord(l){return"object"==typeof l&&null!==l&&!Array.isArray(l)}function typeguards_isFunction(l){return"function"==typeof l}function isDate(l){return l instanceof Date}function isDateOrUndefined(l){return isUndefined(l)||isDate(l)}function predicateRecordValues(l){return m=>{for(const f of Object.values(m))if(!l(f))return!1;return!0}}function isEmptyOrSafeUrl(l){if(!l)return!0;try{const m=new URL(l);return"https:"===m.protocol||"http:"===m.protocol}catch(l){return!1}}const te={createError:l=>{const m=isString(l)?`for ${l}`:l instanceof Request?`for ${l.url}`:"";return new Error(`Request ${m} timed out by client timeout handler.`)},timeout:3e4},createTimeoutHandler=(l={})=>{const m=copyDefinedProperties(l),{createError:f,timeout:g}=Object.assign(Object.assign({},te),m);return l=>(m,E)=>{return Promise.race([l(m,E),(v=g,new Promise((l=>setTimeout(l,v)))).then((()=>Promise.reject(f(m,E))))]);var v}},ne=Injectable("defaultFetchHandler",(()=>new HandlerChainBuilder(fetch).map(createTimeoutHandler({timeout:2e4})).map(createNoCorsRetryingFetchHandler()).map(createRetryingHandler({maxRetries:3,retryPredicate:l=>{if(l instanceof Response){if(l.ok)return!1;if(l.status%400<100)return!1}return!0}})).handler));function withRequestPriority(l,m){return m?Object.assign(Object.assign({},l),{priority:"low"}):l}const re=Injectable("remoteMediaAssetLoader",[ne.token],(l=>{const m=new HandlerChainBuilder(l).map(createArrayBufferParsingHandler()).handler;return function remoteMediaAssetLoader({assetDescriptor:{assetId:l},lowPriority:f}){return __awaiter(this,void 0,void 0,(function*(){const[g,E]=yield m(l,withRequestPriority({cache:"force-cache"},f));if(!E.ok)throw E;return g}))}}));var ie=createErrorClass((function(l){return function EmptyErrorImpl(){l(this),this.name="EmptyError",this.message="no elements in sequence"}}));function firstValueFrom(l,m){var f="object"==typeof m;return new Promise((function(g,E){var v=new H({next:function(l){g(l),v.unsubscribe()},error:E,complete:function(){f?g(m.defaultValue):E(new ie)}});l.subscribe(v)}))}var isArrayLike=function(l){return l&&"number"==typeof l.length&&"function"!=typeof l};function isPromise_isPromise(l){return isFunction(null==l?void 0:l.then)}function isInteropObservable(l){return isFunction(l[K])}function isAsyncIterable(l){return Symbol.asyncIterator&&isFunction(null==l?void 0:l[Symbol.asyncIterator])}function createInvalidObservableTypeError(l){return new TypeError("You provided "+(null!==l&&"object"==typeof l?"an invalid object":"'"+l+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var ae=function getSymbolIterator(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}();function isIterable(l){return isFunction(null==l?void 0:l[ae])}function readableStreamLikeToAsyncGenerator(l){return __asyncGenerator(this,arguments,(function readableStreamLikeToAsyncGenerator_1(){var m,f,g;return __generator(this,(function(E){switch(E.label){case 0:m=l.getReader(),E.label=1;case 1:E.trys.push([1,,9,10]),E.label=2;case 2:return[4,__await(m.read())];case 3:return f=E.sent(),g=f.value,f.done?[4,__await(void 0)]:[3,5];case 4:return[2,E.sent()];case 5:return[4,__await(g)];case 6:return[4,E.sent()];case 7:return E.sent(),[3,2];case 8:return[3,10];case 9:return m.releaseLock(),[7];case 10:return[2]}}))}))}function isReadableStreamLike(l){return isFunction(null==l?void 0:l.getReader)}function innerFrom(l){if(l instanceof Y)return l;if(null!=l){if(isInteropObservable(l))return function fromInteropObservable(l){return new Y((function(m){var f=l[K]();if(isFunction(f.subscribe))return f.subscribe(m);throw new TypeError("Provided object does not correctly implement Symbol.observable")}))}(l);if(isArrayLike(l))return function fromArrayLike(l){return new Y((function(m){for(var f=0;f<l.length&&!m.closed;f++)m.next(l[f]);m.complete()}))}(l);if(isPromise_isPromise(l))return function fromPromise(l){return new Y((function(m){l.then((function(l){m.closed||(m.next(l),m.complete())}),(function(l){return m.error(l)})).then(null,reportUnhandledError)}))}(l);if(isAsyncIterable(l))return fromAsyncIterable(l);if(isIterable(l))return function fromIterable(l){return new Y((function(m){var f,g;try{for(var E=__values(l),v=E.next();!v.done;v=E.next()){var _=v.value;if(m.next(_),m.closed)return}}catch(l){f={error:l}}finally{try{v&&!v.done&&(g=E.return)&&g.call(E)}finally{if(f)throw f.error}}m.complete()}))}(l);if(isReadableStreamLike(l))return function fromReadableStreamLike(l){return fromAsyncIterable(readableStreamLikeToAsyncGenerator(l))}(l)}throw createInvalidObservableTypeError(l)}function fromAsyncIterable(l){return new Y((function(m){(function innerFrom_process(l,m){var f,g,E,v;return __awaiter(this,void 0,void 0,(function(){var _,h;return __generator(this,(function(S){switch(S.label){case 0:S.trys.push([0,5,6,11]),f=__asyncValues(l),S.label=1;case 1:return[4,f.next()];case 2:if((g=S.sent()).done)return[3,4];if(_=g.value,m.next(_),m.closed)return[2];S.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return h=S.sent(),E={error:h},[3,11];case 6:return S.trys.push([6,,9,10]),g&&!g.done&&(v=f.return)?[4,v.call(f)]:[3,8];case 7:S.sent(),S.label=8;case 8:return[3,10];case 9:if(E)throw E.error;return[7];case 10:return[7];case 11:return m.complete(),[2]}}))}))})(l,m).catch((function(l){return m.error(l)}))}))}function createOperatorSubscriber(l,m,f,g,E){return new oe(l,m,f,g,E)}var oe=function(l){function OperatorSubscriber(m,f,g,E,v,_){var h=l.call(this,m)||this;return h.onFinalize=v,h.shouldUnsubscribe=_,h._next=f?function(l){try{f(l)}catch(l){m.error(l)}}:l.prototype._next,h._error=E?function(l){try{E(l)}catch(l){m.error(l)}finally{this.unsubscribe()}}:l.prototype._error,h._complete=g?function(){try{g()}catch(l){m.error(l)}finally{this.unsubscribe()}}:l.prototype._complete,h}return __extends(OperatorSubscriber,l),OperatorSubscriber.prototype.unsubscribe=function(){var m;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var f=this.closed;l.prototype.unsubscribe.call(this),!f&&(null===(m=this.onFinalize)||void 0===m||m.call(this))}},OperatorSubscriber}(F);function operate(l){return function(m){if(function hasLift(l){return isFunction(null==l?void 0:l.lift)}(m))return m.lift((function(m){try{return l(m,this)}catch(l){this.error(l)}}));throw new TypeError("Unable to lift unknown Observable type")}}function catchError(l){return operate((function(m,f){var g,E=null,v=!1;E=m.subscribe(createOperatorSubscriber(f,void 0,void 0,(function(_){g=innerFrom(l(_,catchError(l)(m))),E?(E.unsubscribe(),E=null,g.subscribe(f)):v=!0}))),v&&(E.unsubscribe(),E=null,g.subscribe(f))}))}function map(l,m){return operate((function(f,g){var E=0;f.subscribe(createOperatorSubscriber(g,(function(f){g.next(l.call(m,f,E++))})))}))}function executeSchedule(l,m,f,g,E){void 0===g&&(g=0),void 0===E&&(E=!1);var v=m.schedule((function(){f(),E?l.add(this.schedule(null,g)):this.unsubscribe()}),g);if(l.add(v),!E)return v}function mergeMap(l,m,f){return void 0===f&&(f=1/0),isFunction(m)?mergeMap((function(f,g){return map((function(l,E){return m(f,l,g,E)}))(innerFrom(l(f,g)))}),f):("number"==typeof m&&(f=m),operate((function(m,g){return function mergeInternals(l,m,f,g,E,v,_,h){var S=[],b=0,I=0,T=!1,checkComplete=function(){!T||S.length||b||m.complete()},outerNext=function(l){return b<g?doInnerSub(l):S.push(l)},doInnerSub=function(l){v&&m.next(l),b++;var h=!1;innerFrom(f(l,I++)).subscribe(createOperatorSubscriber(m,(function(l){null==E||E(l),v?outerNext(l):m.next(l)}),(function(){h=!0}),void 0,(function(){if(h)try{b--;for(var _loop_1=function(){var l=S.shift();_?executeSchedule(m,_,(function(){return doInnerSub(l)})):doInnerSub(l)};S.length&&b<g;)_loop_1();checkComplete()}catch(l){m.error(l)}})))};return l.subscribe(createOperatorSubscriber(m,outerNext,(function(){T=!0,checkComplete()}))),function(){null==h||h()}}(m,g,l,f)})))}function observeOn(l,m){return void 0===m&&(m=0),operate((function(f,g){f.subscribe(createOperatorSubscriber(g,(function(f){return executeSchedule(g,l,(function(){return g.next(f)}),m)}),(function(){return executeSchedule(g,l,(function(){return g.complete()}),m)}),(function(f){return executeSchedule(g,l,(function(){return g.error(f)}),m)})))}))}function subscribeOn(l,m){return void 0===m&&(m=0),operate((function(f,g){g.add(l.schedule((function(){return f.subscribe(g)}),m))}))}function scheduleAsyncIterable(l,m){if(!l)throw new Error("Iterable cannot be null");return new Y((function(f){executeSchedule(f,m,(function(){var g=l[Symbol.asyncIterator]();executeSchedule(f,m,(function(){g.next().then((function(l){l.done?f.complete():f.next(l.value)}))}),0,!0)}))}))}function scheduled(l,m){if(null!=l){if(isInteropObservable(l))return function scheduleObservable(l,m){return innerFrom(l).pipe(subscribeOn(m),observeOn(m))}(l,m);if(isArrayLike(l))return function scheduleArray(l,m){return new Y((function(f){var g=0;return m.schedule((function(){g===l.length?f.complete():(f.next(l[g++]),f.closed||this.schedule())}))}))}(l,m);if(isPromise_isPromise(l))return function schedulePromise(l,m){return innerFrom(l).pipe(subscribeOn(m),observeOn(m))}(l,m);if(isAsyncIterable(l))return scheduleAsyncIterable(l,m);if(isIterable(l))return function scheduleIterable(l,m){return new Y((function(f){var g;return executeSchedule(f,m,(function(){g=l[ae](),executeSchedule(f,m,(function(){var l,m,E;try{m=(l=g.next()).value,E=l.done}catch(l){return void f.error(l)}E?f.complete():f.next(m)}),0,!0)})),function(){return isFunction(null==g?void 0:g.return)&&g.return()}}))}(l,m);if(isReadableStreamLike(l))return function scheduleReadableStreamLike(l,m){return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(l),m)}(l,m)}throw createInvalidObservableTypeError(l)}function from(l,m){return m?scheduled(l,m):innerFrom(l)}var se={now:function(){return(se.delegate||Date).now()},delegate:void 0},ce=function(l){function ReplaySubject(m,f,g){void 0===m&&(m=1/0),void 0===f&&(f=1/0),void 0===g&&(g=se);var E=l.call(this)||this;return E._bufferSize=m,E._windowTime=f,E._timestampProvider=g,E._buffer=[],E._infiniteTimeWindow=!0,E._infiniteTimeWindow=f===1/0,E._bufferSize=Math.max(1,m),E._windowTime=Math.max(1,f),E}return __extends(ReplaySubject,l),ReplaySubject.prototype.next=function(m){var f=this,g=f.isStopped,E=f._buffer,v=f._infiniteTimeWindow,_=f._timestampProvider,h=f._windowTime;g||(E.push(m),!v&&E.push(_.now()+h)),this._trimBuffer(),l.prototype.next.call(this,m)},ReplaySubject.prototype._subscribe=function(l){this._throwIfClosed(),this._trimBuffer();for(var m=this._innerSubscribe(l),f=this._infiniteTimeWindow,g=this._buffer.slice(),E=0;E<g.length&&!l.closed;E+=f?1:2)l.next(g[E]);return this._checkFinalizedStatuses(l),m},ReplaySubject.prototype._trimBuffer=function(){var l=this,m=l._bufferSize,f=l._timestampProvider,g=l._buffer,E=l._infiniteTimeWindow,v=(E?1:2)*m;if(m<1/0&&v<g.length&&g.splice(0,g.length-v),!E){for(var _=f.now(),h=0,S=1;S<g.length&&g[S]<=_;S+=2)h=S;h&&g.splice(0,h+1)}},ReplaySubject}(q);function handleReset(l,m){for(var f=[],g=2;g<arguments.length;g++)f[g-2]=arguments[g];if(!0!==m){if(!1!==m){var E=new H({next:function(){E.unsubscribe(),l()}});return innerFrom(m.apply(void 0,__spreadArray([],__read(f)))).subscribe(E)}}else l()}function shareReplay(l,m,f){var g,E,v,_,h=!1;return l&&"object"==typeof l?(g=l.bufferSize,_=void 0===g?1/0:g,E=l.windowTime,m=void 0===E?1/0:E,h=void 0!==(v=l.refCount)&&v,f=l.scheduler):_=null!=l?l:1/0,function share(l){void 0===l&&(l={});var m=l.connector,f=void 0===m?function(){return new q}:m,g=l.resetOnError,E=void 0===g||g,v=l.resetOnComplete,_=void 0===v||v,h=l.resetOnRefCountZero,S=void 0===h||h;return function(l){var m,g,v,h=0,b=!1,I=!1,cancelReset=function(){null==g||g.unsubscribe(),g=void 0},reset=function(){cancelReset(),m=v=void 0,b=I=!1},resetAndUnsubscribe=function(){var l=m;reset(),null==l||l.unsubscribe()};return operate((function(l,T){h++,I||b||cancelReset();var y=v=null!=v?v:f();T.add((function(){0!=--h||I||b||(g=handleReset(resetAndUnsubscribe,S))})),y.subscribe(T),!m&&h>0&&(m=new H({next:function(l){return y.next(l)},error:function(l){I=!0,cancelReset(),g=handleReset(reset,E,l),y.error(l)},complete:function(){b=!0,cancelReset(),g=handleReset(reset,_),y.complete()}}),innerFrom(l).subscribe(m))}))(l)}}({connector:function(){return new ce(_,m,f)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:h})}var le=new Y((function(l){return l.complete()}));function take(l){return l<=0?function(){return le}:operate((function(m,f){var g=0;m.subscribe(createOperatorSubscriber(f,(function(m){++g<=l&&(f.next(m),l<=g&&f.complete())})))}))}var ue;function varint64read(){let l=0,m=0;for(let f=0;f<28;f+=7){let g=this.buf[this.pos++];if(l|=(127&g)<<f,!(128&g))return this.assertBounds(),[l,m]}let f=this.buf[this.pos++];if(l|=(15&f)<<28,m=(112&f)>>4,!(128&f))return this.assertBounds(),[l,m];for(let f=3;f<=31;f+=7){let g=this.buf[this.pos++];if(m|=(127&g)<<f,!(128&g))return this.assertBounds(),[l,m]}throw new Error("invalid varint")}function varint64write(l,m,f){for(let g=0;g<28;g+=7){const E=l>>>g,v=!(E>>>7==0&&0==m),_=255&(v?128|E:E);if(f.push(_),!v)return}const g=l>>>28&15|(7&m)<<4,E=!!(m>>3);if(f.push(255&(E?128|g:g)),E){for(let l=3;l<31;l+=7){const g=m>>>l,E=!(g>>>7==0),v=255&(E?128|g:g);if(f.push(v),!E)return}f.push(m>>>31&1)}}!function(l){l[l.DEFAULT=0]="DEFAULT",l[l.LENS_CORE=64]="LENS_CORE",l[l.CAMERA_KIT_CORE=65]="CAMERA_KIT_CORE",l[l.LENS_CORE_CONFIG=143]="LENS_CORE_CONFIG",l[l.UNRECOGNIZED=-1]="UNRECOGNIZED"}(ue||(ue={}));const de=4294967296;function int64FromString(l){const m="-"===l[0];m&&(l=l.slice(1));const f=1e6;let g=0,E=0;function add1e6digit(m,v){const _=Number(l.slice(m,v));E*=f,g=g*f+_,g>=de&&(E+=g/de|0,g%=de)}return add1e6digit(-24,-18),add1e6digit(-18,-12),add1e6digit(-12,-6),add1e6digit(-6),m?negate(g,E):newBits(g,E)}function uInt64ToString(l,m){if(({lo:l,hi:m}=function toUnsigned(l,m){return{lo:l>>>0,hi:m>>>0}}(l,m)),m<=2097151)return String(de*m+l);const f=16777215&(l>>>24|m<<8),g=m>>16&65535;let E=(16777215&l)+6777216*f+6710656*g,v=f+8147497*g,_=2*g;const h=1e7;return E>=h&&(v+=Math.floor(E/h),E%=h),v>=h&&(_+=Math.floor(v/h),v%=h),_.toString()+decimalFrom1e7WithLeadingZeros(v)+decimalFrom1e7WithLeadingZeros(E)}function newBits(l,m){return{lo:0|l,hi:0|m}}function negate(l,m){return m=~m,l?l=1+~l:m+=1,newBits(l,m)}const decimalFrom1e7WithLeadingZeros=l=>{const m=String(l);return"0000000".slice(m.length)+m};function varint32write(l,m){if(l>=0){for(;l>127;)m.push(127&l|128),l>>>=7;m.push(l)}else{for(let f=0;f<9;f++)m.push(127&l|128),l>>=7;m.push(1)}}function varint32read(){let l=this.buf[this.pos++],m=127&l;if(!(128&l))return this.assertBounds(),m;if(l=this.buf[this.pos++],m|=(127&l)<<7,!(128&l))return this.assertBounds(),m;if(l=this.buf[this.pos++],m|=(127&l)<<14,!(128&l))return this.assertBounds(),m;if(l=this.buf[this.pos++],m|=(127&l)<<21,!(128&l))return this.assertBounds(),m;l=this.buf[this.pos++],m|=(15&l)<<28;for(let m=5;128&l&&m<10;m++)l=this.buf[this.pos++];if(128&l)throw new Error("invalid varint");return this.assertBounds(),m>>>0}const pe=makeInt64Support();function makeInt64Support(){const l=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof l.getBigInt64&&"function"==typeof l.getBigUint64&&"function"==typeof l.setBigInt64&&"function"==typeof l.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const m=BigInt("-9223372036854775808"),f=BigInt("9223372036854775807"),g=BigInt("0"),E=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){const g="bigint"==typeof l?l:BigInt(l);if(g>f||g<m)throw new Error(`invalid int64: ${l}`);return g},uParse(l){const m="bigint"==typeof l?l:BigInt(l);if(m>E||m<g)throw new Error(`invalid uint64: ${l}`);return m},enc(m){return l.setBigInt64(0,this.parse(m),!0),{lo:l.getInt32(0,!0),hi:l.getInt32(4,!0)}},uEnc(m){return l.setBigInt64(0,this.uParse(m),!0),{lo:l.getInt32(0,!0),hi:l.getInt32(4,!0)}},dec:(m,f)=>(l.setInt32(0,m,!0),l.setInt32(4,f,!0),l.getBigInt64(0,!0)),uDec:(m,f)=>(l.setInt32(0,m,!0),l.setInt32(4,f,!0),l.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:l=>("string"!=typeof l&&(l=l.toString()),assertInt64String(l),l),uParse:l=>("string"!=typeof l&&(l=l.toString()),assertUInt64String(l),l),enc:l=>("string"!=typeof l&&(l=l.toString()),assertInt64String(l),int64FromString(l)),uEnc:l=>("string"!=typeof l&&(l=l.toString()),assertUInt64String(l),int64FromString(l)),dec:(l,m)=>function int64ToString(l,m){let f=newBits(l,m);const g=2147483648&f.hi;g&&(f=negate(f.lo,f.hi));const E=uInt64ToString(f.lo,f.hi);return g?"-"+E:E}(l,m),uDec:(l,m)=>uInt64ToString(l,m)}}function assertInt64String(l){if(!/^-?[0-9]+$/.test(l))throw new Error("invalid int64: "+l)}function assertUInt64String(l){if(!/^[0-9]+$/.test(l))throw new Error("invalid uint64: "+l)}const me=Symbol.for("@bufbuild/protobuf/text-encoding");function getTextEncoding(){if(null==globalThis[me]){const l=new globalThis.TextEncoder,m=new globalThis.TextDecoder;globalThis[me]={encodeUtf8:m=>l.encode(m),decodeUtf8:l=>m.decode(l),checkUtf8(l){try{return encodeURIComponent(l),!0}catch(l){return!1}}}}return globalThis[me]}var fe;!function(l){l[l.Varint=0]="Varint",l[l.Bit64=1]="Bit64",l[l.LengthDelimited=2]="LengthDelimited",l[l.StartGroup=3]="StartGroup",l[l.EndGroup=4]="EndGroup",l[l.Bit32=5]="Bit32"}(fe||(fe={}));const ge=34028234663852886e22,Ee=-34028234663852886e22;class BinaryWriter{constructor(l=getTextEncoding().encodeUtf8){this.encodeUtf8=l,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let l=0;for(let m=0;m<this.chunks.length;m++)l+=this.chunks[m].length;let m=new Uint8Array(l),f=0;for(let l=0;l<this.chunks.length;l++)m.set(this.chunks[l],f),f+=this.chunks[l].length;return this.chunks=[],m}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let l=this.finish(),m=this.stack.pop();if(!m)throw new Error("invalid state, fork stack empty");return this.chunks=m.chunks,this.buf=m.buf,this.uint32(l.byteLength),this.raw(l)}tag(l,m){return this.uint32((l<<3|m)>>>0)}raw(l){return this.buf.length&&(this.chunks.push(new Ui