function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var o,i=Object.keys(t);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(t),e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,o)),i}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(o),!0).forEach(function(e){_defineProperty(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);o=o.call(e,t||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}angular.module("c8y.eventList").controller("EventListCtrl",["$scope","c8yWidgetConfigMigrationService",function(s,t){var a=this,c=null,f=null,l=!0,d=!1,h=null,g=_.debounce(function(){h&&(a.options=h,h=null)},100);function u(e){var t;return e&&(e=e instanceof Date?e:new Date(e),(t=e)instanceof Date)&&"Invalid Date"!==t.toString()&&0<t.getTime()?e:null}s.isLoading=!1,s.initialized=!1,s.widgetControls={supports:["dateTimeContext","isAutoRefreshEnabled","displayMode","refreshInterval","refreshOption"],configSettings:{dashboard:{live:{},history:{}},config:{live:{showAutoRefresh:!0,showTimeContext:!0},history:{showTimeContext:!0,showAggregation:!1}},view_and_config:{live:{showAutoRefresh:!0,showRefreshInterval:!1,showTimeContext:!0},history:{showTimeContext:!0,showAggregation:!1}}},settings:{dashboard:{live:{showAutoRefresh:!0,showTimeContext:!0,showRefreshInterval:!0},history:{showTimeContext:!0,showAggregation:!1}},config:{live:{showAutoRefresh:!0},history:{showTimeContext:!0,showAggregation:!1}},view_and_config:{live:{showAutoRefresh:!0,showRefreshInterval:!0,showTimeContext:!0},history:{showTimeContext:!0,showAggregation:!1}}},defaultLinks:{dashboard:{live:{dateTimeContext:!0,isAutoRefreshEnabled:!0},history:{dateTimeContext:!0}},config:{},view_and_config:{}},stateHandlers:{}},s.onGlobalContextChange=function(e){var t,o,i=e.context.dateTimeContext,n=e.diff.dateTimeContext,r="live"===(r=e.context).refreshOption&&r.isAutoRefreshEnabled&&5e3===r.refreshInterval;(s.child.config.realtime=r)!==d&&(r&&(l=!0),d=r),i&&i.dateFrom&&i.dateTo&&(t=u(i.dateFrom),i=u(i.dateTo),t)&&i&&(s.child.config.date=[t,i],t=t.toISOString(),i=i.toISOString(),o=t!==c||i!==f,n=n&&Boolean(n.interval),o=o,n=n,(r=r)&&l?(l=!1,1):n&&o||!(r||!o))&&(c=n=t,f=r=i,h=_objectSpread(_objectSpread(_objectSpread({},a.options||{}),s.child.config.options||{}),{},{dateFrom:n,dateTo:r,source:s.child.config.device&&s.child.config.device.id}),g(),s.initialized=!0),Object.assign(s.child.config,e.context)},s.dashboardChild=s.dashboardChildForLegacy,s.onLoadingStateChange=function(e){s.isLoading=e},(()=>{var e;s.child&&s.child.config&&(e=t.migrateWidgetConfig(s.child.config),Object.assign(s.child.config,e))})(),s.$on("$destroy",function(){g.cancel()})}]);