import { h, } from "@stencil/core";
export class ModalCropper {
  constructor() {
    this.src = undefined;
  }
  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 [
      h("ion-header", null, h("ion-toolbar", { color: "dark" }, h("ion-buttons", { slot: "start" }, h("ion-button", { fill: "clear", color: "light" }, h("ion-icon", { slot: "icon-only", name: "create" }))), h("ion-title", null, "Crop Image"), h("ion-buttons", { slot: "end" }, h("ion-button", { onClick: () => this.closeModal(), fill: "clear", color: "primary" }, "Cancel")))),
      h("ion-content", null, h("floodteam-photo-cropper", { ref: (el) => (this.photoCropperEl = el), src: this.src }), h("ion-button", { class: "ion-float-right ion-margin-end", color: "success", onClick: () => this.save() }, "Save")),
    ];
  }
  static get is() { return "floodteam-modal-cropper"; }
  static get originalStyleUrls() {
    return {
      "$": ["modal-cropper.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["modal-cropper.css"]
    };
  }
  static get properties() {
    return {
      "src": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "src",
        "reflect": false
      }
    };
  }
  static get events() {
    return [{
        "method": "floodteamCropSave",
        "name": "floodteamCropSave",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }, {
        "method": "floodteamCropDismiss",
        "name": "floodteamCropDismiss",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
}
