import { r as registerInstance } from './index-cb74209c.js';
import { m as modalController } from './overlays-a641afa2.js';
import './ionic-global-1b27992c.js';
import './framework-delegate-018abd28.js';
import './helpers-c8e73cb5.js';
import './hardware-back-button-90902d55.js';
import './index-bf616dc7.js';

const FormController = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  /**
   * Display a form in a modal. If the form is canceled, it resolves to
   * `undefined`. If the form is submitted, it resolves to the GeoJSON
   * feature updated by the form.
   * @param feature The GeoJSON feature that the form will edit.
   * @param options Option object used to set the properties of the `gl-form`.
   */
  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 modalController.create({
      component: form,
    });
    await modal.present();
    return await new Promise((resolve) => {
      form.addEventListener("glFormCancel", () => {
        modal.dismiss();
        resolve(undefined);
      });
      form.addEventListener("glFormSubmit", () => {
        modal.dismiss();
        resolve(feature);
      });
    });
  }
};

export { FormController as gl_form_controller };

//# sourceMappingURL=gl-form-controller.entry.js.map