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 '../buttons/tool-icon-button.js';
import { Slot } from '@blockeditor/global/utils';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { ShapeStyle } from '../../../../surface-block/index.js';
import { ShapeComponentConfig } from '../toolbar/shape/shape-menu-config.js';
let EdgelessShapePanel = class EdgelessShapePanel extends LitElement {
    constructor() {
        super(...arguments);
        this.shapeStyle = ShapeStyle.Scribbled;
        this.slots = {
            select: new Slot(),
        };
    }
    _onSelect(value) {
        this.selectedShape = value;
        this.slots.select.emit(value);
    }
    disconnectedCallback() {
        this.slots.select.dispose();
        super.disconnectedCallback();
    }
    render() {
        return html `
      <div class="shape-panel-container">
        ${ShapeComponentConfig.map(({ name, generalIcon, scribbledIcon, tooltip, disabled }) => {
            return html `
              <edgeless-tool-icon-button
                .disabled=${disabled}
                .tooltip=${tooltip}
                .active=${this.selectedShape === name}
                .activeMode=${'background'}
                .iconContainerPadding=${2}
                @click=${() => {
                if (disabled)
                    return;
                this._onSelect(name);
            }}
              >
                ${this.shapeStyle === ShapeStyle.General
                ? generalIcon
                : scribbledIcon}
              </edgeless-tool-icon-button>
            `;
        })}
      </div>
    `;
    }
};
EdgelessShapePanel.styles = css `
    .shape-panel-container {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 40px;
      background: var(--affine-background-overlay-panel-color);
      box-shadow: var(--affine-shadow-2);
      border-radius: 8px;
      padding: 0 8px;
      gap: 8px;
      z-index: 2;
    }

    .shape-panel-container svg {
      fill: var(--affine-icon-color);
      stroke: none;
    }
  `;
__decorate([
    property({ attribute: false })
], EdgelessShapePanel.prototype, "selectedShape", void 0);
__decorate([
    property({ attribute: false })
], EdgelessShapePanel.prototype, "shapeStyle", void 0);
EdgelessShapePanel = __decorate([
    customElement('edgeless-shape-panel')
], EdgelessShapePanel);
export { EdgelessShapePanel };
//# sourceMappingURL=shape-panel.js.map