import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-BIRwgFLv.js';
import { VerdocsEndpoint, getEnvelopeDocumentPageDisplayUri, getEnvelope } from '@verdocs/js-sdk';
import { t as throttle } from './utils-UeubfAI_.js';
import { S as SDKError } from './errors-C1sRVZWv.js';
import { S as Store } from './Datastore-DmsV595e.js';
import './index-dzBXqXlK.js';
import './Types-dqxNbm_b.js';

const verdocsEnvelopeDocumentPageCss = "@-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-envelope-document-page{width:100%;position:relative}verdocs-envelope-document-page .verdocs-envelope-document-page-layer{position:absolute;top:0;left:0;right:0;bottom:0;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-envelope-document-page .verdocs-envelope-document-page-layer.img{width:100%}";

const VerdocsEnvelopeDocumentPage = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.pageRendered = createEvent(this, "pageRendered");
        /**
         * The endpoint to load from.
         */
        this.endpoint = VerdocsEndpoint.getDefault();
        /**
         * The ID of the envelope the document is for.
         */
        this.envelopeId = '';
        /**
         * The ID of the document to display.
         */
        this.documentId = '';
        /**
         * The page number being rendered. (Reminder: page numbers are 1-based.)
         */
        this.pageNumber = 1;
        /**
         * The "virtual" width of the page canvas. Defaults to 612 which at 72dpi is 8.5" wide. This is used to compute
         * the aspect ratio of the final rendered element when scaling up/down.
         */
        this.virtualWidth = 612;
        /**
         * The "virtual" height of the page canvas.  Defaults to 792 which at 72dpi is 11" tall. This is used to compute
         * the aspect ratio of the final rendered element when scaling up/down.
         */
        this.virtualHeight = 792;
        /**
         * The layers that will be rendered. The DOM structure will be a DIV container with one child DIV for each layer.
         * The parent DIV will have a unique ID, and each child DIV will have that ID with the layer name appended, e.g.
         * if `pages` was ['page', 'fields'] the structure will be:
         *
         * ```
         *     <div id="verdocs-envelope-document-page-ker2fr1p9">
         *       <div id="verdocs-envelope-document-page-ker2fr1p9-page"></div>
         *       <div id="verdocs-envelope-document-page-ker2fr1p9-fields"></div>
         *     </div>
         * ```
         */
        this.layers = [{ name: 'page', type: 'canvas' }];
        this.type = 'original';
        this.containerId = `verdocs-envelope-document-page-${Math.random().toString(36).substring(2, 11)}`;
        this.renderedWidth = this.virtualWidth;
        this.renderedHeight = this.virtualHeight;
        this.naturalWidth = this.virtualWidth;
        this.naturalHeight = this.virtualHeight;
        this.aspectRatio = this.virtualWidth / this.virtualHeight;
        this.skipFirstNotification = true;
        this.pageDisplayUri = 'https://verdocs-public-assets.s3.amazonaws.com/page-loading-placeholder.png';
    }
    async componentWillLoad() {
        this.pageDisplayUri = await getEnvelopeDocumentPageDisplayUri(this.endpoint, this.documentId, this.pageNumber, this.type);
    }
    componentDidLoad() {
        this.resizeObserver = new ResizeObserver(throttle(entries => {
            for (const entry of entries) {
                const renderedWidth = entry.contentRect.width;
                this.renderedWidth = renderedWidth;
                this.renderedHeight = this.virtualHeight * (renderedWidth / this.virtualWidth);
            }
            this.notifyRenderedSize();
        }, 100));
        this.resizeObserver.observe(this.container);
    }
    disconnectedCallback() {
        var _a;
        (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
    }
    // Left here for documentation purposes in case we find an edge case where this isn't true. But we apparently don't need this.
    // When we add the resize observer it will always be triggered at least once so notifying here as well is just a dupe.
    // componentDidRender() {
    //   this.notifyRenderedSize();
    // }
    notifyRenderedSize() {
        // We skip one notification because by default we will always get at least two, one when rendering the initial size
        // and a second once we're able to compute the scale size, when the resizeObserver sets renderedWidth/renderedHeight.
        if (this.skipFirstNotification) {
            this.skipFirstNotification = false;
            return;
        }
        this.pageRendered.emit({
            // container: this.container,
            containerId: this.containerId,
            documentId: this.documentId,
            pageNumber: this.pageNumber,
            virtualWidth: this.virtualWidth,
            virtualHeight: this.virtualHeight,
            renderedWidth: this.renderedWidth,
            renderedHeight: this.renderedHeight,
            naturalWidth: this.naturalWidth,
            naturalHeight: this.naturalHeight,
            aspectRatio: this.aspectRatio,
            xScale: this.renderedWidth / this.virtualWidth,
            yScale: this.renderedHeight / this.virtualHeight,
        });
    }
    render() {
        const height = `${this.renderedHeight}px`;
        return (h(Host, { key: '3036d518aa17d3626b86507ea36ef95c6d09966c', id: `${this.containerId}`, style: { height, flex: `0 0 ${height}` } }, this.layers.map(layer => layer.type === 'div' ? (h("div", { class: "verdocs-envelope-document-page-layer", id: `${this.containerId}-${layer.name}`, style: { height } })) : this.pageDisplayUri ? (h("img", { class: "verdocs-envelope-document-page-layer img", id: `${this.containerId}-${layer.name}`, src: this.pageDisplayUri, alt: `Page ${this.pageNumber}`, "aria-hidden": true, loading: "lazy", onLoad: (e) => {
                // Note that all we really care about is the aspect ratio. We track the natural Width and Height but they aren't really that
                // useful as individual values. The image will already have been scaled down to fit a DIV for display (100%, auto height).
                // Builder places fields offset into the rendered display area, not the original document's dimensions. So its X/Y values
                // for a field are based on the responsive Web view the Template editor was seeing. The IMG was scaled down there in the
                // exact same way, so we just honor it. We capture the natural width and height here more as information. Then we use the
                // aspect ratio to adjust the "virtual" height in case the page is not 8.5"x11".
                // TODO: Store this in the DB with each page.
                this.naturalWidth = e.target.naturalWidth;
                this.naturalHeight = e.target.naturalHeight;
                this.aspectRatio = this.naturalWidth / this.naturalHeight;
                this.virtualHeight = this.virtualWidth / this.aspectRatio;
                this.renderedHeight = e.target.offsetWidth / this.aspectRatio;
            } })) : (h("div", null)))));
    }
    get container() { return getElement(this); }
};
VerdocsEnvelopeDocumentPage.style = verdocsEnvelopeDocumentPageCss;

const verdocsQuestionDialogCss = "@-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-question-dialog{top:0;left:0;right:0;bottom:0;position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-question-dialog.closed{display:none}verdocs-question-dialog textarea{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #707ae5;border-radius:4px;background:#ffffff;color:#000;width:100%;font-size:14px;padding:9px;outline:none}verdocs-question-dialog .heading .title{font-size:18px}verdocs-question-dialog .buttons{gap:20px;display:-ms-flexbox;display:flex;margin-top:24px;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-question-dialog .buttons button{-ms-flex:1;flex:1;border:0;height:38px;display:-ms-flexbox;display:flex;color:#ffffff;font-size:14px;cursor:pointer;border-radius:6px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-question-dialog .buttons button.cancel{background-color:#654dcb}verdocs-question-dialog .buttons button.ok{background-color:#55bc81}verdocs-question-dialog .buttons button.ok.single{max-width:150px}verdocs-question-dialog .buttons button:disabled{background-color:#6c727f}";

const QuestionIcon$1 = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#ffffff"/></svg>`;
const VerdocsQuestionDialog = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.next = createEvent(this, "next");
        this.exit = createEvent(this, "exit");
        this.question = '';
        this.closed = false;
    }
    handleOk() {
        this.next.emit({ question: this.question });
    }
    handleCancel() {
        this.exit.emit();
    }
    // We need a separate event handler for clicking the background because it can receive events "through" other child components
    handleDismiss(e) {
        this.closed = true;
        if (e.target.className === 'background-overlay') {
            e.preventDefault();
            this.exit.emit();
        }
    }
    render() {
        return (h("verdocs-dialog", { key: '2d25d6034f32f73872e4e23e18f8f611845462ef', onExit: e => this.handleDismiss(e) }, h("div", { key: 'ded100d23158a50e01441f97bae61ca8afd29aa1', slot: "heading", class: "heading" }, h("div", { key: 'be66073c69e8251d7f407da52cec6e9d66678b3b', class: "icon", innerHTML: QuestionIcon$1 }), h("div", { key: 'dfd7af4e47911d2dcd6e42a27c7c0d70a013d9b7', class: "title" }, "Ask the Sender a Question")), h("div", { key: 'a085530805a7b43395af9188838252ed43fb1f98', slot: "content", class: "content" }, h("textarea", { key: 'f195beca773dc9b8ca4f7860aef766a107db98c8', name: "question", rows: 6, placeholder: "Enter your question...", onInput: (e) => (this.question = e.target.value) }, this.question)), h("div", { key: '0f2a3ea22986937baf9b88181053417c5f20538e', class: "footer", slot: "footer" }, h("div", { key: 'e36cc205b8bdbb65aac6874987b17e3c05becd5f', class: "buttons" }, h("button", { key: 'aafa5ec2ae697f8c234199db40c7b85c80efeba0', class: "cancel", onClick: () => this.handleCancel() }, "Cancel"), h("button", { key: '394fc179810c776d0ad1c7ec1a2429310c965388', class: 'ok', onClick: () => this.handleOk() }, "OK")))));
    }
};
VerdocsQuestionDialog.style = verdocsQuestionDialogCss;

const verdocsSignFooterCss = "@-webkit-keyframes verdocs-field-pulse {\n  0% {\n    background-color: rgba(0, 0, 0, 0.35);\n  }\n  50% {\n    background-color: rgba(0, 0, 0, 0);\n  }\n  100% {\n    background-color: rgba(0, 0, 0, 0.35);\n  }\n}\n@keyframes verdocs-field-pulse {\n  0% {\n    background-color: rgba(0, 0, 0, 0.35);\n  }\n  50% {\n    background-color: rgba(0, 0, 0, 0);\n  }\n  100% {\n    background-color: rgba(0, 0, 0, 0.35);\n  }\n}\nverdocs-sign-footer {\n  left: 0;\n  right: 0;\n  bottom: 0;\n  height: 48px;\n  display: -ms-flexbox;\n  display: flex;\n  color: #616161;\n  position: fixed;\n  font-size: 12px;\n  padding: 0 24px;\n  -ms-flex-align: center;\n  align-items: center;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  background: #ffffff;\n  container-type: inline-size;\n  border-top: 1px solid #e0e0e0;\n  -ms-flex-pack: justify;\n  justify-content: space-between;\n  font-family: var(--verdocs-primary-font, \"Inter\", \"Barlow\", sans-serif);\n  -webkit-transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n  transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n}\nverdocs-sign-footer a {\n  color: #616161;\n  cursor: pointer;\n  text-decoration: none;\n  border-bottom: 1px dotted #616161;\n}\nverdocs-sign-footer.loading {\n  display: none;\n}\nverdocs-sign-footer .powered-by {\n  white-space: nowrap;\n}\nverdocs-sign-footer .buttons {\n  -ms-flex: 0;\n  flex: 0;\n  gap: 16px;\n  display: -ms-flexbox;\n  display: flex;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  white-space: nowrap;\n  -ms-flex-align: center;\n  align-items: center;\n}\nverdocs-sign-footer .buttons button {\n  gap: 4px;\n  border: none;\n  display: -ms-flexbox;\n  display: flex;\n  outline: none;\n  cursor: pointer;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  -ms-flex-align: center;\n  align-items: center;\n  background: transparent;\n}\nverdocs-sign-footer .buttons div {\n  gap: 4px;\n  display: -ms-flexbox;\n  display: flex;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  -ms-flex-align: center;\n  align-items: center;\n}\nverdocs-sign-footer .links {\n  -ms-flex: 0;\n  flex: 0;\n  gap: 8px;\n  display: -ms-flexbox;\n  display: flex;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  white-space: nowrap;\n}\nverdocs-sign-footer.just-buttons .buttons {\n  -ms-flex: 1;\n  flex: 1;\n  -ms-flex-pack: center;\n  justify-content: center;\n}\n@container (max-width: 720px) {\n  verdocs-sign-footer.has-buttons .powered-by {\n    display: none;\n  }\n}\n@container (max-width: 540px) {\n  verdocs-sign-footer.no-buttons .powered-by {\n    display: none;\n  }\n  verdocs-sign-footer.has-buttons .links {\n    display: none;\n  }\n  verdocs-sign-footer .buttons {\n    -ms-flex: 1;\n    flex: 1;\n    -ms-flex-pack: center;\n    justify-content: center;\n  }\n}";

const QuestionIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#424242"/></svg>`;
const DeclineIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z" fill="#424242"/></svg>`;
const SaveIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z" fill="#424242"/></svg>`;
const VerdocsSignFooter = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.askQuestion = createEvent(this, "askQuestion");
        this.decline = createEvent(this, "decline");
        this.finishLater = createEvent(this, "finishLater");
        this.sdkError = createEvent(this, "sdkError");
        this.envelopeListenerId = null;
        /**
         * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
         */
        this.endpoint = VerdocsEndpoint.getDefault();
        /**
         * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.
         */
        this.envelopeId = '';
        /**
         * If the recipient is "done," some buttons will be hidden.
         */
        this.isDone = false;
        /**
         * Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.
         */
        // @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;
        this.askingQuestion = false;
        this.declinine = false;
        this.envelope = null;
    }
    async componentWillLoad() {
        var _a, _b, _c;
        try {
            // NOTE: The caller must have a signing session already active and shared to us via
            // the endpoint property.
            if (!this.envelopeId) {
                console.log(`[FOOTER] Missing required envelope ID ${this.envelopeId}`);
                return;
            }
            this.listenToEnvelope();
        }
        catch (e) {
            console.log('[FOOTER] Error loading envelope', e);
            (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
        }
    }
    disconnectedCallback() {
        this.unlistenToEnvelope();
    }
    async listenToEnvelope() {
        console.log('[FOOTER] Loading envelope', this.envelopeId);
        this.unlistenToEnvelope();
        Store.subscribe('envelopes', this.envelopeId, () => getEnvelope(this.endpoint, this.envelopeId), false, (envelope) => {
            this.envelope = envelope;
        });
    }
    unlistenToEnvelope() {
        if (this.envelopeListenerId) {
            Store.store.delListener(this.envelopeListenerId);
            this.envelopeListenerId = null;
        }
    }
    // handleRecipientAction(recipient: IRecipient, id: string) {
    //   console.log('[SIDEBAR] Recipient action', id, recipient);
    //   switch (id) {
    //     case 'update':
    //       this.showUpdateDialog = recipient.role_name;
    //       break;
    //
    //     case 'reminder':
    //       remindRecipient(this.endpoint, this.envelopeId, recipient.role_name)
    //         .then(() => {
    //           VerdocsToast('Reminder Sent', {style: 'success'});
    //         })
    //         .catch(e => {
    //           console.log('[SIDEBAR] Error resending invitation', e);
    //           VerdocsToast('Error resending invitation: ' + e.message, {style: 'error'});
    //         });
    //       break;
    //
    //     case 'reinvite':
    //       this.showReinviteDialog = recipient.role_name;
    //       break;
    //
    //     case 'inperson':
    //       this.showRecipientDialog = recipient.role_name;
    //       break;
    //
    //     case 'modify':
    //       VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});
    //       break;
    //
    //     case 'details':
    //       VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});
    //       break;
    //   }
    // }
    // handleUpdateRecipient(originalRecipient: IRecipient, updatedRecipient: IRecipient) {
    //   console.log('Updating recipient', originalRecipient, updatedRecipient);
    //   const fields: any = {};
    //   if (updatedRecipient.email !== originalRecipient.email) {
    //     fields.email = updatedRecipient.email;
    //   }
    //   if (updatedRecipient.phone !== originalRecipient.phone) {
    //     fields.phone = updatedRecipient.phone;
    //   }
    //   if (updatedRecipient.message !== originalRecipient.message) {
    //     fields.message = updatedRecipient.message;
    //   }
    //   if (updatedRecipient.first_name !== originalRecipient.first_name) {
    //     fields.first_name = updatedRecipient.first_name;
    //   }
    //   if (updatedRecipient.last_name !== originalRecipient.last_name) {
    //     fields.last_name = updatedRecipient.last_name;
    //   }
    //
    //   if (Object.keys(fields).length > 0) {
    //     updateRecipient(this.endpoint, this.envelopeId, originalRecipient.role_name, fields)
    //       .then(r => {
    //         // TODO: Reload the envelope?
    //         VerdocsToast('Recipient updated', {style: 'success'});
    //         console.log('[SIDEBAR] Updated recipient', r);
    //         Store.getEnvelope(this.endpoint, this.envelopeId, true);
    //         this.showUpdateDialog = '';
    //       })
    //       .catch(e => {
    //         VerdocsToast(e.response.data.error, {style: 'error'});
    //         this.showUpdateDialog = '';
    //       });
    //   } else {
    //     this.showUpdateDialog = '';
    //   }
    // }
    render() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
        const hasPoweredBy = !!((_b = (_a = this.envelope) === null || _a === void 0 ? void 0 : _a.organization) === null || _b === void 0 ? void 0 : _b.powered_by_label);
        const hasLinks = !!((_d = (_c = this.envelope) === null || _c === void 0 ? void 0 : _c.organization) === null || _d === void 0 ? void 0 : _d.terms_use_url) || !!((_f = (_e = this.envelope) === null || _e === void 0 ? void 0 : _e.organization) === null || _f === void 0 ? void 0 : _f.privacy_policy_url);
        const hasButtons = !this.isDone;
        return (h(Host, { key: '1411feb1a6b519746b1bd2c6a5fce91715dd5485', class: { 'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks } }, ((_h = (_g = this.envelope) === null || _g === void 0 ? void 0 : _g.organization) === null || _h === void 0 ? void 0 : _h.powered_by_label) && (h("div", { key: 'c5fc60d172ee3c69c4204256577749c001d53bb1', class: "powered-by" }, ((_k = (_j = this.envelope) === null || _j === void 0 ? void 0 : _j.organization) === null || _k === void 0 ? void 0 : _k.powered_by_label) ? (h("a", { href: (_m = (_l = this.envelope) === null || _l === void 0 ? void 0 : _l.organization) === null || _m === void 0 ? void 0 : _m.powered_by_url, target: "_blank", rel: "noopener noreferrer" }, h("span", null, (_p = (_o = this.envelope) === null || _o === void 0 ? void 0 : _o.organization) === null || _p === void 0 ? void 0 : _p.powered_by_label))) : (h("span", null, (_r = (_q = this.envelope) === null || _q === void 0 ? void 0 : _q.organization) === null || _r === void 0 ? void 0 : _r.powered_by_label)))), !this.isDone && (h("div", { key: '217521e7447870441d8565240750627b8133011d', class: "buttons" }, h("button", { key: '6d56085ff9ef8666a88c9966207dd28fb6caa5f6', onClick: () => (this.askingQuestion = true) }, h("span", { key: '36309d88efd6b195f5d4d2463c60bcc93bf1a600', innerHTML: QuestionIcon }), "Ask Sender a Question"), h("button", { key: '7d3a4362e849a77589625791b97ddf232cbdeb82', onClick: () => { var _a; return (_a = this.decline) === null || _a === void 0 ? void 0 : _a.emit(); } }, h("span", { key: '0c1577a95b4f1c0b4fa3860496433cc45af82c0b', innerHTML: DeclineIcon }), "Decline Signing"), h("button", { key: '9045872eaefa554da23170c02508c99c64a9966f', onClick: () => { var _a; return (_a = this.finishLater) === null || _a === void 0 ? void 0 : _a.emit(); } }, h("span", { key: '3ce2b170bffc99ef79c7931512f5a92cfff589f2', innerHTML: SaveIcon }), "Finish Later"))), h("div", { key: '198e4131f5e551021d54e8301e5142323ee765e7', class: "links" }, ((_t = (_s = this.envelope) === null || _s === void 0 ? void 0 : _s.organization) === null || _t === void 0 ? void 0 : _t.terms_use_url) && (h("a", { key: '9b5874f78e216330cde23dc5b62193dfa39a3722', href: (_v = (_u = this.envelope) === null || _u === void 0 ? void 0 : _u.organization) === null || _v === void 0 ? void 0 : _v.terms_use_url, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '657db0ecdabda0b4b83efc5424864a4ea422539c' }, "Terms of Use"))), ((_x = (_w = this.envelope) === null || _w === void 0 ? void 0 : _w.organization) === null || _x === void 0 ? void 0 : _x.privacy_policy_url) && (h("a", { key: 'd6dac069ba40c0691b6e7c38e52b928a2296eb0d', href: (_z = (_y = this.envelope) === null || _y === void 0 ? void 0 : _y.organization) === null || _z === void 0 ? void 0 : _z.privacy_policy_url, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '04a8ca34da1063fd368cfbf28a60673c69b02d3f' }, "Privacy Policy")))), this.askingQuestion && (h("verdocs-question-dialog", { key: 'acb26d8989d769e5b80f6bda2b0717822e53fc19', onNext: e => {
                var _a;
                (_a = this.askQuestion) === null || _a === void 0 ? void 0 : _a.emit({ question: e.detail.question });
                this.askingQuestion = false;
            }, onExit: () => (this.askingQuestion = false) }))));
    }
};
VerdocsSignFooter.style = verdocsSignFooterCss;

export { VerdocsEnvelopeDocumentPage as verdocs_envelope_document_page, VerdocsQuestionDialog as verdocs_question_dialog, VerdocsSignFooter as verdocs_sign_footer };
//# sourceMappingURL=verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.js.map
