// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Microsoft Software License Terms for the Azure Communications Services, Azure CPaaS, MICROSOFT AZURE COMMUNICATION CALLING EFFECTS
// See LICENSE file for license information.

import{createClientLogger as e}from"@azure/logger";import{LoggerImpl as t}from"./de977d.js";import{stringifyObject as n}from"./cd7b0b.js";import{VideoEffectInternalBase as r}from"./0b7c50.js";var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))};class BackgroundBlurEffectInternalImpl extends r{constructor(e,t,n){super(t,n)}get effectConfig(){return this.configProvider.config.videoEffects.effectConfig}getEffectProvider(){return __awaiter(this,void 0,void 0,(function*(){return this.webcvProvider}))}}let i=0;class BackgroundBlurEffect{constructor(n){this.name="BackgroundBlur",this._logger=new t(e("ACS-calling-video-effects"),[()=>"BackgroundBlurEffect"+i++]),this._backgroundBlurInternal=new BackgroundBlurEffectInternalImpl(null!=n?n:{},this.name,this._logger),this._updateEffectConfig(null!=n?n:{}),this._logger.info(`v${this._backgroundBlurInternal.getVersion()} BackgroundBlurEffect ctor success`)}get _internalHandle(){return this._backgroundBlurInternal}configure(e){return __awaiter(this,void 0,void 0,(function*(){this._updateEffectConfig(e)}))}isSupported(){return __awaiter(this,void 0,void 0,(function*(){return yield this._internalHandle.capabilityChecker.videoEffectsSupported()}))}_updateEffectConfig(e){var t,r;const i=this._internalHandle.configProvider,o=Object.assign({},i.config);o.videoEffects.effectConfig=Object.assign(Object.assign({},null===(r=null===(t=i.config)||void 0===t?void 0:t.videoEffects)||void 0===r?void 0:r.effectConfig),e),i.updateConfig(o),this._logger.info(`Effect config updated with new values: ${n(e)}`)}}export{BackgroundBlurEffect};
