import { p as proxyCustomElement, H, h, d as Host } from './p-D16h8pzh.js';
import { c as createPopper } from './p-BfP9ezJQ.js';

const verdocsToolbarIconCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-toolbar-icon{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-toolbar-icon .icon{display:inline-block;cursor:pointer}verdocs-toolbar-icon .icon svg{fill:#5c6575}verdocs-toolbar-icon .tooltip{display:none;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;padding:5px 10px;font-size:13px;position:relative;border-radius:4px;z-index:20000;white-space:nowrap}verdocs-toolbar-icon .tooltip .arrow,verdocs-toolbar-icon .tooltip .arrow::before{position:absolute;width:8px;height:8px;background:inherit}verdocs-toolbar-icon .tooltip .arrow{visibility:hidden;top:-4px}verdocs-toolbar-icon .tooltip .arrow::before{visibility:visible;content:\"\";-webkit-transform:rotate(45deg);transform:rotate(45deg)}verdocs-toolbar-icon .tooltip[data-show]{display:block}verdocs-toolbar-icon .tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]>.arrow{right:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=right]>.arrow{left:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]{padding:3px 10px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]>.arrow{right:-1px}";

const VerdocsToolbarIcon = /*@__PURE__*/ proxyCustomElement(class VerdocsToolbarIcon extends H {
    constructor() {
        super();
        this.__registerHost();
        /**
         * Help text to display on hover/focus
         */
        this.text = '';
        /**
         * SVG icon to display
         */
        this.icon = '';
        /**
         * Override the Popper "placement" setting
         */
        this.placement = 'bottom';
        /**
         * Triggered when the icon is pressed
         */
        // @Event({composed: true}) press: EventEmitter;
        this.containerId = `verdocs-toolbar-icon-${Math.random().toString(36).substring(2, 11)}`;
    }
    componentDidLoad() {
        this.popperInstance = createPopper(this.iconEl, this.tooltip, {
            placement: this.placement,
            modifiers: this.placement === 'left' ? [{ name: 'offset', options: { offset: [0, 20] } }] : [],
        });
        // placement: 'top-end',
        // modifiers: [{name: 'offset', options: {offset: [0, 10]}}],
        // });
    }
    disconnectedCallback() {
        if (this.popperInstance) {
            this.popperInstance.destroy();
            this.popperInstance = null;
        }
    }
    show() {
        var _a, _b;
        (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.setAttribute('data-show', '');
        (_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update().catch(() => { });
    }
    hide() {
        var _a;
        (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.removeAttribute('data-show');
    }
    // handlePress() {
    //   this.press?.emit();
    // }
    render() {
        return (h(Host, { key: '656b7717e9f46bf4d331a6e60f0aabcaae611018', class: {} }, h("div", { key: '4c14eeea26b0dced9d82e26e909fc1e85d11cadd', "aria-describedby": this.containerId, class: "icon", innerHTML: this.icon, onMouseEnter: () => this.show(), onFocus: () => this.show(), onMouseLeave: () => this.hide(), onBlur: () => this.hide(), ref: el => (this.iconEl = el) }), h("div", { key: '281a88b6d6fce3950a5beb24c56d3399f0125cfa', id: this.containerId, role: "tooltip", class: "tooltip", "data-popper-placement": this.placement, ref: el => (this.tooltip = el) }, this.text, h("div", { key: 'f0618b5716de254e43eecd233cc9d882a895e124', "data-popper-arrow": "true", class: "arrow" }))));
    }
    static get style() { return verdocsToolbarIconCss; }
}, [256, "verdocs-toolbar-icon", {
        "text": [1],
        "icon": [1],
        "placement": [1],
        "containerId": [32]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["verdocs-toolbar-icon"];
    components.forEach(tagName => { switch (tagName) {
        case "verdocs-toolbar-icon":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, VerdocsToolbarIcon);
            }
            break;
    } });
}

export { VerdocsToolbarIcon as V, defineCustomElement as d };
//# sourceMappingURL=p-B0-ZXlBg.js.map

//# sourceMappingURL=p-B0-ZXlBg.js.map