function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,e){var t;if(r)return"string"==typeof r?_arrayLikeToArray(r,e):"Map"===(t="Object"===(t={}.toString.call(r).slice(8,-1))&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,e):void 0}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function _iterableToArrayLimit(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(r){c=!0,o=r}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}function _arrayWithHoles(r){if(Array.isArray(r))return r}(()=>{function r(u,c){function t(r,i){return u(function(e,t){var n=e,o=t;window.c8y_testing&&(n=function(r){e(r),c.$apply()},o=function(r){t(r),c.$apply()}),zip.createReader(new zip.BlobReader(r),function(e){e.getEntries(function(r){r=_slicedToArray(_.filter(r,i),1)[0];r?r.getData(new zip.TextWriter,function(r){e.close(),n(r)}):(e.close(),o(new Error("File not found ".concat(JSON.stringify(i)))))})},o)})}return{zipFiles:function(e){var l=u.defer();return zip.createWriter(new zip.BlobWriter,function(r){function t(){var r,e;(a+=1)<o.length?(e=o[r=a],n.add(e.name,new zip.BlobReader(e),t,function(){i.notify(e,r)})):n.close(function(r){i.resolve(r),window.c8y_testing&&c.$apply()})}var n,o,i,a;l.resolve((n=r,o=e,i=u.defer(),a=-1,t(),i.promise)),window.c8y_testing&&c.$apply()},function(r){l.reject(r),window.c8y_testing&&c.$apply()}),l.promise},getTextData:t,getJsonData:function(r,e){return t(r,e).then(function(r){return JSON.parse(r)})}}}r.$inject=["$q","$rootScope"],angular.module("c8y.ui").provider("c8yZip",function(){return zip.useWebWorkers=!1,{$get:r}})})();