function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_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,r){var e;if(t)return"string"==typeof t?_arrayLikeToArray(t,r):"Map"===(e="Object"===(e={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function _iterableToArrayLimit(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,a,i,o,c=[],l=!0,u=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;l=!1}else for(;!(l=(n=i.call(e)).done)&&(c.push(n.value),c.length!==r);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw a}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}angular.module("c8y.core").directive("c8ySunburstChart",[function(){return{priority:1e3,terminal:!0,restrict:"A",scope:{data:"=chartData"},compile:function(){return function(t,r){var e=_slicedToArray(r,1)[0],n=r.width(),a=n,i=n/2,o=d3.select(e).append("svg").attr("width",n).attr("height",a).append("g").attr("transform","translate(".concat([i,i],")")),c=d3.scale.linear().range([0,2*Math.PI]),l=d3.scale.sqrt().range([0,i]),u=d3.layout.partition().value(function(t){return t.value}),s=d3.svg.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,c(t.x)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,c(t.x+t.dx)))}).innerRadius(function(t){return Math.max(0,l(t.y))}).outerRadius(function(t){return Math.max(0,l(t.y+t.dy))});function d(t){var r=t.depth?180*c(t.x+t.dx/2)/Math.PI-90:0;return"rotate(".concat(0+r,")translate(").concat(l(t.y),")rotate(").concat(90<r?-180:0,")")}function f(t){return t.class}function y(t){return t.depth?c(t.x+t.dx/2)>Math.PI?"end":"start":"middle"}function p(t){return t.text?t.text.class:""}t.$watch("data",function(t){o.selectAll("*").remove(),_.isObjectLike(t)?(r.find("center").remove(),t=u.nodes(t),o.selectAll("*").remove(),o.selectAll("path").data(t).enter().append("path").attr("id",function(t,r){return"path-".concat(r)}).attr("d",s).attr("class",f),o.selectAll("text").data(t).enter().append("text").style("fill-opacity",1).attr("class",p).attr("text-anchor",y).style("font-size",function(t){return t.text?t.text.size:""}).attr("dy",".2em").attr("transform",d).append("tspan").attr("x",0).text(function(t){return t.name||""})):r.prepend('<center><i class="icon-spinner icon-spin  icon-3x "></i></center')})}}}}]);