// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import type * as SDK from '../../core/sdk/sdk.js';
import type * as ComputedStyle from '../../models/computed_style/computed_style.js';
import type * as TextUtils from '../../models/text_utils/text_utils.js';
import type * as InlineEditor from '../../ui/legacy/components/inline_editor/inline_editor.js';
import type * as Components from '../../ui/legacy/components/utils/utils.js';

import type * as ElementsComponents from './components/components.js';
import type {StylePropertiesSection} from './StylePropertiesSection.js';
import type {StylePropertyTreeElement} from './StylePropertyTreeElement.js';
import type {WebCustomData} from './WebCustomData.js';

export interface StylesContainer {
  activeCSSAngle: InlineEditor.CSSAngle.CSSAngle|null;
  readonly webCustomData: WebCustomData|undefined;
  isEditingStyle: boolean;
  readonly sectionByElement: WeakMap<Node, StylePropertiesSection>;
  readonly element: HTMLElement;
  readonly linkifier: Components.Linkifier.Linkifier;

  swatchPopoverHelper(): InlineEditor.SwatchPopoverHelper.SwatchPopoverHelper;
  node(): SDK.DOMModel.DOMNode|null;
  cssModel(): SDK.CSSModel.CSSModel|null;
  computedStyleModel(): ComputedStyle.ComputedStyleModel.ComputedStyleModel;
  refreshUpdate(editedSection: StylePropertiesSection, editedTreeElement?: StylePropertyTreeElement): void;
  filterRegex(): RegExp|null;
  setEditingStyle(editing: boolean): void;
  setUserOperation(userOperation: boolean): void;
  forceUpdate(): void;
  hideAllPopovers(): void;

  getVariablePopoverContents(
      matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, variableName: string,
      computedValue: string|null): ElementsComponents.CSSVariableValueView.CSSVariableValueView;
  getVariableParserError(matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, variableName: string):
      ElementsComponents.CSSVariableValueView.CSSVariableParserError|null;
  jumpToFunctionDefinition(functionName: string): void;
  continueEditingElement(sectionIndex: number, propertyIndex: number): void;
  revealProperty(cssProperty: SDK.CSSProperty.CSSProperty): void;
  resetFocus(): void;
  removeSection(section: StylePropertiesSection): void;
  focusedSectionIndex(): number;
  allSections(): StylePropertiesSection[];

  addBlankSection(
      insertAfterSection: StylePropertiesSection, styleSheetHeader: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader,
      ruleLocation: TextUtils.TextRange.TextRange): void;

  jumpToProperty(propertyName: string, sectionName?: string, blockName?: string): boolean;
  jumpToSectionBlock(section: string): void;
  jumpToFontPaletteDefinition(paletteName: string): void;
  jumpToDeclaration(valueSource: SDK.CSSMatchedStyles.CSSValueSource): void;
  setActiveProperty(treeElement: StylePropertyTreeElement|null): void;
  addStyleUpdateListener(listener: () => void): void;
  removeStyleUpdateListener(listener: () => void): void;
}
