text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  const __chunk_1 = require('./chunk-5137b566.js');
  const __chunk_2 = require('./chunk-d8847c1c.js');
  const __chunk_4 = require('./chunk-fba9594f.js');
  const __chunk_5 = require('./chunk-153bf688.js');
  const __chunk_8 = require('./chunk-31bc374f.js');
  
  /**
   * iOS Loading Enter Animation
   */
  const iosEnterAnimation = (AnimationC, baseEl) => {
      const baseAnimation = new AnimationC();
      const backdropAnimation = new AnimationC();
      backdropAnimation.addElement(baseEl.querySelector('ion-backdrop'));
      const wrapperAnimation = new AnimationC();
      wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper'));
      backdropAnimation.fromTo('opacity', 0.01, 0.3);
      wrapperAnimation.fromTo('opacity', 0.01, 1)
          .fromTo('scale', 1.1, 1);
      return Promise.resolve(baseAnimation
          .addElement(baseEl)
          .easing('ease-in-out')
          .duration(200)
          .add(backdropAnimation)
          .add(wrapperAnimation));
  };
  
  /**
   * iOS Loading Leave Animation
   */
  const iosLeaveAnimation = (AnimationC, baseEl) => {
      const baseAnimation = new AnimationC();
      const backdropAnimation = new AnimationC();
      backdropAnimation.addElement(baseEl.querySelector('ion-backdrop'));
      const wrapperAnimation = new AnimationC();
      wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper'));
      backdropAnimation.fromTo('opacity', 0.3, 0);
      wrapperAnimation.fromTo('opacity', 0.99, 0)
          .fromTo('scale', 1, 0.9);
      return Promise.resolve(baseAnimation
          .addElement(baseEl)
          .easing('ease-in-out')
          .duration(200)
          .add(backdropAnimation)
          .add(wrapperAnimation));
  };
  
  /**
   * Md Loading Enter Animation
   */
  const mdEnterAnimation = (AnimationC, baseEl) => {
      const baseAnimation = new AnimationC();
      const backdropAnimation = new AnimationC();
      backdropAnimation.addElement(baseEl.querySelector('ion-backdrop'));
      const wrapperAnimation = new AnimationC();
      wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper'));
      backdropAnimation.fromTo('opacity', 0.01, 0.32);
      wrapperAnimation.fromTo('opacity', 0.01, 1).fromTo('scale', 1.1, 1);
      return Promise.resolve(baseAnimation
          .addElement(baseEl)
          .easing('ease-in-out')
          .duration(200)
          .add(backdropAnimation)
          .add(wrapperAnimation));
  };
  
  /**
   * Md Loading Leave Animation
   */
  const mdLeaveAnimation = (AnimationC, baseEl) => {
      const baseAnimation = new AnimationC();
      const backdropAnimation = new AnimationC();
      backdropAnimation.addElement(baseEl.querySelector('ion-backdrop'));
      const wrapperAnimation = new AnimationC();
      wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper'));
      backdropAnimation.fromTo('opacity', 0.32, 0);
      wrapperAnimation.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 0.9);
      return Promise.resolve(baseAnimation
          .addElement(baseEl)
          .easing('ease-in-out')
          .duration(200)
          .add(backdropAnimation)
          .add(wrapperAnimation));
  };
  
  /**
   * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
   */
  class Loading {
      constructor(hostRef) {
          __chunk_1.registerInstance(this, hostRef);
          this.presented = false;
          this.mode = __chunk_1.getIonMode(this);
          /**
           * If `true`, the keyboard will be automatically dismissed when the overlay is presented.
           */
          this.keyboardClose = true;
          /**
           * Number of milliseconds to wait before dismissing the loading indicator.
           */
          this.duration = 0;
          /**
           * If `true`, the loading indicator will be dismissed when the backdrop is clicked.
           */
          this.backdropDismiss = false;
          /**
           * If `true`, a backdrop will be displayed behind the loading indicator.
           */
          this.showBackdrop = true;
          /**
           * If `true`, the loading indicator will be translucent.
           */
          this.translucent = false;
          /**
           * If `true`, the loading indicator will animate.
           */
          this.animated = true;
          this.onBackdropTap = () => {
              this.dismiss(undefined, __chunk_4.BACKDROP);
          };
          this.didPresent = __chunk_1.createEvent(this, "ionLoadingDidPresent", 7);
          this.willPresent = __chunk_1.createEvent(this, "ionLoadingWillPresent", 7);
          this.willDismiss = __chunk_1.createEvent(this, "ionLoadingWillDismiss", 7);
          this.didDismiss = __chunk_1.createEvent(this, "ionLoadingDidDismiss", 7);
      }
      componentWillLoad() {
          if (this.spinner === undefined) {
              const mode = __chunk_1.getIonMode(this);
              this.spinner = __chunk_2.config.get('loadingSpinner', __chunk_2.config.get('spinner', mode === 'ios' ? 'lines' : 'crescent'));
          }
      }
      /**
       * Present the loading overlay after it has been created.
       */
      async present() {
          await __chunk_4.present(this, 'loadingEnter', iosEnterAnimation, mdEnterAnimation, undefined);
          if (this.duration > 0) {
              this.durationTimeout = setTimeout(() => this.dismiss(), this.duration + 10);
          }
      }
      /**
       * Dismiss the loading overlay after it has been presented.
       *
       * @param data Any data to emit in the dismiss events.
       * @param role The role of the element that is dismissing the loading.
       * This can be useful in a button handler for determining which button was
       * clicked to dismiss the loading.
       * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
       */
      dismiss(data, role) {
          if (this.durationTimeout) {
              clearTimeout(this.durationTimeout);
          }
          return __chunk_4.dismiss(this, data, role, 'loadingLeave', iosLeaveAnimation, mdLeaveAnimation);
      }
      /**
       * Returns a promise that resolves when the loading did dismiss.
       */
      onDidDismiss() {
          return __chunk_4.eventMethod(this.el, 'ionLoadingDidDismiss');
      }
      /**
       * Returns a promise that resolves when the loading will dismiss.
       */
      onWillDismiss() {
          return __chunk_4.eventMethod(this.el, 'ionLoadingWillDismiss');
      }
      render() {
          const { message, spinner } = this;
          const mode = __chunk_1.getIonMode(this);
          return (__chunk_1.h(__chunk_1.Host, { onIonBackdropTap: this.onBackdropTap, style: {
                  zIndex: `${40000 + this.overlayIndex}`
              }, class: Object.assign({}, __chunk_5.getClassMap(this.cssClass), { [mode]: true, 'loading-translucent': this.translucent }) }, __chunk_1.h("ion-backdrop", { visible: this.showBackdrop, tappable: this.backdropDismiss }), __chunk_1.h("div", { class: "loading-wrapper", role: "dialog" }, spinner && (__chunk_1.h("div", { class: "loading-spinner" }, __chunk_1.h("ion-spinner", { name: spinner }))), message && __chunk_1.h("div", { class: "loading-content", innerHTML: __chunk_8.sanitizeDOMString(message) }))));
      }
      get el() { return __chunk_1.getElement(this); }
      static get style() { return ".sc-ion-loading-md-h{--min-width:auto;--width:auto;--min-height:auto;--height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:var(--ion-font-family,inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1000}.overlay-hidden.sc-ion-loading-md-h{display:none}.loading-wrapper.sc-ion-loading-md{display:-ms-flexbox;display:flex;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;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);background:var(--background);opacity:0;z-index:10}.spinner-bubbles.sc-ion-loading-md, .spinner-circles.sc-ion-loading-md, .spinner-crescent.sc-ion-loading-md, .spinner-dots.sc-ion-loading-md, .spinner-lines.sc-ion-loading-md, .spinner-lines-small.sc-ion-loading-md{color:var(--spinner-color)}.sc-ion-loading-md-h{--background:var(--ion-color-step-50,#f2f2f2);--max-width:280px;--max-height:90%;--spinner-color:var(--ion-color-primary,#3880ff);color:var(--ion-color-step-850,#262626);font-size:14px}.loading-wrapper.sc-ion-loading-md{border-radius:2px;padding-left:24px;padding-right:24px;padding-top:24px;padding-bottom:24px;-webkit-box-shadow:0 16px 20px rgba(0,0,0,.4);box-shadow:0 16px 20px rgba(0,0,0,.4)}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.loading-wrapper.sc-ion-loading-md{padding-left:unset;padding-right:unset;-webkit-padding-start:24px;padding-inline-start:24px;-webkit-padding-end:24px;padding-inline-end:24px}}.loading-spinner.sc-ion-loading-md + .loading-content.sc-ion-loading-md{margin-left:16px}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.loading-spinner.sc-ion-loading-md + .loading-content.sc-ion-loading-md{margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}"; }
  }
  
  exports.ion_loading = Loading;
  