import { r as registerInstance, h, H as Host } from './index-CV0Pyo1O.js';
import { a as businessServiceReceivedOptions, r as recurringPaymentsOptions, s as seasonalBusinessOptions, d as businessClassificationOptions, b as businessTitleOptions } from './business-form-options-DXjZp4Rl.js';
import { C as CURRENCY_MASK, I as IDENTITY_MASKS, P as PHONE_MASKS } from './form-input-masks-CVaOFfrI.js';
import { b as heading2, x as label, u as inputDisabled, a0 as buttonSecondary, ak as alertDanger } from './parts-CPKMvyV_.js';
import { e as CoreBusinessInfo, d as deconstructDate, C as CountryCode } from './Business-BcNb9bVO.js';
import { c as countryLabels } from './country-config-CEJVOOGe.js';

const AdditionalQuestions = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.errors = {};
        this.additional_questions = {};
        this.inputHandler = this.inputHandler.bind(this);
    }
    componentDidLoad() {
        this.formController.errors.subscribe(errors => (this.errors = Object.assign({}, errors)));
        this.formController.values.subscribe(values => (this.additional_questions = Object.assign({}, values.additional_questions)));
    }
    inputHandler(name, value) {
        this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { additional_questions: Object.assign(Object.assign({}, this.formController.values.getValue().additional_questions), { [name]: value }) }));
    }
    render() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
        const additionalQuestionsDefaultValue = this.formController.getInitialValues().additional_questions;
        return (h(Host, { key: '05b69febfcd1e3901109c2cf64d812ff766b81cc' }, h("fieldset", { key: '84f06779dff94622fc7d14fdca53efb84f11e8cd' }, h("legend", { key: '3079e5d172c833d8172660f2f66b4d9637bfdb21', part: heading2 }, "Additional Questions"), h("div", { key: 'cf5155033143279316822237a84a0ad5e292a6cd', class: "row gy-3" }, h("div", { key: 'e28450dacb0d7040d62a4820c0252d95792d7e87', class: "col-12 col-md-6" }, h("form-control-monetary-provisioning", { key: 'e2ac8f211ffd9848fab123bc7826fd9f18e109a8', name: "business_revenue", label: "What is the business' estimated annual revenue from its primary business activities?", inputHandler: this.inputHandler, errorText: (_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a.additional_questions) === null || _b === void 0 ? void 0 : _b.business_revenue, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_revenue, maskOptions: CURRENCY_MASK.WHOLE })), h("div", { key: 'c5de85cd5e7b1501a0667a49d8d4826971e93052', class: "col-12 col-md-6" }, h("form-control-monetary-provisioning", { key: '3da3805e4ddbc633f060d36487b46e76e4f6eb04', name: "business_payment_volume", label: "What is the business' annual credit card & ACH volume anticipated to process?", inputHandler: this.inputHandler, errorText: (_d = (_c = this.errors) === null || _c === void 0 ? void 0 : _c.additional_questions) === null || _d === void 0 ? void 0 : _d.business_payment_volume, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_payment_volume, maskOptions: CURRENCY_MASK.WHOLE })), h("div", { key: 'ad62fecba837464fddba48273635bc8ae3a7d7ed', class: "col-12" }, h("form-control-select", { key: '9f09093b45c1c8eeb63065402f4b15e31c166d51', name: 'business_when_service_received', label: 'On average, how long after paying will your customers typically receive their goods or services?', inputHandler: this.inputHandler, errorText: (_f = (_e = this.errors) === null || _e === void 0 ? void 0 : _e.additional_questions) === null || _f === void 0 ? void 0 : _f.business_when_service_received, options: businessServiceReceivedOptions, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_when_service_received })), h("div", { key: 'e2a05cbb74138a554033817e3bb1372933e64b99', class: "col-12" }, h("form-control-select", { key: '8a95d74c02f2cf662f6cf0658faeae1a1a8f6a11', name: 'business_recurring_payments', label: 'Does your business offer recurring payments?', inputHandler: this.inputHandler, errorText: (_h = (_g = this.errors) === null || _g === void 0 ? void 0 : _g.additional_questions) === null || _h === void 0 ? void 0 : _h.business_recurring_payments, options: recurringPaymentsOptions, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_recurring_payments })), h("div", { key: '8d94059b0966237c980b1c1622e1ed3fd5bd8a58', class: "col-12" }, h("form-control-text", { key: '320fa784aef300393ddfcca4f2ef4798d207bf30', name: 'business_recurring_payments_percentage', label: 'What percent of revenue is generated from each recurring payment type offered?', inputHandler: this.inputHandler, errorText: (_k = (_j = this.errors) === null || _j === void 0 ? void 0 : _j.additional_questions) === null || _k === void 0 ? void 0 : _k.business_recurring_payments_percentage, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_recurring_payments_percentage })), h("div", { key: '8525c21ec91e652737455e7b093ff280800d97c2', class: "col-12" }, h("form-control-select", { key: 'c2cba23606b03f758ba704c074a65a212e111998', name: 'business_seasonal', label: 'Is this business seasonal?', inputHandler: this.inputHandler, errorText: (_m = (_l = this.errors) === null || _l === void 0 ? void 0 : _l.additional_questions) === null || _m === void 0 ? void 0 : _m.business_seasonal, options: seasonalBusinessOptions, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_seasonal })), h("div", { key: 'c047c43284fbe92952c487544bc8206c98433edc', class: "col-12" }, h("form-control-text", { key: '27348b1899f8b8f7f18a0618aa4dcb812a3bef04', name: 'business_other_payment_details', label: 'Is there anything else you would like us to know about how your customers pay the business?', inputHandler: this.inputHandler, errorText: (_p = (_o = this.errors) === null || _o === void 0 ? void 0 : _o.additional_questions) === null || _p === void 0 ? void 0 : _p.business_other_payment_details, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_other_payment_details }))))));
    }
};

const BusinessCoreInfo = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.errors = {};
        this.coreInfo = {};
        this.isEditingTaxId = false;
        this.inputHandler = this.inputHandler.bind(this);
    }
    componentDidLoad() {
        this.formController.values.subscribe(values => (this.coreInfo = Object.assign({}, new CoreBusinessInfo(values))));
        this.formController.errors.subscribe(errors => {
            this.errors = Object.assign({}, errors);
        });
    }
    inputHandler(name, value) {
        this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { [name]: value }));
    }
    render() {
        var _a, _b;
        const coreInfoDefaultValue = this.formController.getInitialValues();
        return (h(Host, { key: '9c73706505c1fa0a56d7eb68fc1c4c0a6fffd1dc' }, h("fieldset", { key: 'd30bae9bab7ffd0e385ce276e7797cfd606e5a42' }, h("legend", { key: '5792db95cbbc080f3c990b4b9cea84484f374ec3', part: heading2 }, "General Info"), h("div", { key: 'ae7fa3c788d625d60cfc83b270312946dce97f0b', class: "row gy-3" }, h("div", { key: 'f7e5ab1ec57a8ce8de5ef8591ecad8b2fbd2f030', class: "col-12" }, h("form-control-text", { key: 'fa96501ceca053263029489a74bddd31222b1462', name: "legal_name", label: "Legal Name", defaultValue: coreInfoDefaultValue.legal_name, errorText: this.errors.legal_name, inputHandler: this.inputHandler })), h("div", { key: '21e14d0c13017376d7e74e84169f30fe05fa13af', class: "col-12" }, h("form-control-text", { key: '266187ec2209299a4b0ebc4c7d600c670de3b21f', name: "doing_business_as", label: "Doing Business As (DBA)", defaultValue: coreInfoDefaultValue.doing_business_as, errorText: this.errors.doing_business_as, inputHandler: this.inputHandler })), h("div", { key: 'd9bbb19b4ec15a18a0467444e964512114e74031', class: "col-12 col-md-8" }, h("form-control-select", { key: 'fe490b4abb4a1e07392db9ad4e4c15b02d928f4c', name: "classification", label: "Business Classification", options: businessClassificationOptions, defaultValue: coreInfoDefaultValue.classification, errorText: this.errors.classification, inputHandler: this.inputHandler })), h("div", { key: 'fc5dafdace199fd34d22f22d629d87fc8ff7cc3e', class: "col-12 col-md-4" }, h("form-control-date", { key: '0263cdef27d1b36c22bde16dbdb3777ad9ef62e3', name: "date_of_incorporation", label: "Date of Incorporation", defaultValue: coreInfoDefaultValue.date_of_incorporation, errorText: this.errors.date_of_incorporation, inputHandler: this.inputHandler })), h("div", { key: '2ae2b710d615e5314d4b836b9a498fc9140b749a', class: "col-12 col-md-6" }, h("form-control-text", { key: 'f6e738254ff7ead5680b895b6df77dc58efbc393', name: "industry", label: "Industry", defaultValue: coreInfoDefaultValue.industry, errorText: this.errors.industry, inputHandler: this.inputHandler })), h("div", { key: '8a01de0514d495b103aa43070d268070f57af62a', class: "col-12 col-md-6" }, (!((_a = this.coreInfo) === null || _a === void 0 ? void 0 : _a.tax_id_last4) || this.isEditingTaxId) ? (h("form-control-number-masked", { name: "tax_id", label: countryLabels[this.country].taxIdLabelOptional || countryLabels[this.country].taxIdLabel, defaultValue: this.isEditingTaxId ? '' : coreInfoDefaultValue.tax_id, errorText: this.errors.tax_id, inputHandler: this.inputHandler, mask: IDENTITY_MASKS[this.country], helpText: countryLabels[this.country].taxIdHelpText })) : (h("div", null, h("label", { class: "form-label", part: label }, countryLabels[this.country].taxIdLabel), h("div", { class: "input-group mb-3" }, h("input", { type: "text", class: "form-control", part: inputDisabled, value: `****${(_b = this.coreInfo) === null || _b === void 0 ? void 0 : _b.tax_id_last4}`, disabled: true }), h("button", { class: "btn btn-secondary", type: "button", part: buttonSecondary, onClick: () => {
                this.isEditingTaxId = true;
                this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { tax_id: '' }));
            } }, "Change"))))), h("div", { key: 'a82eb6e652eb36fd57cd4a6c413e896aebfefce6', class: "col-12" }, h("form-control-text", { key: '930f882235d7c4902ae6daf54d644a0cd9d23daf', name: "website_url", label: "Website URL", defaultValue: coreInfoDefaultValue.website_url, errorText: this.errors.website_url, inputHandler: this.inputHandler })), h("div", { key: 'b2e819e6dfd97229e81e1860e1debe3ab95e3dc0', class: "col-12 col-md-6" }, h("form-control-text", { key: '7a4a158a1c64adfe90b825ff54c9f1f607c25bb7', name: "email", label: "Email Address", defaultValue: coreInfoDefaultValue.email, errorText: this.errors.email, inputHandler: this.inputHandler })), h("div", { key: '948c4f98a4a7a8b898058adb0957b7251d8c9fe4', class: "col-12 col-md-6" }, h("form-control-number-masked", { key: 'dc5804f3c9254c859f5e6a78487dae423c9689f1', name: "phone", label: "Phone Number", defaultValue: coreInfoDefaultValue.phone, errorText: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US }))))));
    }
};

const BusinessRepresentative = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.errors = {};
        this.representative = {};
        this.isEditingIdentification = false;
        this.inputHandler = (name, value) => {
            this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { [name]: value }) }));
        };
        this.onAddressFormUpdate = (values) => {
            this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { address: Object.assign(Object.assign({}, this.formController.values.getValue().representative.address), values) }) }));
        };
        this.onDateOfBirthUpdate = (event) => {
            const dob_values = deconstructDate(event.detail);
            this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { dob_day: dob_values.dob_day, dob_month: dob_values.dob_month, dob_year: dob_values.dob_year }) }));
        };
    }
    get identificationNumberLabel() {
        var _a;
        const label = countryLabels[this.country].idNumberLabel;
        const labelOptional = countryLabels[this.country].idNumberLabelOptional;
        return (((_a = this.representative) === null || _a === void 0 ? void 0 : _a.ssn_last4) || this.country === CountryCode.CAN) ? labelOptional : label;
    }
    componentDidLoad() {
        this.formController.errors.subscribe(errors => (this.errors = Object.assign({}, errors.representative)));
        this.formController.values.subscribe(values => (this.representative = Object.assign({}, values.representative)));
    }
    render() {
        var _a, _b;
        const representativeDefaultValue = this.formController.getInitialValues().representative;
        return (h(Host, { key: '9045242989e4d43d1e7b0770d0c5421005db78fa' }, h("fieldset", { key: '6643f8bd8e81bbc64ae8a0e9bcf317e16f91bab9' }, h("legend", { key: '20b897584a059ad98c109a37a3ea74c8be4b407c', part: heading2 }, "Representative"), h("div", { key: '37da5bfb73a7606c6180c151761aaf13dcc819c4', class: "row gy-3" }, h("div", { key: '8d76accd442d9fda35ae4d3e1c47b65e17f098a0', class: "col-12 col-md-8" }, h("form-control-text", { key: '2eadd087eac463e851192d8ee1c30390a29ee8b2', name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, errorText: this.errors.name, inputHandler: this.inputHandler })), h("div", { key: 'f495a8cb3c6a0e9b4a00aac3e8c77f66da84b9e2', class: "col-12 col-md-4" }, h("form-control-select", { key: '4b7669b96b7df9a387cf3c4f9638ea9ada9f37ee', name: "title", label: "Title", options: businessTitleOptions, defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, errorText: this.errors.title, inputHandler: this.inputHandler })), h("div", { key: '3e10f464a7e26a9518b4ce6d37c6f4a968514f98', class: "col-12 col-md-6" }, h("form-control-text", { key: 'a0d51c6999295428bfdcb43ef4b0ec15194eb077', name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.email, errorText: this.errors.email, inputHandler: this.inputHandler })), h("div", { key: 'a8e1a4c8e4fa5a50d436c18e41a5b77f23bc53cf', class: "col-12 col-md-6" }, h("form-control-number-masked", { key: 'a72115bf51fc97a25add717c208e820c7e9e5495', name: "phone", label: "Phone Number", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, errorText: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { key: 'db04f552f1757b6ac4e10539e4a148f399a75192', class: "col-12 col-md-4" }, h("form-control-date", { key: 'cb07a2cc4e6fc242d643f9caea01db380a9ff366', name: "dob_full", label: "Birth Date", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_full, errorText: this.errors.dob_full, inputHandler: this.inputHandler, onFormControlInput: this.onDateOfBirthUpdate })), h("div", { key: '95348511ba3b1582053f754249b15efe4d707252', class: "col-12 col-md-8" }, (!((_a = this.representative) === null || _a === void 0 ? void 0 : _a.ssn_last4) || this.isEditingIdentification) ? (h("form-control-number-masked", { name: "identification_number", label: this.identificationNumberLabel, defaultValue: this.isEditingIdentification ? '' : representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, errorText: this.errors.identification_number, inputHandler: this.inputHandler, mask: IDENTITY_MASKS[this.country], helpText: countryLabels[this.country].identityHelpText })) : (h("div", null, h("label", { class: "form-label", part: label }, this.identificationNumberLabel), h("div", { class: "input-group mb-3" }, h("input", { type: "text", class: "form-control", part: inputDisabled, value: `****${(_b = this.representative) === null || _b === void 0 ? void 0 : _b.ssn_last4}`, disabled: true }), h("button", { class: "btn btn-secondary", type: "button", part: buttonSecondary, onClick: () => {
                this.isEditingIdentification = true;
                // Clear last4 and current value to force validation
                this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { ssn_last4: null, identification_number: '' }) }));
            } }, "Change"))))), h("div", { key: '57dcdaad0ec89f94d82236bfc8e093b68b7ec478', class: "col-12" }, h("identity-address-form", { key: '0ea02562077d352c5d3a1d0903dee1e8b69fa6f1', errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate, country: this.country }))))));
    }
};

const FormAlert = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
    }
    render() {
        if (!this.text) {
            return null;
        }
        if (this.hideAlert) {
            return null;
        }
        return (h("div", { class: 'alert alert-danger d-flex align-items-center', role: 'alert', part: alertDanger }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "currentColor", class: "bi bi-exclamation-triangle-fill flex-shrink-0 me-2", viewBox: "0 0 16 16", role: "img", "aria-label": "Warning:" }, h("path", { d: "M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" })), h("div", null, this.text)));
    }
};

const LegalAddressForm = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.errors = {};
        this.inputHandler = this.inputHandler.bind(this);
    }
    componentDidLoad() {
        this.formController.errors.subscribe(errors => (this.errors = Object.assign({}, errors)));
        this.formController.values.subscribe(values => (this.legal_address = Object.assign({}, values.legal_address)));
    }
    inputHandler(name, value) {
        this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { legal_address: Object.assign(Object.assign({}, this.formController.values.getValue().legal_address), { [name]: value }) }));
    }
    render() {
        var _a;
        const legalAddressDefaultValue = this.formController.getInitialValues().legal_address;
        return (h(Host, { key: '856cd25caef521b651b9dd8a40dc6f9f0c727706' }, h("fieldset", { key: '150ad1f56747aae80ae8d2610fa08fcabee27c87' }, h("legend", { key: '565a46bd0977680e400663ef0590d65e977135be', part: heading2 }, "Business Legal Address"), h("form-address-fields", { key: 'c2ce05c006ec80c5319b30b40387e400ec52ab86', country: this.country, errors: (_a = this.errors) === null || _a === void 0 ? void 0 : _a.legal_address, defaultValues: legalAddressDefaultValue, inputHandler: this.inputHandler }))));
    }
};

export { AdditionalQuestions as additional_questions, BusinessCoreInfo as business_core_info, BusinessRepresentative as business_representative, FormAlert as form_alert, LegalAddressForm as legal_address_form };
