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

const verdocsButtonPanelCss = "@-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-button-panel{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:inline-block}verdocs-button-panel .icon{display:inline-block;cursor:pointer;opacity:0.6}verdocs-button-panel .icon svg{fill:#707ae5}verdocs-button-panel .icon:hover{opacity:1}.verdocs-button-panel-content{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;display:none;background:#ffffff;color:#33364b;width:320px;font-weight:bold;padding:15px;font-size:14px;position:relative;border-radius:4px;z-index:10000}.verdocs-button-panel-content .arrow,.verdocs-button-panel-content .arrow::before{position:absolute;width:8px;height:8px;background:inherit}.verdocs-button-panel-content .arrow{visibility:hidden;top:-4px}.verdocs-button-panel-content .arrow::before{visibility:visible;content:\"\";-webkit-transform:rotate(45deg);transform:rotate(45deg)}.verdocs-button-panel-content[data-show]{display:block}.verdocs-button-panel-content[data-popper-placement^=top]>.arrow{bottom:-4px}.verdocs-button-panel-content[data-popper-placement^=bottom]>.arrow{top:-4px}.verdocs-button-panel-content[data-popper-placement^=left]>.arrow{right:-4px}.verdocs-button-panel-content[data-popper-placement^=right]>.arrow{left:-4px}.verdocs-button-panel-content h6{font-size:16px;font-weight:bold;margin:0 0 16px 0;color:#092c4c;border-bottom:1px solid #cccccc}";

const VerdocsButtonPanel = /*@__PURE__*/ proxyCustomElement(class VerdocsButtonPanel extends H {
    constructor() {
        super();
        this.__registerHost();
        /**
         * SVG icon to display
         */
        this.icon = '';
        // Not marked as @State because it's not the thing that controls our rendering
        this.showing = false;
    }
    componentDidRender() {
        document.body.appendChild(this.panelEl);
        if (this.popperInstance) {
            this.popperInstance.destroy();
        }
        this.popperInstance = createPopper(this.iconEl, this.panelEl, {
        // placement: 'top-end',
        // modifiers: [{name: 'offset', options: {offset: [0, 10]}}],
        });
    }
    disconnectedCallback() {
        if (this.popperInstance) {
            this.popperInstance.destroy();
            this.popperInstance = null;
        }
        if (this.panelEl) {
            this.panelEl.remove();
        }
    }
    async showPanel() {
        var _a, _b;
        (_a = this.panelEl) === null || _a === void 0 ? void 0 : _a.setAttribute('data-show', '');
        (_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update().catch(() => { });
        this.showing = true;
        this.hiderEl = document.createElement('div');
        this.hiderEl.id = 'verdocs-button-panel-hider';
        this.hiderEl.style.zIndex = '100';
        this.hiderEl.style.position = 'absolute';
        this.hiderEl.style.top = '0px';
        this.hiderEl.style.left = '0px';
        this.hiderEl.style.right = '0px';
        this.hiderEl.style.bottom = '0px';
        this.hiderEl.onclick = (e) => {
            e.stopPropagation();
            this.toggle();
        };
        document.body.appendChild(this.hiderEl);
    }
    async hidePanel() {
        var _a;
        Array.from(document.getElementsByClassName('verdocs-button-panel-content')).forEach(el => {
            el.removeAttribute('data-show');
        });
        (_a = document.getElementById('verdocs-button-panel-hider')) === null || _a === void 0 ? void 0 : _a.remove();
        this.showing = false;
    }
    async toggle() {
        if (this.showing) {
            await this.hidePanel();
        }
        else {
            await this.showPanel();
        }
    }
    render() {
        return (h(Host, { key: 'c4a19a142c4e228213a78988847a66b9d952ee27' }, h("div", { key: 'd01b744c644e6ae143aa8654c25a15780189cd98', class: "icon", innerHTML: this.icon, onClick: (e) => {
                e.stopPropagation();
                return this.toggle();
            }, ref: el => (this.iconEl = el) }), h("div", { key: '5bc6a60df0c2e15b7fa4da356130618c540e2ec7', role: "tooltip", class: "verdocs-button-panel-content", "data-popper-placement": "bottom", ref: el => (this.panelEl = el) }, h("div", { key: '024f7c9713c9c57dc04d9cceaa93c7a40cb8eaba', "data-popper-arrow": "true", class: "arrow" }), h("slot", { key: '544361c54c163063f4013cc52ea4a12c6baff24b' }))));
    }
    static get style() { return verdocsButtonPanelCss; }
}, [260, "verdocs-button-panel", {
        "icon": [1],
        "showPanel": [64],
        "hidePanel": [64],
        "toggle": [64]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["verdocs-button-panel"];
    components.forEach(tagName => { switch (tagName) {
        case "verdocs-button-panel":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, VerdocsButtonPanel);
            }
            break;
    } });
}

export { VerdocsButtonPanel as V, defineCustomElement as d };
//# sourceMappingURL=p-UsZ2lpxS.js.map

//# sourceMappingURL=p-UsZ2lpxS.js.map