'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-fd2bbf0b.js');

const modalCropperCss = "floodteam-modal-cropper ion-title{text-transform:capitalize !important}floodteam-modal-cropper floodteam-photo-cropper>div{max-height:300px}";

let ModalCropper = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.floodteamCropSave = index.createEvent(this, "floodteamCropSave", 7);
    this.floodteamCropDismiss = index.createEvent(this, "floodteamCropDismiss", 7);
  }
  async closeModal() {
    const modal = document.querySelector("ion-modal");
    if (modal) {
      modal.dismiss();
    }
    this.floodteamCropDismiss.emit({});
  }
  async save() {
    const modal = document.querySelector("ion-modal");
    if (modal) {
      modal.dismiss();
    }
    this.floodteamCropSave.emit({
      encodedContent: await this.photoCropperEl.getImageData(),
    });
  }
  render() {
    return [
      index.h("ion-header", null, index.h("ion-toolbar", { color: "dark" }, index.h("ion-buttons", { slot: "start" }, index.h("ion-button", { fill: "clear", color: "light" }, index.h("ion-icon", { slot: "icon-only", name: "create" }))), index.h("ion-title", null, "Crop Image"), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { onClick: () => this.closeModal(), fill: "clear", color: "primary" }, "Cancel")))),
      index.h("ion-content", null, index.h("floodteam-photo-cropper", { ref: (el) => (this.photoCropperEl = el), src: this.src }), index.h("ion-button", { class: "ion-float-right ion-margin-end", color: "success", onClick: () => this.save() }, "Save")),
    ];
  }
};
ModalCropper.style = modalCropperCss;

exports.floodteam_modal_cropper = ModalCropper;

//# sourceMappingURL=floodteam-modal-cropper.cjs.entry.js.map