Guest User

bundle.js

a guest
Oct 4th, 2018
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/    // The module cache
  3. /******/    var installedModules = {};
  4. /******/
  5. /******/    // The require function
  6. /******/    function __webpack_require__(moduleId) {
  7. /******/
  8. /******/        // Check if module is in cache
  9. /******/        if(installedModules[moduleId]) {
  10. /******/            return installedModules[moduleId].exports;
  11. /******/        }
  12. /******/        // Create a new module (and put it into the cache)
  13. /******/        var module = installedModules[moduleId] = {
  14. /******/            i: moduleId,
  15. /******/            l: false,
  16. /******/            exports: {}
  17. /******/        };
  18. /******/
  19. /******/        // Execute the module function
  20. /******/        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/        // Flag the module as loaded
  23. /******/        module.l = true;
  24. /******/
  25. /******/        // Return the exports of the module
  26. /******/        return module.exports;
  27. /******/    }
  28. /******/
  29. /******/
  30. /******/    // expose the modules object (__webpack_modules__)
  31. /******/    __webpack_require__.m = modules;
  32. /******/
  33. /******/    // expose the module cache
  34. /******/    __webpack_require__.c = installedModules;
  35. /******/
  36. /******/    // define getter function for harmony exports
  37. /******/    __webpack_require__.d = function(exports, name, getter) {
  38. /******/        if(!__webpack_require__.o(exports, name)) {
  39. /******/            Object.defineProperty(exports, name, {
  40. /******/                configurable: false,
  41. /******/                enumerable: true,
  42. /******/                get: getter
  43. /******/            });
  44. /******/        }
  45. /******/    };
  46. /******/
  47. /******/    // getDefaultExport function for compatibility with non-harmony modules
  48. /******/    __webpack_require__.n = function(module) {
  49. /******/        var getter = module && module.__esModule ?
  50. /******/            function getDefault() { return module['default']; } :
  51. /******/            function getModuleExports() { return module; };
  52. /******/        __webpack_require__.d(getter, 'a', getter);
  53. /******/        return getter;
  54. /******/    };
  55. /******/
  56. /******/    // Object.prototype.hasOwnProperty.call
  57. /******/    __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/    // __webpack_public_path__
  60. /******/    __webpack_require__.p = "";
  61. /******/
  62. /******/    // Load entry module and return exports
  63. /******/    return __webpack_require__(__webpack_require__.s = 3);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69.  
  70. "use strict";
  71.  
  72.  
  73. Object.defineProperty(exports, "__esModule", {
  74.   value: true
  75. });
  76.  
  77. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  78.  
  79. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  80.  
  81. /**
  82.  * @license
  83.  * Copyright 2016 Google Inc.
  84.  *
  85.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  86.  * of this software and associated documentation files (the "Software"), to deal
  87.  * in the Software without restriction, including without limitation the rights
  88.  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  89.  * copies of the Software, and to permit persons to whom the Software is
  90.  * furnished to do so, subject to the following conditions:
  91.  *
  92.  * The above copyright notice and this permission notice shall be included in
  93.  * all copies or substantial portions of the Software.
  94.  *
  95.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  96.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  97.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  98.  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  99.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  100.  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  101.  * THE SOFTWARE.
  102.  */
  103.  
  104. /**
  105.  * @template A
  106.  */
  107. var MDCFoundation = function () {
  108.   _createClass(MDCFoundation, null, [{
  109.     key: "cssClasses",
  110.  
  111.     /** @return enum{cssClasses} */
  112.     get: function get() {
  113.       // Classes extending MDCFoundation should implement this method to return an object which exports every
  114.       // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
  115.       return {};
  116.     }
  117.  
  118.     /** @return enum{strings} */
  119.  
  120.   }, {
  121.     key: "strings",
  122.     get: function get() {
  123.       // Classes extending MDCFoundation should implement this method to return an object which exports all
  124.       // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
  125.       return {};
  126.     }
  127.  
  128.     /** @return enum{numbers} */
  129.  
  130.   }, {
  131.     key: "numbers",
  132.     get: function get() {
  133.       // Classes extending MDCFoundation should implement this method to return an object which exports all
  134.       // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
  135.       return {};
  136.     }
  137.  
  138.     /** @return {!Object} */
  139.  
  140.   }, {
  141.     key: "defaultAdapter",
  142.     get: function get() {
  143.       // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
  144.       // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
  145.       // validation.
  146.       return {};
  147.     }
  148.  
  149.     /**
  150.      * @param {A=} adapter
  151.      */
  152.  
  153.   }]);
  154.  
  155.   function MDCFoundation() {
  156.     var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  157.  
  158.     _classCallCheck(this, MDCFoundation);
  159.  
  160.     /** @protected {!A} */
  161.     this.adapter_ = adapter;
  162.   }
  163.  
  164.   _createClass(MDCFoundation, [{
  165.     key: "init",
  166.     value: function init() {
  167.       // Subclasses should override this method to perform initialization routines (registering events, etc.)
  168.     }
  169.   }, {
  170.     key: "destroy",
  171.     value: function destroy() {
  172.       // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
  173.     }
  174.   }]);
  175.  
  176.   return MDCFoundation;
  177. }();
  178.  
  179. exports.default = MDCFoundation;
  180.  
  181. /***/ }),
  182. /* 1 */
  183. /***/ (function(module, exports, __webpack_require__) {
  184.  
  185. "use strict";
  186.  
  187.  
  188. Object.defineProperty(exports, "__esModule", {
  189.   value: true
  190. });
  191.  
  192. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  193.  
  194. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  195.  
  196. /**
  197.  * @license
  198.  * Copyright 2016 Google Inc.
  199.  *
  200.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  201.  * of this software and associated documentation files (the "Software"), to deal
  202.  * in the Software without restriction, including without limitation the rights
  203.  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  204.  * copies of the Software, and to permit persons to whom the Software is
  205.  * furnished to do so, subject to the following conditions:
  206.  *
  207.  * The above copyright notice and this permission notice shall be included in
  208.  * all copies or substantial portions of the Software.
  209.  *
  210.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  211.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  212.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  213.  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  214.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  215.  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  216.  * THE SOFTWARE.
  217.  */
  218.  
  219. /* eslint no-unused-vars: [2, {"args": "none"}] */
  220.  
  221. /**
  222.  * Adapter for MDC Ripple. Provides an interface for managing
  223.  * - classes
  224.  * - dom
  225.  * - CSS variables
  226.  * - position
  227.  * - dimensions
  228.  * - scroll position
  229.  * - event handlers
  230.  * - unbounded, active and disabled states
  231.  *
  232.  * Additionally, provides type information for the adapter to the Closure
  233.  * compiler.
  234.  *
  235.  * Implement this adapter for your framework of choice to delegate updates to
  236.  * the component in your framework of choice. See architecture documentation
  237.  * for more details.
  238.  * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
  239.  *
  240.  * @record
  241.  */
  242. var MDCRippleAdapter = function () {
  243.   function MDCRippleAdapter() {
  244.     _classCallCheck(this, MDCRippleAdapter);
  245.   }
  246.  
  247.   _createClass(MDCRippleAdapter, [{
  248.     key: "browserSupportsCssVars",
  249.  
  250.     /** @return {boolean} */
  251.     value: function browserSupportsCssVars() {}
  252.  
  253.     /** @return {boolean} */
  254.  
  255.   }, {
  256.     key: "isUnbounded",
  257.     value: function isUnbounded() {}
  258.  
  259.     /** @return {boolean} */
  260.  
  261.   }, {
  262.     key: "isSurfaceActive",
  263.     value: function isSurfaceActive() {}
  264.  
  265.     /** @return {boolean} */
  266.  
  267.   }, {
  268.     key: "isSurfaceDisabled",
  269.     value: function isSurfaceDisabled() {}
  270.  
  271.     /** @param {string} className */
  272.  
  273.   }, {
  274.     key: "addClass",
  275.     value: function addClass(className) {}
  276.  
  277.     /** @param {string} className */
  278.  
  279.   }, {
  280.     key: "removeClass",
  281.     value: function removeClass(className) {}
  282.  
  283.     /** @param {!EventTarget} target */
  284.  
  285.   }, {
  286.     key: "containsEventTarget",
  287.     value: function containsEventTarget(target) {}
  288.  
  289.     /**
  290.      * @param {string} evtType
  291.      * @param {!Function} handler
  292.      */
  293.  
  294.   }, {
  295.     key: "registerInteractionHandler",
  296.     value: function registerInteractionHandler(evtType, handler) {}
  297.  
  298.     /**
  299.      * @param {string} evtType
  300.      * @param {!Function} handler
  301.      */
  302.  
  303.   }, {
  304.     key: "deregisterInteractionHandler",
  305.     value: function deregisterInteractionHandler(evtType, handler) {}
  306.  
  307.     /**
  308.      * @param {string} evtType
  309.      * @param {!Function} handler
  310.      */
  311.  
  312.   }, {
  313.     key: "registerDocumentInteractionHandler",
  314.     value: function registerDocumentInteractionHandler(evtType, handler) {}
  315.  
  316.     /**
  317.      * @param {string} evtType
  318.      * @param {!Function} handler
  319.      */
  320.  
  321.   }, {
  322.     key: "deregisterDocumentInteractionHandler",
  323.     value: function deregisterDocumentInteractionHandler(evtType, handler) {}
  324.  
  325.     /**
  326.      * @param {!Function} handler
  327.      */
  328.  
  329.   }, {
  330.     key: "registerResizeHandler",
  331.     value: function registerResizeHandler(handler) {}
  332.  
  333.     /**
  334.      * @param {!Function} handler
  335.      */
  336.  
  337.   }, {
  338.     key: "deregisterResizeHandler",
  339.     value: function deregisterResizeHandler(handler) {}
  340.  
  341.     /**
  342.      * @param {string} varName
  343.      * @param {?number|string} value
  344.      */
  345.  
  346.   }, {
  347.     key: "updateCssVariable",
  348.     value: function updateCssVariable(varName, value) {}
  349.  
  350.     /** @return {!ClientRect} */
  351.  
  352.   }, {
  353.     key: "computeBoundingRect",
  354.     value: function computeBoundingRect() {}
  355.  
  356.     /** @return {{x: number, y: number}} */
  357.  
  358.   }, {
  359.     key: "getWindowPageOffset",
  360.     value: function getWindowPageOffset() {}
  361.   }]);
  362.  
  363.   return MDCRippleAdapter;
  364. }();
  365.  
  366. exports.default = MDCRippleAdapter;
  367.  
  368. /***/ }),
  369. /* 2 */
  370. /***/ (function(module, exports, __webpack_require__) {
  371.  
  372. "use strict";
  373.  
  374.  
  375. Object.defineProperty(exports, "__esModule", {
  376.   value: true
  377. });
  378. /**
  379.  * @license
  380.  * Copyright 2016 Google Inc.
  381.  *
  382.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  383.  * of this software and associated documentation files (the "Software"), to deal
  384.  * in the Software without restriction, including without limitation the rights
  385.  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  386.  * copies of the Software, and to permit persons to whom the Software is
  387.  * furnished to do so, subject to the following conditions:
  388.  *
  389.  * The above copyright notice and this permission notice shall be included in
  390.  * all copies or substantial portions of the Software.
  391.  *
  392.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  393.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  394.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  395.  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  396.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  397.  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  398.  * THE SOFTWARE.
  399.  */
  400.  
  401. /**
  402.  * Stores result from supportsCssVariables to avoid redundant processing to detect CSS custom variable support.
  403.  * @private {boolean|undefined}
  404.  */
  405. var supportsCssVariables_ = void 0;
  406.  
  407. /**
  408.  * Stores result from applyPassive to avoid redundant processing to detect passive event listener support.
  409.  * @private {boolean|undefined}
  410.  */
  411. var supportsPassive_ = void 0;
  412.  
  413. /**
  414.  * @param {!Window} windowObj
  415.  * @return {boolean}
  416.  */
  417. function detectEdgePseudoVarBug(windowObj) {
  418.   // Detect versions of Edge with buggy var() support
  419.   // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
  420.   var document = windowObj.document;
  421.   var node = document.createElement('div');
  422.   node.className = 'mdc-ripple-surface--test-edge-var-bug';
  423.   document.body.appendChild(node);
  424.  
  425.   // The bug exists if ::before style ends up propagating to the parent element.
  426.   // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
  427.   // but Firefox is known to support CSS custom properties correctly.
  428.   // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  429.   var computedStyle = windowObj.getComputedStyle(node);
  430.   var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
  431.   node.remove();
  432.   return hasPseudoVarBug;
  433. }
  434.  
  435. /**
  436.  * @param {!Window} windowObj
  437.  * @param {boolean=} forceRefresh
  438.  * @return {boolean|undefined}
  439.  */
  440.  
  441. function supportsCssVariables(windowObj) {
  442.   var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  443.  
  444.   var supportsCssVariables = supportsCssVariables_;
  445.   if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  446.     return supportsCssVariables;
  447.   }
  448.  
  449.   var supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function';
  450.   if (!supportsFunctionPresent) {
  451.     return;
  452.   }
  453.  
  454.   var explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes');
  455.   // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  456.   // See: README section on Safari
  457.   var weAreFeatureDetectingSafari10plus = windowObj.CSS.supports('(--css-vars: yes)') && windowObj.CSS.supports('color', '#00000000');
  458.  
  459.   if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
  460.     supportsCssVariables = !detectEdgePseudoVarBug(windowObj);
  461.   } else {
  462.     supportsCssVariables = false;
  463.   }
  464.  
  465.   if (!forceRefresh) {
  466.     supportsCssVariables_ = supportsCssVariables;
  467.   }
  468.   return supportsCssVariables;
  469. }
  470.  
  471. //
  472. /**
  473.  * Determine whether the current browser supports passive event listeners, and if so, use them.
  474.  * @param {!Window=} globalObj
  475.  * @param {boolean=} forceRefresh
  476.  * @return {boolean|!EventListenerOptions}
  477.  */
  478. function applyPassive() {
  479.   var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
  480.   var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  481.  
  482.   if (supportsPassive_ === undefined || forceRefresh) {
  483.     var isSupported = false;
  484.     try {
  485.       globalObj.document.addEventListener('test', null, { get passive() {
  486.           isSupported = true;
  487.           return isSupported;
  488.         } });
  489.     } catch (e) {}
  490.  
  491.     supportsPassive_ = isSupported;
  492.   }
  493.  
  494.   return supportsPassive_ ? /** @type {!EventListenerOptions} */{ passive: true } : false;
  495. }
  496.  
  497. /**
  498.  * @param {!Object} HTMLElementPrototype
  499.  * @return {string}
  500.  */
  501. function getMatchesProperty(HTMLElementPrototype) {
  502.   /**
  503.    * Order is important because we return the first existing method we find.
  504.    * Do not change the order of the items in the below array.
  505.    */
  506.   var matchesMethods = ['matches', 'webkitMatchesSelector', 'msMatchesSelector'];
  507.   var method = 'matches';
  508.   for (var i = 0; i < matchesMethods.length; i++) {
  509.     var matchesMethod = matchesMethods[i];
  510.     if (matchesMethod in HTMLElementPrototype) {
  511.       method = matchesMethod;
  512.       break;
  513.     }
  514.   }
  515.  
  516.   return method;
  517. }
  518.  
  519. /**
  520.  * @param {!Event} ev
  521.  * @param {{x: number, y: number}} pageOffset
  522.  * @param {!ClientRect} clientRect
  523.  * @return {{x: number, y: number}}
  524.  */
  525. function getNormalizedEventCoords(ev, pageOffset, clientRect) {
  526.   var x = pageOffset.x,
  527.       y = pageOffset.y;
  528.  
  529.   var documentX = x + clientRect.left;
  530.   var documentY = y + clientRect.top;
  531.  
  532.   var normalizedX = void 0;
  533.   var normalizedY = void 0;
  534.   // Determine touch point relative to the ripple container.
  535.   if (ev.type === 'touchstart') {
  536.     ev = /** @type {!TouchEvent} */ev;
  537.     normalizedX = ev.changedTouches[0].pageX - documentX;
  538.     normalizedY = ev.changedTouches[0].pageY - documentY;
  539.   } else {
  540.     ev = /** @type {!MouseEvent} */ev;
  541.     normalizedX = ev.pageX - documentX;
  542.     normalizedY = ev.pageY - documentY;
  543.   }
  544.  
  545.   return { x: normalizedX, y: normalizedY };
  546. }
  547.  
  548. exports.supportsCssVariables = supportsCssVariables;
  549. exports.applyPassive = applyPassive;
  550. exports.getMatchesProperty = getMatchesProperty;
  551. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  552.  
  553. /***/ }),
  554. /* 3 */
  555. /***/ (function(module, exports, __webpack_require__) {
  556.  
  557. __webpack_require__(4);
  558. module.exports = __webpack_require__(5);
  559.  
  560.  
  561. /***/ }),
  562. /* 4 */
  563. /***/ (function(module, exports, __webpack_require__) {
  564.  
  565. module.exports = __webpack_require__.p + "bundle.css";
  566.  
  567. /***/ }),
  568. /* 5 */
  569. /***/ (function(module, exports, __webpack_require__) {
  570.  
  571. "use strict";
  572.  
  573.  
  574. var _ripple = __webpack_require__(6);
  575.  
  576. var ripple = new _ripple.MDCRipple(document.querySelector('.foo-button'));
  577.  
  578. /***/ }),
  579. /* 6 */
  580. /***/ (function(module, exports, __webpack_require__) {
  581.  
  582. "use strict";
  583.  
  584.  
  585. Object.defineProperty(exports, "__esModule", {
  586.   value: true
  587. });
  588. exports.util = exports.RippleCapableSurface = exports.MDCRippleFoundation = exports.MDCRipple = undefined;
  589.  
  590. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  591.  
  592. var _component = __webpack_require__(7);
  593.  
  594. var _component2 = _interopRequireDefault(_component);
  595.  
  596. var _adapter = __webpack_require__(1);
  597.  
  598. var _adapter2 = _interopRequireDefault(_adapter);
  599.  
  600. var _foundation = __webpack_require__(8);
  601.  
  602. var _foundation2 = _interopRequireDefault(_foundation);
  603.  
  604. var _util = __webpack_require__(2);
  605.  
  606. var util = _interopRequireWildcard(_util);
  607.  
  608. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  609.  
  610. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  611.  
  612. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  613.  
  614. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  615.  
  616. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
  617.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * @license
  618.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * Copyright 2016 Google Inc.
  619.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
  620.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * Permission is hereby granted, free of charge, to any person obtaining a copy
  621.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * of this software and associated documentation files (the "Software"), to deal
  622.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * in the Software without restriction, including without limitation the rights
  623.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  624.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * copies of the Software, and to permit persons to whom the Software is
  625.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * furnished to do so, subject to the following conditions:
  626.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
  627.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * The above copyright notice and this permission notice shall be included in
  628.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * all copies or substantial portions of the Software.
  629.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
  630.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  631.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  632.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  633.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  634.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  635.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  636.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * THE SOFTWARE.
  637.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
  638.  
  639. /**
  640.  * @extends MDCComponent<!MDCRippleFoundation>
  641.  */
  642. var MDCRipple = function (_MDCComponent) {
  643.   _inherits(MDCRipple, _MDCComponent);
  644.  
  645.   /** @param {...?} args */
  646.   function MDCRipple() {
  647.     var _ref;
  648.  
  649.     _classCallCheck(this, MDCRipple);
  650.  
  651.     for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  652.       args[_key] = arguments[_key];
  653.     }
  654.  
  655.     /** @type {boolean} */
  656.     var _this = _possibleConstructorReturn(this, (_ref = MDCRipple.__proto__ || Object.getPrototypeOf(MDCRipple)).call.apply(_ref, [this].concat(args)));
  657.  
  658.     _this.disabled = false;
  659.  
  660.     /** @private {boolean} */
  661.     _this.unbounded_;
  662.     return _this;
  663.   }
  664.  
  665.   /**
  666.    * @param {!Element} root
  667.    * @param {{isUnbounded: (boolean|undefined)}=} options
  668.    * @return {!MDCRipple}
  669.    */
  670.  
  671.  
  672.   _createClass(MDCRipple, [{
  673.     key: 'setUnbounded_',
  674.  
  675.  
  676.     /**
  677.      * Closure Compiler throws an access control error when directly accessing a
  678.      * protected or private property inside a getter/setter, like unbounded above.
  679.      * By accessing the protected property inside a method, we solve that problem.
  680.      * That's why this function exists.
  681.      * @private
  682.      */
  683.     value: function setUnbounded_() {
  684.       this.foundation_.setUnbounded(this.unbounded_);
  685.     }
  686.   }, {
  687.     key: 'activate',
  688.     value: function activate() {
  689.       this.foundation_.activate();
  690.     }
  691.   }, {
  692.     key: 'deactivate',
  693.     value: function deactivate() {
  694.       this.foundation_.deactivate();
  695.     }
  696.   }, {
  697.     key: 'layout',
  698.     value: function layout() {
  699.       this.foundation_.layout();
  700.     }
  701.  
  702.     /**
  703.      * @return {!MDCRippleFoundation}
  704.      * @override
  705.      */
  706.  
  707.   }, {
  708.     key: 'getDefaultFoundation',
  709.     value: function getDefaultFoundation() {
  710.       return new _foundation2.default(MDCRipple.createAdapter(this));
  711.     }
  712.  
  713.     /** @override */
  714.  
  715.   }, {
  716.     key: 'initialSyncWithDOM',
  717.     value: function initialSyncWithDOM() {
  718.       this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset;
  719.     }
  720.   }, {
  721.     key: 'unbounded',
  722.  
  723.  
  724.     /** @return {boolean} */
  725.     get: function get() {
  726.       return this.unbounded_;
  727.     }
  728.  
  729.     /** @param {boolean} unbounded */
  730.     ,
  731.     set: function set(unbounded) {
  732.       this.unbounded_ = Boolean(unbounded);
  733.       this.setUnbounded_();
  734.     }
  735.   }], [{
  736.     key: 'attachTo',
  737.     value: function attachTo(root) {
  738.       var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  739.           _ref2$isUnbounded = _ref2.isUnbounded,
  740.           isUnbounded = _ref2$isUnbounded === undefined ? undefined : _ref2$isUnbounded;
  741.  
  742.       var ripple = new MDCRipple(root);
  743.       // Only override unbounded behavior if option is explicitly specified
  744.       if (isUnbounded !== undefined) {
  745.         ripple.unbounded = /** @type {boolean} */isUnbounded;
  746.       }
  747.       return ripple;
  748.     }
  749.  
  750.     /**
  751.      * @param {!RippleCapableSurface} instance
  752.      * @return {!MDCRippleAdapter}
  753.      */
  754.  
  755.   }, {
  756.     key: 'createAdapter',
  757.     value: function createAdapter(instance) {
  758.       var MATCHES = util.getMatchesProperty(HTMLElement.prototype);
  759.  
  760.       return {
  761.         browserSupportsCssVars: function browserSupportsCssVars() {
  762.           return util.supportsCssVariables(window);
  763.         },
  764.         isUnbounded: function isUnbounded() {
  765.           return instance.unbounded;
  766.         },
  767.         isSurfaceActive: function isSurfaceActive() {
  768.           return instance.root_[MATCHES](':active');
  769.         },
  770.         isSurfaceDisabled: function isSurfaceDisabled() {
  771.           return instance.disabled;
  772.         },
  773.         addClass: function addClass(className) {
  774.           return instance.root_.classList.add(className);
  775.         },
  776.         removeClass: function removeClass(className) {
  777.           return instance.root_.classList.remove(className);
  778.         },
  779.         containsEventTarget: function containsEventTarget(target) {
  780.           return instance.root_.contains(target);
  781.         },
  782.         registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  783.           return instance.root_.addEventListener(evtType, handler, util.applyPassive());
  784.         },
  785.         deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  786.           return instance.root_.removeEventListener(evtType, handler, util.applyPassive());
  787.         },
  788.         registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  789.           return document.documentElement.addEventListener(evtType, handler, util.applyPassive());
  790.         },
  791.         deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  792.           return document.documentElement.removeEventListener(evtType, handler, util.applyPassive());
  793.         },
  794.         registerResizeHandler: function registerResizeHandler(handler) {
  795.           return window.addEventListener('resize', handler);
  796.         },
  797.         deregisterResizeHandler: function deregisterResizeHandler(handler) {
  798.           return window.removeEventListener('resize', handler);
  799.         },
  800.         updateCssVariable: function updateCssVariable(varName, value) {
  801.           return instance.root_.style.setProperty(varName, value);
  802.         },
  803.         computeBoundingRect: function computeBoundingRect() {
  804.           return instance.root_.getBoundingClientRect();
  805.         },
  806.         getWindowPageOffset: function getWindowPageOffset() {
  807.           return { x: window.pageXOffset, y: window.pageYOffset };
  808.         }
  809.       };
  810.     }
  811.   }]);
  812.  
  813.   return MDCRipple;
  814. }(_component2.default);
  815.  
  816. /**
  817.  * See Material Design spec for more details on when to use ripples.
  818.  * https://material.io/guidelines/motion/choreography.html#choreography-creation
  819.  * @record
  820.  */
  821.  
  822.  
  823. var RippleCapableSurface = function RippleCapableSurface() {
  824.   _classCallCheck(this, RippleCapableSurface);
  825. };
  826.  
  827. /** @protected {!Element} */
  828.  
  829.  
  830. RippleCapableSurface.prototype.root_;
  831.  
  832. /**
  833.  * Whether or not the ripple bleeds out of the bounds of the element.
  834.  * @type {boolean|undefined}
  835.  */
  836. RippleCapableSurface.prototype.unbounded;
  837.  
  838. /**
  839.  * Whether or not the ripple is attached to a disabled component.
  840.  * @type {boolean|undefined}
  841.  */
  842. RippleCapableSurface.prototype.disabled;
  843.  
  844. exports.MDCRipple = MDCRipple;
  845. exports.MDCRippleFoundation = _foundation2.default;
  846. exports.RippleCapableSurface = RippleCapableSurface;
  847. exports.util = util;
  848.  
  849. /***/ }),
  850. /* 7 */
  851. /***/ (function(module, exports, __webpack_require__) {
  852.  
  853. "use strict";
  854.  
  855.  
  856. Object.defineProperty(exports, "__esModule", {
  857.   value: true
  858. });
  859.  
  860. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
  861.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * @license
  862.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * Copyright 2016 Google Inc.
  863.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       *
  864.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * Permission is hereby granted, free of charge, to any person obtaining a copy
  865.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * of this software and associated documentation files (the "Software"), to deal
  866.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * in the Software without restriction, including without limitation the rights
  867.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  868.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * copies of the Software, and to permit persons to whom the Software is
  869.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * furnished to do so, subject to the following conditions:
  870.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       *
  871.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * The above copyright notice and this permission notice shall be included in
  872.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * all copies or substantial portions of the Software.
  873.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       *
  874.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  875.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  876.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  877.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  878.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  879.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  880.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       * THE SOFTWARE.
  881.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       */
  882.  
  883. var _foundation = __webpack_require__(0);
  884.  
  885. var _foundation2 = _interopRequireDefault(_foundation);
  886.  
  887. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  888.  
  889. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  890.  
  891. /**
  892.  * @template F
  893.  */
  894. var MDCComponent = function () {
  895.   _createClass(MDCComponent, null, [{
  896.     key: 'attachTo',
  897.  
  898.     /**
  899.      * @param {!Element} root
  900.      * @return {!MDCComponent}
  901.      */
  902.     value: function attachTo(root) {
  903.       // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
  904.       // returns an instantiated component with its root set to that element. Also note that in the cases of
  905.       // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
  906.       // from getDefaultFoundation().
  907.       return new MDCComponent(root, new _foundation2.default());
  908.     }
  909.  
  910.     /**
  911.      * @param {!Element} root
  912.      * @param {F=} foundation
  913.      * @param {...?} args
  914.      */
  915.  
  916.   }]);
  917.  
  918.   function MDCComponent(root) {
  919.     var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
  920.  
  921.     _classCallCheck(this, MDCComponent);
  922.  
  923.     /** @protected {!Element} */
  924.     this.root_ = root;
  925.  
  926.     for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  927.       args[_key - 2] = arguments[_key];
  928.     }
  929.  
  930.     this.initialize.apply(this, args);
  931.     // Note that we initialize foundation here and not within the constructor's default param so that
  932.     // this.root_ is defined and can be used within the foundation class.
  933.     /** @protected {!F} */
  934.     this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
  935.     this.foundation_.init();
  936.     this.initialSyncWithDOM();
  937.   }
  938.  
  939.   _createClass(MDCComponent, [{
  940.     key: 'initialize',
  941.     value: function initialize() /* ...args */{}
  942.     // Subclasses can override this to do any additional setup work that would be considered part of a
  943.     // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
  944.     // initialized. Any additional arguments besides root and foundation will be passed in here.
  945.  
  946.  
  947.     /**
  948.      * @return {!F} foundation
  949.      */
  950.  
  951.   }, {
  952.     key: 'getDefaultFoundation',
  953.     value: function getDefaultFoundation() {
  954.       // Subclasses must override this method to return a properly configured foundation class for the
  955.       // component.
  956.       throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
  957.     }
  958.   }, {
  959.     key: 'initialSyncWithDOM',
  960.     value: function initialSyncWithDOM() {
  961.       // Subclasses should override this method if they need to perform work to synchronize with a host DOM
  962.       // object. An example of this would be a form control wrapper that needs to synchronize its internal state
  963.       // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
  964.       // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
  965.     }
  966.   }, {
  967.     key: 'destroy',
  968.     value: function destroy() {
  969.       // Subclasses may implement this method to release any resources / deregister any listeners they have
  970.       // attached. An example of this might be deregistering a resize event from the window object.
  971.       this.foundation_.destroy();
  972.     }
  973.  
  974.     /**
  975.      * Wrapper method to add an event listener to the component's root element. This is most useful when
  976.      * listening for custom events.
  977.      * @param {string} evtType
  978.      * @param {!Function} handler
  979.      */
  980.  
  981.   }, {
  982.     key: 'listen',
  983.     value: function listen(evtType, handler) {
  984.       this.root_.addEventListener(evtType, handler);
  985.     }
  986.  
  987.     /**
  988.      * Wrapper method to remove an event listener to the component's root element. This is most useful when
  989.      * unlistening for custom events.
  990.      * @param {string} evtType
  991.      * @param {!Function} handler
  992.      */
  993.  
  994.   }, {
  995.     key: 'unlisten',
  996.     value: function unlisten(evtType, handler) {
  997.       this.root_.removeEventListener(evtType, handler);
  998.     }
  999.  
  1000.     /**
  1001.      * Fires a cross-browser-compatible custom event from the component root of the given type,
  1002.      * with the given data.
  1003.      * @param {string} evtType
  1004.      * @param {!Object} evtData
  1005.      * @param {boolean=} shouldBubble
  1006.      */
  1007.  
  1008.   }, {
  1009.     key: 'emit',
  1010.     value: function emit(evtType, evtData) {
  1011.       var shouldBubble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1012.  
  1013.       var evt = void 0;
  1014.       if (typeof CustomEvent === 'function') {
  1015.         evt = new CustomEvent(evtType, {
  1016.           detail: evtData,
  1017.           bubbles: shouldBubble
  1018.         });
  1019.       } else {
  1020.         evt = document.createEvent('CustomEvent');
  1021.         evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  1022.       }
  1023.  
  1024.       this.root_.dispatchEvent(evt);
  1025.     }
  1026.   }]);
  1027.  
  1028.   return MDCComponent;
  1029. }();
  1030.  
  1031. exports.default = MDCComponent;
  1032.  
  1033. /***/ }),
  1034. /* 8 */
  1035. /***/ (function(module, exports, __webpack_require__) {
  1036.  
  1037. "use strict";
  1038.  
  1039.  
  1040. Object.defineProperty(exports, "__esModule", {
  1041.   value: true
  1042. });
  1043.  
  1044. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1045.  
  1046. var _foundation = __webpack_require__(0);
  1047.  
  1048. var _foundation2 = _interopRequireDefault(_foundation);
  1049.  
  1050. var _adapter = __webpack_require__(1);
  1051.  
  1052. var _adapter2 = _interopRequireDefault(_adapter);
  1053.  
  1054. var _constants = __webpack_require__(9);
  1055.  
  1056. var _util = __webpack_require__(2);
  1057.  
  1058. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1059.  
  1060. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1061.  
  1062. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1063.  
  1064. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
  1065.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * @license
  1066.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * Copyright 2016 Google Inc.
  1067.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
  1068.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * Permission is hereby granted, free of charge, to any person obtaining a copy
  1069.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * of this software and associated documentation files (the "Software"), to deal
  1070.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * in the Software without restriction, including without limitation the rights
  1071.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1072.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * copies of the Software, and to permit persons to whom the Software is
  1073.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * furnished to do so, subject to the following conditions:
  1074.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
  1075.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * The above copyright notice and this permission notice shall be included in
  1076.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * all copies or substantial portions of the Software.
  1077.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 *
  1078.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1079.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1080.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1081.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1082.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1083.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1084.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * THE SOFTWARE.
  1085.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
  1086.  
  1087. /**
  1088.  * @typedef {{
  1089.  *   isActivated: (boolean|undefined),
  1090.  *   hasDeactivationUXRun: (boolean|undefined),
  1091.  *   wasActivatedByPointer: (boolean|undefined),
  1092.  *   wasElementMadeActive: (boolean|undefined),
  1093.  *   activationEvent: (!Event|undefined),
  1094.  *   isProgrammatic: (boolean|undefined)
  1095.  * }}
  1096.  */
  1097. var ActivationStateType = void 0;
  1098.  
  1099. /**
  1100.  * @typedef {{
  1101.  *   activate: (string|undefined),
  1102.  *   deactivate: (string|undefined),
  1103.  *   focus: (string|undefined),
  1104.  *   blur: (string|undefined)
  1105.  * }}
  1106.  */
  1107. var ListenerInfoType = void 0;
  1108.  
  1109. /**
  1110.  * @typedef {{
  1111.  *   activate: function(!Event),
  1112.  *   deactivate: function(!Event=),
  1113.  *   focus: function(),
  1114.  *   blur: function()
  1115.  * }}
  1116.  */
  1117. var ListenersType = void 0;
  1118.  
  1119. /**
  1120.  * @typedef {{
  1121.  *   x: number,
  1122.  *   y: number
  1123.  * }}
  1124.  */
  1125. var PointType = void 0;
  1126.  
  1127. // Activation events registered on the root element of each instance for activation
  1128. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  1129.  
  1130. // Deactivation events registered on documentElement when a pointer-related down event occurs
  1131. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup'];
  1132.  
  1133. // Tracks activations that have occurred on the current frame, to avoid simultaneous nested activations
  1134. /** @type {!Array<!EventTarget>} */
  1135. var activatedTargets = [];
  1136.  
  1137. /**
  1138.  * @extends {MDCFoundation<!MDCRippleAdapter>}
  1139.  */
  1140.  
  1141. var MDCRippleFoundation = function (_MDCFoundation) {
  1142.   _inherits(MDCRippleFoundation, _MDCFoundation);
  1143.  
  1144.   _createClass(MDCRippleFoundation, null, [{
  1145.     key: 'cssClasses',
  1146.     get: function get() {
  1147.       return _constants.cssClasses;
  1148.     }
  1149.   }, {
  1150.     key: 'strings',
  1151.     get: function get() {
  1152.       return _constants.strings;
  1153.     }
  1154.   }, {
  1155.     key: 'numbers',
  1156.     get: function get() {
  1157.       return _constants.numbers;
  1158.     }
  1159.   }, {
  1160.     key: 'defaultAdapter',
  1161.     get: function get() {
  1162.       return {
  1163.         browserSupportsCssVars: function browserSupportsCssVars() /* boolean - cached */{},
  1164.         isUnbounded: function isUnbounded() /* boolean */{},
  1165.         isSurfaceActive: function isSurfaceActive() /* boolean */{},
  1166.         isSurfaceDisabled: function isSurfaceDisabled() /* boolean */{},
  1167.         addClass: function addClass() /* className: string */{},
  1168.         removeClass: function removeClass() /* className: string */{},
  1169.         containsEventTarget: function containsEventTarget() /* target: !EventTarget */{},
  1170.         registerInteractionHandler: function registerInteractionHandler() /* evtType: string, handler: EventListener */{},
  1171.         deregisterInteractionHandler: function deregisterInteractionHandler() /* evtType: string, handler: EventListener */{},
  1172.         registerDocumentInteractionHandler: function registerDocumentInteractionHandler() /* evtType: string, handler: EventListener */{},
  1173.         deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() /* evtType: string, handler: EventListener */{},
  1174.         registerResizeHandler: function registerResizeHandler() /* handler: EventListener */{},
  1175.         deregisterResizeHandler: function deregisterResizeHandler() /* handler: EventListener */{},
  1176.         updateCssVariable: function updateCssVariable() /* varName: string, value: string */{},
  1177.         computeBoundingRect: function computeBoundingRect() /* ClientRect */{},
  1178.         getWindowPageOffset: function getWindowPageOffset() /* {x: number, y: number} */{}
  1179.       };
  1180.     }
  1181.   }]);
  1182.  
  1183.   function MDCRippleFoundation(adapter) {
  1184.     _classCallCheck(this, MDCRippleFoundation);
  1185.  
  1186.     /** @private {number} */
  1187.     var _this = _possibleConstructorReturn(this, (MDCRippleFoundation.__proto__ || Object.getPrototypeOf(MDCRippleFoundation)).call(this, Object.assign(MDCRippleFoundation.defaultAdapter, adapter)));
  1188.  
  1189.     _this.layoutFrame_ = 0;
  1190.  
  1191.     /** @private {!ClientRect} */
  1192.     _this.frame_ = /** @type {!ClientRect} */{ width: 0, height: 0 };
  1193.  
  1194.     /** @private {!ActivationStateType} */
  1195.     _this.activationState_ = _this.defaultActivationState_();
  1196.  
  1197.     /** @private {number} */
  1198.     _this.initialSize_ = 0;
  1199.  
  1200.     /** @private {number} */
  1201.     _this.maxRadius_ = 0;
  1202.  
  1203.     /** @private {function(!Event)} */
  1204.     _this.activateHandler_ = function (e) {
  1205.       return _this.activate_(e);
  1206.     };
  1207.  
  1208.     /** @private {function(!Event=)} */
  1209.     _this.deactivateHandler_ = function () {
  1210.       return _this.deactivate_();
  1211.     };
  1212.  
  1213.     /** @private {function(!Event=)} */
  1214.     _this.focusHandler_ = function () {
  1215.       return _this.handleFocus();
  1216.     };
  1217.  
  1218.     /** @private {function(!Event=)} */
  1219.     _this.blurHandler_ = function () {
  1220.       return _this.handleBlur();
  1221.     };
  1222.  
  1223.     /** @private {!Function} */
  1224.     _this.resizeHandler_ = function () {
  1225.       return _this.layout();
  1226.     };
  1227.  
  1228.     /** @private {{left: number, top:number}} */
  1229.     _this.unboundedCoords_ = {
  1230.       left: 0,
  1231.       top: 0
  1232.     };
  1233.  
  1234.     /** @private {number} */
  1235.     _this.fgScale_ = 0;
  1236.  
  1237.     /** @private {number} */
  1238.     _this.activationTimer_ = 0;
  1239.  
  1240.     /** @private {number} */
  1241.     _this.fgDeactivationRemovalTimer_ = 0;
  1242.  
  1243.     /** @private {boolean} */
  1244.     _this.activationAnimationHasEnded_ = false;
  1245.  
  1246.     /** @private {!Function} */
  1247.     _this.activationTimerCallback_ = function () {
  1248.       _this.activationAnimationHasEnded_ = true;
  1249.       _this.runDeactivationUXLogicIfReady_();
  1250.     };
  1251.  
  1252.     /** @private {!Event|undefined} */
  1253.     _this.previousActivationEvent_;
  1254.     return _this;
  1255.   }
  1256.  
  1257.   /**
  1258.    * We compute this property so that we are not querying information about the client
  1259.    * until the point in time where the foundation requests it. This prevents scenarios where
  1260.    * client-side feature-detection may happen too early, such as when components are rendered on the server
  1261.    * and then initialized at mount time on the client.
  1262.    * @return {boolean}
  1263.    * @private
  1264.    */
  1265.  
  1266.  
  1267.   _createClass(MDCRippleFoundation, [{
  1268.     key: 'supportsPressRipple_',
  1269.     value: function supportsPressRipple_() {
  1270.       return this.adapter_.browserSupportsCssVars();
  1271.     }
  1272.  
  1273.     /**
  1274.      * @return {!ActivationStateType}
  1275.      */
  1276.  
  1277.   }, {
  1278.     key: 'defaultActivationState_',
  1279.     value: function defaultActivationState_() {
  1280.       return {
  1281.         isActivated: false,
  1282.         hasDeactivationUXRun: false,
  1283.         wasActivatedByPointer: false,
  1284.         wasElementMadeActive: false,
  1285.         activationEvent: undefined,
  1286.         isProgrammatic: false
  1287.       };
  1288.     }
  1289.  
  1290.     /** @override */
  1291.  
  1292.   }, {
  1293.     key: 'init',
  1294.     value: function init() {
  1295.       var _this2 = this;
  1296.  
  1297.       var supportsPressRipple = this.supportsPressRipple_();
  1298.  
  1299.       this.registerRootHandlers_(supportsPressRipple);
  1300.  
  1301.       if (supportsPressRipple) {
  1302.         var _MDCRippleFoundation$ = MDCRippleFoundation.cssClasses,
  1303.             ROOT = _MDCRippleFoundation$.ROOT,
  1304.             UNBOUNDED = _MDCRippleFoundation$.UNBOUNDED;
  1305.  
  1306.         requestAnimationFrame(function () {
  1307.           _this2.adapter_.addClass(ROOT);
  1308.           if (_this2.adapter_.isUnbounded()) {
  1309.             _this2.adapter_.addClass(UNBOUNDED);
  1310.             // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
  1311.             _this2.layoutInternal_();
  1312.           }
  1313.         });
  1314.       }
  1315.     }
  1316.  
  1317.     /** @override */
  1318.  
  1319.   }, {
  1320.     key: 'destroy',
  1321.     value: function destroy() {
  1322.       var _this3 = this;
  1323.  
  1324.       if (this.supportsPressRipple_()) {
  1325.         if (this.activationTimer_) {
  1326.           clearTimeout(this.activationTimer_);
  1327.           this.activationTimer_ = 0;
  1328.           this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  1329.         }
  1330.  
  1331.         if (this.fgDeactivationRemovalTimer_) {
  1332.           clearTimeout(this.fgDeactivationRemovalTimer_);
  1333.           this.fgDeactivationRemovalTimer_ = 0;
  1334.           this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  1335.         }
  1336.  
  1337.         var _MDCRippleFoundation$2 = MDCRippleFoundation.cssClasses,
  1338.             ROOT = _MDCRippleFoundation$2.ROOT,
  1339.             UNBOUNDED = _MDCRippleFoundation$2.UNBOUNDED;
  1340.  
  1341.         requestAnimationFrame(function () {
  1342.           _this3.adapter_.removeClass(ROOT);
  1343.           _this3.adapter_.removeClass(UNBOUNDED);
  1344.           _this3.removeCssVars_();
  1345.         });
  1346.       }
  1347.  
  1348.       this.deregisterRootHandlers_();
  1349.       this.deregisterDeactivationHandlers_();
  1350.     }
  1351.  
  1352.     /**
  1353.      * @param {boolean} supportsPressRipple Passed from init to save a redundant function call
  1354.      * @private
  1355.      */
  1356.  
  1357.   }, {
  1358.     key: 'registerRootHandlers_',
  1359.     value: function registerRootHandlers_(supportsPressRipple) {
  1360.       var _this4 = this;
  1361.  
  1362.       if (supportsPressRipple) {
  1363.         ACTIVATION_EVENT_TYPES.forEach(function (type) {
  1364.           _this4.adapter_.registerInteractionHandler(type, _this4.activateHandler_);
  1365.         });
  1366.         if (this.adapter_.isUnbounded()) {
  1367.           this.adapter_.registerResizeHandler(this.resizeHandler_);
  1368.         }
  1369.       }
  1370.  
  1371.       this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  1372.       this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  1373.     }
  1374.  
  1375.     /**
  1376.      * @param {!Event} e
  1377.      * @private
  1378.      */
  1379.  
  1380.   }, {
  1381.     key: 'registerDeactivationHandlers_',
  1382.     value: function registerDeactivationHandlers_(e) {
  1383.       var _this5 = this;
  1384.  
  1385.       if (e.type === 'keydown') {
  1386.         this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
  1387.       } else {
  1388.         POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) {
  1389.           _this5.adapter_.registerDocumentInteractionHandler(type, _this5.deactivateHandler_);
  1390.         });
  1391.       }
  1392.     }
  1393.  
  1394.     /** @private */
  1395.  
  1396.   }, {
  1397.     key: 'deregisterRootHandlers_',
  1398.     value: function deregisterRootHandlers_() {
  1399.       var _this6 = this;
  1400.  
  1401.       ACTIVATION_EVENT_TYPES.forEach(function (type) {
  1402.         _this6.adapter_.deregisterInteractionHandler(type, _this6.activateHandler_);
  1403.       });
  1404.       this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  1405.       this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  1406.  
  1407.       if (this.adapter_.isUnbounded()) {
  1408.         this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  1409.       }
  1410.     }
  1411.  
  1412.     /** @private */
  1413.  
  1414.   }, {
  1415.     key: 'deregisterDeactivationHandlers_',
  1416.     value: function deregisterDeactivationHandlers_() {
  1417.       var _this7 = this;
  1418.  
  1419.       this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
  1420.       POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) {
  1421.         _this7.adapter_.deregisterDocumentInteractionHandler(type, _this7.deactivateHandler_);
  1422.       });
  1423.     }
  1424.  
  1425.     /** @private */
  1426.  
  1427.   }, {
  1428.     key: 'removeCssVars_',
  1429.     value: function removeCssVars_() {
  1430.       var _this8 = this;
  1431.  
  1432.       var strings = MDCRippleFoundation.strings;
  1433.  
  1434.       Object.keys(strings).forEach(function (k) {
  1435.         if (k.indexOf('VAR_') === 0) {
  1436.           _this8.adapter_.updateCssVariable(strings[k], null);
  1437.         }
  1438.       });
  1439.     }
  1440.  
  1441.     /**
  1442.      * @param {!Event=} e
  1443.      * @private
  1444.      */
  1445.  
  1446.   }, {
  1447.     key: 'activate_',
  1448.     value: function activate_(e) {
  1449.       var _this9 = this;
  1450.  
  1451.       if (this.adapter_.isSurfaceDisabled()) {
  1452.         return;
  1453.       }
  1454.  
  1455.       var activationState = this.activationState_;
  1456.       if (activationState.isActivated) {
  1457.         return;
  1458.       }
  1459.  
  1460.       // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
  1461.       var previousActivationEvent = this.previousActivationEvent_;
  1462.       var isSameInteraction = previousActivationEvent && e !== undefined && previousActivationEvent.type !== e.type;
  1463.       if (isSameInteraction) {
  1464.         return;
  1465.       }
  1466.  
  1467.       activationState.isActivated = true;
  1468.       activationState.isProgrammatic = e === undefined;
  1469.       activationState.activationEvent = e;
  1470.       activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : e !== undefined && (e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown');
  1471.  
  1472.       var hasActivatedChild = e !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  1473.         return _this9.adapter_.containsEventTarget(target);
  1474.       });
  1475.       if (hasActivatedChild) {
  1476.         // Immediately reset activation state, while preserving logic that prevents touch follow-on events
  1477.         this.resetActivationState_();
  1478.         return;
  1479.       }
  1480.  
  1481.       if (e !== undefined) {
  1482.         activatedTargets.push( /** @type {!EventTarget} */e.target);
  1483.         this.registerDeactivationHandlers_(e);
  1484.       }
  1485.  
  1486.       activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
  1487.       if (activationState.wasElementMadeActive) {
  1488.         this.animateActivation_();
  1489.       }
  1490.  
  1491.       requestAnimationFrame(function () {
  1492.         // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
  1493.         activatedTargets = [];
  1494.  
  1495.         if (!activationState.wasElementMadeActive && e !== undefined && (e.key === ' ' || e.keyCode === 32)) {
  1496.           // If space was pressed, try again within an rAF call to detect :active, because different UAs report
  1497.           // active states inconsistently when they're called within event handling code:
  1498.           // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  1499.           // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  1500.           // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
  1501.           // variable is set within a rAF callback for a submit button interaction (#2241).
  1502.           activationState.wasElementMadeActive = _this9.checkElementMadeActive_(e);
  1503.           if (activationState.wasElementMadeActive) {
  1504.             _this9.animateActivation_();
  1505.           }
  1506.         }
  1507.  
  1508.         if (!activationState.wasElementMadeActive) {
  1509.           // Reset activation state immediately if element was not made active.
  1510.           _this9.activationState_ = _this9.defaultActivationState_();
  1511.         }
  1512.       });
  1513.     }
  1514.  
  1515.     /**
  1516.      * @param {!Event=} e
  1517.      * @private
  1518.      */
  1519.  
  1520.   }, {
  1521.     key: 'checkElementMadeActive_',
  1522.     value: function checkElementMadeActive_(e) {
  1523.       return e !== undefined && e.type === 'keydown' ? this.adapter_.isSurfaceActive() : true;
  1524.     }
  1525.  
  1526.     /**
  1527.      * @param {!Event=} event Optional event containing position information.
  1528.      */
  1529.  
  1530.   }, {
  1531.     key: 'activate',
  1532.     value: function activate(event) {
  1533.       this.activate_(event);
  1534.     }
  1535.  
  1536.     /** @private */
  1537.  
  1538.   }, {
  1539.     key: 'animateActivation_',
  1540.     value: function animateActivation_() {
  1541.       var _this10 = this;
  1542.  
  1543.       var _MDCRippleFoundation$3 = MDCRippleFoundation.strings,
  1544.           VAR_FG_TRANSLATE_START = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_START,
  1545.           VAR_FG_TRANSLATE_END = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_END;
  1546.       var _MDCRippleFoundation$4 = MDCRippleFoundation.cssClasses,
  1547.           FG_DEACTIVATION = _MDCRippleFoundation$4.FG_DEACTIVATION,
  1548.           FG_ACTIVATION = _MDCRippleFoundation$4.FG_ACTIVATION;
  1549.       var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  1550.  
  1551.  
  1552.       this.layoutInternal_();
  1553.  
  1554.       var translateStart = '';
  1555.       var translateEnd = '';
  1556.  
  1557.       if (!this.adapter_.isUnbounded()) {
  1558.         var _getFgTranslationCoor = this.getFgTranslationCoordinates_(),
  1559.             startPoint = _getFgTranslationCoor.startPoint,
  1560.             endPoint = _getFgTranslationCoor.endPoint;
  1561.  
  1562.         translateStart = startPoint.x + 'px, ' + startPoint.y + 'px';
  1563.         translateEnd = endPoint.x + 'px, ' + endPoint.y + 'px';
  1564.       }
  1565.  
  1566.       this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  1567.       this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  1568.       // Cancel any ongoing activation/deactivation animations
  1569.       clearTimeout(this.activationTimer_);
  1570.       clearTimeout(this.fgDeactivationRemovalTimer_);
  1571.       this.rmBoundedActivationClasses_();
  1572.       this.adapter_.removeClass(FG_DEACTIVATION);
  1573.  
  1574.       // Force layout in order to re-trigger the animation.
  1575.       this.adapter_.computeBoundingRect();
  1576.       this.adapter_.addClass(FG_ACTIVATION);
  1577.       this.activationTimer_ = setTimeout(function () {
  1578.         return _this10.activationTimerCallback_();
  1579.       }, DEACTIVATION_TIMEOUT_MS);
  1580.     }
  1581.  
  1582.     /**
  1583.      * @private
  1584.      * @return {{startPoint: PointType, endPoint: PointType}}
  1585.      */
  1586.  
  1587.   }, {
  1588.     key: 'getFgTranslationCoordinates_',
  1589.     value: function getFgTranslationCoordinates_() {
  1590.       var _activationState_ = this.activationState_,
  1591.           activationEvent = _activationState_.activationEvent,
  1592.           wasActivatedByPointer = _activationState_.wasActivatedByPointer;
  1593.  
  1594.  
  1595.       var startPoint = void 0;
  1596.       if (wasActivatedByPointer) {
  1597.         startPoint = (0, _util.getNormalizedEventCoords)(
  1598.         /** @type {!Event} */activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
  1599.       } else {
  1600.         startPoint = {
  1601.           x: this.frame_.width / 2,
  1602.           y: this.frame_.height / 2
  1603.         };
  1604.       }
  1605.       // Center the element around the start point.
  1606.       startPoint = {
  1607.         x: startPoint.x - this.initialSize_ / 2,
  1608.         y: startPoint.y - this.initialSize_ / 2
  1609.       };
  1610.  
  1611.       var endPoint = {
  1612.         x: this.frame_.width / 2 - this.initialSize_ / 2,
  1613.         y: this.frame_.height / 2 - this.initialSize_ / 2
  1614.       };
  1615.  
  1616.       return { startPoint: startPoint, endPoint: endPoint };
  1617.     }
  1618.  
  1619.     /** @private */
  1620.  
  1621.   }, {
  1622.     key: 'runDeactivationUXLogicIfReady_',
  1623.     value: function runDeactivationUXLogicIfReady_() {
  1624.       var _this11 = this;
  1625.  
  1626.       // This method is called both when a pointing device is released, and when the activation animation ends.
  1627.       // The deactivation animation should only run after both of those occur.
  1628.       var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  1629.       var _activationState_2 = this.activationState_,
  1630.           hasDeactivationUXRun = _activationState_2.hasDeactivationUXRun,
  1631.           isActivated = _activationState_2.isActivated;
  1632.  
  1633.       var activationHasEnded = hasDeactivationUXRun || !isActivated;
  1634.  
  1635.       if (activationHasEnded && this.activationAnimationHasEnded_) {
  1636.         this.rmBoundedActivationClasses_();
  1637.         this.adapter_.addClass(FG_DEACTIVATION);
  1638.         this.fgDeactivationRemovalTimer_ = setTimeout(function () {
  1639.           _this11.adapter_.removeClass(FG_DEACTIVATION);
  1640.         }, _constants.numbers.FG_DEACTIVATION_MS);
  1641.       }
  1642.     }
  1643.  
  1644.     /** @private */
  1645.  
  1646.   }, {
  1647.     key: 'rmBoundedActivationClasses_',
  1648.     value: function rmBoundedActivationClasses_() {
  1649.       var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  1650.  
  1651.       this.adapter_.removeClass(FG_ACTIVATION);
  1652.       this.activationAnimationHasEnded_ = false;
  1653.       this.adapter_.computeBoundingRect();
  1654.     }
  1655.   }, {
  1656.     key: 'resetActivationState_',
  1657.     value: function resetActivationState_() {
  1658.       var _this12 = this;
  1659.  
  1660.       this.previousActivationEvent_ = this.activationState_.activationEvent;
  1661.       this.activationState_ = this.defaultActivationState_();
  1662.       // Touch devices may fire additional events for the same interaction within a short time.
  1663.       // Store the previous event until it's safe to assume that subsequent events are for new interactions.
  1664.       setTimeout(function () {
  1665.         return _this12.previousActivationEvent_ = undefined;
  1666.       }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  1667.     }
  1668.  
  1669.     /**
  1670.      * @private
  1671.      */
  1672.  
  1673.   }, {
  1674.     key: 'deactivate_',
  1675.     value: function deactivate_() {
  1676.       var _this13 = this;
  1677.  
  1678.       var activationState = this.activationState_;
  1679.       // This can happen in scenarios such as when you have a keyup event that blurs the element.
  1680.       if (!activationState.isActivated) {
  1681.         return;
  1682.       }
  1683.  
  1684.       var state = /** @type {!ActivationStateType} */Object.assign({}, activationState);
  1685.  
  1686.       if (activationState.isProgrammatic) {
  1687.         requestAnimationFrame(function () {
  1688.           return _this13.animateDeactivation_(state);
  1689.         });
  1690.         this.resetActivationState_();
  1691.       } else {
  1692.         this.deregisterDeactivationHandlers_();
  1693.         requestAnimationFrame(function () {
  1694.           _this13.activationState_.hasDeactivationUXRun = true;
  1695.           _this13.animateDeactivation_(state);
  1696.           _this13.resetActivationState_();
  1697.         });
  1698.       }
  1699.     }
  1700.   }, {
  1701.     key: 'deactivate',
  1702.     value: function deactivate() {
  1703.       this.deactivate_();
  1704.     }
  1705.  
  1706.     /**
  1707.      * @param {!ActivationStateType} options
  1708.      * @private
  1709.      */
  1710.  
  1711.   }, {
  1712.     key: 'animateDeactivation_',
  1713.     value: function animateDeactivation_(_ref) {
  1714.       var wasActivatedByPointer = _ref.wasActivatedByPointer,
  1715.           wasElementMadeActive = _ref.wasElementMadeActive;
  1716.  
  1717.       if (wasActivatedByPointer || wasElementMadeActive) {
  1718.         this.runDeactivationUXLogicIfReady_();
  1719.       }
  1720.     }
  1721.   }, {
  1722.     key: 'layout',
  1723.     value: function layout() {
  1724.       var _this14 = this;
  1725.  
  1726.       if (this.layoutFrame_) {
  1727.         cancelAnimationFrame(this.layoutFrame_);
  1728.       }
  1729.       this.layoutFrame_ = requestAnimationFrame(function () {
  1730.         _this14.layoutInternal_();
  1731.         _this14.layoutFrame_ = 0;
  1732.       });
  1733.     }
  1734.  
  1735.     /** @private */
  1736.  
  1737.   }, {
  1738.     key: 'layoutInternal_',
  1739.     value: function layoutInternal_() {
  1740.       var _this15 = this;
  1741.  
  1742.       this.frame_ = this.adapter_.computeBoundingRect();
  1743.       var maxDim = Math.max(this.frame_.height, this.frame_.width);
  1744.  
  1745.       // Surface diameter is treated differently for unbounded vs. bounded ripples.
  1746.       // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
  1747.       // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
  1748.       // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
  1749.       // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
  1750.       // `overflow: hidden`.
  1751.       var getBoundedRadius = function getBoundedRadius() {
  1752.         var hypotenuse = Math.sqrt(Math.pow(_this15.frame_.width, 2) + Math.pow(_this15.frame_.height, 2));
  1753.         return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  1754.       };
  1755.  
  1756.       this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
  1757.  
  1758.       // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
  1759.       this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  1760.       this.fgScale_ = this.maxRadius_ / this.initialSize_;
  1761.  
  1762.       this.updateLayoutCssVars_();
  1763.     }
  1764.  
  1765.     /** @private */
  1766.  
  1767.   }, {
  1768.     key: 'updateLayoutCssVars_',
  1769.     value: function updateLayoutCssVars_() {
  1770.       var _MDCRippleFoundation$5 = MDCRippleFoundation.strings,
  1771.           VAR_FG_SIZE = _MDCRippleFoundation$5.VAR_FG_SIZE,
  1772.           VAR_LEFT = _MDCRippleFoundation$5.VAR_LEFT,
  1773.           VAR_TOP = _MDCRippleFoundation$5.VAR_TOP,
  1774.           VAR_FG_SCALE = _MDCRippleFoundation$5.VAR_FG_SCALE;
  1775.  
  1776.  
  1777.       this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + 'px');
  1778.       this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
  1779.  
  1780.       if (this.adapter_.isUnbounded()) {
  1781.         this.unboundedCoords_ = {
  1782.           left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
  1783.           top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
  1784.         };
  1785.  
  1786.         this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + 'px');
  1787.         this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + 'px');
  1788.       }
  1789.     }
  1790.  
  1791.     /** @param {boolean} unbounded */
  1792.  
  1793.   }, {
  1794.     key: 'setUnbounded',
  1795.     value: function setUnbounded(unbounded) {
  1796.       var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  1797.  
  1798.       if (unbounded) {
  1799.         this.adapter_.addClass(UNBOUNDED);
  1800.       } else {
  1801.         this.adapter_.removeClass(UNBOUNDED);
  1802.       }
  1803.     }
  1804.   }, {
  1805.     key: 'handleFocus',
  1806.     value: function handleFocus() {
  1807.       var _this16 = this;
  1808.  
  1809.       requestAnimationFrame(function () {
  1810.         return _this16.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  1811.       });
  1812.     }
  1813.   }, {
  1814.     key: 'handleBlur',
  1815.     value: function handleBlur() {
  1816.       var _this17 = this;
  1817.  
  1818.       requestAnimationFrame(function () {
  1819.         return _this17.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  1820.       });
  1821.     }
  1822.   }]);
  1823.  
  1824.   return MDCRippleFoundation;
  1825. }(_foundation2.default);
  1826.  
  1827. exports.default = MDCRippleFoundation;
  1828.  
  1829. /***/ }),
  1830. /* 9 */
  1831. /***/ (function(module, exports, __webpack_require__) {
  1832.  
  1833. "use strict";
  1834.  
  1835.  
  1836. Object.defineProperty(exports, "__esModule", {
  1837.   value: true
  1838. });
  1839. /**
  1840.  * @license
  1841.  * Copyright 2016 Google Inc.
  1842.  *
  1843.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  1844.  * of this software and associated documentation files (the "Software"), to deal
  1845.  * in the Software without restriction, including without limitation the rights
  1846.  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1847.  * copies of the Software, and to permit persons to whom the Software is
  1848.  * furnished to do so, subject to the following conditions:
  1849.  *
  1850.  * The above copyright notice and this permission notice shall be included in
  1851.  * all copies or substantial portions of the Software.
  1852.  *
  1853.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1854.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1855.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1856.  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1857.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1858.  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1859.  * THE SOFTWARE.
  1860.  */
  1861.  
  1862. var cssClasses = {
  1863.   // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  1864.   // given that it's an 'upgrade' to an existing component. That being said it is the root
  1865.   // CSS class that all other CSS classes derive from.
  1866.   ROOT: 'mdc-ripple-upgraded',
  1867.   UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
  1868.   BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  1869.   FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  1870.   FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation'
  1871. };
  1872.  
  1873. var strings = {
  1874.   VAR_LEFT: '--mdc-ripple-left',
  1875.   VAR_TOP: '--mdc-ripple-top',
  1876.   VAR_FG_SIZE: '--mdc-ripple-fg-size',
  1877.   VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  1878.   VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  1879.   VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end'
  1880. };
  1881.  
  1882. var numbers = {
  1883.   PADDING: 10,
  1884.   INITIAL_ORIGIN_SCALE: 0.6,
  1885.   DEACTIVATION_TIMEOUT_MS: 225, // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration)
  1886.   FG_DEACTIVATION_MS: 150, // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration)
  1887.   TAP_DELAY_MS: 300 // Delay between touch and simulated mouse events on touch devices
  1888. };
  1889.  
  1890. exports.cssClasses = cssClasses;
  1891. exports.strings = strings;
  1892. exports.numbers = numbers;
  1893.  
  1894. /***/ })
  1895. /******/ ]);
Advertisement
Add Comment
Please, Sign In to add comment