Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clocklet

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clocklet - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

4

es/clocklet.js

@@ -28,7 +28,7 @@ import adjustOnArrowKeys from 'lenientime/es/input-helpers/adjust-on-arrow-keys';

var isTarget_1 = typeof target === 'function' ? target : function (element) { return (Element.prototype.matches || Element.prototype.msMatchesSelector).call(element, target); };
document.body.addEventListener('focus', function (event) {
addEventListener('focus', function (event) {
var element = event.target;
isTarget_1(element) && instance.open(element, optionsSelector(element));
}, true);
document.body.addEventListener('blur', close, true);
addEventListener('blur', close, true);
}

@@ -35,0 +35,0 @@ return instance;

declare const template: string
export default template
{
"name": "clocklet",
"version": "0.2.4",
"version": "0.2.5",
"description": "An opinionated clock-style vanilla-js timepicker",

@@ -18,5 +18,5 @@ "repository": "luncheon/clocklet",

"clean": "rimraf es/ umd/ css/ .docs/ docs/demo.html",
"start": "concurrently --kill-others \"npm run watch:umd\" \"npm run watch:css\" \"npm run watch:demo\"",
"start": "npm-run-all -p watch:*",
"diff": "publish-diff",
"build": "npm run build:es && npm run build:umd && npm run build:css && npm run build:demo",
"build": "npm-run-all -p build:es build:umd build:css build:demo",
"build:es": "rimraf es/ && rollup -c -f es -i src/script/template.pug -o es/template.pug.js && copyfiles -f src/script/template.pug.d.ts es/ && tsc -p . --outDir es/",

@@ -27,4 +27,4 @@ "build:umd": "rimraf umd/ && rollup -c -n clocklet -i src/script/clocklet.ts -o umd/clocklet.js && uglifyjs -m -c join_vars=true -o umd/clocklet.min.js umd/clocklet.js",

"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.2.4'}",
"watch:demo": "rimraf .docs/ docs/demo.html && pug -w -o .docs/ src/demo/demo.pug -O {cdnBaseUrl:'..'}"
"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.2.5'}\"",
"watch:demo": "rimraf .docs/ docs/demo.html && pug -w -o .docs/ src/demo/demo.pug -O \"{cdnBaseUrl:'..'}\""
},

@@ -46,18 +46,18 @@ "keywords": [

"devDependencies": {
"concurrently": "^4.1.0",
"copyfiles": "^2.1.0",
"@rollup/plugin-node-resolve": "^7.1.1",
"copyfiles": "^2.2.0",
"cssnano": "^4.1.10",
"jstransformer-escape-html": "^1.1.0",
"mkdirp": "^0.5.1",
"postcss-cli": "^6.1.2",
"mkdirp": "^1.0.3",
"npm-run-all": "^4.1.5",
"postcss-cli": "^7.1.0",
"publish-diff": "^0.4.1",
"pug-cli": "^1.0.0-alpha6",
"rimraf": "^2.6.3",
"rollup": "^1.4.1",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-pug": "^1.1.0",
"stylus": "^0.54.5",
"typescript": "^3.3.3333",
"uglify-js": "^3.4.9"
"rimraf": "^3.0.2",
"rollup": "^2.2.0",
"rollup-plugin-pug": "^1.1.1",
"stylus": "^0.54.7",
"typescript": "^3.8.3",
"uglify-js": "^3.8.0"
}
}

@@ -42,4 +42,4 @@ ## <a name="clocklet" href="#clocklet" style="pointer-events:none">![Clocklet](https://luncheon.github.io/clocklet/logo.png)</a>

```html
<link rel="https://cdn.jsdelivr.net/npm/clocklet@0.2.4/css/clocklet.min.css">
<script src="https://cdn.jsdelivr.net/npm/clocklet@0.2.4"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/clocklet@0.2.5/css/clocklet.min.css">
<script src="https://cdn.jsdelivr.net/npm/clocklet@0.2.5"></script>
<script>/* `window.clocklet` object is available */</script>

@@ -50,4 +50,4 @@ ```

<a target="_blank" download="clocklet.min.css" href="https://cdn.jsdelivr.net/npm/clocklet@0.2.4/css/clocklet.min.css">clocklet.min.css</a>
<a target="_blank" download="clocklet.min.js" href="https://cdn.jsdelivr.net/npm/clocklet@0.2.4/umd/clocklet.min.js">clocklet.min.js</a>
<a target="_blank" download="clocklet.min.css" href="https://cdn.jsdelivr.net/npm/clocklet@0.2.5/css/clocklet.min.css">clocklet.min.css</a>
<a target="_blank" download="clocklet.min.js" href="https://cdn.jsdelivr.net/npm/clocklet@0.2.5/umd/clocklet.min.js">clocklet.min.js</a>

@@ -54,0 +54,0 @@

@@ -34,7 +34,7 @@ import adjustOnArrowKeys from 'lenientime/es/input-helpers/adjust-on-arrow-keys'

const isTarget = typeof target === 'function' ? target : (element: Element) => (Element.prototype.matches || Element.prototype.msMatchesSelector).call(element, target) as boolean
document.body.addEventListener('focus', event => {
addEventListener('focus', event => {
const element = event.target as HTMLInputElement
isTarget(element) && instance.open(element, optionsSelector(element))
}, true)
document.body.addEventListener('blur', close, true)
addEventListener('blur', close, true)
}

@@ -41,0 +41,0 @@ return instance

@@ -0,0 +0,0 @@ export function getClockletData(element: Element, attributeName: string) {

@@ -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

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = global || self, global.clocklet = factory());
}(this, function () { 'use strict';
}(this, (function () { 'use strict';

@@ -696,8 +696,11 @@ function padStart(source, minLength, pad) {

var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};

@@ -1058,7 +1061,7 @@

var isTarget_1 = typeof target === 'function' ? target : function (element) { return (Element.prototype.matches || Element.prototype.msMatchesSelector).call(element, target); };
document.body.addEventListener('focus', function (event) {
addEventListener('focus', function (event) {
var element = event.target;
isTarget_1(element) && instance.open(element, optionsSelector(element));
}, true);
document.body.addEventListener('blur', close, true);
addEventListener('blur', close, true);
}

@@ -1071,2 +1074,2 @@ return instance;

}));
})));

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).clocklet=e()}(this,function(){"use strict";function p(t,e,o){return t=String(t),!e||!isFinite(e)||t.length>=e?t:n(e-t.length,o)+t}function t(t,e,o){return t=String(t),!e||!isFinite(e)||t.length>=e?t:t+n(e-t.length,o)}function n(t,e){for(var o=e=null==e||""===e?" ":String(e);o.length<t;)o+=e;return o.substr(0,t)}function l(){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 n=parseFloat(o);if(isFinite(n))return n}}}var c=1e3,i=60*c,a=60*i,e=12*a,u=24*a;function o(){return(Date.now()-(new Date).getTimezoneOffset()*i)%u}function r(t){var e=Math.floor(t)%u;return 0<=e?e:e+u}function s(t){return e<=t?t-e:t}function k(t){return t<e?t+e:t}function f(t,e){switch(t=r(t),e&&String(e)[0].toLowerCase()){case"a":return s(t);case"p":return k(t);default:return t}}function d(t){switch(typeof t){case"number":return r(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?f((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 r(t.totalMilliseconds);var e=l(t.h,t.hour,t.hours,0)*a+l(t.m,t.minute,t.minutes,0)*i+l(t.s,t.second,t.seconds,0)*c+l(t.S,t.millisecond,t.milliseconds,0);return!0!==t.am&&!1!==t.pm?!0!==t.pm&&!1!==t.am?f(e,t.a):k(e):s(e)}(t instanceof Array?{h:t[0],m:t[1],s:t[2],S:t[3]}:t)}return NaN}var b={H:m(0,23),HH:m(0,23,2,"0"),_H:m(0,23,2),h:m(1,12),hh:m(1,12,2,"0"),_h:m(1,12,2),k:m(0,11),kk:m(0,11,2,"0"),_k:m(0,23,2),m:m(0,59),mm:m(0,59,2,"0"),_m:m(0,59,2),s:m(0,59),ss:m(0,59,2,"0"),_s:m(0,59,2),S:m(0,9),SS:m(0,99,2,"0"),SSS:m(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 m(a,u,r,s){return void 0===r&&(r=1),function(i){return function(t,e){var o,n,l,c=(o=parseInt(i,10)+t,n=a,l=u,e?(o=(o-n)%(++l-n))<0?o+l:o+n:o<n?n:l<o?l:o);return isNaN(c)?void 0:p(c,r,s)}}}function h(t,e,o){for(var n=y(t),l=0,c=0,i=0;i<n.length;++i){var a=n[i];if(a.literal){var u=e.indexOf(a.property,l);if(-1===u||o<=u){if(0===i)return;var r=e.slice(c,u);return{property:p=n[i-1].property,index:c,value:r,adjust:b[p](r)}}c=l=u+a.property.length}else"_"===a.property[0]&&" "===e[l]&&++l}var s=n[n.length-1];if(s&&!s.literal){var p;r=e.slice(l);return{property:p=s.property,index:l,value:r,adjust:b[p](r)}}}function y(t){for(var e,o=/\\.|HH?|hh?|kk?|mm?|ss?|S{1,3}|AA?|aa?|_H|_h|_k|_m|_s/g,n=[],l=0;e=o.exec(t);){var c=e.index,i=o.lastIndex;l!==c&&n.push({index:l,property:t.slice(l,c),literal:!0}),"\\"===e[0][0]?n.push({index:c,property:e[0].slice(1),literal:!0}):n.push({index:c,property:e[0],literal:!1}),l=i}return l<t.length&&n.push({index:l,property:t.slice(l),literal:!0}),n}var v=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?"--":p(this.H,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_H",{get:function(){return this.invalid?"--":p(this.H,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"hh",{get:function(){return this.invalid?"--":p(this.h,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_h",{get:function(){return this.invalid?"--":p(this.h,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"kk",{get:function(){return this.invalid?"--":p(this.k,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_k",{get:function(){return this.invalid?"--":p(this.k,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"mm",{get:function(){return this.invalid?"--":p(this.m,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_m",{get:function(){return this.invalid?"--":p(this.m,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"ss",{get:function(){return this.invalid?"--":p(this.s,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_s",{get:function(){return this.invalid?"--":p(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<u},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(d(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(d({h:l(t.h,t.hour,t.hours,this.hour),m:l(t.m,t.minute,t.minutes,this.minute),s:l(t.s,t.second,t.seconds,this.second),S:l(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=d(t);return 0===e?this:new o(this._totalMilliseconds+e)},o.prototype.minus=function(t){var e=d(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-d(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 v(0),O=new v(NaN),E=function(t){if(null==t)return O;if(t instanceof v)return t;var e=d(t);return 0===e?g:isNaN(e)?O:new v(e)};function S(t,e,o){void 0===o&&(o=O);for(var n=o,l=0,c=t.length;l<c;++l){var i=E(t[l]);i.valid&&(n=e(n,i,l,t))}return n}function _(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("input",!0,!1,"complete"),t.dispatchEvent(e)}E.prototype=v.prototype,E.INVALID=O,E.ZERO=g,E.now=function(){return new v(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 P,j=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var l in e=arguments[o])Object.prototype.hasOwnProperty.call(e,l)&&(t[l]=e[l]);return t};if(void 0===window.ontouchend)P=!1;else{var w=window.ontouchend;P=(window.ontouchend=void 0)!==window.ontouchend,window.ontouchend=w}var M=P;function x(t,e,o,n,l){var c=document.createEvent("CustomEvent");return c.initCustomEvent(e,o,n,l),c.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})},t.dispatchEvent(c),c}function H(t,e){return t.getAttribute("data-clocklet-"+e)}function L(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],n=this.dial.querySelector('[data-clocklet-tick-value="'+t+'"]');o!==n&&(o&&o.classList.remove(e),n&&n.classList.add(e))},t.prototype._onDragStart=function(t){if(t.touches&&1<t.touches.length)this.dragging=!1;else{this.dragging=!0;var e=H(t.target,"tick-value");e&&this.setValue(e),t.preventDefault(),x(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),n=o&&H(o,"tick-value");if(n&&this.dial.contains(o))this.setValue(n);else{var l=this.dial.getBoundingClientRect(),c=e.clientX-l.left-l.width/2,i=e.clientY-l.top-l.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(),x(this.dial,"clocklet.dragend",!0,!1)},t}(),C={className:"",format:"HH:mm",placement:"bottom",alignment:"left",appendTo:"body",zIndex:"",dispatchesInputEvents:!0};function N(t){if(t){for(var e={},o=0,n=t.split(";");o<n.length;o++){var l=n[o],c=l.indexOf(":");e[l.slice(0,c).trim().replace(/[a-zA-Z0-9_]-[a-z]/g,function(t){return t[0]+t[2].toUpperCase()})]=l.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" type="button" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="1" style="left:54.8%;top:4.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="2" style="left:59.6%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="3" style="left:64.2%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="4" style="left:68.7%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="5" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="6" style="left:77%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="7" style="left:80.8%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="8" style="left:84.2%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="9" style="left:87.2%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="10" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="11" style="left:92%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="12" style="left:93.7%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="13" style="left:95%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="14" style="left:95.7%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="15" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="16" style="left:95.7%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="17" style="left:95%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="18" style="left:93.7%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="19" style="left:92%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="20" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="21" style="left:87.2%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="22" style="left:84.2%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="23" style="left:80.8%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="24" style="left:77%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="25" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="26" style="left:68.7%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="27" style="left:64.2%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="28" style="left:59.6%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="29" style="left:54.8%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="30" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="31" style="left:45.2%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="32" style="left:40.4%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="33" style="left:35.8%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="34" style="left:31.3%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="35" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="36" style="left:23%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="37" style="left:19.2%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="38" style="left:15.8%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="39" style="left:12.8%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="40" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="41" style="left:8%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="42" style="left:6.3%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="43" style="left:5%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="44" style="left:4.3%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="45" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="46" style="left:4.3%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="47" style="left:5%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="48" style="left:6.3%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="49" style="left:8%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="50" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="51" style="left:12.8%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="52" style="left:15.8%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="53" style="left:19.2%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="54" style="left:23%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="55" style="left:30.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="56" style="left:31.3%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="57" style="left:35.8%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="58" style="left:40.4%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" 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" type="button" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="1" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="2" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="3" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="4" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="5" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="6" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="7" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="8" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="9" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="10" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" 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 n=0,l=0,c=y(e);l<c.length;l++){var i=c[l];if(i.literal)n+=i.property.length;else{var a=t[i.property];if(o.test(i.property))return{index:n,value:a};n+=a.length}}}var V=["position","left","top","right","bottom","marginLeft","marginTop","marginRight","marginBottom"],R=matchMedia("(hover: none)").matches,z=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=j(Object.create(C),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"===H(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 n=function(){return o._relocate&&o._relocate()};addEventListener("resize",n),addEventListener("orientationchange",n)}return t.prototype.open=function(e,t){var o=this,n=j(Object.create(this.defaultOptions),t),l=e.getBoundingClientRect(),c=getComputedStyle(e),i=this.container,a=this.root,u={options:n};if(!x(e,"clocklet.opening",!0,!0,u).defaultPrevented){if(this.input=e,this.dispatchesInputEvents=n.dispatchesInputEvents,L(a,"placement",n.placement),L(a,"alignment",n.alignment),L(a,"format",n.format),L(a,"append-to",n.appendTo),a.className="clocklet clocklet--showing "+(R?"":"clocklet--hoverable ")+n.className,i.style.zIndex=""!==n.zIndex?n.zIndex:(parseInt(c.zIndex,10)||0)+1,"parent"===n.appendTo?e.parentElement.insertBefore(i,e):i.parentElement!==document.body&&document.body.appendChild(i),"top"===n.placement?(a.style.top="",a.style.bottom="0"):(a.style.top=l.height+"px",a.style.bottom=""),"right"===n.alignment?(a.style.left="",a.style.right="-"+l.width+"px"):("center"===n.alignment?a.style.left=(e.offsetWidth-a.offsetWidth)/2+"px":a.style.left="0",a.style.right=""),"fixed"===c.position||"parent"===n.appendTo&&"absolute"===c.position)this._relocate=void 0,F(i.style,c,V);else{if(F(i.style,{},V),"parent"===n.appendTo){var r=getComputedStyle(e.parentElement);"flex"===r.display||"inline-flex"===r.display?(i.style.position="absolute",this._relocate=function(){i.style.left=e.offsetLeft+"px",i.style.top=e.offsetTop+"px"}):(i.style.position="relative",this._relocate=function(){i.style.left=i.style.top="",i.style.left=e.offsetLeft-i.offsetLeft+"px",i.style.top=e.offsetTop-i.offsetTop+"px"})}else i.style.position="absolute",this._relocate=function(){var t=e.getBoundingClientRect();i.style.left=document.documentElement.scrollLeft+document.body.scrollLeft+t.left+"px",i.style.top=document.documentElement.scrollTop+document.body.scrollTop+t.top+"px"};this._relocate()}this.updateHighlight(),setTimeout(function(){a.classList.remove("clocklet--showing"),o.input&&a.classList.add("clocklet--shown")}),x(e,"clocklet.opened",!0,!1,u)}},t.prototype.close=function(){var t=this.input,e={};t&&(x(t,"clocklet.closing",!0,!0,e).defaultPrevented?t.focus():(this.input=void 0,this.root.classList.remove("clocklet--shown"),x(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:H(this.ampm,"ampm")}),n=H(this.root,"format");if(this.input.value=o.format(n),"text"===this.input.type){var l=void 0!==t.h?T(o,n):void 0!==t.m?B(o,n,/m$/):void 0!==t.a?I(o,n)||T(o,n):void 0;l&&this.input.setSelectionRange(l.index,l.index+l.value.length)}this.dispatchesInputEvents&&this.input.value!==e&&x(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=I(t.valid?t:E.ZERO,H(this.root,"format"));L(this.ampm,"ampm-formatted",e&&e.value||"")}},t}();function F(t,e,o){for(var n=0,l=o;n<l.length;n++){var c=l[n];t[c]=e[c]||""}}var q,$,Z,K,W,X,Y={dataAttributeName:"clocklet",formatSelector:function(t){var e=N(t.getAttribute("data-clocklet"));return e&&e.format}};return W=(K=Y)&&K.dataAttributeName||"lenientime",X=K&&K.formatSelector||function(t){return t.dataset.lenientime},addEventListener("change",function(t){var e=t.target,o=e.value,n=e.dataset;if(o&&W in n){var l=E(o),c=l.valid?l.format(X(e)||"HH:mm"):"";c!==o&&(e.value=c,_(e))}},!0),$=(q=Y)&&q.dataAttributeName||"lenientime",Z=q&&q.formatSelector||function(t){return t.dataset.lenientime},q&&q.amountSelector,addEventListener("keydown",function(t){var e=t.which;if(!(38!==e&&40!==e||t.altKey||t.ctrlKey||t.metaKey)){var o=t.target,n=o.dataset;if($ in n){t.preventDefault();var l=Z(o)||"HH:mm",c=o.value;if(c){var i=o.selectionStart;if(s=null===i?void 0:h(l,c,i)){var a=(38===e?1:-1)*(q&&q.amountSelector&&q.amountSelector(o)||1),u=s.adjust(a,!0);if(void 0!==u){var r=s.index;o.value=c.slice(0,r)+u+c.slice(r+s.value.length),o.setSelectionRange(r,r+u.length),_(o)}}}else{var s;o.value=E.ZERO.format(l),(s=h(l,o.value,0))&&o.setSelectionRange(s.index,s.index+s.value.length),_(o)}}}},!0),function(t){void 0===t&&(t={});var o=new z(t.defaultOptions),e=t.target||"input[data-clocklet]",n=t.optionsSelector||function(t){return N(t.getAttribute("data-clocklet"))},l=o.close.bind(o);if(e instanceof Element)e.addEventListener("focus",function(t){return o.open(t.target,n(t.target))}),e.addEventListener("blur",l);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,n(e))},!0),document.body.addEventListener("blur",l,!0)}return o}()});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).clocklet=e()}(this,function(){"use strict";function p(t,e,o){return t=String(t),!e||!isFinite(e)||t.length>=e?t:n(e-t.length,o)+t}function t(t,e,o){return t=String(t),!e||!isFinite(e)||t.length>=e?t:t+n(e-t.length,o)}function n(t,e){for(var o=e=null==e||""===e?" ":String(e);o.length<t;)o+=e;return o.substr(0,t)}function o(){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 n=parseFloat(o);if(isFinite(n))return n}}}var l=1e3,c=60*l,i=60*c,e=12*i,a=24*i;function u(){return(Date.now()-(new Date).getTimezoneOffset()*c)%a}function r(t){var e=Math.floor(t)%a;return 0<=e?e:e+a}function s(t){return e<=t?t-e:t}function k(t){return t<e?t+e:t}function f(t,e){switch(t=r(t),e&&String(e)[0].toLowerCase()){case"a":return s(t);case"p":return k(t);default:return t}}function d(t){switch(typeof t){case"number":return r(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 u();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?f((e[1]?parseFloat(e[1])*i:0)+(e[2]?parseFloat(e[2])*c:0)+(e[3]?parseFloat(e[3])*l: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 r(t.totalMilliseconds);var e=o(t.h,t.hour,t.hours,0)*i+o(t.m,t.minute,t.minutes,0)*c+o(t.s,t.second,t.seconds,0)*l+o(t.S,t.millisecond,t.milliseconds,0);return!0!==t.am&&!1!==t.pm?!0!==t.pm&&!1!==t.am?f(e,t.a):k(e):s(e)}(t instanceof Array?{h:t[0],m:t[1],s:t[2],S:t[3]}:t)}return NaN}function b(){return/\\.|HH?|hh?|kk?|mm?|ss?|S{1,3}|AA?|aa?|_H|_h|_k|_m|_s/g}var h={H:m(0,23),HH:m(0,23,2,"0"),_H:m(0,23,2),h:m(1,12),hh:m(1,12,2,"0"),_h:m(1,12,2),k:m(0,11),kk:m(0,11,2,"0"),_k:m(0,23,2),m:m(0,59),mm:m(0,59,2,"0"),_m:m(0,59,2),s:m(0,59),ss:m(0,59,2,"0"),_s:m(0,59,2),S:m(0,9),SS:m(0,99,2,"0"),SSS:m(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 m(a,u,r,s){return void 0===r&&(r=1),function(i){return function(t,e){var o,n,l,c=(o=parseInt(i,10)+t,n=a,l=u,e?(o=(o-n)%(++l-n))<0?o+l:o+n:o<n?n:l<o?l:o);return isNaN(c)?void 0:p(c,r,s)}}}function y(t,e,o){for(var n=v(t),l=0,c=0,i=0;i<n.length;++i){var a=n[i];if(a.literal){var u=e.indexOf(a.property,l);if(-1===u||o<=u){if(0===i)return;var r=e.slice(c,u);return{property:p=n[i-1].property,index:c,value:r,adjust:h[p](r)}}c=l=u+a.property.length}else"_"===a.property[0]&&" "===e[l]&&++l}var s=n[n.length-1];if(s&&!s.literal){var p;r=e.slice(l);return{property:p=s.property,index:l,value:r,adjust:h[p](r)}}}function v(t){for(var e,o=b(),n=[],l=0;e=o.exec(t);){var c=e.index,i=o.lastIndex;l!==c&&n.push({index:l,property:t.slice(l,c),literal:!0}),"\\"===e[0][0]?n.push({index:c,property:e[0].slice(1),literal:!0}):n.push({index:c,property:e[0],literal:!1}),l=i}return l<t.length&&n.push({index:l,property:t.slice(l),literal:!0}),n}var g=(Object.defineProperty(O.prototype,"hour",{get:function(){return Math.floor(this._totalMilliseconds/i)},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%i/c)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"second",{get:function(){return Math.floor(this._totalMilliseconds%c/l)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"millisecond",{get:function(){return this._totalMilliseconds%l},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?"--":p(this.H,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"_H",{get:function(){return this.invalid?"--":p(this.H,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"hh",{get:function(){return this.invalid?"--":p(this.h,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"_h",{get:function(){return this.invalid?"--":p(this.h,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"kk",{get:function(){return this.invalid?"--":p(this.k,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"_k",{get:function(){return this.invalid?"--":p(this.k,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"mm",{get:function(){return this.invalid?"--":p(this.m,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"_m",{get:function(){return this.invalid?"--":p(this.m,2," ")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"ss",{get:function(){return this.invalid?"--":p(this.s,2,"0")},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"_s",{get:function(){return this.invalid?"--":p(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/l)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"totalMinutes",{get:function(){return Math.floor(this._totalMilliseconds/c)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"valid",{get:function(){return 0<=this._totalMilliseconds&&this._totalMilliseconds<a},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%i)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"startOfMinute",{get:function(){return new O(this._totalMilliseconds-this._totalMilliseconds%c)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"startOfSecond",{get:function(){return new O(this._totalMilliseconds-this._totalMilliseconds%l)},enumerable:!0,configurable:!0}),O.prototype.ifInvalid=function(t){return this.valid?this:new O(d(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(b(),function(t){return"\\"===t[0]?t[1]:e[t]});var e},O.prototype.with=function(t){return new O(d({h:o(t.h,t.hour,t.hours,this.hour),m:o(t.m,t.minute,t.minutes,this.minute),s:o(t.s,t.second,t.seconds,this.second),S:o(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=d(t);return 0===e?this:new O(this._totalMilliseconds+e)},O.prototype.minus=function(t){var e=d(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-d(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);function O(t){this._totalMilliseconds=t}function E(t){if(null==t)return P;if(t instanceof g)return t;var e=d(t);return 0===e?S:isNaN(e)?P:new g(e)}var S=new g(0),P=new g(NaN);function j(t,e,o){void 0===o&&(o=P);for(var n=o,l=0,c=t.length;l<c;++l){var i=E(t[l]);i.valid&&(n=e(n,i,l,t))}return n}function _(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("input",!0,!1,"complete"),t.dispatchEvent(e)}E.prototype=g.prototype,E.INVALID=P,E.ZERO=S,E.now=function(){return new g(u())},E.min=function(){return j(arguments,function(t,e){return t.invalid||e.isBefore(t)?e:t})},E.max=function(){return j(arguments,function(t,e){return t.invalid||e.isAfter(t)?e:t})};var w,M=function(){return(M=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var l in e=arguments[o])Object.prototype.hasOwnProperty.call(e,l)&&(t[l]=e[l]);return t}).apply(this,arguments)};if(void 0===window.ontouchend)w=!1;else{var x=window.ontouchend;w=(window.ontouchend=void 0)!==window.ontouchend,window.ontouchend=x}var H=w;function L(t,e,o,n,l){var c=document.createEvent("CustomEvent");return c.initCustomEvent(e,o,n,l),c.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})},t.dispatchEvent(c),c}function A(t,e){return t.getAttribute("data-clocklet-"+e)}function C(t,e,o){t.setAttribute("data-clocklet-"+e,o)}var N=(D.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],n=this.dial.querySelector('[data-clocklet-tick-value="'+t+'"]');o!==n&&(o&&o.classList.remove(e),n&&n.classList.add(e))},D.prototype._onDragStart=function(t){if(t.touches&&1<t.touches.length)this.dragging=!1;else{this.dragging=!0;var e=A(t.target,"tick-value");e&&this.setValue(e),t.preventDefault(),L(this.dial,"clocklet.dragstart",!0,!1)}},D.prototype._onDrag=function(t){if(this.dragging){var e=t.targetTouches?t.targetTouches[0]:t,o=document.elementFromPoint(e.clientX,e.clientY),n=o&&A(o,"tick-value");if(n&&this.dial.contains(o))this.setValue(n);else{var l=this.dial.getBoundingClientRect(),c=e.clientX-l.left-l.width/2,i=e.clientY-l.top-l.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()}},D.prototype._onDragEnd=function(t){this.dragging=!1,t.preventDefault(),L(this.dial,"clocklet.dragend",!0,!1)},D);function D(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)):H?(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))}var T={className:"",format:"HH:mm",placement:"bottom",alignment:"left",appendTo:"body",zIndex:"",dispatchesInputEvents:!0};function I(t){if(t){for(var e={},o=0,n=t.split(";");o<n.length;o++){var l=n[o],c=l.indexOf(":");e[l.slice(0,c).trim().replace(/[a-zA-Z0-9_]-[a-z]/g,function(t){return t[0]+t[2].toUpperCase()})]=l.slice(c+1).trim()}return e}}var B='<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" type="button" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="1" style="left:54.8%;top:4.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="2" style="left:59.6%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="3" style="left:64.2%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="4" style="left:68.7%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="5" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="6" style="left:77%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="7" style="left:80.8%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="8" style="left:84.2%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="9" style="left:87.2%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="10" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="11" style="left:92%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="12" style="left:93.7%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="13" style="left:95%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="14" style="left:95.7%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="15" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="16" style="left:95.7%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="17" style="left:95%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="18" style="left:93.7%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="19" style="left:92%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="20" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="21" style="left:87.2%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="22" style="left:84.2%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="23" style="left:80.8%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="24" style="left:77%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="25" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="26" style="left:68.7%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="27" style="left:64.2%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="28" style="left:59.6%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="29" style="left:54.8%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="30" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="31" style="left:45.2%;top:95.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="32" style="left:40.4%;top:95%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="33" style="left:35.8%;top:93.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="34" style="left:31.3%;top:92%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="35" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="36" style="left:23%;top:87.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="37" style="left:19.2%;top:84.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="38" style="left:15.8%;top:80.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="39" style="left:12.8%;top:77%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="40" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="41" style="left:8%;top:68.7%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="42" style="left:6.3%;top:64.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="43" style="left:5%;top:59.6%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="44" style="left:4.3%;top:54.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="45" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="46" style="left:4.3%;top:45.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="47" style="left:5%;top:40.4%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="48" style="left:6.3%;top:35.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="49" style="left:8%;top:31.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="50" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="51" style="left:12.8%;top:23%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="52" style="left:15.8%;top:19.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="53" style="left:19.2%;top:15.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="54" style="left:23%;top:12.8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="55" style="left:30.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="56" style="left:31.3%;top:8%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="57" style="left:35.8%;top:6.3%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" data-clocklet-tick-value="58" style="left:40.4%;top:5%"></button><button class="clocklet-tick clocklet-tick--minute" type="button" 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" type="button" data-clocklet-tick-value="0" style="left:50%;top:11%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="1" style="left:69.5%;top:16.2%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="2" style="left:83.8%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="3" style="left:89%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="4" style="left:83.8%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="5" style="left:69.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="6" style="left:50%;top:89%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="7" style="left:30.5%;top:83.8%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="8" style="left:16.2%;top:69.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="9" style="left:11%;top:50%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" data-clocklet-tick-value="10" style="left:16.2%;top:30.5%"></button><button class="clocklet-tick clocklet-tick--hour" type="button" 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 V(t,e){return z(t,e,/[Hhk]$/)}function R(t,e){return z(t,e,/a/i)}function z(t,e,o){for(var n=0,l=0,c=v(e);l<c.length;l++){var i=c[l];if(i.literal)n+=i.property.length;else{var a=t[i.property];if(o.test(i.property))return{index:n,value:a};n+=a.length}}}var F=["position","left","top","right","bottom","marginLeft","marginTop","marginRight","marginBottom"],q=matchMedia("(hover: none)").matches,$=(Z.prototype.open=function(e,t){var o=this,n=M(Object.create(this.defaultOptions),t),l=e.getBoundingClientRect(),c=getComputedStyle(e),i=this.container,a=this.root,u={options:n};if(!L(e,"clocklet.opening",!0,!0,u).defaultPrevented){if(this.input=e,this.dispatchesInputEvents=n.dispatchesInputEvents,C(a,"placement",n.placement),C(a,"alignment",n.alignment),C(a,"format",n.format),C(a,"append-to",n.appendTo),a.className="clocklet clocklet--showing "+(q?"":"clocklet--hoverable ")+n.className,i.style.zIndex=""!==n.zIndex?n.zIndex:(parseInt(c.zIndex,10)||0)+1,"parent"===n.appendTo?e.parentElement.insertBefore(i,e):i.parentElement!==document.body&&document.body.appendChild(i),"top"===n.placement?(a.style.top="",a.style.bottom="0"):(a.style.top=l.height+"px",a.style.bottom=""),"right"===n.alignment?(a.style.left="",a.style.right="-"+l.width+"px"):("center"===n.alignment?a.style.left=(e.offsetWidth-a.offsetWidth)/2+"px":a.style.left="0",a.style.right=""),"fixed"===c.position||"parent"===n.appendTo&&"absolute"===c.position)this._relocate=void 0,K(i.style,c,F);else{if(K(i.style,{},F),"parent"===n.appendTo){var r=getComputedStyle(e.parentElement);"flex"===r.display||"inline-flex"===r.display?(i.style.position="absolute",this._relocate=function(){i.style.left=e.offsetLeft+"px",i.style.top=e.offsetTop+"px"}):(i.style.position="relative",this._relocate=function(){i.style.left=i.style.top="",i.style.left=e.offsetLeft-i.offsetLeft+"px",i.style.top=e.offsetTop-i.offsetTop+"px"})}else i.style.position="absolute",this._relocate=function(){var t=e.getBoundingClientRect();i.style.left=document.documentElement.scrollLeft+document.body.scrollLeft+t.left+"px",i.style.top=document.documentElement.scrollTop+document.body.scrollTop+t.top+"px"};this._relocate()}this.updateHighlight(),setTimeout(function(){a.classList.remove("clocklet--showing"),o.input&&a.classList.add("clocklet--shown")}),L(e,"clocklet.opened",!0,!1,u)}},Z.prototype.close=function(){var t=this.input,e={};t&&(L(t,"clocklet.closing",!0,!0,e).defaultPrevented?t.focus():(this.input=void 0,this.root.classList.remove("clocklet--shown"),L(t,"clocklet.closed",!0,!1,e)))},Z.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:A(this.ampm,"ampm")}),n=A(this.root,"format");if(this.input.value=o.format(n),"text"===this.input.type){var l=void 0!==t.h?V(o,n):void 0!==t.m?z(o,n,/m$/):void 0!==t.a?R(o,n)||V(o,n):void 0;l&&this.input.setSelectionRange(l.index,l.index+l.value.length)}this.dispatchesInputEvents&&this.input.value!==e&&L(this.input,"input",!0,!1,void 0)}},Z.prototype.updateHighlight=function(){if(this.input){var t=this.input.value?E(this.input.value):E.INVALID;t.valid?(C(this.root,"value",t.HHmm),this.hour.value(t.hour%12),this.minute.value(t.minute),C(this.ampm,"ampm",t.a)):(C(this.root,"value",""),this.hour.value(-1),this.minute.value(-1),C(this.ampm,"ampm","am"));var e=R(t.valid?t:E.ZERO,A(this.root,"format"));C(this.ampm,"ampm-formatted",e&&e.value||"")}},Z);function Z(t){var e,o=this;this.container=((e=document.createElement("div")).className="clocklet-container",e.innerHTML=B,e),this.root=this.container.firstElementChild,this.plate=this.root.firstElementChild,this.hour=new N(this.plate.getElementsByClassName("clocklet-dial--hour")[0],12,function(t){return o.value({h:t})}),this.minute=new N(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=M(Object.create(T),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"===A(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")});function n(){return o._relocate&&o._relocate()}addEventListener("resize",n),addEventListener("orientationchange",n)}function K(t,e,o){for(var n=0,l=o;n<l.length;n++){var c=l[n];t[c]=e[c]||""}}var W,X,Y,U,G,J,Q={dataAttributeName:"clocklet",formatSelector:function(t){var e=I(t.getAttribute("data-clocklet"));return e&&e.format}};return G=(U=Q)&&U.dataAttributeName||"lenientime",J=U&&U.formatSelector||function(t){return t.dataset.lenientime},addEventListener("change",function(t){var e=t.target,o=e.value,n=e.dataset;if(o&&G in n){var l=E(o),c=l.valid?l.format(J(e)||"HH:mm"):"";c!==o&&(e.value=c,_(e))}},!0),X=(W=Q)&&W.dataAttributeName||"lenientime",Y=W&&W.formatSelector||function(t){return t.dataset.lenientime},W&&W.amountSelector,addEventListener("keydown",function(t){var e=t.which;if(!(38!==e&&40!==e||t.altKey||t.ctrlKey||t.metaKey)){var o=t.target,n=o.dataset;if(X in n){t.preventDefault();var l=Y(o)||"HH:mm",c=o.value;if(c){var i=o.selectionStart;if(s=null===i?void 0:y(l,c,i)){var a=(38===e?1:-1)*(W&&W.amountSelector&&W.amountSelector(o)||1),u=s.adjust(a,!0);if(void 0!==u){var r=s.index;o.value=c.slice(0,r)+u+c.slice(r+s.value.length),o.setSelectionRange(r,r+u.length),_(o)}}}else{var s;o.value=E.ZERO.format(l),(s=y(l,o.value,0))&&o.setSelectionRange(s.index,s.index+s.value.length),_(o)}}}},!0),function(t){void 0===t&&(t={});var o=new $(t.defaultOptions),e=t.target||"input[data-clocklet]",n=t.optionsSelector||function(t){return I(t.getAttribute("data-clocklet"))},l=o.close.bind(o);if(e instanceof Element)e.addEventListener("focus",function(t){return o.open(t.target,n(t.target))}),e.addEventListener("blur",l);else{var c="function"==typeof e?e:function(t){return(Element.prototype.matches||Element.prototype.msMatchesSelector).call(t,e)};addEventListener("focus",function(t){var e=t.target;c(e)&&o.open(e,n(e))},!0),addEventListener("blur",l,!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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc