import { c as MapToComponentField, M as MapToComponentMethod, V as VegaSlimmer } from './global-slimmer-registry-0a7aa308.js';
import { G as GP_BRAND_CHANGE } from './static-subject-title-52f93124.js';
import { O as Observer } from './observer-3959f9dd.js';
import { C as ChangeManager } from './change-manager-ecbd3a2a.js';

var __decorate = (undefined && undefined.__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;
};
/** The `BrandSwitchControllerSlimmer` class monitors brand changes and updates the color, logo and footer content accordingly. */
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);

export { BrandSwitchControllerSlimmer as B };
