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

const verdocsFileChooserCss = "verdocs-file-chooser{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;font-family:var(--verdocs-primary-font, \"Inter\", \"Barlow\", 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(registerHost) {
        super();
        if (registerHost !== false) {
            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: '9bbcded830636b89e0b47dd545c15117c5b9f8b8' }, h("input", { key: '0d8fb69380eb9391ad2e704e07abf29483ed7a01', 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: 'ac5d2a127e5653ed80effd71e7d5b41024b931a7', class: "upload-box" }, h("div", { key: 'bfe87d0804272452b31461e4eb714e9336157394', class: "selected-filename" }, this.file ? this.file.name : 'Drag a file here'), h("div", { key: '0999c21ef1c212435cbabd7eca81f8a7463055fe', class: "or-prefer" }, this.file ? unicodeNBSP : 'Or, if you prefer...'), h("verdocs-button", { key: 'd0b299a80d0cede99f92b06ab512053de0441011', 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-BuPGeecy.js.map

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