text: "use strict";(function(){var __webpack_modules__={670:function _(module,__unused_webpack_exports,__webpack_require__){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}var _require=__webpack_require__(626),TimerStatus=_require.TimerStatus,Timer=_require.Timer,StopwatchTimer=_require.StopwatchTimer,CountdownTimer=_require.CountdownTimer,getCookie=_require.getCookie,setCookie=_require.setCookie;window.lang={};window.i18n={languages:{"en-US":"English","zh-HK":"繁體中文"},components:[],addComponent:function addComponent(c){this.components.push(c)},init:function init(){var cookie=getCookie();var code=cookie.lang;if(code==undefined){var language=window.navigator.userLanguage||window.navigator.language;var check=function check(r){return r.test(language)};switch(true){case check(/yue.*/):case check(/zh.*/):code="zh-HK";break}}if(code==undefined)code="en-US";this.load(code)},load:function(){var _load=_asyncToGenerator(regeneratorRuntime.mark(function _callee(code){var fileref;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:fileref=document.createElement("script");fileref.setAttribute("src","./lang/"+code+".js");document.getElementsByTagName("head")[0].appendChild(fileref);case 3:case"end":return _context.stop()}}},_callee)}));function load(_x){return _load.apply(this,arguments)}return load}(),use:function(){var _use=_asyncToGenerator(regeneratorRuntime.mark(function _callee2(newLang){return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:window.lang=window.lang==undefined?newLang:Object.assign(lang,newLang);setCookie({lang:lang.name});this.components.forEach(function(c){c.$forceUpdate()});case 3:case"end":return _context2.stop()}}},_callee2,this)}));function use(_x2){return _use.apply(this,arguments)}return use}()};module.exports={i18n:i18n}},626:function _(module){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}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)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}var TimerStatus=function TimerStatus(){_classCallCheck(this,TimerStatus)};_defineProperty(TimerStatus,"INIT",Symbol());_defineProperty(TimerStatus,"RUNNING",Symbol());_defineProperty(TimerStatus,"PAUSE",Symbol());_defineProperty(TimerStatus,"TIMESUP",Symbol());var Timer=function(){function Timer(){_classCallCheck(this,Timer);this._previousTicks=0;this._startTick=null}_createClass(Timer,[{key:"stop",value:function stop(){if(this.isRunning){this._previousTicks+=(new Date).getTime()-this._startTick;this._startTick=null}}},{key:"start",value:function start(){throw new Error("NotImplementedError")}},{key:"set",value:function set(a,b,c,d){throw new Error("NotImplementedError")}},{key:"reset",value:function reset(){this._startTick=null;this._previousTicks=0;this.set(this._totalTicks||0)}},{key:"displayTicks",get:function get(){throw new Error("NotImplementedError")}},{key:"isRunning",get:function get(){return this.status==TimerStatus.RUNNING}},{key:"status",get:function get(){throw new Error("NotImplementedError")}}]);return Timer}();var StopwatchTimer=function(_Timer){_inherits(StopwatchTimer,_Timer);var _super=_createSuper(StopwatchTimer);function StopwatchTimer(){var _this;_classCallCheck(this,StopwatchTimer);_this=_super.call(this);_this._initTicks=0;return _this}_createClass(StopwatchTimer,[{key:"start",value:function start(){if(!this.isRunning)this._startTick=(new Date).getTime()}},{key:"set",value:function set(a,b,c,d){if(b!=null&&c!=null&&d!=null)a=a*36e5+b*6e4+c*1e3+d;if(this.status==TimerStatus.PAUSE){this._initTicks=a-1;this._previousTicks=1}else{this._initTicks=a}}},{key:"displayTicks",get:function get(){return this.passedTicks}},{key:"status",get:function get(){if(this._startTick==null&&this._previousTicks==0)return TimerStatus.INIT;else if(this._startTick==null&&this._previousTicks!=0)return TimerStatus.PAUSE;else return TimerStatus.RUNNING}},{key:"passedTicks",get:function get(){return Math.max(0,(this._startTick?(new Date).getTime()-this._startTick:0)+this._initTicks+this._previousTicks)}}]);return StopwatchTimer}(Timer);var CountdownTimer=function(_Timer2){_inherits(CountdownTimer,_Timer2);var _super2=_createSuper(CountdownTimer);function CountdownTimer(){var _this2;_classCallCheck(this,CountdownTimer);_this2=_super2.call(this);_this2._totalTicks=0;return _this2}_createClass(CountdownTimer,[{key:"start",value:function start(){if(!this.isRunning&&!this.isTimeup)this._startTick=(new Date).getTime()}},{key:"set",value:function set(a,b,c,d){if(b!=null&&c!=null&&d!=null)a=a*36e5+b*6e4+c*1e3+d;if(this.status==TimerStatus.PAUSE){this._totalTicks=a+1;this._previousTicks=1}else{this._totalTicks=a}}},{key:"displayTicks",get:function get(){return this.remainingTicks}},{key:"isTimeup",get:function get(){return this.status==TimerStatus.TIMESUP}},{key:"status",get:function get(){if(this._startTick==null&&this._previousTicks==0)return TimerStatus.INIT;else if(this._startTick!=null&&this.remainingTicks!=0)return TimerStatus.RUNNING;else if(this._startTick==null&&this._previousTicks!=0)return TimerStatus.PAUSE;else if(this.remainingTicks==0)return TimerStatus.TIMESUP}},{key:"totalTicks",get:function get(){return this._totalTicks}},{key:"remainingTicks",get:function get(){return Math.max(0,(this._startTick?this._startTick-(new Date).getTime():0)+this._totalTicks-this._previousTicks)}}]);return CountdownTimer}(Timer);var SoundManager=function(){function SoundManager(){_classCallCheck(this,SoundManager);this._on=true;this._playing=false}_createClass(SoundManager,[{key:"updateStatus",value:function updateStatus(status){if(status==TimerStatus.TIMESUP){if(this._playing==false){this.audioElem.currentTime=0;var playPromise=this.audioElem.play();if(playPromise!==undefined)playPromise["catch"](function(){return undefined});this._playing=true}}else{this.audioElem.pause();this._playing=false}}},{key:"isSoundOn",set:function set(v){this._on=v;this.audioElem.volume=this._on?1:0},get:function get(){return this._on}},{key:"audioElem",get:function get(){return document.getElementById("sound")}}]);return SoundManager}();function setCookie(input){var expiryDate=new Date;expiryDate.setFullYear(expiryDate.getFullYear()+1);Object.keys(input).forEach(function(key){return document.cookie="".concat(encodeURIComponent(key),"=").concat(encodeURIComponent(input[key]),"; expires=").concat(expiryDate.toGMTString(),";")})}function getCookie(){return document.cookie.split(";").map(function(v){return v.split("=")}).reduce(function(acc,v){if(v.length!=1)acc[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim());return acc},{})}module.exports={TimerStatus:TimerStatus,Timer:Timer,StopwatchTimer:StopwatchTimer,CountdownTimer:CountdownTimer,SoundManager:SoundManager,setCookie:setCookie,getCookie:getCookie}},867:function _(module,__unused_webpack_exports,__webpack_require__){"use strict";var _require=__webpack_require__(626),getCookie=_require.getCookie,setCookie=_require.setCookie,SoundManager=_require.SoundManager,TimerStatus=_require.TimerStatus,CountdownTimer=_require.CountdownTimer;var _require2=__webpack_require__(670),i18n=_require2.i18n;window.vuePanel=new Vue({el:"#setting-panel",mounted:function mounted(){var _this=this;i18n.addComponent(this);var cookie=getCookie();this.theme=cookie.theme||this.theme;this.sound.isSoundOn=cookie.sound?cookie.sound=="true":this.sound.isSoundOn;var cancelHideOptional=function cancelHideOptional(){if(!_this.isHideOptional)return;_this.isHideOptional=false};document.body.addEventListener("touchstart",cancelHideOptional,false);document.body.addEventListener("touchmove",cancelHideOptional,false);var prevX=0;var prevY=0;document.body.addEventListener("mousemove",function(e){var movementX=prevX?e.screenX-prevX:0;var movementY=prevY?e.screenY-prevY:0;prevX=e.screenX;prevY=e.screenY;if(movementX>2||movementY>2)cancelHideOptional()});document.addEventListener("fullscreenchange",function(){_this.$forceUpdate()});window.addEventListener("resize",function(){_this.$forceUpdate()})},data:{isHideOptional:false,theme:"dark",themesList:["dark","light"],zoomScale:1,sound:new SoundManager,animation:{soundBtnHighlight:false}},watch:{isHideOptional:function isHideOptional(){document.body.style.cursor=this.isHideOptional?"none":""},theme:{handler:function handler(newVal,oldVal){this.themesList.forEach(function(x){return document.body.classList.remove(x)});document.body.classList.add(newVal);if(oldVal!=undefined)setCookie({theme:newVal})},immediate:true},"sound.isSoundOn":{handler:function handler(newVal,oldVal){if(oldVal!=undefined)setCookie({sound:newVal})},immediate:true}},computed:{},methods:{updateTimer:function updateTimer(t){this.sound.updateStatus(t.status);if(t.status==TimerStatus.RUNNING&&t instanceof CountdownTimer)this.playSoundBtnHighlight();else this.animation.soundBtnHighlight=false},playSoundBtnHighlight:function playSoundBtnHighlight(){var _this2=this;if(!this.animation.soundBtnHighlight){this.animation.soundBtnHighlight=true;this.$refs.muteIcon.classList.add("highlight");setTimeout(function(){_this2.$refs.muteIcon.classList.remove("highlight")},1e3)}},openFullscreen:function openFullscreen(){var elem=document.documentElement;if(elem.requestFullscreen){elem.requestFullscreen()}else if(elem.webkitRequestFullscreen){elem.webkitRequestFullscreen()}else if(elem.msRequestFullscreen){elem.msRequestFullscreen()}},closeFullscreen:function closeFullscreen(){if(document.exitFullscreen){document.exitFullscreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}},isFullScreen:function isFullScreen(){return document.fullscreenElement!=null||document.msFullscreenElement!=null},getTimerScale:function getTimerScale(){var clientWidth=document.body.offsetWidth;var i=Math.min(1,clientWidth/900)*this.zoomScale;return"scale("+i+")"}}});module.exports={vuePanel:vuePanel}},643:function _(module,__unused_webpack_exports,__webpack_require__){"use strict";function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&Symbol.iterator in Object(iter))return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}var _require=__webpack_require__(626),TimerStatus=_require.TimerStatus,StopwatchTimer=_require.StopwatchTimer,CountdownTimer=_require.CountdownTimer,getCookie=_require.getCookie,setCookie=_require.setCookie;var _require2=__webpack_require__(670),i18n=_require2.i18n;window.vueTimer=new Vue({el:"#thebody",mounted:function mounted(){var _this=this;i18n.addComponent(this);var cookie=getCookie();if(cookie.timer_mode){if(cookie.timer_mode=="countdown"){this.t=new CountdownTimer;this.t._totalTicks=Math.trunc(cookie.timer_total_ticks)||0}else{this.t=new StopwatchTimer;this.t._initTicks=Math.trunc(cookie.timer_init_ticks)||0}this.t._startTick=Math.trunc(cookie.timer_start_tick)||null;this.t._previousTicks=Math.trunc(cookie.timer_previous_ticks)||0}if(this.t.status==TimerStatus.TIMESUP)this.t.reset();setInterval(function(){if(_this.t)_this.t.__ob__.dep.notify()},1);this.getAllEditableTimeValueFieldElm().forEach(function(x){x.addEventListener("focus",_this.focusTimeValueFieldEvent,false);x.addEventListener("blur",_this.blurTimeValueFieldEvent,false);x.addEventListener("beforeinput",_this.b4changedTimeValueFieldEvent,false);x.addEventListener("input",_this.changedTimeValueFieldEvent,false)})},data:{t:new CountdownTimer,timerEditingFlag:{hour:false,minute:false,second:false,msec:false}},watch:{"t._previousTicks":function t_previousTicks(){this.updateTimerCookie()},"t._startTick":function t_startTick(){this.updateTimerCookie()},t:function t(value){vuePanel.updateTimer(value)},timeS:function timeS(){document.title="".concat(this.timeH,":").concat(this.timeM,":").concat(this.timeS)},isEditable:{handler:function handler(v){this.getAllEditableTimeValueFieldElm().forEach(function(x){if(v)x.setAttribute("contenteditable","true");else x.removeAttribute("contenteditable")})},immediate:true}},methods:{BodyKeyDownEvent:function BodyKeyDownEvent(e){var allFieldElm=_toConsumableArray(this.getAllEditableTimeValueFieldElm());if(e.key==="Tab"||e.key==="Enter"){if(allFieldElm.includes(e.target)){e.preventDefault();var now=e.target;var next=allFieldElm[(allFieldElm.indexOf(e.target)+1)%allFieldElm.length];now.blur();next.focus()}}},clickBtn1Event:function clickBtn1Event(){if(this.t.status==TimerStatus.INIT){if(this.t.displayTicks==0){this.t=new StopwatchTimer}else{var oldTicks=this.t.displayTicks;this.t=new CountdownTimer;this.t.set(oldTicks)}this.t.start()}else if(this.t.status==TimerStatus.RUNNING)this.t.stop();else if(this.t.status==TimerStatus.PAUSE)this.t.start()},clickBtn2Event:function clickBtn2Event(){if(this.t.status==TimerStatus.INIT){this.t.set(0);this.updateTimerCookie()}else{this.t.reset()}},updateEditableDataAndHtml:function updateEditableDataAndHtml(target,value){var max={hour:99,minute:59,second:59,msec:999};value=Math.max(0,Math.min(value,max[target.id]));target.innerText=value;var _this$getTimerData=this.getTimerData(),hour=_this$getTimerData.hour,minute=_this$getTimerData.minute,second=_this$getTimerData.second,msec=_this$getTimerData.msec;this.t.set(hour,minute,second,msec)},focusTimeValueFieldEvent:function focusTimeValueFieldEvent(e){var target=e.target;if(target.contentEditable=="inherit")return;var p=target,s=window.getSelection(),r=document.createRange();r.setStart(p,0);r.setEnd(p,0);s.removeAllRanges();s.addRange(r);this.timerEditingFlag[target.id]=true;target.beforeFocus=target.innerText},blurTimeValueFieldEvent:function blurTimeValueFieldEvent(e){var target=e.target;if(this.timerEditingFlag[target.id]==false)return;var value_str=target.innerText;var value=Math.trunc(value_str);this.timerEditingFlag[target.id]=false;if(value_str.length==0||isNaN(value)||value_str.indexOf(".")!==-1){value=Math.trunc(target.beforeFocus)}this.updateEditableDataAndHtml(target,value)},b4changedTimeValueFieldEvent:function b4changedTimeValueFieldEvent(e){e.target.beforeInput=e.target.innerText},changedTimeValueFieldEvent:function changedTimeValueFieldEvent(e){var sel=window.getSelection();var startOffset=sel.getRangeAt(0).startOffset;var target=e.target;var value_str=target.innerText;if(value_str.length==0)value_str=target.innerText="0";value_str=value_str.slice(0,target.id=="msec"?3:2);var value=Math.trunc(value_str);if(isNaN(value)||value_str.indexOf(".")!==-1){value=Math.trunc(target.beforeInput)}this.updateEditableDataAndHtml(target,value);var newRange=document.createRange();newRange.setStart(target.childNodes[0],Math.min(target.innerText.length,startOffset));newRange.collapse(true);sel.removeAllRanges();sel.addRange(newRange)},updateTimerCookie:function updateTimerCookie(){setCookie({timer_mode:this.t instanceof CountdownTimer?"countdown":"stopwatch",timer_start_tick:this.t._startTick,timer_previous_ticks:this.t._previousTicks,timer_init_ticks:this.t._initTicks,timer_total_ticks:this.t._totalTicks})},getTimerData:function getTimerData(){var rtn={};this.getAllEditableTimeValueFieldElm().forEach(function(e){return rtn[e.id]=e.innerText-0});return rtn},getAllEditableTimeValueFieldElm:function getAllEditableTimeValueFieldElm(){return _toConsumableArray(document.querySelectorAll("#timer-body span.editable-field"))}},computed:{displayTicks:function displayTicks(){return t.displayTicks},timeH:function timeH(){if(this.timerEditingFlag.hour)return"";var time=Math.trunc(this.t.displayTicks/36e5);time%=100;return time>9?time+"":"0"+time},timeM:function timeM(){if(this.timerEditingFlag.minute)return"";var time=Math.trunc(this.t.displayTicks%36e5/6e4);return time>9?time+"":"0"+time},timeS:function timeS(){if(this.timerEditingFlag.second)return"";var time=Math.trunc(this.t.displayTicks%6e4/1e3);return time>9?time+"":"0"+time},timeMS:function timeMS(){if(this.timerEditingFlag.msec)return"";var time=Math.trunc(this.t.displayTicks%1e3);if(this.t.status==TimerStatus.INIT&&time==0)return"000";else return time},isBtn1Disabled:function isBtn1Disabled(){return this.t instanceof CountdownTimer?this.t.status==TimerStatus.TIMESUP:false},isTimesUp:function isTimesUp(){return this.t.status==TimerStatus.TIMESUP},btn1Warning:function btn1Warning(){return this.t.status==TimerStatus.TIMESUP?lang.times_up_blocked_warning:""},btn1Message:function btn1Message(){return this.t.status==TimerStatus.RUNNING?lang.pause:lang.start},btn2Message:function btn2Message(){return this.t.status==TimerStatus.INIT?lang.clear:lang.reset},isEditable:function isEditable(){return this.t.status==TimerStatus.INIT||this.t.status==TimerStatus.PAUSE}}});module.exports={vueTimer:vueTimer}},177:function _(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__)}};var __webpack_module_cache__={};function __webpack_require__(moduleId){if(__webpack_module_cache__[moduleId]){return __webpack_module_cache__[moduleId].exports}var module=__webpack_module_cache__[moduleId]={exports:{}};__webpack_modules__[moduleId](module,module.exports,__webpack_require__);return module.exports}(function(){__webpack_require__.r=function(exports){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(exports,"__esModule",{value:true})}})();(function(){"use strict";__webpack_require__(177);__webpack_require__(670);i18n.init();window.addEventListener("DOMContentLoaded",function(){__webpack_require__(867);__webpack_require__(643)});window.addEventListener("load",function(){document.getElementById("sound").load()})})()})();