define(["exports", "../../tslib/tslib.es6.js", "../mwc-base/base-element.js", "../ripple/foundation.js", "../../lit-element/lit-element.js", "../../lit-html/directives/class-map.js", "../../lit-html/directives/style-map.js"], function (_exports, _tslibEs, _baseElement, _foundation, _litElement, _classMap, _styleMap) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.RippleBase = void 0;
  _foundation = babelHelpers.interopRequireDefault(_foundation);

  /**
  @license
  Copyright 2018 Google Inc. All Rights Reserved.
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  */

  /** @soyCompatible */
  class RippleBase extends _baseElement.BaseElement {
    constructor() {
      super(...arguments);
      this.primary = false;
      this.accent = false;
      this.unbounded = false;
      this.disabled = false;
      this.light = false;
      this.hovering = false;
      this.bgFocused = false;
      this.fgActivation = false;
      this.fgDeactivation = false;
      this.fgScale = '';
      this.fgSize = '';
      this.translateStart = '';
      this.translateEnd = '';
      this.leftPos = '';
      this.topPos = '';
      this.mdcFoundationClass = _foundation.default;
    }

    createAdapter() {
      return {
        browserSupportsCssVars: () => true,
        isUnbounded: () => this.unbounded,
        isSurfaceActive: () => {
          return (this.parentElement || this).matches(':active');
        },
        isSurfaceDisabled: () => this.disabled,
        addClass: className => {
          switch (className) {
            case 'mdc-ripple-upgraded--background-focused':
              this.bgFocused = true;
              break;

            case 'mdc-ripple-upgraded--foreground-activation':
              this.fgActivation = true;
              break;

            case 'mdc-ripple-upgraded--foreground-deactivation':
              this.fgDeactivation = true;
              break;

            default:
              break;
          }
        },
        removeClass: className => {
          switch (className) {
            case 'mdc-ripple-upgraded--background-focused':
              this.bgFocused = false;
              break;

            case 'mdc-ripple-upgraded--foreground-activation':
              this.fgActivation = false;
              break;

            case 'mdc-ripple-upgraded--foreground-deactivation':
              this.fgDeactivation = false;
              break;

            default:
              break;
          }
        },
        containsEventTarget: () => true,
        registerInteractionHandler: () => undefined,
        deregisterInteractionHandler: () => undefined,
        registerDocumentInteractionHandler: () => undefined,
        deregisterDocumentInteractionHandler: () => undefined,
        registerResizeHandler: () => undefined,
        deregisterResizeHandler: () => undefined,
        updateCssVariable: (varName, value) => {
          switch (varName) {
            case '--mdc-ripple-fg-scale':
              this.fgScale = value;
              break;

            case '--mdc-ripple-fg-size':
              this.fgSize = value;
              break;

            case '--mdc-ripple-fg-translate-end':
              this.translateEnd = value;
              break;

            case '--mdc-ripple-fg-translate-start':
              this.translateStart = value;
              break;

            case '--mdc-ripple-left':
              this.leftPos = value;
              break;

            case '--mdc-ripple-top':
              this.topPos = value;
              break;

            default:
              break;
          }
        },
        computeBoundingRect: () => (this.parentElement || this).getBoundingClientRect(),
        getWindowPageOffset: () => ({
          x: window.pageXOffset,
          y: window.pageYOffset
        })
      };
    }

    activate(ev) {
      this.waitForFoundation(() => {
        this.mdcFoundation.activate(ev);
      });
    }

    deactivate() {
      this.waitForFoundation(() => {
        this.mdcFoundation.deactivate();
      });
    }

    handleFocus() {
      this.waitForFoundation(() => {
        this.mdcFoundation.handleFocus();
      });
    }

    handleBlur() {
      this.waitForFoundation(() => {
        this.mdcFoundation.handleBlur();
      });
    }

    handleMouseEnter() {
      this.hovering = true;
    }

    handleMouseLeave() {
      this.hovering = false;
    }
    /**
     * Wait for the MDCFoundation to be created by `firstUpdated`
     */


    waitForFoundation(fn) {
      if (this.mdcFoundation) {
        fn();
      } else {
        this.updateComplete.then(fn);
      }
    }
    /** @soyCompatible */


    render() {
      /** @classMap */
      const classes = {
        'mdc-ripple-upgraded--unbounded': this.unbounded,
        'mdc-ripple-upgraded--background-focused': this.bgFocused,
        'mdc-ripple-upgraded--foreground-activation': this.fgActivation,
        'mdc-ripple-upgraded--foreground-deactivation': this.fgDeactivation,
        'hover': this.hovering,
        'primary': this.primary,
        'accent': this.accent,
        'disabled': this.disabled,
        'light': this.light
      };
      return (0, _litElement.html)`
        <div class="mdc-ripple-surface mdc-ripple-upgraded ${(0, _classMap.classMap)(classes)}"
          style="${(0, _styleMap.styleMap)({
        '--mdc-ripple-fg-scale': this.fgScale,
        '--mdc-ripple-fg-size': this.fgSize,
        '--mdc-ripple-fg-translate-end': this.translateEnd,
        '--mdc-ripple-fg-translate-start': this.translateStart,
        '--mdc-ripple-left': this.leftPos,
        '--mdc-ripple-top': this.topPos
      })}"
          ?data-mdc-ripple-is-unbounded="${this.unbounded}">
        </div>`;
    }

  }

  _exports.RippleBase = RippleBase;
  (0, _tslibEs.__decorate)([(0, _litElement.query)('.mdc-ripple-surface')], RippleBase.prototype, "mdcRoot", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    type: Boolean
  })], RippleBase.prototype, "primary", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    type: Boolean
  })], RippleBase.prototype, "accent", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    type: Boolean
  })], RippleBase.prototype, "unbounded", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    type: Boolean
  })], RippleBase.prototype, "disabled", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    type: Boolean
  })], RippleBase.prototype, "light", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "hovering", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "bgFocused", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "fgActivation", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "fgDeactivation", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "fgScale", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "fgSize", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "translateStart", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "translateEnd", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "leftPos", void 0);
  (0, _tslibEs.__decorate)([(0, _litElement.property)({
    attribute: false
  })], RippleBase.prototype, "topPos", void 0);
});