text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@polymer/polymer/polymer-element.js")):"function"==typeof define&&define.amd?define(["exports","@polymer/polymer/polymer-element.js"],t):t((e=e||self).SimpleTimer={},e.polymerElement_js)}(this,function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e,t,n){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function u(){var e,t,n=(e=["\n      <style>\n        :host {\n          display: block;\n        }\n      </style>\n      [[_formattedTime]]\n    "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return u=function(){return n},n}var c=function(e){function c(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),o(this,i(c).apply(this,arguments))}var a,l,f;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(c,t.PolymerElement),a=c,f=[{key:"template",get:function(){return t.html(u())}},{key:"tag",get:function(){return"simple-timer"}},{key:"properties",get:function(){return{startTime:{type:Number,value:60},currentTime:{type:Number,notify:!0},isRunning:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},countUp:{type:Boolean,value:!1},_elapsedTime:{type:Number,value:0},_formattedTime:{type:String,value:"0"}}}}],(l=[{key:"ready",value:function(){s(i(c.prototype),"ready",this).call(this),this.countUp?(this.set("currentTime",0),this.set("_formattedTime","0")):(this.set("currentTime",this.startTime),this.set("_formattedTime",this.startTime.toString()))}},{key:"start",value:function(){(this.currentTime<=0&&!this.countUp||this.currentTime>=this.startTime&&this.countUp)&&(this.currentTime=this.countUp?this.startTime:0),this.startTime&&!this.isRunning?(this._elapsed=performance.now()/1e3,this.isRunning=!0,window.requestAnimationFrame(this._decreaseTimer.bind(this))):this.pause()}},{key:"pause",value:function(){this.isRunning=!1}},{key:"_decreaseTimer",value:function(e){if(this.isRunning){if(this.currentTime<=0&&!this.countUp||this.currentTime>=this.startTime&&this.countUp)return this.currentTime=this.countUp?this.startTime:0,this.pause(),void this.dispatchEvent(new CustomEvent("simple-timer-end",{bubbles:!0,cancelable:!0,composed:!0,detail:!0}));var t=e/1e3,n=t-this._elapsed;this.currentTime=this.countUp?this.currentTime+n:this.currentTime-n,this._formattedTime=this._formatTime(this.currentTime),this._elapsed=t,window.requestAnimationFrame(this._decreaseTimer.bind(this))}}},{key:"_formatTime",value:function(e){var t=e.toString().split(".");return 0===t[0].indexOf("-")?0:t[0]+"."+t[1].substring(0,2)}}])&&n(a.prototype,l),f&&n(a,f),c}();window.customElements.define(c.tag,c),e.SimpleTimer=c,Object.defineProperty(e,"__esModule",{value:!0})});
  //# sourceMappingURL=simple-timer.umd.js.map
  