"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("../polyfills/tslib.js");
var webmapgl_core_js_1 = require("../webmapgl.core.js");
var chunk_c82b670d_js_1 = require("./chunk-c82b670d.js");
var chunk_ff8a6606_js_1 = require("./chunk-ff8a6606.js");
var chunk_9b9063ff_js_1 = require("./chunk-9b9063ff.js");
function iosEnterAnimation(e, t) { var o = new e, n = new e; n.addElement(t.querySelector("ion-backdrop")); var i = new e; return i.addElement(t.querySelector(".modal-wrapper")), i.beforeStyles({ opacity: 1 }).fromTo("translateY", "100%", "0%"), n.fromTo("opacity", .01, .4), Promise.resolve(o.addElement(t).easing("cubic-bezier(0.36,0.66,0.04,1)").duration(400).beforeAddClass("show-modal").add(n).add(i)); }
function iosLeaveAnimation(e, t) { var o = new e, n = new e; n.addElement(t.querySelector("ion-backdrop")); var i = new e, a = t.querySelector(".modal-wrapper"); i.addElement(a); var r = a.getBoundingClientRect(); return i.beforeStyles({ opacity: 1 }).fromTo("translateY", "0%", t.ownerDocument.defaultView.innerHeight - r.top + "px"), n.fromTo("opacity", .4, 0), Promise.resolve(o.addElement(t).easing("ease-out").duration(250).add(n).add(i)); }
function mdEnterAnimation(e, t) { var o = new e, n = new e; n.addElement(t.querySelector("ion-backdrop")); var i = new e; return i.addElement(t.querySelector(".modal-wrapper")), i.fromTo("opacity", .01, 1).fromTo("translateY", "40px", "0px"), n.fromTo("opacity", .01, .32), Promise.resolve(o.addElement(t).easing("cubic-bezier(0.36,0.66,0.04,1)").duration(280).beforeAddClass("show-modal").add(n).add(i)); }
function mdLeaveAnimation(e, t) { var o = new e, n = new e; n.addElement(t.querySelector("ion-backdrop")); var i = new e, a = t.querySelector(".modal-wrapper"); return i.addElement(a), i.fromTo("opacity", .99, 0).fromTo("translateY", "0px", "40px"), n.fromTo("opacity", .32, 0), Promise.resolve(o.addElement(t).easing("cubic-bezier(0.47,0,0.745,0.715)").duration(200).add(n).add(i)); }
var Modal = function () { function e() { this.presented = !1, this.keyboardClose = !0, this.backdropDismiss = !0, this.showBackdrop = !0, this.animated = !0; } return e.prototype.onDismiss = function (e) { e.stopPropagation(), e.preventDefault(), this.dismiss(); }, e.prototype.onBackdropTap = function () { this.dismiss(void 0, chunk_ff8a6606_js_1.a); }, e.prototype.lifecycle = function (e) { var t = this.usersElement, o = LIFECYCLE_MAP[e.type]; if (t && o) {
    var n = new CustomEvent(o, { bubbles: !1, cancelable: !1, detail: e.detail });
    t.dispatchEvent(n);
} }, e.prototype.present = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var e, t, o; return tslib_1.__generator(this, function (n) { switch (n.label) {
    case 0:
        if (this.presented)
            return [2];
        if (!(e = this.el.querySelector(".modal-wrapper")))
            throw new Error("container is undefined");
        return t = Object.assign({}, this.componentProps, { modal: this.el }), o = this, [4, chunk_9b9063ff_js_1.a(this.delegate, e, this.component, ["ion-page"], t)];
    case 1: return o.usersElement = n.sent(), [4, chunk_9b9063ff_js_1.h(this.usersElement)];
    case 2: return n.sent(), [2, chunk_ff8a6606_js_1.c(this, "modalEnter", iosEnterAnimation, mdEnterAnimation)];
} }); }); }, e.prototype.dismiss = function (e, t) { return tslib_1.__awaiter(this, void 0, void 0, function () { var o; return tslib_1.__generator(this, function (n) { switch (n.label) {
    case 0: return [4, chunk_ff8a6606_js_1.d(this, e, t, "modalLeave", iosLeaveAnimation, mdLeaveAnimation)];
    case 1: return (o = n.sent()) ? [4, chunk_9b9063ff_js_1.i(this.delegate, this.usersElement)] : [3, 3];
    case 2: n.sent(), n.label = 3;
    case 3: return [2, o];
} }); }); }, e.prototype.onDidDismiss = function () { return chunk_ff8a6606_js_1.e(this.el, "ionModalDidDismiss"); }, e.prototype.onWillDismiss = function () { return chunk_ff8a6606_js_1.e(this.el, "ionModalWillDismiss"); }, e.prototype.hostData = function () { var e; return { "no-router": !0, "aria-modal": "true", class: Object.assign((e = {}, e["" + this.mode] = !0, e), chunk_c82b670d_js_1.b(this.cssClass)), style: { zIndex: 2e4 + this.overlayIndex } }; }, e.prototype.render = function () { var e, t = ((e = {})["modal-wrapper"] = !0, e["" + this.mode] = !0, e); return [webmapgl_core_js_1.h("ion-backdrop", { visible: this.showBackdrop, tappable: this.backdropDismiss }), webmapgl_core_js_1.h("div", { role: "dialog", class: t })]; }, Object.defineProperty(e, "is", { get: function () { return "ion-modal"; }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "encapsulation", { get: function () { return "scoped"; }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "properties", { get: function () { return { animated: { type: Boolean, attr: "animated" }, backdropDismiss: { type: Boolean, attr: "backdrop-dismiss" }, component: { type: String, attr: "component" }, componentProps: { type: "Any", attr: "component-props" }, config: { context: "config" }, cssClass: { type: String, attr: "css-class" }, delegate: { type: "Any", attr: "delegate" }, dismiss: { method: !0 }, el: { elementRef: !0 }, enterAnimation: { type: "Any", attr: "enter-animation" }, keyboardClose: { type: Boolean, attr: "keyboard-close" }, leaveAnimation: { type: "Any", attr: "leave-animation" }, mode: { type: String, attr: "mode" }, onDidDismiss: { method: !0 }, onWillDismiss: { method: !0 }, overlayIndex: { type: Number, attr: "overlay-index" }, present: { method: !0 }, showBackdrop: { type: Boolean, attr: "show-backdrop" } }; }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "events", { get: function () { return [{ name: "ionModalDidPresent", method: "didPresent", bubbles: !0, cancelable: !0, composed: !0 }, { name: "ionModalWillPresent", method: "willPresent", bubbles: !0, cancelable: !0, composed: !0 }, { name: "ionModalWillDismiss", method: "willDismiss", bubbles: !0, cancelable: !0, composed: !0 }, { name: "ionModalDidDismiss", method: "didDismiss", bubbles: !0, cancelable: !0, composed: !0 }]; }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "listeners", { get: function () { return [{ name: "ionDismiss", method: "onDismiss" }, { name: "ionBackdropTap", method: "onBackdropTap" }, { name: "ionModalDidPresent", method: "lifecycle" }, { name: "ionModalWillPresent", method: "lifecycle" }, { name: "ionModalWillDismiss", method: "lifecycle" }, { name: "ionModalDidDismiss", method: "lifecycle" }]; }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "style", { get: function () { return ".sc-ion-modal-md-h{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color,#fff);--box-shadow:none;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;contain:strict}.overlay-hidden.sc-ion-modal-md-h{display:none}.modal-wrapper.sc-ion-modal-md{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}\@media only screen and (min-width:768px) and (min-height:600px){.sc-ion-modal-md-h{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}\@media only screen and (min-width:768px) and (min-height:768px){.sc-ion-modal-md-h{--width:600px;--height:600px}}\@media only screen and (min-width:768px) and (min-height:600px){.sc-ion-modal-md-h{--border-radius:2px;--box-shadow:0 28px 48px rgba(0,0,0,0.4)}}.modal-wrapper.sc-ion-modal-md{-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0);opacity:.01}"; }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "styleMode", { get: function () { return "md"; }, enumerable: !0, configurable: !0 }), e; }(), LIFECYCLE_MAP = { ionModalDidPresent: "ionViewDidEnter", ionModalWillPresent: "ionViewWillEnter", ionModalWillDismiss: "ionViewWillLeave", ionModalDidDismiss: "ionViewDidLeave" };
exports.IonModal = Modal;
