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 r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,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 r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{function e(r){return{dateToString:function(e){return e&&moment(e).format("YYYY-MM-DD")},dateToStringWithTimeZone:function(e){return e&&moment(e).format()},stringToDate:function(e){return e&&moment(e).toDate()},setLocal:function(e,t){r.localStorage.setItem(e,JSON.stringify(t))},getLocal:function(e){try{return JSON.parse(r.localStorage.getItem(e))}catch(e){if(!(e instanceof SyntaxError))throw e}},log:function(e){return r.console.log(e),e},enhanceWithKeysUtil:function(e){var t=e.target,r=e.reservedKeys,n=void 0===r?[]:r,r=e.standardKeys,o=void 0===r?{}:r;return _objectSpread(_objectSpread({},t),{},{reservedKeys:n,standardKeys:o,getKeys:i,getStandardKeys:c,getNonStandardKeys:function(e){return _.difference(i(e),_.keys(c(e)))}});function i(e){return _(angular.copy(e)).keys().filter(function(e){return!_.includes(n,e)}).value()}function c(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=angular.copy(e);return _.pickBy(o,function(e,t){return _.has(n,t)&&!r.includes(t)})}},enhanceWithLatestFactoryUtil:function(e,u){return _objectSpread(_objectSpread({},e),{},{latest:function(i){var c;if(_.isFunction(i))return c=-1,function(){for(var t=c+=1,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=i.apply(this,r);if(_.isFunction(o.then))return o=o.then(function(e){return t!==c?u.reject("Promise is cancelled by a more recent one."):e},function(e){return t!==c?u.reject("Promise is cancelled by a more recent one."):u.reject(e)});throw new TypeError("Function must return a promise")};throw new TypeError("Argument needs to be a function")}})}}}e.$inject=["$window"],angular.module("c8y.core").factory("c8yUtil",e)})();