function _slicedToArray(t,n){return _arrayWithHoles(t)||_iterableToArrayLimit(t,n)||_unsupportedIterableToArray(t,n)||_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(t,n){var r;if(t)return"string"==typeof t?_arrayLikeToArray(t,n):"Map"===(r="Object"===(r={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,n):void 0}function _arrayLikeToArray(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=Array(n);r<n;r++)e[r]=t[r];return e}function _iterableToArrayLimit(t,n){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var e,o,a,i,c=[],u=!0,l=!1;try{if(a=(r=r.call(t)).next,0===n){if(Object(r)!==r)return;u=!1}else for(;!(u=(e=a.call(r)).done)&&(c.push(e.value),c.length!==n);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}(()=>{function t(t,a,i){var c="action-bar-position",u="action-bar-no-wrap",l="action-bar-priority",f=0,s="right",r=[],n=[],y=[],e=[],m=[];return i.$on("$routeChangeSuccess",function(){m.length=0,n.forEach(function(t){return t()})}),{initSet:function(t){r.push(t);var n=(t=>(t=t.$element.find("ng-transclude > *").toArray(),_(t).flatten().compact().value()))(t).map(o);y.forEach(function(t){return t(n)}),(t._actionBarElements=n).forEach(function(t){return m.push(t)}),i.$emit("c8yActionBarChanged")},destroySet:function(n){_.remove(r,n),n._actionBarElements.forEach(function(t){return _.remove(m,t)}),e.forEach(function(t){return t(n._actionBarElements)}),i.$emit("c8yActionBarChanged")},onClean:function(t){n.push(t)},onAdd:function(t){return y.push(t),m},onRemove:function(t){e.push(t)},addLiveAction:function(t){var n=t.action,r=t.run,e=o();function o(){var t=i.$new(!0);t.action=n,t.run=r;t=_slicedToArray(a('\n    <li action-bar-position="more">\n      <button title="{{ action.text | translate }}" class="btn btn-link" ng-click="run()">\n        <i c8y-icon="{{action.icon}}" ng-show="action.icon"></i>\n        {{action.text | translate}}\n      </button>\n    </li>\n  ')(t),1)[0];return t.setAttribute(c,n.position||"more"),angular.element(t).data("action",n),t}e.createCopy=o,m.push(e),y.forEach(function(t){return t([e])}),i.$emit("c8yActionBarChanged")},elements:m};function o(t){var n=t.getAttribute(l)||f,r=t.getAttribute(c)||s,e="LI"===t.tagName,o="true"===t.getAttribute(u),e=e||o?t:document.createElement("li");return e.setAttribute(l,n),e!==t&&e.appendChild(t),e.setAttribute(c,r),e}}t.$inject=["$timeout","$compile","$rootScope"],angular.module("c8y.ui").factory("c8yActionBar",t)})();