text: angular.module("jkuri.timepicker",[]).directive("ngTimepicker",["$document",function(a){var b=function(d,c){d.initTime=c.initTime||"11:00";d.step=c.step||"15";d.showMeridian=d.$eval(c.showMeridian)||false;d.meridian=c.meridian||"AM";d.theme=c.theme||""};return{restrict:"EA",scope:true,require:"?ngModel",link:function(h,g,f,j){b(h,f);h.opened=false;var c=function(){var k=h.initTime.split(":");h.hour=k[0];h.minutes=k[1]};var e=function(){var k;if(!h.showMeridian){k=h.hour+":"+h.minutes;h.viewValue=k;j.$setViewValue(k)}else{k=h.hour+":"+h.minutes;h.viewValue=k+" "+h.meridian;k=i()+":"+h.minutes;j.$setViewValue(k)}};var i=function(){var k=parseInt(h.hour,10);if(h.hour===12&&h.meridian==="PM"){return 12}if(h.hour===12&&h.meridian==="AM"){return"00"}if(h.meridian==="PM"){return k+12}else{if(parseInt(k,10)<10){return"0"+k}else{return k}}};var d=function(){var k=h.initTime.split(":");h.hour=k[0];h.minutes=k[1];k=h.hour+":"+h.minutes;h.viewValue=k;j.$setViewValue(k)};h.showTimepicker=function(){h.opened=true};h.incrementHour=function(){if(!h.showMeridian){if(parseInt(h.hour,10)<23){h.hour=parseInt(h.hour,10)+1}else{h.hour=0}}else{if(parseInt(h.hour,10)<12){h.hour=parseInt(h.hour,10)+1}else{if(parseInt(h.hour,10)===12){h.hour=1;h.toggleMeridian()}}}if(parseInt(h.hour,10)<10){h.hour="0"+h.hour}e()};h.decreaseHour=function(){if(!h.showMeridian){if(parseInt(h.hour,10)===0){h.hour=23}else{h.hour=parseInt(h.hour,10)-1}}else{if(parseInt(h.hour,10)===0){h.hour=12;h.toggleMeridian()}else{h.hour=parseInt(h.hour,10)-1}}if(parseInt(h.hour,10)<10){h.hour="0"+h.hour}e()};h.incrementMinutes=function(){h.minutes=parseInt(h.minutes,10)+parseInt(h.step,10);if(h.minutes>59){h.minutes="00";h.incrementHour()}e()};h.decreaseMinutes=function(){h.minutes=parseInt(h.minutes,10)-parseInt(h.step,10);if(parseInt(h.minutes,10)<0){h.minutes=60-parseInt(h.step,10);h.decreaseHour()}if(parseInt(h.minutes,10)===0){h.minutes="00"}e()};h.toggleMeridian=function(){h.meridian=(h.meridian==="AM")?"PM":"AM";e()};a.on("click",function(k){if(g!==k.target&&!g[0].contains(k.target)){h.$apply(function(){h.opened=false})}});c();e()},template:'<div><input type="text" ng-focus="showTimepicker()" ng-value="viewValue" class="ng-timepicker-input" ng-readonly="true"></div><div class="ng-timepicker" ng-show="opened" ng-class="{\'red\': theme === \'red\', \'green\': theme === \'green\', \'blue\': theme === \'blue\'}">  <table>    <tbody>    <tr>        <td class="act noselect" ng-click="incrementHour()"><i class="fa fa-angle-up"></i></td>        <td></td>        <td class="act noselect" ng-click="incrementMinutes()"><i class="fa fa-angle-up"></i></td>        <td class="act noselect" ng-click="toggleMeridian()" ng-show="showMeridian"><i class="fa fa-angle-up"></i></td>      </tr>      <tr>        <td><input type="text" ng-model="hour" ng-readonly="true"></td>        <td>:</td>        <td><input type="text" ng-model="minutes" ng-readonly="true"></td>        <td ng-show="showMeridian"><input type="text" ng-model="meridian" ng-readonly="true"></td>      </tr>      <tr>        <td class="act noselect" ng-click="decreaseHour()"><i class="fa fa-angle-down"></i></td>        <td></td>        <td class="act noselect" ng-click="decreaseMinutes()"><i class="fa fa-angle-down"></i></td>        <td class="act noselect" ng-click="toggleMeridian()" ng-show="showMeridian"><i class="fa fa-angle-down"></i></td>      </tr>  </table></div>'}}]);