clocklet
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -33,2 +33,3 @@ import { __assign } from 'tslib'; | ||
var inputRect = input.getBoundingClientRect(); | ||
var inputStyle = getComputedStyle(input); | ||
var _a = this, container = _a.container, root = _a.root; | ||
@@ -62,17 +63,26 @@ var eventDetail = { options: resolvedOptions }; | ||
} | ||
container.style.zIndex = resolvedOptions.zIndex !== '' ? resolvedOptions.zIndex : (parseInt(getComputedStyle(input).zIndex, 10) || 0) + 1; | ||
if (resolvedOptions.appendTo === 'parent') { | ||
container.style.position = 'relative'; | ||
container.style.left = '0'; | ||
container.style.top = '0'; | ||
input.parentElement.insertBefore(container, input); | ||
container.style.zIndex = resolvedOptions.zIndex !== '' ? resolvedOptions.zIndex : (parseInt(inputStyle.zIndex, 10) || 0) + 1; | ||
if (inputStyle.position === 'fixed' || | ||
resolvedOptions.appendTo === 'parent' && (inputStyle.position === 'absolute' || inputStyle.position === 'relative')) { | ||
copyStyles(container.style, inputStyle, ['position', 'left', 'top', 'right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']); | ||
} | ||
else { | ||
container.style.position = 'absolute'; | ||
container.style.left = document.documentElement.scrollLeft + document.body.scrollLeft + inputRect.left + 'px'; | ||
container.style.top = document.documentElement.scrollTop + document.body.scrollTop + inputRect.top + 'px'; | ||
if (container.parentElement !== document.body) { | ||
document.body.appendChild(container); | ||
copyStyles(container.style, {}, ['right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']); | ||
if (resolvedOptions.appendTo === 'parent') { | ||
container.style.position = 'relative'; | ||
container.style.left = '0'; | ||
container.style.top = '0'; | ||
} | ||
else { | ||
container.style.position = 'absolute'; | ||
container.style.left = document.documentElement.scrollLeft + document.body.scrollLeft + inputRect.left + 'px'; | ||
container.style.top = document.documentElement.scrollTop + document.body.scrollTop + inputRect.top + 'px'; | ||
} | ||
} | ||
if (resolvedOptions.appendTo === 'parent') { | ||
input.parentElement.insertBefore(container, input); | ||
} | ||
else if (container.parentElement !== document.body) { | ||
document.body.appendChild(container); | ||
} | ||
this.updateHighlight(); | ||
@@ -105,5 +115,2 @@ setTimeout(function () { | ||
} | ||
if (time.a === undefined) { | ||
time = { h: time.h, m: time.m, a: getClockletData(this.ampm, 'ampm') }; | ||
} | ||
var oldValue = this.input.value; | ||
@@ -158,1 +165,7 @@ var _time = lenientime(this.input.value).with(time.a !== undefined ? time : { h: time.h, m: time.m, a: getClockletData(this.ampm, 'ampm') }); | ||
} | ||
function copyStyles(destination, source, properties) { | ||
for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { | ||
var property = properties_1[_i]; | ||
destination[property] = source[property] || ''; | ||
} | ||
} |
declare const template: string | ||
export default template |
{ | ||
"name": "clocklet", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "An opinionated clock-style vanilla-js timepicker", | ||
@@ -25,3 +25,3 @@ "repository": "luncheon/clocklet", | ||
"watch:css": "rimraf css/ && mkdirp css/ && stylus -w -o css/ src/style/", | ||
"build:demo": "rimraf .docs/ docs/demo.html && pug -o .docs/ src/demo/demo.pug -O {cdnBaseUrl:'..'} && pug -o docs/ src/demo/demo.pug -O {cdnBaseUrl:'https://cdn.jsdelivr.net/npm/clocklet@0.1.6'}", | ||
"build:demo": "rimraf .docs/ docs/demo.html && pug -o .docs/ src/demo/demo.pug -O {cdnBaseUrl:'..'} && pug -o docs/ src/demo/demo.pug -O {cdnBaseUrl:'https://cdn.jsdelivr.net/npm/clocklet@0.1.7'}", | ||
"watch:demo": "rimraf .docs/ docs/demo.html && pug -w -o .docs/ src/demo/demo.pug -O {cdnBaseUrl:'..'}" | ||
@@ -28,0 +28,0 @@ }, |
@@ -39,4 +39,4 @@ ## <a name="clocklet" href="#clocklet" style="pointer-events:none">![Clocklet](https://luncheon.github.io/clocklet/docs/logo.png)</a> | ||
```html | ||
<link rel="https://cdn.jsdelivr.net/npm/clocklet@0.1.6/css/clocklet.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/clocklet@0.1.6"></script> | ||
<link rel="https://cdn.jsdelivr.net/npm/clocklet@0.1.7/css/clocklet.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/clocklet@0.1.7"></script> | ||
<script>/* `window.clocklet` object is available */</script> | ||
@@ -43,0 +43,0 @@ ``` |
@@ -37,11 +37,12 @@ import { __assign } from 'tslib' | ||
public open(input: HTMLInputElement, options?: Partial<Readonly<ClockletOptions>>) { | ||
const resolvedOptions = __assign(Object.create(this.defaultOptions), options) as ClockletOptions | ||
const inputRect = input.getBoundingClientRect() | ||
const { container, root } = this | ||
const eventDetail = { options: resolvedOptions } | ||
const resolvedOptions = __assign(Object.create(this.defaultOptions), options) as ClockletOptions | ||
const inputRect = input.getBoundingClientRect() | ||
const inputStyle = getComputedStyle(input) | ||
const { container, root } = this | ||
const eventDetail = { options: resolvedOptions } | ||
if (dispatchCustomEvent(input, 'clocklet.opening', true, true, eventDetail).defaultPrevented) { | ||
return | ||
} | ||
this.input = input | ||
this.dispatchesInputEvents = resolvedOptions.dispatchesInputEvents | ||
this.input = input | ||
this.dispatchesInputEvents = resolvedOptions.dispatchesInputEvents | ||
@@ -52,3 +53,3 @@ setClockletData(root, 'placement', resolvedOptions.placement) | ||
setClockletData(root, 'append-to', resolvedOptions.appendTo) | ||
root.className = 'clocklet clocklet--showing ' + (hoverable ? '' : 'clocklet--hoverable ') + resolvedOptions.className | ||
root.className = 'clocklet clocklet--showing ' + (hoverable ? '' : 'clocklet--hoverable ') + resolvedOptions.className | ||
if (resolvedOptions.placement === 'top') { | ||
@@ -69,16 +70,23 @@ root.style.top = '' | ||
container.style.zIndex = resolvedOptions.zIndex !== '' ? resolvedOptions.zIndex as string : (parseInt(getComputedStyle(input).zIndex!, 10) || 0) + 1 as any as string | ||
if (resolvedOptions.appendTo === 'parent') { | ||
container.style.position = 'relative' | ||
container.style.left = '0' | ||
container.style.top = '0' | ||
input.parentElement!.insertBefore(container, input) | ||
container.style.zIndex = resolvedOptions.zIndex !== '' ? resolvedOptions.zIndex as string : (parseInt(inputStyle.zIndex!, 10) || 0) + 1 as any as string | ||
if (inputStyle.position === 'fixed' || | ||
resolvedOptions.appendTo === 'parent' && (inputStyle.position === 'absolute' || inputStyle.position === 'relative')) { | ||
copyStyles(container.style, inputStyle, ['position', 'left', 'top', 'right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']) | ||
} else { | ||
container.style.position = 'absolute' | ||
container.style.left = document.documentElement.scrollLeft + document.body.scrollLeft + inputRect.left + 'px' | ||
container.style.top = document.documentElement.scrollTop + document.body.scrollTop + inputRect.top + 'px' | ||
if (container.parentElement !== document.body) { | ||
document.body.appendChild(container) | ||
copyStyles(container.style, {} as CSSStyleDeclaration, ['right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']) | ||
if (resolvedOptions.appendTo === 'parent') { | ||
container.style.position = 'relative' | ||
container.style.left = '0' | ||
container.style.top = '0' | ||
} else { | ||
container.style.position = 'absolute' | ||
container.style.left = document.documentElement.scrollLeft + document.body.scrollLeft + inputRect.left + 'px' | ||
container.style.top = document.documentElement.scrollTop + document.body.scrollTop + inputRect.top + 'px' | ||
} | ||
} | ||
if (resolvedOptions.appendTo === 'parent') { | ||
input.parentElement!.insertBefore(container, input) | ||
} else if (container.parentElement !== document.body) { | ||
document.body.appendChild(container) | ||
} | ||
this.updateHighlight() | ||
@@ -113,5 +121,2 @@ setTimeout(() => { | ||
} | ||
if (time.a === undefined) { | ||
time = { h: time.h, m: time.m, a: getClockletData(this.ampm, 'ampm') as 'am' | 'pm' } | ||
} | ||
const oldValue = this.input.value | ||
@@ -168,1 +173,6 @@ const _time = lenientime(this.input.value).with(time.a !== undefined ? time : { h: time.h, m: time.m, a: getClockletData(this.ampm, 'ampm') as 'am' | 'pm' }) | ||
function copyStyles<T>(destination: T, source: Readonly<T>, properties: (keyof T)[]) { | ||
for (const property of properties) { | ||
destination[property] = source[property] || '' | ||
} | ||
} |
@@ -0,0 +0,0 @@ import adjustOnArrowKeys from 'lenientime/es/input-helpers/adjust-on-arrow-keys' |
@@ -0,0 +0,0 @@ export function getClockletData(element: Element, attributeName: string) { |
@@ -0,0 +0,0 @@ import touchEventsSupported from './touch-events-supported'; |
@@ -0,0 +0,0 @@ export function dispatchCustomEvent(target: EventTarget, type: string, bubbles: boolean, cancelable: boolean, detail?: any) { |
@@ -0,0 +0,0 @@ export interface ClockletOptions { |
declare const template: string | ||
export default template |
@@ -0,0 +0,0 @@ import Lenientime from 'lenientime/es/core/lenientime' |
@@ -0,0 +0,0 @@ let touchEventsSupported: boolean |
interface Window { | ||
PointerEvent: PointerEvent | ||
} |
@@ -882,2 +882,3 @@ (function (global, factory) { | ||
var inputRect = input.getBoundingClientRect(); | ||
var inputStyle = getComputedStyle(input); | ||
var _a = this, container = _a.container, root = _a.root; | ||
@@ -911,17 +912,26 @@ var eventDetail = { options: resolvedOptions }; | ||
} | ||
container.style.zIndex = resolvedOptions.zIndex !== '' ? resolvedOptions.zIndex : (parseInt(getComputedStyle(input).zIndex, 10) || 0) + 1; | ||
if (resolvedOptions.appendTo === 'parent') { | ||
container.style.position = 'relative'; | ||
container.style.left = '0'; | ||
container.style.top = '0'; | ||
input.parentElement.insertBefore(container, input); | ||
container.style.zIndex = resolvedOptions.zIndex !== '' ? resolvedOptions.zIndex : (parseInt(inputStyle.zIndex, 10) || 0) + 1; | ||
if (inputStyle.position === 'fixed' || | ||
resolvedOptions.appendTo === 'parent' && (inputStyle.position === 'absolute' || inputStyle.position === 'relative')) { | ||
copyStyles(container.style, inputStyle, ['position', 'left', 'top', 'right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']); | ||
} | ||
else { | ||
container.style.position = 'absolute'; | ||
container.style.left = document.documentElement.scrollLeft + document.body.scrollLeft + inputRect.left + 'px'; | ||
container.style.top = document.documentElement.scrollTop + document.body.scrollTop + inputRect.top + 'px'; | ||
if (container.parentElement !== document.body) { | ||
document.body.appendChild(container); | ||
copyStyles(container.style, {}, ['right', 'bottom', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom']); | ||
if (resolvedOptions.appendTo === 'parent') { | ||
container.style.position = 'relative'; | ||
container.style.left = '0'; | ||
container.style.top = '0'; | ||
} | ||
else { | ||
container.style.position = 'absolute'; | ||
container.style.left = document.documentElement.scrollLeft + document.body.scrollLeft + inputRect.left + 'px'; | ||
container.style.top = document.documentElement.scrollTop + document.body.scrollTop + inputRect.top + 'px'; | ||
} | ||
} | ||
if (resolvedOptions.appendTo === 'parent') { | ||
input.parentElement.insertBefore(container, input); | ||
} | ||
else if (container.parentElement !== document.body) { | ||
document.body.appendChild(container); | ||
} | ||
this.updateHighlight(); | ||
@@ -954,5 +964,2 @@ setTimeout(function () { | ||
} | ||
if (time.a === undefined) { | ||
time = { h: time.h, m: time.m, a: getClockletData(this.ampm, 'ampm') }; | ||
} | ||
var oldValue = this.input.value; | ||
@@ -1006,2 +1013,8 @@ var _time = lenientime(this.input.value).with(time.a !== undefined ? time : { h: time.h, m: time.m, a: getClockletData(this.ampm, 'ampm') }); | ||
} | ||
function copyStyles(destination, source, properties) { | ||
for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { | ||
var property = properties_1[_i]; | ||
destination[property] = source[property] || ''; | ||
} | ||
} | ||
@@ -1008,0 +1021,0 @@ { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.clocklet=e()}(this,function(){"use strict";function k(t,e,l){return t=String(t),!e||!isFinite(e)||t.length>=e?t:o(e-t.length,l)+t}function t(t,e,l){return t=String(t),!e||!isFinite(e)||t.length>=e?t:t+o(e-t.length,l)}function o(t,e){for(var l=e=null==e||""===e?" ":String(e);l.length<t;)l+=e;return l.substr(0,t)}function n(){for(var t=0,e=arguments.length;t<e;++t){var l=arguments[t];if("number"==typeof l)return l;if("string"==typeof l){var o=parseFloat(l);if(isFinite(o))return o}}}var c=1e3,i=60*c,a=60*i,e=12*a,r=24*a;function l(){return(Date.now()-(new Date).getTimezoneOffset()*i)%r}function u(t){var e=Math.floor(t)%r;return 0<=e?e:e+r}function s(t){return e<=t?t-e:t}function p(t){return t<e?t+e:t}function d(t,e){switch(t=u(t),e&&String(e)[0].toLowerCase()){case"a":return s(t);case"p":return p(t);default:return t}}function f(t){switch(typeof t){case"number":return u(t);case"string":return function(t){if(!(t=t&&String(t).replace(/[\uff00-\uffef]/g,function(t){return String.fromCharCode(t.charCodeAt(0)-65248)}).replace(/\s/g,"").replace(/(a|p)\.?m?\.?$/i,function(t,e){return e.toLowerCase()})))return 0;if("now"===t.toLowerCase())return l();var e=t.match(/^([+-]?[0-9]{1,2})(?:([0-9]{2})(?:([0-9]{2})([0-9]*))?)?(a|p)?$/i)||t.match(/^([+-]?[0-9]*\.[0-9]*)()()()(a|p)?$/i)||t.match(/^([+-]?[0-9]*\.?[0-9]*):([+-]?[0-9]*\.?[0-9]*)(?::([+-]?[0-9]*\.?[0-9]*))?()(a|p)?$/i);return e?d((e[1]?parseFloat(e[1])*a:0)+(e[2]?parseFloat(e[2])*i:0)+(e[3]?parseFloat(e[3])*c:0)+(e[4]?1e3*parseFloat("0."+e[4]):0),e[5]):NaN}(t);case"object":if(t)return function(t){if("number"==typeof t.totalMilliseconds)return u(t.totalMilliseconds);var e=n(t.h,t.hour,t.hours,0)*a+n(t.m,t.minute,t.minutes,0)*i+n(t.s,t.second,t.seconds,0)*c+n(t.S,t.millisecond,t.milliseconds,0);if(!0===t.am||!1===t.pm)return s(e);if(!0===t.pm||!1===t.am)return p(e);return d(e,t.a)}(t instanceof Array?{h:t[0],m:t[1],s:t[2],S:t[3]}:t)}return NaN}var m={H:h(0,23),HH:h(0,23,2,"0"),_H:h(0,23,2),h:h(1,12),hh:h(1,12,2,"0"),_h:h(1,12,2),k:h(0,11),kk:h(0,11,2,"0"),_k:h(0,23,2),m:h(0,59),mm:h(0,59,2,"0"),_m:h(0,59,2),s:h(0,59),ss:h(0,59,2,"0"),_s:h(0,59,2),S:h(0,9),SS:h(0,99,2,"0"),SSS:h(0,999,3,"0"),a:function(e){return function(t){return"pm"===e?"am":"pm"}},A:function(e){return function(t){return"PM"===e?"AM":"PM"}},aa:function(e){return function(t){return"p.m."===e?"a.m.":"p.m."}},AA:function(e){return function(t){return"P.M."===e?"A.M.":"P.M."}}};function h(a,r,u,s){return void 0===u&&(u=1),function(i){return function(t,e){var l,o,n,c=(l=parseInt(i,10)+t,o=a,n=r,e?(l=(l-o)%(++n-o))<0?l+n:l+o:l<o?o:n<l?n:l);return isNaN(c)?void 0:k(c,u,s)}}}function b(t,e,l){for(var o=v(t),n=0,c=0,i=0;i<o.length;++i){var a=o[i];if(a.literal){var r=e.indexOf(a.property,n);if(-1===r||l<=r){if(0===i)return;var u=e.slice(c,r);return{property:k=o[i-1].property,index:c,value:u,adjust:m[k](u)}}c=n=r+a.property.length}else"_"===a.property[0]&&" "===e[n]&&++n}var s=o[o.length-1];if(s&&!s.literal){var k;u=e.slice(n);return{property:k=s.property,index:n,value:u,adjust:m[k](u)}}}function v(t){for(var e,l=/\\.|HH?|hh?|kk?|mm?|ss?|S{1,3}|AA?|aa?|_H|_h|_k|_m|_s/g,o=[],n=0;e=l.exec(t);){var c=e.index,i=l.lastIndex;n!==c&&o.push({index:n,property:t.slice(n,c),literal:!0}),"\\"===e[0][0]?o.push({index:c,property:e[0].slice(1),literal:!0}):o.push({index:c,property:e[0],literal:!1}),n=i}return n<t.length&&o.push({index:n,property:t.slice(n),literal:!0}),o}var y=function(){function l(t){this._totalMilliseconds=t}return Object.defineProperty(l.prototype,"hour",{get:function(){return Math.floor(this._totalMilliseconds/a)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"hour12",{get:function(){return(this.hour+11)%12+1},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"minute",{get:function(){return Math.floor(this._totalMilliseconds%a/i)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"second",{get:function(){return Math.floor(this._totalMilliseconds%i/c)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"millisecond",{get:function(){return this._totalMilliseconds%c},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"am",{get:function(){return this.hour<12},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"pm",{get:function(){return 12<=this.hour},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"hours",{get:function(){return this.hour},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"hours12",{get:function(){return this.hour12},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"minutes",{get:function(){return this.minute},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"seconds",{get:function(){return this.second},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"milliseconds",{get:function(){return this.millisecond},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"H",{get:function(){return this.invalid?"-":String(this.hour)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"h",{get:function(){return this.invalid?"-":String(this.hour12)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"k",{get:function(){return this.invalid?"-":String((this.hour+23)%24+1)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"m",{get:function(){return this.invalid?"-":String(this.minute)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"s",{get:function(){return this.invalid?"-":String(this.second)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"S",{get:function(){return this.invalid?"-":String(Math.floor(this.millisecond/100))},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"SS",{get:function(){return this.invalid?"--":t(Math.floor(this.millisecond/10),2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"SSS",{get:function(){return this.invalid?"---":t(this.millisecond,3,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"a",{get:function(){return this.invalid?"--":this.am?"am":"pm"},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"A",{get:function(){return this.invalid?"--":this.am?"AM":"PM"},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"aa",{get:function(){return this.invalid?"----":this.am?"a.m.":"p.m."},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"AA",{get:function(){return this.invalid?"----":this.am?"A.M.":"P.M."},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"HH",{get:function(){return this.invalid?"--":k(this.H,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"_H",{get:function(){return this.invalid?"--":k(this.H,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"hh",{get:function(){return this.invalid?"--":k(this.h,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"_h",{get:function(){return this.invalid?"--":k(this.h,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"kk",{get:function(){return this.invalid?"--":k(this.k,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"_k",{get:function(){return this.invalid?"--":k(this.k,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"mm",{get:function(){return this.invalid?"--":k(this.m,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"_m",{get:function(){return this.invalid?"--":k(this.m,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"ss",{get:function(){return this.invalid?"--":k(this.s,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"_s",{get:function(){return this.invalid?"--":k(this.s,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"HHmm",{get:function(){return this.HH+":"+this.mm},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"HHmmss",{get:function(){return this.HHmm+":"+this.ss},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"HHmmssSSS",{get:function(){return this.HHmmss+"."+this.SSS},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"totalMilliseconds",{get:function(){return this._totalMilliseconds},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"totalSeconds",{get:function(){return Math.floor(this._totalMilliseconds/c)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"totalMinutes",{get:function(){return Math.floor(this._totalMilliseconds/i)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"valid",{get:function(){return 0<=this._totalMilliseconds&&this._totalMilliseconds<r},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"invalid",{get:function(){return!this.valid},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"startOfHour",{get:function(){return new l(this._totalMilliseconds-this._totalMilliseconds%a)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"startOfMinute",{get:function(){return new l(this._totalMilliseconds-this._totalMilliseconds%i)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"startOfSecond",{get:function(){return new l(this._totalMilliseconds-this._totalMilliseconds%c)},enumerable:!0,configurable:!0}),l.prototype.ifInvalid=function(t){return this.valid?this:new l(f(t))},l.prototype.startOf=function(t){switch(t){case"hour":return this.startOfHour;case"minute":return this.startOfMinute;case"second":return this.startOfSecond;default:return this}},l.prototype.toString=function(){return this.HHmmssSSS},l.prototype.format=function(t){return e=this,String(t).replace(/\\.|HH?|hh?|kk?|mm?|ss?|S{1,3}|AA?|aa?|_H|_h|_k|_m|_s/g,function(t){return"\\"===t[0]?t[1]:e[t]});var e},l.prototype.with=function(t){return new l(f({h:n(t.h,t.hour,t.hours,this.hour),m:n(t.m,t.minute,t.minutes,this.minute),s:n(t.s,t.second,t.seconds,this.second),S:n(t.S,t.millisecond,t.milliseconds,this.millisecond),am:!0===t.am||!1===t.pm||"am"===t.a||"pm"!==t.a&&void 0}))},l.prototype.plus=function(t){var e=f(t);return 0===e?this:new l(this._totalMilliseconds+e)},l.prototype.minus=function(t){var e=f(t);return 0===e?this:new l(this._totalMilliseconds-e)},l.prototype.equals=function(t){return 0===this.compareTo(t)},l.prototype.compareTo=function(t){return this._totalMilliseconds-f(t)},l.prototype.isBefore=function(t){return this.compareTo(t)<0},l.prototype.isBeforeOrEqual=function(t){return this.compareTo(t)<=0},l.prototype.isAfter=function(t){return 0<this.compareTo(t)},l.prototype.isAfterOrEqual=function(t){return 0<=this.compareTo(t)},l.prototype.isBetweenExclusive=function(t,e){return this.isAfter(t)&&this.isBefore(e)},l.prototype.isBetweenInclusive=function(t,e){return this.isAfterOrEqual(t)&&this.isBeforeOrEqual(e)},l}(),g=new y(0),O=new y(NaN),E=function(t){if(null==t)return O;if(t instanceof y)return t;var e=f(t);return 0===e?g:isNaN(e)?O:new y(e)};function S(t,e,l){void 0===l&&(l=O);for(var o=l,n=0,c=t.length;n<c;++n){var i=E(t[n]);i.valid&&(o=e(o,i,n,t))}return o}function P(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("input",!0,!1,"complete"),t.dispatchEvent(e)}E.prototype=y.prototype,E.INVALID=O,E.ZERO=g,E.now=function(){return new y(l())},E.min=function(){return S(arguments,function(t,e){return t.invalid||e.isBefore(t)?e:t})},E.max=function(){return S(arguments,function(t,e){return t.invalid||e.isAfter(t)?e:t})};var j,w=Object.assign||function(t){for(var e,l=1,o=arguments.length;l<o;l++)for(var n in e=arguments[l])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t};if(void 0===window.ontouchend)j=!1;else{var _=window.ontouchend;j=(window.ontouchend=void 0)!==window.ontouchend,window.ontouchend=_}var M=j;function H(t,e,l,o,n){var c=document.createEvent("CustomEvent");return c.initCustomEvent(e,l,o,n),c.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})},t.dispatchEvent(c),c}function x(t,e){return t.getAttribute("data-clocklet-"+e)}function L(t,e,l){t.setAttribute("data-clocklet-"+e,l)}var A=function(){function t(t,e,l){this.dial=t,this.maxValue=e,this.setValue=l,this.hand=this.dial.getElementsByClassName("clocklet-hand")[0],this.dragging=!1,window.PointerEvent?(t.addEventListener("pointerdown",this._onDragStart.bind(this)),addEventListener("pointermove",this._onDrag.bind(this),!0),addEventListener("pointerup",this._onDragEnd.bind(this),!0)):M?(t.addEventListener("touchstart",this._onDragStart.bind(this)),t.addEventListener("touchmove",this._onDrag.bind(this)),t.addEventListener("touchend",this._onDragEnd.bind(this))):(t.addEventListener("mousedown",this._onDragStart.bind(this)),addEventListener("mousemove",this._onDrag.bind(this),!0),addEventListener("mouseup",this._onDragEnd.bind(this),!0))}return t.prototype.value=function(t){this.hand.style.transform="rotate("+360*t/this.maxValue+"deg)";var e="clocklet-tick--selected",l=this.dial.getElementsByClassName(e)[0],o=this.dial.querySelector('[data-clocklet-tick-value="'+t+'"]');l!==o&&(l&&l.classList.remove(e),o&&o.classList.add(e))},t.prototype._onDragStart=function(t){if(t.touches&&1<t.touches.length)this.dragging=!1;else{this.dragging=!0;var e=x(t.target,"tick-value");e&&this.setValue(e),t.preventDefault(),H(this.dial,"clocklet.dragstart",!0,!1)}},t.prototype._onDrag=function(t){if(this.dragging){var e=t.targetTouches?t.targetTouches[0]:t,l=document.elementFromPoint(e.clientX,e.clientY),o=l&&x(l,"tick-value");if(o&&this.dial.contains(l))this.setValue(o);else{var n=this.dial.getBoundingClientRect(),c=e.clientX-n.left-n.width/2,i=e.clientY-n.top-n.height/2,a=Math.atan2(i,c);this.setValue(Math.round(a*this.maxValue/(2*Math.PI)+this.maxValue/4+this.maxValue)%this.maxValue)}t.preventDefault()}},t.prototype._onDragEnd=function(t){this.dragging=!1,t.preventDefault(),H(this.dial,"clocklet.dragend",!0,!1)},t}(),N={className:"",format:"HH:mm",placement:"bottom",alignment:"left",appendTo:"body",zIndex:"",dispatchesInputEvents:!0};function C(t){if(t){for(var e={},l=0,o=t.split(";");l<o.length;l++){var n=o[l],c=n.indexOf(":");e[n.slice(0,c).trim().replace(/[a-zA-Z0-9_]-[a-z]/g,function(t){return t[0]+t[2].toUpperCase()})]=n.slice(c+1).trim()}return e}}var D='<div class="clocklet"><div class="clocklet-plate"><div class="clocklet-dial clocklet-dial--minute"><div class="clocklet-hand clocklet-hand--minute"></div><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="1" style="left:54.8%;top:4.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="2" style="left:59.6%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="3" style="left:64.2%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="4" style="left:68.7%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="5" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="6" style="left:77%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="7" style="left:80.8%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="8" style="left:84.2%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="9" style="left:87.2%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="10" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="11" style="left:92%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="12" style="left:93.7%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="13" style="left:95%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="14" style="left:95.7%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="15" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="16" style="left:95.7%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="17" style="left:95%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="18" style="left:93.7%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="19" style="left:92%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="20" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="21" style="left:87.2%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="22" style="left:84.2%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="23" style="left:80.8%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="24" style="left:77%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="25" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="26" style="left:68.7%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="27" style="left:64.2%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="28" style="left:59.6%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="29" style="left:54.8%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="30" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="31" style="left:45.2%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="32" style="left:40.4%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="33" style="left:35.8%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="34" style="left:31.3%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="35" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="36" style="left:23%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="37" style="left:19.2%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="38" style="left:15.8%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="39" style="left:12.8%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="40" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="41" style="left:8%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="42" style="left:6.3%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="43" style="left:5%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="44" style="left:4.3%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="45" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="46" style="left:4.3%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="47" style="left:5%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="48" style="left:6.3%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="49" style="left:8%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="50" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="51" style="left:12.8%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="52" style="left:15.8%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="53" style="left:19.2%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="54" style="left:23%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="55" style="left:30.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="56" style="left:31.3%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="57" style="left:35.8%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="58" style="left:40.4%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="59" style="left:45.2%;top:4.3%"></button></div><div class="clocklet-dial clocklet-dial--hour"><div class="clocklet-hand clocklet-hand--hour"></div><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="1" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="2" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="3" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="4" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="5" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="6" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="7" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="8" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="9" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="10" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="11" style="left:30.5%;top:16.2%"></button></div><div class="clocklet-ampm"></div><div class="clocklet-hand-origin"></div></div></div>';function I(t,e){return B(t,e,/[Hhk]$/)}function T(t,e){return B(t,e,/a/i)}function B(t,e,l){for(var o=0,n=0,c=v(e);n<c.length;n++){var i=c[n];if(i.literal)o+=i.property.length;else{var a=t[i.property];if(l.test(i.property))return{index:o,value:a};o+=a.length}}}var V=matchMedia("(hover: none)").matches,z=function(){function t(t){var e,l=this;this.container=((e=document.createElement("div")).className="clocklet-container",e.innerHTML=D,e),this.root=this.container.firstElementChild,this.plate=this.root.firstElementChild,this.hour=new A(this.plate.getElementsByClassName("clocklet-dial--hour")[0],12,function(t){return l.value({h:t})}),this.minute=new A(this.plate.getElementsByClassName("clocklet-dial--minute")[0],60,function(t){return l.value({m:t})}),this.ampm=this.plate.getElementsByClassName("clocklet-ampm")[0],this.defaultOptions=w(Object.create(N),t),addEventListener("input",function(t){return t.target===l.input&&l.updateHighlight()},!0),this.root.addEventListener("mousedown",function(t){return t.preventDefault()}),this.ampm.addEventListener("mousedown",function(){return l.value({a:"pm"===x(l.ampm,"ampm")?"am":"pm"})}),this.root.addEventListener("clocklet.dragstart",function(){return l.root.classList.add("clocklet--dragging")}),this.root.addEventListener("clocklet.dragend",function(){return l.root.classList.remove("clocklet--dragging")});var o=this.relocate.bind(this);addEventListener("resize",o),addEventListener("orientationchange",o)}return t.prototype.open=function(t,e){var l=this,o=w(Object.create(this.defaultOptions),e),n=t.getBoundingClientRect(),c=this.container,i=this.root,a={options:o};H(t,"clocklet.opening",!0,!0,a).defaultPrevented||(this.input=t,this.dispatchesInputEvents=o.dispatchesInputEvents,L(i,"placement",o.placement),L(i,"alignment",o.alignment),L(i,"format",o.format),L(i,"append-to",o.appendTo),i.className="clocklet clocklet--showing "+(V?"":"clocklet--hoverable ")+o.className,"top"===o.placement?(i.style.top="",i.style.bottom="0"):(i.style.top=n.height+"px",i.style.bottom=""),"right"===o.alignment?(i.style.left="",i.style.right="-"+n.width+"px"):(i.style.left="0",i.style.right=""),c.style.zIndex=""!==o.zIndex?o.zIndex:(parseInt(getComputedStyle(t).zIndex,10)||0)+1,"parent"===o.appendTo?(c.style.position="relative",c.style.left="0",c.style.top="0",t.parentElement.insertBefore(c,t)):(c.style.position="absolute",c.style.left=document.documentElement.scrollLeft+document.body.scrollLeft+n.left+"px",c.style.top=document.documentElement.scrollTop+document.body.scrollTop+n.top+"px",c.parentElement!==document.body&&document.body.appendChild(c)),this.updateHighlight(),setTimeout(function(){i.classList.remove("clocklet--showing"),l.input&&i.classList.add("clocklet--shown")}),H(t,"clocklet.opened",!0,!1,a))},t.prototype.close=function(){var t=this.input,e={};t&&(H(t,"clocklet.closing",!0,!0,e).defaultPrevented?t.focus():(this.input=void 0,this.root.classList.remove("clocklet--shown"),H(t,"clocklet.closed",!0,!1,e)))},t.prototype.value=function(t){if(this.input){void 0===t.a&&(t={h:t.h,m:t.m,a:x(this.ampm,"ampm")});var e=this.input.value,l=E(this.input.value).with(void 0!==t.a?t:{h:t.h,m:t.m,a:x(this.ampm,"ampm")}),o=x(this.root,"format");if(this.input.value=l.format(o),"text"===this.input.type){var n=void 0!==t.h?I(l,o):void 0!==t.m?B(l,o,/m$/):void 0!==t.a?T(l,o)||I(l,o):void 0;n&&this.input.setSelectionRange(n.index,n.index+n.value.length)}this.dispatchesInputEvents&&this.input.value!==e&&H(this.input,"input",!0,!1,void 0)}},t.prototype.updateHighlight=function(){if(this.input){var t=this.input.value?E(this.input.value):E.INVALID;t.valid?(L(this.root,"value",t.HHmm),this.hour.value(t.hour%12),this.minute.value(t.minute),L(this.ampm,"ampm",t.a)):(L(this.root,"value",""),this.hour.value(-1),this.minute.value(-1),L(this.ampm,"ampm","am"));var e=T(t.valid?t:E.ZERO,x(this.root,"format"));L(this.ampm,"ampm-formatted",e&&e.value||"")}},t.prototype.relocate=function(){if(this.input&&"body"===x(this.root,"append-to")){var t=this.input.getBoundingClientRect();this.container.style.left=document.documentElement.scrollLeft+document.body.scrollLeft+t.left+"px",this.container.style.top=document.documentElement.scrollTop+document.body.scrollTop+t.top+"px"}},t}();var F,R,q,$,Z,K,X={dataAttributeName:"clocklet",formatSelector:function(t){var e=C(t.getAttribute("data-clocklet"));return e&&e.format}};return Z=($=X)&&$.dataAttributeName||"lenientime",K=$&&$.formatSelector||function(t){return t.dataset.lenientime},addEventListener("change",function(t){var e=t.target,l=e.value,o=e.dataset;if(l&&Z in o){var n=E(l),c=n.valid?n.format(K(e)||"HH:mm"):"";c!==l&&(e.value=c,P(e))}},!0),R=(F=X)&&F.dataAttributeName||"lenientime",q=F&&F.formatSelector||function(t){return t.dataset.lenientime},F&&F.amountSelector,addEventListener("keydown",function(t){var e=t.which;if(!(38!==e&&40!==e||t.altKey||t.ctrlKey||t.metaKey)){var l=t.target,o=l.dataset;if(R in o){t.preventDefault();var n=q(l)||"HH:mm",c=l.value;if(c){var i=l.selectionStart;if(s=null===i?void 0:b(n,c,i)){var a=(38===e?1:-1)*(F&&F.amountSelector&&F.amountSelector(l)||1),r=s.adjust(a,!0);if(void 0!==r){var u=s.index;l.value=c.slice(0,u)+r+c.slice(u+s.value.length),l.setSelectionRange(u,u+r.length),P(l)}}}else{var s;l.value=E.ZERO.format(n),(s=b(n,l.value,0))&&l.setSelectionRange(s.index,s.index+s.value.length),P(l)}}}},!0),function(t){void 0===t&&(t={});var l=new z(t.defaultOptions),e=t.target||"input[data-clocklet]",o=t.optionsSelector||function(t){return C(t.getAttribute("data-clocklet"))},n=l.close.bind(l);if(e instanceof Element)e.addEventListener("focus",function(t){return l.open(t.target,o(t.target))}),e.addEventListener("blur",n);else{var c="function"==typeof e?e:function(t){return(Element.prototype.matches||Element.prototype.msMatchesSelector).call(t,e)};document.body.addEventListener("focus",function(t){var e=t.target;c(e)&&l.open(e,o(e))},!0),document.body.addEventListener("blur",n,!0)}return l}()}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.clocklet=e()}(this,function(){"use strict";function k(t,e,o){return t=String(t),!e||!isFinite(e)||t.length>=e?t:l(e-t.length,o)+t}function t(t,e,o){return t=String(t),!e||!isFinite(e)||t.length>=e?t:t+l(e-t.length,o)}function l(t,e){for(var o=e=null==e||""===e?" ":String(e);o.length<t;)o+=e;return o.substr(0,t)}function n(){for(var t=0,e=arguments.length;t<e;++t){var o=arguments[t];if("number"==typeof o)return o;if("string"==typeof o){var l=parseFloat(o);if(isFinite(l))return l}}}var c=1e3,i=60*c,a=60*i,e=12*a,r=24*a;function o(){return(Date.now()-(new Date).getTimezoneOffset()*i)%r}function u(t){var e=Math.floor(t)%r;return 0<=e?e:e+r}function s(t){return e<=t?t-e:t}function p(t){return t<e?t+e:t}function d(t,e){switch(t=u(t),e&&String(e)[0].toLowerCase()){case"a":return s(t);case"p":return p(t);default:return t}}function f(t){switch(typeof t){case"number":return u(t);case"string":return function(t){if(!(t=t&&String(t).replace(/[\uff00-\uffef]/g,function(t){return String.fromCharCode(t.charCodeAt(0)-65248)}).replace(/\s/g,"").replace(/(a|p)\.?m?\.?$/i,function(t,e){return e.toLowerCase()})))return 0;if("now"===t.toLowerCase())return o();var e=t.match(/^([+-]?[0-9]{1,2})(?:([0-9]{2})(?:([0-9]{2})([0-9]*))?)?(a|p)?$/i)||t.match(/^([+-]?[0-9]*\.[0-9]*)()()()(a|p)?$/i)||t.match(/^([+-]?[0-9]*\.?[0-9]*):([+-]?[0-9]*\.?[0-9]*)(?::([+-]?[0-9]*\.?[0-9]*))?()(a|p)?$/i);return e?d((e[1]?parseFloat(e[1])*a:0)+(e[2]?parseFloat(e[2])*i:0)+(e[3]?parseFloat(e[3])*c:0)+(e[4]?1e3*parseFloat("0."+e[4]):0),e[5]):NaN}(t);case"object":if(t)return function(t){if("number"==typeof t.totalMilliseconds)return u(t.totalMilliseconds);var e=n(t.h,t.hour,t.hours,0)*a+n(t.m,t.minute,t.minutes,0)*i+n(t.s,t.second,t.seconds,0)*c+n(t.S,t.millisecond,t.milliseconds,0);if(!0===t.am||!1===t.pm)return s(e);if(!0===t.pm||!1===t.am)return p(e);return d(e,t.a)}(t instanceof Array?{h:t[0],m:t[1],s:t[2],S:t[3]}:t)}return NaN}var m={H:h(0,23),HH:h(0,23,2,"0"),_H:h(0,23,2),h:h(1,12),hh:h(1,12,2,"0"),_h:h(1,12,2),k:h(0,11),kk:h(0,11,2,"0"),_k:h(0,23,2),m:h(0,59),mm:h(0,59,2,"0"),_m:h(0,59,2),s:h(0,59),ss:h(0,59,2,"0"),_s:h(0,59,2),S:h(0,9),SS:h(0,99,2,"0"),SSS:h(0,999,3,"0"),a:function(e){return function(t){return"pm"===e?"am":"pm"}},A:function(e){return function(t){return"PM"===e?"AM":"PM"}},aa:function(e){return function(t){return"p.m."===e?"a.m.":"p.m."}},AA:function(e){return function(t){return"P.M."===e?"A.M.":"P.M."}}};function h(a,r,u,s){return void 0===u&&(u=1),function(i){return function(t,e){var o,l,n,c=(o=parseInt(i,10)+t,l=a,n=r,e?(o=(o-l)%(++n-l))<0?o+n:o+l:o<l?l:n<o?n:o);return isNaN(c)?void 0:k(c,u,s)}}}function b(t,e,o){for(var l=v(t),n=0,c=0,i=0;i<l.length;++i){var a=l[i];if(a.literal){var r=e.indexOf(a.property,n);if(-1===r||o<=r){if(0===i)return;var u=e.slice(c,r);return{property:k=l[i-1].property,index:c,value:u,adjust:m[k](u)}}c=n=r+a.property.length}else"_"===a.property[0]&&" "===e[n]&&++n}var s=l[l.length-1];if(s&&!s.literal){var k;u=e.slice(n);return{property:k=s.property,index:n,value:u,adjust:m[k](u)}}}function v(t){for(var e,o=/\\.|HH?|hh?|kk?|mm?|ss?|S{1,3}|AA?|aa?|_H|_h|_k|_m|_s/g,l=[],n=0;e=o.exec(t);){var c=e.index,i=o.lastIndex;n!==c&&l.push({index:n,property:t.slice(n,c),literal:!0}),"\\"===e[0][0]?l.push({index:c,property:e[0].slice(1),literal:!0}):l.push({index:c,property:e[0],literal:!1}),n=i}return n<t.length&&l.push({index:n,property:t.slice(n),literal:!0}),l}var y=function(){function o(t){this._totalMilliseconds=t}return Object.defineProperty(o.prototype,"hour",{get:function(){return Math.floor(this._totalMilliseconds/a)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hour12",{get:function(){return(this.hour+11)%12+1},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"minute",{get:function(){return Math.floor(this._totalMilliseconds%a/i)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"second",{get:function(){return Math.floor(this._totalMilliseconds%i/c)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"millisecond",{get:function(){return this._totalMilliseconds%c},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"am",{get:function(){return this.hour<12},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"pm",{get:function(){return 12<=this.hour},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hours",{get:function(){return this.hour},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hours12",{get:function(){return this.hour12},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"minutes",{get:function(){return this.minute},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"seconds",{get:function(){return this.second},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"milliseconds",{get:function(){return this.millisecond},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"H",{get:function(){return this.invalid?"-":String(this.hour)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"h",{get:function(){return this.invalid?"-":String(this.hour12)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"k",{get:function(){return this.invalid?"-":String((this.hour+23)%24+1)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"m",{get:function(){return this.invalid?"-":String(this.minute)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"s",{get:function(){return this.invalid?"-":String(this.second)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"S",{get:function(){return this.invalid?"-":String(Math.floor(this.millisecond/100))},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"SS",{get:function(){return this.invalid?"--":t(Math.floor(this.millisecond/10),2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"SSS",{get:function(){return this.invalid?"---":t(this.millisecond,3,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"a",{get:function(){return this.invalid?"--":this.am?"am":"pm"},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"A",{get:function(){return this.invalid?"--":this.am?"AM":"PM"},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"aa",{get:function(){return this.invalid?"----":this.am?"a.m.":"p.m."},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"AA",{get:function(){return this.invalid?"----":this.am?"A.M.":"P.M."},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"HH",{get:function(){return this.invalid?"--":k(this.H,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_H",{get:function(){return this.invalid?"--":k(this.H,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hh",{get:function(){return this.invalid?"--":k(this.h,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_h",{get:function(){return this.invalid?"--":k(this.h,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"kk",{get:function(){return this.invalid?"--":k(this.k,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_k",{get:function(){return this.invalid?"--":k(this.k,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"mm",{get:function(){return this.invalid?"--":k(this.m,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_m",{get:function(){return this.invalid?"--":k(this.m,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"ss",{get:function(){return this.invalid?"--":k(this.s,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_s",{get:function(){return this.invalid?"--":k(this.s,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"HHmm",{get:function(){return this.HH+":"+this.mm},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"HHmmss",{get:function(){return this.HHmm+":"+this.ss},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"HHmmssSSS",{get:function(){return this.HHmmss+"."+this.SSS},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"totalMilliseconds",{get:function(){return this._totalMilliseconds},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"totalSeconds",{get:function(){return Math.floor(this._totalMilliseconds/c)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"totalMinutes",{get:function(){return Math.floor(this._totalMilliseconds/i)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"valid",{get:function(){return 0<=this._totalMilliseconds&&this._totalMilliseconds<r},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"invalid",{get:function(){return!this.valid},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"startOfHour",{get:function(){return new o(this._totalMilliseconds-this._totalMilliseconds%a)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"startOfMinute",{get:function(){return new o(this._totalMilliseconds-this._totalMilliseconds%i)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"startOfSecond",{get:function(){return new o(this._totalMilliseconds-this._totalMilliseconds%c)},enumerable:!0,configurable:!0}),o.prototype.ifInvalid=function(t){return this.valid?this:new o(f(t))},o.prototype.startOf=function(t){switch(t){case"hour":return this.startOfHour;case"minute":return this.startOfMinute;case"second":return this.startOfSecond;default:return this}},o.prototype.toString=function(){return this.HHmmssSSS},o.prototype.format=function(t){return e=this,String(t).replace(/\\.|HH?|hh?|kk?|mm?|ss?|S{1,3}|AA?|aa?|_H|_h|_k|_m|_s/g,function(t){return"\\"===t[0]?t[1]:e[t]});var e},o.prototype.with=function(t){return new o(f({h:n(t.h,t.hour,t.hours,this.hour),m:n(t.m,t.minute,t.minutes,this.minute),s:n(t.s,t.second,t.seconds,this.second),S:n(t.S,t.millisecond,t.milliseconds,this.millisecond),am:!0===t.am||!1===t.pm||"am"===t.a||"pm"!==t.a&&void 0}))},o.prototype.plus=function(t){var e=f(t);return 0===e?this:new o(this._totalMilliseconds+e)},o.prototype.minus=function(t){var e=f(t);return 0===e?this:new o(this._totalMilliseconds-e)},o.prototype.equals=function(t){return 0===this.compareTo(t)},o.prototype.compareTo=function(t){return this._totalMilliseconds-f(t)},o.prototype.isBefore=function(t){return this.compareTo(t)<0},o.prototype.isBeforeOrEqual=function(t){return this.compareTo(t)<=0},o.prototype.isAfter=function(t){return 0<this.compareTo(t)},o.prototype.isAfterOrEqual=function(t){return 0<=this.compareTo(t)},o.prototype.isBetweenExclusive=function(t,e){return this.isAfter(t)&&this.isBefore(e)},o.prototype.isBetweenInclusive=function(t,e){return this.isAfterOrEqual(t)&&this.isBeforeOrEqual(e)},o}(),g=new y(0),O=new y(NaN),E=function(t){if(null==t)return O;if(t instanceof y)return t;var e=f(t);return 0===e?g:isNaN(e)?O:new y(e)};function S(t,e,o){void 0===o&&(o=O);for(var l=o,n=0,c=t.length;n<c;++n){var i=E(t[n]);i.valid&&(l=e(l,i,n,t))}return l}function P(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("input",!0,!1,"complete"),t.dispatchEvent(e)}E.prototype=y.prototype,E.INVALID=O,E.ZERO=g,E.now=function(){return new y(o())},E.min=function(){return S(arguments,function(t,e){return t.invalid||e.isBefore(t)?e:t})},E.max=function(){return S(arguments,function(t,e){return t.invalid||e.isAfter(t)?e:t})};var j,w=Object.assign||function(t){for(var e,o=1,l=arguments.length;o<l;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t};if(void 0===window.ontouchend)j=!1;else{var _=window.ontouchend;j=(window.ontouchend=void 0)!==window.ontouchend,window.ontouchend=_}var M=j;function H(t,e,o,l,n){var c=document.createEvent("CustomEvent");return c.initCustomEvent(e,o,l,n),c.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})},t.dispatchEvent(c),c}function L(t,e){return t.getAttribute("data-clocklet-"+e)}function x(t,e,o){t.setAttribute("data-clocklet-"+e,o)}var A=function(){function t(t,e,o){this.dial=t,this.maxValue=e,this.setValue=o,this.hand=this.dial.getElementsByClassName("clocklet-hand")[0],this.dragging=!1,window.PointerEvent?(t.addEventListener("pointerdown",this._onDragStart.bind(this)),addEventListener("pointermove",this._onDrag.bind(this),!0),addEventListener("pointerup",this._onDragEnd.bind(this),!0)):M?(t.addEventListener("touchstart",this._onDragStart.bind(this)),t.addEventListener("touchmove",this._onDrag.bind(this)),t.addEventListener("touchend",this._onDragEnd.bind(this))):(t.addEventListener("mousedown",this._onDragStart.bind(this)),addEventListener("mousemove",this._onDrag.bind(this),!0),addEventListener("mouseup",this._onDragEnd.bind(this),!0))}return t.prototype.value=function(t){this.hand.style.transform="rotate("+360*t/this.maxValue+"deg)";var e="clocklet-tick--selected",o=this.dial.getElementsByClassName(e)[0],l=this.dial.querySelector('[data-clocklet-tick-value="'+t+'"]');o!==l&&(o&&o.classList.remove(e),l&&l.classList.add(e))},t.prototype._onDragStart=function(t){if(t.touches&&1<t.touches.length)this.dragging=!1;else{this.dragging=!0;var e=L(t.target,"tick-value");e&&this.setValue(e),t.preventDefault(),H(this.dial,"clocklet.dragstart",!0,!1)}},t.prototype._onDrag=function(t){if(this.dragging){var e=t.targetTouches?t.targetTouches[0]:t,o=document.elementFromPoint(e.clientX,e.clientY),l=o&&L(o,"tick-value");if(l&&this.dial.contains(o))this.setValue(l);else{var n=this.dial.getBoundingClientRect(),c=e.clientX-n.left-n.width/2,i=e.clientY-n.top-n.height/2,a=Math.atan2(i,c);this.setValue(Math.round(a*this.maxValue/(2*Math.PI)+this.maxValue/4+this.maxValue)%this.maxValue)}t.preventDefault()}},t.prototype._onDragEnd=function(t){this.dragging=!1,t.preventDefault(),H(this.dial,"clocklet.dragend",!0,!1)},t}(),N={className:"",format:"HH:mm",placement:"bottom",alignment:"left",appendTo:"body",zIndex:"",dispatchesInputEvents:!0};function C(t){if(t){for(var e={},o=0,l=t.split(";");o<l.length;o++){var n=l[o],c=n.indexOf(":");e[n.slice(0,c).trim().replace(/[a-zA-Z0-9_]-[a-z]/g,function(t){return t[0]+t[2].toUpperCase()})]=n.slice(c+1).trim()}return e}}var D='<div class="clocklet"><div class="clocklet-plate"><div class="clocklet-dial clocklet-dial--minute"><div class="clocklet-hand clocklet-hand--minute"></div><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="1" style="left:54.8%;top:4.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="2" style="left:59.6%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="3" style="left:64.2%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="4" style="left:68.7%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="5" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="6" style="left:77%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="7" style="left:80.8%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="8" style="left:84.2%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="9" style="left:87.2%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="10" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="11" style="left:92%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="12" style="left:93.7%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="13" style="left:95%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="14" style="left:95.7%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="15" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="16" style="left:95.7%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="17" style="left:95%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="18" style="left:93.7%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="19" style="left:92%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="20" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="21" style="left:87.2%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="22" style="left:84.2%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="23" style="left:80.8%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="24" style="left:77%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="25" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="26" style="left:68.7%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="27" style="left:64.2%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="28" style="left:59.6%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="29" style="left:54.8%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="30" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="31" style="left:45.2%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="32" style="left:40.4%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="33" style="left:35.8%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="34" style="left:31.3%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="35" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="36" style="left:23%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="37" style="left:19.2%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="38" style="left:15.8%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="39" style="left:12.8%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="40" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="41" style="left:8%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="42" style="left:6.3%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="43" style="left:5%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="44" style="left:4.3%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="45" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="46" style="left:4.3%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="47" style="left:5%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="48" style="left:6.3%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="49" style="left:8%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="50" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="51" style="left:12.8%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="52" style="left:15.8%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="53" style="left:19.2%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="54" style="left:23%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="55" style="left:30.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="56" style="left:31.3%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="57" style="left:35.8%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="58" style="left:40.4%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" data-clocklet-tick-value="59" style="left:45.2%;top:4.3%"></button></div><div class="clocklet-dial clocklet-dial--hour"><div class="clocklet-hand clocklet-hand--hour"></div><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="1" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="2" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="3" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="4" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="5" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="6" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="7" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="8" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="9" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="10" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" data-clocklet-tick-value="11" style="left:30.5%;top:16.2%"></button></div><div class="clocklet-ampm"></div><div class="clocklet-hand-origin"></div></div></div>';function T(t,e){return B(t,e,/[Hhk]$/)}function I(t,e){return B(t,e,/a/i)}function B(t,e,o){for(var l=0,n=0,c=v(e);n<c.length;n++){var i=c[n];if(i.literal)l+=i.property.length;else{var a=t[i.property];if(o.test(i.property))return{index:l,value:a};l+=a.length}}}var V=matchMedia("(hover: none)").matches,R=function(){function t(t){var e,o=this;this.container=((e=document.createElement("div")).className="clocklet-container",e.innerHTML=D,e),this.root=this.container.firstElementChild,this.plate=this.root.firstElementChild,this.hour=new A(this.plate.getElementsByClassName("clocklet-dial--hour")[0],12,function(t){return o.value({h:t})}),this.minute=new A(this.plate.getElementsByClassName("clocklet-dial--minute")[0],60,function(t){return o.value({m:t})}),this.ampm=this.plate.getElementsByClassName("clocklet-ampm")[0],this.defaultOptions=w(Object.create(N),t),addEventListener("input",function(t){return t.target===o.input&&o.updateHighlight()},!0),this.root.addEventListener("mousedown",function(t){return t.preventDefault()}),this.ampm.addEventListener("mousedown",function(){return o.value({a:"pm"===L(o.ampm,"ampm")?"am":"pm"})}),this.root.addEventListener("clocklet.dragstart",function(){return o.root.classList.add("clocklet--dragging")}),this.root.addEventListener("clocklet.dragend",function(){return o.root.classList.remove("clocklet--dragging")});var l=this.relocate.bind(this);addEventListener("resize",l),addEventListener("orientationchange",l)}return t.prototype.open=function(t,e){var o=this,l=w(Object.create(this.defaultOptions),e),n=t.getBoundingClientRect(),c=getComputedStyle(t),i=this.container,a=this.root,r={options:l};H(t,"clocklet.opening",!0,!0,r).defaultPrevented||(this.input=t,this.dispatchesInputEvents=l.dispatchesInputEvents,x(a,"placement",l.placement),x(a,"alignment",l.alignment),x(a,"format",l.format),x(a,"append-to",l.appendTo),a.className="clocklet clocklet--showing "+(V?"":"clocklet--hoverable ")+l.className,"top"===l.placement?(a.style.top="",a.style.bottom="0"):(a.style.top=n.height+"px",a.style.bottom=""),"right"===l.alignment?(a.style.left="",a.style.right="-"+n.width+"px"):(a.style.left="0",a.style.right=""),i.style.zIndex=""!==l.zIndex?l.zIndex:(parseInt(c.zIndex,10)||0)+1,"fixed"===c.position||"parent"===l.appendTo&&("absolute"===c.position||"relative"===c.position)?z(i.style,c,["position","left","top","right","bottom","marginLeft","marginTop","marginRight","marginBottom"]):(z(i.style,{},["right","bottom","marginLeft","marginTop","marginRight","marginBottom"]),"parent"===l.appendTo?(i.style.position="relative",i.style.left="0",i.style.top="0"):(i.style.position="absolute",i.style.left=document.documentElement.scrollLeft+document.body.scrollLeft+n.left+"px",i.style.top=document.documentElement.scrollTop+document.body.scrollTop+n.top+"px")),"parent"===l.appendTo?t.parentElement.insertBefore(i,t):i.parentElement!==document.body&&document.body.appendChild(i),this.updateHighlight(),setTimeout(function(){a.classList.remove("clocklet--showing"),o.input&&a.classList.add("clocklet--shown")}),H(t,"clocklet.opened",!0,!1,r))},t.prototype.close=function(){var t=this.input,e={};t&&(H(t,"clocklet.closing",!0,!0,e).defaultPrevented?t.focus():(this.input=void 0,this.root.classList.remove("clocklet--shown"),H(t,"clocklet.closed",!0,!1,e)))},t.prototype.value=function(t){if(this.input){var e=this.input.value,o=E(this.input.value).with(void 0!==t.a?t:{h:t.h,m:t.m,a:L(this.ampm,"ampm")}),l=L(this.root,"format");if(this.input.value=o.format(l),"text"===this.input.type){var n=void 0!==t.h?T(o,l):void 0!==t.m?B(o,l,/m$/):void 0!==t.a?I(o,l)||T(o,l):void 0;n&&this.input.setSelectionRange(n.index,n.index+n.value.length)}this.dispatchesInputEvents&&this.input.value!==e&&H(this.input,"input",!0,!1,void 0)}},t.prototype.updateHighlight=function(){if(this.input){var t=this.input.value?E(this.input.value):E.INVALID;t.valid?(x(this.root,"value",t.HHmm),this.hour.value(t.hour%12),this.minute.value(t.minute),x(this.ampm,"ampm",t.a)):(x(this.root,"value",""),this.hour.value(-1),this.minute.value(-1),x(this.ampm,"ampm","am"));var e=I(t.valid?t:E.ZERO,L(this.root,"format"));x(this.ampm,"ampm-formatted",e&&e.value||"")}},t.prototype.relocate=function(){if(this.input&&"body"===L(this.root,"append-to")){var t=this.input.getBoundingClientRect();this.container.style.left=document.documentElement.scrollLeft+document.body.scrollLeft+t.left+"px",this.container.style.top=document.documentElement.scrollTop+document.body.scrollTop+t.top+"px"}},t}();function z(t,e,o){for(var l=0,n=o;l<n.length;l++){var c=n[l];t[c]=e[c]||""}}var F,q,$,Z,K,X,Y={dataAttributeName:"clocklet",formatSelector:function(t){var e=C(t.getAttribute("data-clocklet"));return e&&e.format}};return K=(Z=Y)&&Z.dataAttributeName||"lenientime",X=Z&&Z.formatSelector||function(t){return t.dataset.lenientime},addEventListener("change",function(t){var e=t.target,o=e.value,l=e.dataset;if(o&&K in l){var n=E(o),c=n.valid?n.format(X(e)||"HH:mm"):"";c!==o&&(e.value=c,P(e))}},!0),q=(F=Y)&&F.dataAttributeName||"lenientime",$=F&&F.formatSelector||function(t){return t.dataset.lenientime},F&&F.amountSelector,addEventListener("keydown",function(t){var e=t.which;if(!(38!==e&&40!==e||t.altKey||t.ctrlKey||t.metaKey)){var o=t.target,l=o.dataset;if(q in l){t.preventDefault();var n=$(o)||"HH:mm",c=o.value;if(c){var i=o.selectionStart;if(s=null===i?void 0:b(n,c,i)){var a=(38===e?1:-1)*(F&&F.amountSelector&&F.amountSelector(o)||1),r=s.adjust(a,!0);if(void 0!==r){var u=s.index;o.value=c.slice(0,u)+r+c.slice(u+s.value.length),o.setSelectionRange(u,u+r.length),P(o)}}}else{var s;o.value=E.ZERO.format(n),(s=b(n,o.value,0))&&o.setSelectionRange(s.index,s.index+s.value.length),P(o)}}}},!0),function(t){void 0===t&&(t={});var o=new R(t.defaultOptions),e=t.target||"input[data-clocklet]",l=t.optionsSelector||function(t){return C(t.getAttribute("data-clocklet"))},n=o.close.bind(o);if(e instanceof Element)e.addEventListener("focus",function(t){return o.open(t.target,l(t.target))}),e.addEventListener("blur",n);else{var c="function"==typeof e?e:function(t){return(Element.prototype.matches||Element.prototype.msMatchesSelector).call(t,e)};document.body.addEventListener("focus",function(t){var e=t.target;c(e)&&o.open(e,l(e))},!0),document.body.addEventListener("blur",n,!0)}return o}()}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
164881
2289