(()=>{function e(a){return{restrict:"EA",require:"ngModel",templateUrl:":::PLUGIN_PATH:::/ui/views/dateTimePicker.html",replace:!0,scope:{required:"=?ngRequired",disabled:"=?ngDisabled",inputsSize:"@?",placeholder:"@",minDate:"=?",maxDate:"=?",showWeeks:"=?",showSeconds:"=?",showSpinners:"=?",withMilliseconds:"=?",appendToBody:"<?",isOpen:"=?"},link:function(o,e,t,i){function n(i,a){return function(e){var t=o[i],n=!0;return n=t?moment(t)[a](e):n}}i.$parsers.push(function(e){var t,n;return o.required||(t=null),e.date&&e.time&&(n=moment(e.date),e=moment(e.time),n.set({hour:e.hour(),minute:e.minute(),second:e.second(),millisecond:e.millisecond()}),t=o.withMilliseconds?n.format(a.dateFullFormatWithMs):n.format(a.dateFullFormat)),t}),i.$formatters.push(function(e){return{date:e&&new Date(e),time:e&&new Date(e)}}),i.$validators.minDate=n("minDate","isBefore"),i.$validators.maxDate=n("maxDate","isAfter"),i.$render=function(){_.assign(o,{value:i.$viewValue})},o.ngModelCtrl=i,o.$watch("isOpen",function(){o.isOpen&&o.appendToBody&&$("[uib-datepicker-popup-wrap]").on("click",function(e){return e.stopPropagation()})}),o.$watch("value",function(e,t){var n;t=t,(n=e).time||!n.date||t.date||((n=new Date).setHours(0,0,0,0),e.time=n,o.value.time=e.time),i.$setViewValue(_.cloneDeep(e))},!0),o.onTimeManualChange=function(e){var t=i.$viewValue;(t.time=e)&&(o.showSeconds||e.setSeconds(0),e.setMilliseconds(0)),i.$setViewValue(_.cloneDeep(t))}},controller:t}}function t(e,t,n){var i={},a={showMeridian:n.shouldUseMeridianFormat()};e.datepickerFormat=n.getDateFormat({useUppercaseFormat:!1}),e.datePickerOptions=i,e.timePickerOptions=a,e.getInputSizeClass=function(){return"input-".concat(e.inputsSize||"default")},e.$watchGroup(["minDate","maxDate","showWeeks"],function(){_.assign(i,_.defaults({minDate:e.minDate&&new Date(e.minDate),maxDate:e.maxDate&&new Date(e.maxDate),showWeeks:e.showWeeks},{showWeeks:!0})),e.ngModelCtrl&&e.ngModelCtrl.$validate()}),e.$watchGroup(["showSpinners","showSeconds"],function(){_.assign(a,_.defaults({showSpinners:e.showSpinners,showSeconds:e.showSeconds},{showSpinners:!1,showSeconds:!1})),a.show=!1,t(function(){a.show=!0})})}t.$inject=["$scope","$timeout","c8yDateFormatService"],e.$inject=["c8yBase"],angular.module("c8y.ui").directive("c8yDateTimePicker",e)})();