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 { WithDisposable } from '@blockeditor/lit';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { EdgelessEraserIcon } from '../../../../../_common/icons/index.js';
import {} from '../../../../../_common/utils/index.js';
import { getTooltipWithShortcut } from '../../utils.js';
let EdgelessEraserToolButton = class EdgelessEraserToolButton extends WithDisposable(LitElement) {
    firstUpdated() {
        this.edgeless.bindHotKey({
            Escape: () => {
                if (this.edgelessTool.type === 'eraser') {
                    this.setEdgelessTool({ type: 'default' });
                }
            },
        }, { global: true });
    }
    render() {
        const type = this.edgelessTool?.type;
        return html `
      <edgeless-toolbar-button
        class="edgeless-eraser-button"
        .tooltip=${getTooltipWithShortcut('Eraser', 'E')}
        .tooltipOffset=${4}
        .active=${type === 'eraser'}
        @click=${() => this.setEdgelessTool({ type: 'eraser' })}
      >
        <div class="eraser-button">
          <div class=${type === 'eraser' ? 'active-mode' : ''}></div>
          ${EdgelessEraserIcon}
        </div>
      </edgeless-toolbar-button>
    `;
    }
};
EdgelessEraserToolButton.styles = css `
    .eraser-button {
      position: relative;
      height: 66px;
      width: 60px;
      overflow-y: hidden;
    }
    .eraser-button .active-mode {
      position: absolute;
      top: 8px;
      left: 6px;
      width: 48px;
      height: 66px;
      border-top-left-radius: 12px;
      border-top-right-radius: 12px;
      background: var(--affine-hover-color);
    }
    #edgeless-eraser-icon {
      position: absolute;
      top: 4px;
      left: 50%;
      transform: translateX(-50%);
      transition: top 0.3s ease-in-out;
    }
    #edgeless-eraser-icon:hover {
      top: 0px;
    }
  `;
__decorate([
    property({ attribute: false })
], EdgelessEraserToolButton.prototype, "edgelessTool", void 0);
__decorate([
    property({ attribute: false })
], EdgelessEraserToolButton.prototype, "edgeless", void 0);
__decorate([
    property({ attribute: false })
], EdgelessEraserToolButton.prototype, "setEdgelessTool", void 0);
EdgelessEraserToolButton = __decorate([
    customElement('edgeless-eraser-tool-button')
], EdgelessEraserToolButton);
export { EdgelessEraserToolButton };
//# sourceMappingURL=eraser-tool-button.js.map