import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-D16h8pzh.js';
import { VerdocsEndpoint } from '@verdocs/js-sdk';
import { u as unicodeNBSP } from './p-7LXbcjVz.js';
import { d as defineCustomElement$1 } from './p-BNrp2UP2.js';

const verdocsFileChooserCss = "@-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-file-chooser{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-file-chooser .upload-box{text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;padding:40px 15px;color:rgba(0, 0, 0, 0.54)}verdocs-file-chooser .upload-box svg{width:64px;height:64px;fill:#5c6575}verdocs-file-chooser .selected-filename{font-size:20px;font-weight:bold;overflow-wrap:anywhere}verdocs-file-chooser .or-prefer{height:20px;margin:20px 0;font-size:16px}";

const VerdocsFileChooser = /*@__PURE__*/ proxyCustomElement(class VerdocsFileChooser extends H {
    constructor() {
        super();
        this.__registerHost();
        this.fileSelected = createEvent(this, "fileSelected");
        /**
         * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
         */
        this.endpoint = VerdocsEndpoint.getDefault();
    }
    handleFileChanged(e) {
        var _a, _b;
        this.file = ((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || null;
        (_b = this.fileSelected) === null || _b === void 0 ? void 0 : _b.emit({ file: this.file });
        console.debug('[CHOOSER] Selected file', this.file);
    }
    handleSelectFile(e) {
        var _a, _b;
        e.stopPropagation();
        this.file = null;
        (_a = this.fileSelected) === null || _a === void 0 ? void 0 : _a.emit({ file: null });
        (_b = document.getElementById('verdocs-file-chooser')) === null || _b === void 0 ? void 0 : _b.click();
    }
    render() {
        const buttonlabel = this.file ? 'Select a different file' : 'Select a file from your computer';
        return (h(Host, { key: 'd2388c9f8fa3aa1de54d359698fd8b9b7a2dd39a' }, h("input", { key: 'd848ef1b6f60d6e57d7c4939dc44c8ed320e97b3', type: "file", multiple: true, id: "verdocs-file-chooser", accept: "application/pdf,.pdf,.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", style: { display: 'none' }, onChange: e => this.handleFileChanged(e) }), h("div", { key: 'd94e8fbc7b94f460fdbc51cf055a17fce83a2673', class: "upload-box" }, h("div", { key: '02dcf9d0f6c6f687eee3598c06e44b31de34b5c7', class: "selected-filename" }, this.file ? this.file.name : 'Drag a file here'), h("div", { key: 'd8c20dddc52d531c6d05078f7c76d2a6924d78e0', class: "or-prefer" }, this.file ? unicodeNBSP : 'Or, if you prefer...'), h("verdocs-button", { key: '5d65da28787d44f563ce72685e5458bb1322973d', label: buttonlabel, size: "small", onClick: e => this.handleSelectFile(e) }))));
    }
    static get style() { return verdocsFileChooserCss; }
}, [256, "verdocs-file-chooser", {
        "endpoint": [16],
        "file": [32]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["verdocs-file-chooser", "verdocs-button"];
    components.forEach(tagName => { switch (tagName) {
        case "verdocs-file-chooser":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, VerdocsFileChooser);
            }
            break;
        case "verdocs-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}

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

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