import { r as registerInstance, c as getConnect } from './chunk-eb0263ab.js';

class FormController {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.modalCtrl = getConnect(this, "ion-modal-controller");
    }
    async create(feature, options) {
        let form = document.createElement('gl-form');
        form.feature = feature;
        for (let optionName in options)
            form[optionName] = options[optionName];
        const modal = await this.modalCtrl.create({
            component: form
        });
        await modal.present();
        return await new Promise((resolve) => {
            form.addEventListener('glFormCancel', () => {
                modal.dismiss();
                resolve();
            });
            form.addEventListener('glFormSubmit', () => {
                modal.dismiss();
                resolve(feature);
            });
        });
    }
}

export { FormController as gl_form_controller };
