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 '../../panel/one-row-color-panel.js';
import '../common/slide-menu.js';
import { css, html, LitElement, nothing } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { ConnectorCWithArrowIcon, ConnectorLWithArrowIcon, ConnectorXWithArrowIcon, } from '../../../../../_common/icons/index.js';
import {} from '../../../../../_common/utils/index.js';
import { ConnectorMode } from '../../../../../surface-block/index.js';
import { getTooltipWithShortcut } from '../../utils.js';
const CONNECTOR_SUBMENU_WIDTH = 474;
function ConnectorModeButtonGroup(mode, setConnectorMode) {
    const straightLineTooltip = getTooltipWithShortcut('Straight', 'L');
    const orthogonalTooltip = getTooltipWithShortcut('Elbowed', 'X');
    const curveTooltip = getTooltipWithShortcut('Curve', 'C');
    /**
     * There is little hacky on rendering tooltip.
     * We don't want either tooltip overlap the top button or tooltip on left.
     * So we put the lower button's tooltip as the first element of the button group container
     */
    return html `
    <div class="connector-mode-button-group">
      <edgeless-tool-icon-button
        .active=${mode === ConnectorMode.Straight}
        .activeMode=${'background'}
        .iconContainerPadding=${2}
        .tooltip=${straightLineTooltip}
        @click=${() => setConnectorMode({ mode: ConnectorMode.Straight })}
      >
        ${ConnectorLWithArrowIcon}
      </edgeless-tool-icon-button>
      <edgeless-tool-icon-button
        .active=${mode === ConnectorMode.Curve}
        .activeMode=${'background'}
        .iconContainerPadding=${2}
        .tooltip=${curveTooltip}
        @click=${() => setConnectorMode({ mode: ConnectorMode.Curve })}
      >
        ${ConnectorCWithArrowIcon}
      </edgeless-tool-icon-button>
      <edgeless-tool-icon-button
        .active=${mode === ConnectorMode.Orthogonal}
        .activeMode=${'background'}
        .iconContainerPadding=${2}
        .tooltip=${orthogonalTooltip}
        @click=${() => setConnectorMode({ mode: ConnectorMode.Orthogonal })}
      >
        ${ConnectorXWithArrowIcon}
      </edgeless-tool-icon-button>
    </div>
  `;
}
let EdgelessConnectorMenu = class EdgelessConnectorMenu extends LitElement {
    get edgelessTool() {
        return this.edgeless.edgelessTool;
    }
    render() {
        if (this.edgelessTool.type !== 'connector')
            return nothing;
        const { stroke, strokeWidth } = this;
        const connectorModeButtonGroup = ConnectorModeButtonGroup(this.mode, this.onChange);
        return html `
      <edgeless-slide-menu .menuWidth=${CONNECTOR_SUBMENU_WIDTH}>
        <div class="connector-submenu-content">
          ${connectorModeButtonGroup}
          <div class="submenu-divider"></div>
          <edgeless-line-width-panel
            .selectedSize=${strokeWidth}
            @select=${(e) => this.onChange({ strokeWidth: e.detail })}
          >
          </edgeless-line-width-panel>
          <div class="submenu-divider"></div>
          <edgeless-one-row-color-panel
            .value=${stroke}
            @select=${(e) => this.onChange({ stroke: e.detail })}
          ></edgeless-one-row-color-panel>
        </div>
      </edgeless-slide-menu>
    `;
    }
};
EdgelessConnectorMenu.styles = css `
    :host {
      position: absolute;
      display: flex;
      z-index: -1;
    }

    .connector-submenu-content {
      display: flex;
      height: 24px;
      align-items: center;
      justify-content: center;
    }

    .connector-mode-button-group {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 14px;
    }

    .connector-mode-button-group > edgeless-tool-icon-button svg {
      fill: var(--affine-icon-color);
    }

    .submenu-divider {
      width: 1px;
      height: 24px;
      margin: 0 16px;
      background-color: var(--affine-border-color);
      display: inline-block;
    }
  `;
__decorate([
    property({ attribute: false })
], EdgelessConnectorMenu.prototype, "edgeless", void 0);
__decorate([
    property({ attribute: false })
], EdgelessConnectorMenu.prototype, "mode", void 0);
__decorate([
    property({ attribute: false })
], EdgelessConnectorMenu.prototype, "stroke", void 0);
__decorate([
    property({ attribute: false })
], EdgelessConnectorMenu.prototype, "strokeWidth", void 0);
__decorate([
    property({ attribute: false })
], EdgelessConnectorMenu.prototype, "onChange", void 0);
EdgelessConnectorMenu = __decorate([
    customElement('edgeless-connector-menu')
], EdgelessConnectorMenu);
export { EdgelessConnectorMenu };
//# sourceMappingURL=connector-menu.js.map