var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { MapToComponentField, MapToComponentMethod, VegaSlimmer } from 'vega-slimmer/core';
import { GP_BRAND_CHANGE } from '../change-manager/subject/static-subject/static-subject-title';
import { Observer } from '../change-manager/observer/observer';
import ChangeManager from '../change-manager/change-manager';
/** The `BrandSwitchControllerSlimmer` class monitors brand changes and updates the color, logo and footer content accordingly. */
export class BrandSwitchControllerSlimmer extends VegaSlimmer {
  /**
   * Component lifecycle - [connectedCallback]
   * Register an observer to watch for current branding updates, which will cause the component to update.
   */
  connectedCallback() {
    this.observer = new Observer(this.isAcceptObserver.bind(this), (currentBranding) => {
      this.currentBranding = currentBranding;
    });
    ChangeManager.register(GP_BRAND_CHANGE, this.observer);
  }
  /**
   * cancel dark mode observer when disconnectedCallback
   */
  disconnectResizeObserver() {
    ChangeManager.unregister(GP_BRAND_CHANGE, this.observer);
  }
  /**
   * Determines whether the observer should accept changes.
   *
   * @returns {boolean} Always returns true in the current implementation.
   */
  isAcceptObserver() {
    return true;
  }
}
__decorate([
  MapToComponentField({ writable: true })
], BrandSwitchControllerSlimmer.prototype, "currentBranding", void 0);
__decorate([
  MapToComponentMethod('connectedCallback')
], BrandSwitchControllerSlimmer.prototype, "connectedCallback", null);
__decorate([
  MapToComponentMethod('disconnectedCallback')
], BrandSwitchControllerSlimmer.prototype, "disconnectResizeObserver", null);
