text: AmCharts.translations["export"]||(AmCharts.translations["export"]={}),AmCharts.translations["export"].en||(AmCharts.translations["export"].en={"fallback.save.text":"CTRL + C to copy the data into the clipboard.","fallback.save.image":"Rightclick -> Save picture as... to save the image.","capturing.delayed.menu.label":"{{duration}}","capturing.delayed.menu.title":"Click to cancel","menu.label.print":"Print","menu.label.undo":"Undo","menu.label.redo":"Redo","menu.label.cancel":"Cancel","menu.label.save.image":"Download as ...","menu.label.save.data":"Save as ...","menu.label.draw":"Annotate ...","menu.label.draw.change":"Change ...","menu.label.draw.add":"Add ...","menu.label.draw.shapes":"Shape ...","menu.label.draw.colors":"Color ...","menu.label.draw.widths":"Size ...","menu.label.draw.opacities":"Opacity ...","menu.label.draw.text":"Text","menu.label.draw.modes":"Mode ...","menu.label.draw.modes.pencil":"Pencil","menu.label.draw.modes.line":"Line","menu.label.draw.modes.arrow":"Arrow"}),function(){AmCharts["export"]=function(a,b){var c={name:"export",version:"1.3.0",libs:{async:!0,autoLoad:!0,reload:!1,resources:[{"pdfmake/pdfmake.js":["pdfmake/vfs_fonts.js"],"jszip/jszip.js":["xlsx/xlsx.js"]},"fabric.js/fabric.js","FileSaver.js/FileSaver.js"]},config:{},setup:{chart:a,hasBlob:!1},drawing:{enabled:!1,undos:[],redos:[],buffer:{position:{x1:0,y1:0,x2:0,y2:0,xD:0,yD:0}},handler:{undo:function(a,b){var d=c.drawing.undos.pop();if(d){d.selectable=!0,c.drawing.redos.push(d),"added"==d.action&&c.setup.fabric.remove(d.target);var e=JSON.parse(d.state);d.target.set(e),d.target instanceof fabric.Group&&c.drawing.handler.change({color:e.cfg.color,width:e.cfg.width,opacity:e.cfg.opacity},!0,d.target),c.setup.fabric.renderAll(),d.state!=d.target.recentState||b||c.drawing.handler.undo(d,!0)}},redo:function(){var d=c.drawing.redos.pop();if(d){d.selectable=!0,c.drawing.undos.push(d),"added"==d.action&&c.setup.fabric.add(d.target);var e=JSON.parse(d.state);d.target.recentState=d.state,d.target.set(e),d.target instanceof fabric.Group&&c.drawing.handler.change({color:e.cfg.color,width:e.cfg.width,opacity:e.cfg.opacity},!0,d.target),c.setup.fabric.renderAll(),"addified"==d.action&&c.drawing.handler.redo()}},done:function(){c.drawing.buffer.enabled=!1,c.drawing.undos=[],c.drawing.redos=[],c.createMenu(c.config.menu),c.setup.fabric.deactivateAll(),c.setup.wrapper.setAttribute("class",c.setup.chart.classNamePrefix+"-export-canvas"),c.setup.wrapper.style.display="none"},add:function(a){var b=c.deepMerge({top:c.setup.fabric.height/2,left:c.setup.fabric.width/2},a||{}),d=-1!=b.url.indexOf(".svg")?fabric.loadSVGFromURL:fabric.Image.fromURL;d(b.url,function(a,d){var e=void 0!==d?fabric.util.groupSVGElements(a,d):a,f=!1;(e.height>c.setup.fabric.height||e.width>c.setup.fabric.width)&&(f=c.setup.fabric.height/2/e.height),b.top>c.setup.fabric.height&&(b.top=c.setup.fabric.height/2),b.left>c.setup.fabric.width&&(b.left=c.setup.fabric.width/2),e.set({originX:"center",originY:"center",top:b.top,left:b.left,width:f?e.width*f:e.width,height:f?e.height*f:e.height,fill:c.drawing.color}),c.setup.fabric.add(e)})},change:function(a,b,d){var f,g,h,e=c.deepMerge({},a||{}),i=d||c.drawing.buffer.target,j=i?i._objects?i._objects:[i]:null;if(e.mode&&(c.drawing.mode=e.mode),e.width&&(c.drawing.width=e.width,c.drawing.fontSize=3*e.width),e.fontSize&&(c.drawing.fontSize=e.fontSize),e.color&&(c.drawing.color=e.color),e.opacity&&(c.drawing.opacity=e.opacity),h=new fabric.Color(c.drawing.color).getSource(),h.pop(),h.push(c.drawing.opacity),c.drawing.color="rgba("+h.join()+")",c.setup.fabric.freeDrawingBrush.color=c.drawing.color,c.setup.fabric.freeDrawingBrush.width=c.drawing.width,i){for(f=JSON.parse(i.recentState).cfg,f&&(e.color=e.color||f.color,e.width=e.width||f.width,e.opacity=e.opacity||f.opacity,e.fontSize=e.fontSize||3*e.width,h=new fabric.Color(e.color).getSource(),h.pop(),h.push(e.opacity),e.color="rgba("+h.join()+")"),g=0;g<j.length;g++)j[g]instanceof fabric.Text||j[g]instanceof fabric.PathGroup||j[g]instanceof fabric.Triangle?((e.color||e.opacity)&&j[g].set({fill:e.color}),e.fontSize&&j[g].set({fontSize:e.fontSize})):(j[g]instanceof fabric.Path||j[g]instanceof fabric.Line)&&(i instanceof fabric.Group?(e.color||e.opacity)&&j[g].set({stroke:e.color}):((e.color||e.opacity)&&j[g].set({stroke:e.color}),e.width&&j[g].set({strokeWidth:e.width})));b||(f=JSON.stringify(c.deepMerge(i.saveState().originalState,{cfg:{color:e.color,width:e.width,opacity:e.opacity}})),i.recentState=f,c.drawing.redos=[],c.drawing.undos.push({action:"modified",target:i,state:f})),c.setup.fabric.renderAll()}},text:function(a){var b=c.deepMerge({text:c.i18l("menu.label.draw.text"),top:c.setup.fabric.height/2,left:c.setup.fabric.width/2,fontSize:c.drawing.fontSize,fontFamily:c.setup.chart.fontFamily||"Verdana",fill:c.drawing.color},a||{});b.click=function(){};var d=new fabric.IText(b.text,b);return c.setup.fabric.add(d),c.setup.fabric.setActiveObject(d),d.selectAll(),d.enterEditing(),d},line:function(a){var d,e,f,g,b=c.deepMerge({x1:c.setup.fabric.width/2-c.setup.fabric.width/10,x2:c.setup.fabric.width/2+c.setup.fabric.width/10,y1:c.setup.fabric.height/2,y2:c.setup.fabric.height/2,angle:90,strokeLineCap:c.drawing.lineCap,arrow:c.drawing.arrow,color:c.drawing.color,width:c.drawing.width,group:[]},a||{}),h=new fabric.Line([b.x1,b.y1,b.x2,b.y2],{stroke:b.color,strokeWidth:b.width,strokeLineCap:b.strokeLineCap});if(b.group.push(h),b.arrow&&(b.angle=b.angle?b.angle:c.getAngle(b.x1,b.y1,b.x2,b.y2),"start"==b.arrow?(f=b.y1+b.width/2,g=b.x1+b.width/2):"middle"==b.arrow?(f=b.y2+b.width/2-(b.y2-b.y1)/2,g=b.x2+b.width/2-(b.x2-b.x1)/2):(f=b.y2+b.width/2,g=b.x2+b.width/2),e=new fabric.Triangle({top:f,left:g,fill:b.color,height:7*b.width,width:7*b.width,angle:b.angle,originX:"center",originY:"bottom"}),b.group.push(e)),"config"!=b.action){if(b.arrow){var i=new fabric.Group(b.group);return i.set({cfg:b,fill:b.color,action:b.action,selectable:!0,known:"change"==b.action}),"change"==b.action&&c.setup.fabric.setActiveObject(i),c.setup.fabric.add(i),i}return c.setup.fabric.add(h),h}for(d=0;d<b.group.length;d++)b.group[d].noUndo=!0,c.setup.fabric.add(b.group[d]);return b}}},defaults:{position:"top-right",fileName:"amCharts",action:"download",path:(a.path||"")+"plugins/export/",formats:{JPG:{mimeType:"image/jpg",extension:"jpg",capture:!0},PNG:{mimeType:"image/png",extension:"png",capture:!0},SVG:{mimeType:"text/xml",extension:"svg",capture:!0},PDF:{mimeType:"application/pdf",extension:"pdf",capture:!0},CSV:{mimeType:"text/plain",extension:"csv"},JSON:{mimeType:"text/plain",extension:"json"},XLSX:{mimeType:"application/octet-stream",extension:"xlsx"}},fabric:{backgroundColor:"#FFFFFF",removeImages:!0,selection:!1,drawing:{enabled:!0,arrow:"end",lineCap:"butt",mode:"pencil",modes:["pencil","line","arrow"],color:"#000000",colors:["#000000","#FFFFFF","#FF0000","#00FF00","#0000FF"],shapes:["11.svg","14.svg","16.svg","17.svg","20.svg","27.svg"],width:1,fontSize:11,widths:[1,5,10,15],opacity:1,opacities:[1,.8,.6,.4,.2],menu:void 0}},pdfMake:{pageSize:"A4",pageOrientation:"portrait",images:{},content:["Saved from:",window.location.href,{image:"reference",fit:[523.28,769.89]}]},menu:void 0,divId:null,menuReviver:null,menuWalker:null,fallback:!0,keyListener:!0,fileListener:!0},i18l:function(a,b){var d=b?langugage:c.setup.chart.language?c.setup.chart.language:"en",e=AmCharts.translations[c.name][d]||{};return e[a]||a},download:function(a,b,d){if(window.saveAs&&c.setup.hasBlob)c.toBlob({data:a,type:b},function(a){saveAs(a,d)});else if(c.config.fallback&&"text/plain"==b){var f=document.createElement("div"),g=document.createElement("div"),h=document.createElement("textarea");g.innerHTML=c.i18l("fallback.save.text"),f.appendChild(g),f.appendChild(h),g.setAttribute("class","amcharts-export-fallback-message"),f.setAttribute("class","amcharts-export-fallback"),c.setup.chart.containerDiv.appendChild(f),h.setAttribute("readonly",""),h.value=a,h.focus(),h.select(),c.createMenu([{"class":"export-main export-close",label:"Done",click:function(){c.createMenu(c.config.menu),c.setup.chart.containerDiv.removeChild(f)}}])}else{if(!c.config.fallback||"image"!=b.split("/")[0])throw new Error("Unable to create file. Ensure saveAs (FileSaver.js) is supported.");var f=document.createElement("div"),g=document.createElement("div"),i=c.toImage({data:a});g.innerHTML=c.i18l("fallback.save.image"),f.appendChild(g),f.appendChild(i),g.setAttribute("class","amcharts-export-fallback-message"),f.setAttribute("class","amcharts-export-fallback"),c.setup.chart.containerDiv.appendChild(f),c.createMenu([{"class":"export-main export-close",label:"Done",click:function(){c.createMenu(c.config.menu),c.setup.chart.containerDiv.removeChild(f)}}])}return a},loadResource:function(a,b){function k(){if(b)for(d=0;d<b.length;d++)c.loadResource(b[d])}var d,e,f,g,h,i,j=-1!=a.indexOf("//")?a:[c.libs.path,a].join("");for(-1!=a.indexOf(".js")?(f=document.createElement("script"),f.setAttribute("type","text/javascript"),f.setAttribute("src",j),c.libs.async&&f.setAttribute("async","")):-1!=a.indexOf(".css")&&(f=document.createElement("link"),f.setAttribute("type","text/css"),f.setAttribute("rel","stylesheet"),f.setAttribute("href",j)),d=0;d<document.head.childNodes.length;d++)if(g=document.head.childNodes[d],h=g?g.src||g.href:!1,i=g?g.tagName:!1,g&&h&&-1!=h.indexOf(a)){c.libs.reload&&document.head.removeChild(g),e=!0;break}(!e||c.libs.reload)&&(f.addEventListener("load",k),document.head.appendChild(f))},loadDependencies:function(){var a,b;if(c.libs.autoLoad)for(a=0;a<c.libs.resources.length;a++)if(c.libs.resources[a]instanceof Object)for(b in c.libs.resources[a])c.loadResource(b,c.libs.resources[a][b]);else c.loadResource(c.libs.resources[a])},pxToNumber:function(a){return Number(String(a).replace("px",""))||0},numberToPx:function(a){return String(a)+"px"},deepMerge:function(a,b,d){var e,f,g=b instanceof Array?"array":"object";for(e in b)"array"==g&&isNaN(e)||(f=b[e],(void 0==a[e]||d)&&(f instanceof Array?a[e]=new Array:f instanceof Function?a[e]=new Function:f instanceof Date?a[e]=new Date:f instanceof Object?a[e]=new Object:f instanceof Number?a[e]=new Number:f instanceof String&&(a[e]=new String)),!(a instanceof Object||a instanceof Array)||!(f instanceof Object||f instanceof Array)||f instanceof Function||f instanceof Date||c.isElement(f)||"chart"==e?a instanceof Array&&!d?a.push(f):a[e]=f:c.deepMerge(a[e],f,d));return a},isElement:function(a){return a instanceof Object&&a&&1===a.nodeType},isPressed:function(a){return"mousemove"==a.type&&1===a.which||(c.drawing.buffer.isPressed="touchmove"==a.type||1===a.buttons||1===a.button||1===a.which?!0:!1),c.drawing.buffer.isPressed},isTainted:function(a){var b=String(window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));return a&&-1!=a.indexOf("//")&&-1==a.indexOf(b.replace(/.*:/,""))?!0:!1},isSupported:function(){return c.config.enabled?!(AmCharts.isIE&&AmCharts.IEversion<=9)||Array.prototype.indexOf&&document.head&&c.config.fallback!==!1?!0:!1:!1},getAngle:function(a,b,c,d){var g,e=c-a,f=d-b;return g=0==e?0==f?0:f>0?Math.PI/2:3*Math.PI/2:0==f?e>0?0:Math.PI:0>e?Math.atan(f/e)+Math.PI:0>f?Math.atan(f/e)+2*Math.PI:Math.atan(f/e),180*g/Math.PI},gatherAttribute:function(a,b,d,e){var f,e=e?e:0,d=d?d:3;return a&&(f=a.getAttribute(b),!f&&d>e)?c.gatherAttribute(a.parentNode,b,d,e+1):f},gatherClassName:function(a,b,d,e){var f,e=e?e:0,d=d?d:3;if(c.isElement(a)){if(f=-1!=(a.getAttribute("class")||"").split(" ").indexOf(b),!f&&d>e)return c.gatherClassName(a.parentNode,b,d,e+1);f&&(f=a)}return f},gatherElements:function(a,b,d){var e,f;for(e=0;e<a.children.length;e++){var g=a.children[e];if("clipPath"==g.tagName){for(f=0;f<g.childNodes.length;f++)g.childNodes[f].setAttribute("fill","transparent");a.clippings[g.id]=g}else if("pattern"==g.tagName){var h={node:g,source:g.getAttribute("xlink:href"),width:Number(g.getAttribute("width")),height:Number(g.getAttribute("height")),repeat:"repeat"};for(f=0;f<g.childNodes.length;f++)"rect"==g.childNodes[f].tagName&&(h.fill=g.childNodes[f].getAttribute("fill"));b.removeImages&&c.isTainted(h.source)?a.patterns[g.id]=h.fill?h.fill:"transparent":(d.included++,fabric.Image.fromURL(h.source,function(b){return function(c){d.loaded++;var e=new fabric.StaticCanvas(void 0,{backgroundColor:b.fill});e.add(c);var f=new fabric.Pattern({source:function(){return e.setDimensions({width:b.width,height:b.height}),e.getElement()},repeat:"repeat"});a.patterns[b.node.id]=f}}(h)))}else"image"==g.tagName&&(d.included++,fabric.Image.fromURL(g.getAttribute("xlink:href"),function(){d.loaded++}))}return a},gatherPosition:function(a,b){var f,d=c.drawing.buffer.position,e=fabric.util.invertTransform(c.setup.fabric.viewportTransform);return"touchmove"==a.type&&("touches"in a?a=a.touches[0]:"changedTouches"in a&&(a=a.changedTouches[0])),f=fabric.util.transformPoint(c.setup.fabric.getPointer(a,!0),e),1==b&&(d.x1=f.x,d.y1=f.y),d.x2=f.x,d.y2=f.y,d.xD=d.x1-d.x2<0?-1*(d.x1-d.x2):d.x1-d.x2,d.yD=d.y1-d.y2<0?-1*(d.y1-d.y2):d.y1-d.y2,d},capture:function(a,b){var d,e=c.deepMerge(c.deepMerge({},c.config.fabric),a||{}),f=[],g={x:0,y:0,pX:0,pY:0,width:c.setup.chart.divRealWidth,height:c.setup.chart.divRealHeight},h={loaded:0,included:0},i=c.setup.chart.containerDiv.getElementsByTagName("svg");for(d=0;d<i.length;d++){var j={svg:i[d],parent:i[d].parentNode,children:i[d].getElementsByTagName("*"),offset:{x:0,y:0},patterns:{},clippings:{}};j=c.gatherElements(j,e,h),f.push(j)}if(c.config.legend&&c.setup.chart.legend&&"outside"==c.setup.chart.legend.position){var j={svg:c.setup.chart.legend.container.container,parent:c.setup.chart.legend.container.container.parentNode,children:c.setup.chart.legend.container.container.getElementsByTagName("*"),offset:{x:0,y:0},legend:{type:-1!=["top","left"].indexOf(c.config.legend.position)?"unshift":"push",position:c.config.legend.position,width:c.config.legend.width?c.config.legend.width:c.setup.chart.legend.container.width,height:c.config.legend.height?c.config.legend.height:c.setup.chart.legend.container.height},patterns:{},clippings:{}};-1!=["left","right"].indexOf(j.legend.position)?(g.width+=j.legend.width,g.height=j.legend.height>g.height?j.legend.height:g.height):-1!=["top","bottom"].indexOf(j.legend.position)&&(g.height+=j.legend.height),j=c.gatherElements(j,e,h),f[j.legend.type](j)}if(c.drawing.buffer.enabled="draw"==e.action,c.setup.wrapper?c.setup.wrapper.innerHTML="":(c.setup.wrapper=document.createElement("div"),c.setup.wrapper.setAttribute("class",c.setup.chart.classNamePrefix+"-export-canvas"),c.setup.chart.containerDiv.appendChild(c.setup.wrapper)),"stock"==c.setup.chart.type){var k={top:0,right:0,bottom:0,left:0};c.setup.chart.leftContainer&&(g.width-=c.setup.chart.leftContainer.offsetWidth,k.left=c.setup.chart.leftContainer.offsetWidth+2*c.setup.chart.panelsSettings.panelSpacing),c.setup.chart.rightContainer&&(g.width-=c.setup.chart.rightContainer.offsetWidth,k.right=c.setup.chart.rightContainer.offsetWidth+2*c.setup.chart.panelsSettings.panelSpacing),c.setup.chart.periodSelector&&-1!=["top","bottom"].indexOf(c.setup.chart.periodSelector.position)&&(g.height-=c.setup.chart.periodSelector.offsetHeight+c.setup.chart.panelsSettings.panelSpacing,k[c.setup.chart.periodSelector.position]+=c.setup.chart.periodSelector.offsetHeight+c.setup.chart.panelsSettings.panelSpacing),c.setup.chart.dataSetSelector&&-1!=["top","bottom"].indexOf(c.setup.chart.dataSetSelector.position)&&(g.height-=c.setup.chart.dataSetSelector.offsetHeight,k[c.setup.chart.dataSetSelector.position]+=c.setup.chart.dataSetSelector.offsetHeight),c.setup.wrapper.style.paddingTop=c.numberToPx(k.top),c.setup.wrapper.style.paddingRight=c.numberToPx(k.right),c.setup.wrapper.style.paddingBottom=c.numberToPx(k.bottom),c.setup.wrapper.style.paddingLeft=c.numberToPx(k.left)}for(c.setup.canvas=document.createElement("canvas"),c.setup.wrapper.appendChild(c.setup.canvas),c.setup.fabric=new fabric.Canvas(c.setup.canvas,c.deepMerge({width:g.width,height:g.height,isDrawingMode:!0},e)),c.deepMerge(c.setup.fabric,e),c.deepMerge(c.setup.fabric.freeDrawingBrush,e.drawing),c.deepMerge(c.drawing,e.drawing),c.drawing.handler.change(e.drawing),c.setup.fabric.on("mouse:down",function(a){c.gatherPosition(a.e,1),c.drawing.buffer.pressedTS=Number(new Date),c.isPressed(a.e)}),c.setup.fabric.on("mouse:move",function(a){var b=c.gatherPosition(a.e,2);if(c.isPressed(a.e),c.drawing.buffer.isPressed&&!c.drawing.buffer.line&&!c.drawing.buffer.isSelected&&"pencil"!=c.drawing.mode&&(b.xD>5||b.xD>5)&&(c.drawing.buffer.hasLine=!0,c.setup.fabric.isDrawingMode=!1,c.setup.fabric._onMouseUpInDrawingMode(a),c.drawing.buffer.line=c.drawing.handler.line({x1:b.x1,y1:b.y1,x2:b.x2,y2:b.y2,arrow:"line"==c.drawing.mode?!1:c.drawing.arrow,action:"config"})),c.drawing.buffer.line){var e,f,g,h=c.drawing.buffer.line;for(h.x2=b.x2,h.y2=b.y2,d=0;d<h.group.length;d++)e=h.group[d],e instanceof fabric.Line?e.set({x2:h.x2,y2:h.y2}):e instanceof fabric.Triangle&&(h.angle=c.getAngle(h.x1,h.y1,h.x2,h.y2)+90,"start"==h.arrow?(f=h.y1+h.width/2,g=h.x1+h.width/2):"middle"==h.arrow?(f=h.y2+h.width/2-(h.y2-h.y1)/2,g=h.x2+h.width/2-(h.x2-h.x1)/2):(f=h.y2+h.width/2,g=h.x2+h.width/2),e.set({top:f,left:g,angle:h.angle}));c.setup.fabric.renderAll()}}),c.setup.fabric.on("mouse:up",function(a){if(Number(new Date)-c.drawing.buffer.pressedTS<200){var b=c.setup.fabric.findTarget(a.e);b&&b.selectable&&c.setup.fabric.setActiveObject(b)}if(c.drawing.buffer.line){for(d=0;d<c.drawing.buffer.line.group.length;d++)c.drawing.buffer.line.group[d].remove();delete c.drawing.buffer.line.action,delete c.drawing.buffer.line.group,c.drawing.handler.line(c.drawing.buffer.line)}c.drawing.buffer.line=!1,c.drawing.buffer.hasLine=!1,c.drawing.buffer.isPressed=!1}),c.setup.fabric.on("object:selected",function(a){c.drawing.buffer.isSelected=!0,c.drawing.buffer.target=a.target,c.setup.fabric.isDrawingMode=!1}),c.setup.fabric.on("selection:cleared",function(){c.drawing.buffer.onMouseDown=c.setup.fabric.freeDrawingBrush.onMouseDown,c.drawing.buffer.target=!1,c.drawing.buffer.isSelected&&(c.setup.fabric._isCurrentlyDrawing=!1,c.setup.fabric.freeDrawingBrush.onMouseDown=function(){}),setTimeout(function(){c.drawing.buffer.isSelected=!1,c.setup.fabric.isDrawingMode=!0,c.setup.fabric.freeDrawingBrush.onMouseDown=c.drawing.buffer.onMouseDown},10)}),c.setup.fabric.on("path:created",function(a){var b=a.path;return Number(new Date)-c.drawing.buffer.pressedTS<200||c.drawing.buffer.hasLine?(c.setup.fabric.remove(b),c.setup.fabric.renderAll(),void 0):void 0}),c.setup.fabric.on("object:added",function(a){var b=a.target,d=c.deepMerge(b.saveState().originalState,{cfg:{color:c.drawing.color,width:c.drawing.width,opacity:c.drawing.opacity,fontSize:c.drawing.fontSize}});return Number(new Date)-c.drawing.buffer.pressedTS<200&&!b.noUndo?(c.setup.fabric.remove(b),c.setup.fabric.renderAll(),void 0):(d=JSON.stringify(d),b.recentState=d,!b.selectable||b.known||b.noUndo||(c.drawing.undos.push({action:"added",target:b,state:d}),c.drawing.undos.push({action:"addified",target:b,state:d}),c.drawing.redos=[]),b.known=!0,c.setup.fabric.isDrawingMode=!0,void 0)}),c.setup.fabric.on("object:modified",function(a){var b=a.target,d=JSON.parse(b.recentState),e=c.deepMerge(b.saveState().originalState,{cfg:d.cfg});e=JSON.stringify(e),b.recentState=e,c.drawing.undos.push({action:"modified",target:b,state:e}),c.drawing.redos=[]}),c.setup.fabric.on("text:changed",function(a){var b=a.target;clearTimeout(b.timer),b.timer=setTimeout(function(){var a=JSON.stringify(b.saveState().originalState);b.recentState=a,c.drawing.redos=[],c.drawing.undos.push({action:"modified",target:b,state:a})},250)}),c.drawing.buffer.enabled?(c.setup.wrapper.setAttribute("class",c.setup.chart.classNamePrefix+"-export-canvas active"),c.setup.wrapper.style.backgroundColor=e.backgroundColor,c.setup.wrapper.style.display="block"):(c.setup.wrapper.setAttribute("class",c.setup.chart.classNamePrefix+"-export-canvas"),c.setup.wrapper.style.display="none"),d=0;d<f.length;d++){var j=f[d],l=c.gatherClassName(j.parent,c.setup.chart.classNamePrefix+"-legend-div",1),m=c.gatherClassName(j.parent,c.setup.chart.classNamePrefix+"-stock-panel-div"),n=c.gatherClassName(j.parent,c.setup.chart.classNamePrefix+"-scrollbar-chart-div");"stock"==c.setup.chart.type&&c.setup.chart.legendSettings.position?-1!=["top","bottom"].indexOf(c.setup.chart.legendSettings.position)?j.parent.style.top&&j.parent.style.left?(j.offset.y=c.pxToNumber(j.parent.style.top),j.offset.x=c.pxToNumber(j.parent.style.left)):(j.offset.x=g.x,j.offset.y=g.y,g.y+=c.pxToNumber(j.parent.style.height),m?(g.pY=c.pxToNumber(m.style.marginTop),j.offset.y+=g.pY):n&&(j.offset.y+=g.pY)):-1!=["left","right"].indexOf(c.setup.chart.legendSettings.position)&&(j.offset.y=c.pxToNumber(j.parent.style.top)+g.pY,j.offset.x=c.pxToNumber(j.parent.style.left)+g.pX,l?g.pY+=c.pxToNumber(m.style.height)+c.setup.chart.panelsSettings.panelSpacing:n&&(j.offset.y-=c.setup.chart.panelsSettings.panelSpacing)):(j.parent.style.top&&j.parent.style.left?(j.offset.y=c.pxToNumber(j.parent.style.top),j.offset.x=c.pxToNumber(j.parent.style.left)):j.legend?"left"==j.legend.position?g.x+=j.legend.width:"right"==j.legend.position?j.offset.x+=g.width-j.legend.width:"top"==j.legend.position?g.y+=j.legend.height:"bottom"==j.legend.position&&(j.offset.y+=g.height-j.legend.height):(j.offset.x=g.x,j.offset.y=g.y+g.pY,g.y+=c.pxToNumber(j.parent.style.height)),l&&m&&m.style.marginTop&&(g.y+=c.pxToNumber(m.style.marginTop),j.offset.y+=c.pxToNumber(m.style.marginTop))),c.handleCallback(e.beforeCapture,e),fabric.parseSVGDocument(j.svg,function(a){return function(d,g){var i,j=fabric.util.groupSVGElements(d,g),k={top:a.offset.y,left:a.offset.x,selectable:!1};for(i=0;i<j.paths.length;i++)if(j.paths[i]){if(e.removeImages&&c.isTainted(j.paths[i]["xlink:href"])){j.paths.splice(i,1);continue}if(j.paths[i].fill instanceof Object)"radial"==j.paths[i].fill.type&&(j.paths[i].fill.coords.r2=-1*j.paths[i].fill.coords.r1,j.paths[i].fill.coords.r1=0),j.paths[i].set({opacity:j.paths[i].fillOpacity});else if("url"==String(j.paths[i].fill).slice(0,3)){var l=j.paths[i].fill.slice(5,-1);a.patterns&&a.patterns[l]&&j.paths[i].set({fill:a.patterns[l],opacity:j.paths[i].fillOpacity})}if("url"==String(j.paths[i].clipPath).slice(0,3)){var l=j.paths[i].clipPath.slice(5,-1);if(a.clippings[l]){var m=a.clippings[l].childNodes[0],n=j.paths[i].svg.getAttribute("transform")||"translate(0,0)";n=n.slice(10,-1).split(","),j.paths[i].set({clipTo:function(a,b){return function(c){var d=Number(a.getAttribute("width")||"0"),e=Number(a.getAttribute("height")||"0"),f=Number(a.getAttribute("x")||"0"),g=Number(a.getAttribute("y")||"0");c.rect(-1*Number(b[0])+f,-1*Number(b[1])+g,d,e)}}(m,n)})}}if(j.paths[i].originalBBox){var o=j.paths[i].originalBBox;"left"==j.paths[i].textAlign?j.paths[i].set({left:o.left+j.paths[i].width/2}):j.paths[i].set({left:o.left-j.paths[i].width/2})}}if(j.set(k),c.setup.fabric.add(j),a.svg.parentNode&&a.svg.parentNode.getElementsByTagName){var p=a.svg.parentNode.getElementsByClassName(c.setup.chart.classNamePrefix+"-balloon-div");for(i=0;i<p.length;i++)if(e.balloonFunction instanceof Function)e.balloonFunction.apply(c,[p[i],a]);else{var q=p[i],r=q.childNodes[0],s=new fabric.Text(r.innerText||r.innerHTML,{fontSize:c.pxToNumber(r.style.fontSize),fontFamily:r.style.fontFamily,fill:r.style.color,top:c.pxToNumber(q.style.top)+a.offset.y,left:c.pxToNumber(q.style.left)+a.offset.x,selectable:!1});c.setup.fabric.add(s)}}if(a.svg.nextSibling&&"A"==a.svg.nextSibling.tagName){var s=new fabric.Text(a.svg.nextSibling.innerText||a.svg.nextSibling.innerHTML,{fontSize:c.pxToNumber(a.svg.nextSibling.style.fontSize),fontFamily:a.svg.nextSibling.style.fontFamily,fill:a.svg.nextSibling.style.color,top:c.pxToNumber(a.svg.nextSibling.style.top)+a.offset.y,left:c.pxToNumber(a.svg.nextSibling.style.left)+a.offset.x,selectable:!1});c.setup.fabric.add(s)}if(f.pop(),!f.length)var t=setInterval(function(){h.loaded==h.included&&(clearTimeout(t),c.handleCallback(e.afterCapture,e),c.setup.fabric.renderAll(),c.handleCallback(b,e))},AmCharts.updateRate)}}(j),function(a,b){var d,f=c.gatherAttribute(a,"class"),g=c.gatherAttribute(a,"visibility"),h=c.gatherAttribute(a,"clip-path",1);if(b.className=String(f),b.classList=String(f).split(" "),b.clipPath=h,b.svg=a,"text"==a.tagName&&a.childNodes.length>1){var i=[],j=a.getAttribute("text-anchor")||"left",k={start:"left",middle:"center",end:"right"};for(d=0;d<a.childNodes.length;d++)i.push(a.childNodes[d].textContent);"middle"!=j&&(b.originalBBox=b.getBoundingRect()),b.set({lineHeight:1.05,top:b.top+b.height-b.fontSize*(.18+b._fontSizeFraction)/2,text:i.join("\n"),textAlign:k[j],selectable:!1})}if("hidden"==g)b.opacity=0;else{var l=["fill","stroke"];for(d=0;d<l.length;d++){var m=l[d],n=String(a.getAttribute(m)||""),o=Number(a.getAttribute(m+"-opacity")||"1"),p=fabric.Color.fromHex(n).getSource();-1==b.classList.indexOf(c.setup.chart.classNamePrefix+"-guide-fill")||n||(o=0,p=fabric.Color.fromHex("#000000").getSource()),p&&(p.pop(),p.push(o),b[m]="rgba("+p.join()+")",b[m+c.capitalize("opacity")]=o)}}c.handleCallback(e.reviver,b,a)})}},toCanvas:function(a,b){c.deepMerge({},a||{});var e=c.setup.canvas;return c.handleCallback(b,e),e},toImage:function(a,b){var d=c.deepMerge({format:"png",quality:1,multiplier:1},a||{}),e=d.data,f=document.createElement("img");return d.data||(e=d.lossless||"svg"==d.format?c.toSVG(c.deepMerge(d,{getBase64:!0})):c.setup.fabric.toDataURL(d)),f.setAttribute("src",e),c.handleCallback(b,f),f},toBlob:function(a,b){var e,d=c.deepMerge({data:"empty",type:"text/plain"},a||{}),f=/^data:.+;base64,(.*)$/.exec(d.data);return f&&(d.data=f[0],d.type=d.data.slice(5,d.data.indexOf(",")-7),d.data=c.toByteArray({data:d.data.slice(d.data.indexOf(",")+1,d.data.length)})),e=d.getByteArray?d.data:new Blob([d.data],{type:d.type}),c.handleCallback(b,e),e},toJPG:function(a,b){var d=c.deepMerge({format:"jpeg",quality:1,multiplier:1},a||{});d.format=d.format.toLowerCase();var e=c.setup.fabric.toDataURL(d);return c.handleCallback(b,e),e},toPNG:function(a,b){var d=c.deepMerge({format:"png",quality:1,multiplier:1},a||{}),e=c.setup.fabric.toDataURL(d);return c.handleCallback(b,e),e},toSVG:function(a,b){var d=c.deepMerge({reviver:function(a){var b=new RegExp(/\bstyle=(['"])(.*?)\1/),c=b.exec(a)[0].slice(7,-1),d=c.split(";"),e=[];for(i1=0;i1<d.length;i1++)if(d[i1]){var f=d[i1].replace(/\s/g,"").split(":"),g=f[0],h=f[1];if(-1!=["fill","stroke"].indexOf(g))if(h=fabric.Color.fromRgba(h),h&&h._source){var i="#"+h.toHex(),j=h._source[3];e.push([g,i].join(":")),e.push([g+"-opacity",j].join(":"))}else e.push(d[i1]);else"opactiy"!=g&&e.push(d[i1])}return a.replace(c,e.join(";"))}},a||{}),e=c.setup.fabric.toSVG(d,d.reviver);return d.getBase64&&(e="data:image/svg+xml;base64,"+btoa(e)),c.handleCallback(b,e),e},toPDF:function(a,b){var d=c.deepMerge(c.deepMerge({multiplier:2},c.config.pdfMake),a||{},!0);d.images.reference=c.toPNG(d);var e=new pdfMake.createPdf(d);return b&&e.getDataUrl(function(a){return function(){a.apply(c,arguments)}}(b)),e},toPRINT:function(a,b){var d,e=c.deepMerge({delay:1,lossless:!1},a||{}),f=c.toImage(e),g=[],h=document.body.childNodes;for(f.setAttribute("style","width: 100%; max-height: 100%;"),d=0;d<h.length;d++)c.isElement(h[d])&&(g[d]=h[d].style.display,h[d].style.display="none");return document.body.appendChild(f),window.print(),setTimeout(function(){for(d=0;d<h.length;d++)c.isElement(h[d])&&(h[d].style.display=g[d]);document.body.removeChild(f),c.handleCallback(b,f)},e.delay),f},toJSON:function(a,b){var d=c.deepMerge({data:c.getChartData(a)},a||{},!0),e=JSON.stringify(d.data,void 0,"	");return c.handleCallback(b,e),e},toCSV:function(a,b){function j(a){return"string"==typeof a&&(a=a),"string"==typeof a&&(f.escape&&(a=a.replace('"','""')),f.quotes&&(a=['"',a,'"'].join(""))),a}var d,e,f=c.deepMerge({data:c.getChartData(a),delimiter:",",quotes:!0,escape:!0},a||{},!0),g="",h=[],i=[];for(l in f.data[0])i.push(j(l)),h.push(l);g+=i.join(f.delimiter)+"\n";for(d in f.data)if(i=[],!isNaN(d)){for(e in h)if(!isNaN(e)){var k=h[e],l=f.data[d][k];i.push(j(l,k))}g+=i.join(f.delimiter)+"\n"}return c.handleCallback(b,g),g},toXLSX:function(a,b){function g(a,b){b&&(a+=1462);var c=Date.parse(a);return(c-new Date(Date.UTC(1899,11,30)))/864e5}function h(a){for(var c={},d={s:{c:1e7,r:1e7},e:{c:0,r:0}},e=0;e!=a.length;++e)for(var f=0;f!=a[e].length;++f){d.s.r>e&&(d.s.r=e),d.s.c>f&&(d.s.c=f),d.e.r<e&&(d.e.r=e),d.e.c<f&&(d.e.c=f);var h={v:a[e][f]};if(null!=h.v){var i=XLSX.utils.encode_cell({c:f,r:e});"number"==typeof h.v?h.t="n":"boolean"==typeof h.v?h.t="b":h.v instanceof Date?(h.t="n",h.z=XLSX.SSF._table[14],h.v=g(h.v)):h.t="s",c[i]=h}}return d.s.c<1e7&&(c["!ref"]=XLSX.utils.encode_range(d)),c}var d=c.deepMerge({name:"amCharts",dateFormat:"dateObject",withHeader:!0,stringify:!1},a||{},!0),e="",f={SheetNames:[],Sheets:{}};return d.data=d.data?d.data:c.getChartData(d),f.SheetNames.push(d.name),f.Sheets[d.name]=h(c.toArray(d)),e=XLSX.write(f,{bookType:"xlsx",bookSST:!0,type:"base64"}),e="data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"+e,c.handleCallback(b,e),e},toArray:function(a,b){var d,e,f=c.deepMerge({data:c.getChartData(a),withHeader:!1,stringify:!0},a||{},!0),g=[],h=[];for(e in f.data[0])h.push(e);f.withHeader&&g.push(h);for(d in f.data){var i=[];if(!isNaN(d)){for(e in h)if(!isNaN(e)){var e=h[e],j=f.data[d][e]||"";j=f.stringify?String(j):j,i.push(j)}g.push(i)}}return c.handleCallback(b,g),g},toByteArray:function(a,b){function l(a){var b=a.charCodeAt(0);return b===f?62:b===g?63:h>b?-1:h+10>b?b-h+26+26:j+26>b?b-j:i+26>b?b-i+26:void 0}function m(a){function k(a){h[j++]=a}var b,c,d,f,g,h;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=a.length;g="="===a.charAt(i-2)?2:"="===a.charAt(i-1)?1:0,h=new e(3*a.length/4-g),d=g>0?a.length-4:a.length;var j=0;for(b=0,c=0;d>b;b+=4,c+=3)f=l(a.charAt(b))<<18|l(a.charAt(b+1))<<12|l(a.charAt(b+2))<<6|l(a.charAt(b+3)),k((16711680&f)>>16),k((65280&f)>>8),k(255&f);return 2===g?(f=l(a.charAt(b))<<2|l(a.charAt(b+1))>>4,k(255&f)):1===g&&(f=l(a.charAt(b))<<10|l(a.charAt(b+1))<<4|l(a.charAt(b+2))>>2,k(255&f>>8),k(255&f)),h}var d=c.deepMerge({},a||{}),e="undefined"!=typeof Uint8Array?Uint8Array:Array,f="+".charCodeAt(0),g="/".charCodeAt(0),h="0".charCodeAt(0),i="a".charCodeAt(0),j="A".charCodeAt(0),k=m(d.data);return c.handleCallback(b,k),k},handleCallback:function(a){var b,d=Array();if(a&&a instanceof Function){for(b=0;b<arguments.length;b++)b>0&&d.push(arguments[b]);a.apply(c,d)}},handleDropbox:function(a){if(c.drawing.buffer.enabled)if(a.preventDefault(),a.stopPropagation(),"dragover"==a.type)c.setup.wrapper.setAttribute("class",c.setup.chart.classNamePrefix+"-export-canvas active dropbox");else if(c.setup.wrapper.setAttribute("class",c.setup.chart.classNamePrefix+"-export-canvas active"),"drop"==a.type&&a.dataTransfer.files.length)for(var b=0;b<a.dataTransfer.files.length;b++){var d=new FileReader;d.onloadend=function(b){return function(){c.drawing.handler.add({url:d.result,top:a.layerY-10*b,left:a.layerX-10*b})}}(b),d.readAsDataURL(a.dataTransfer.files[b])}},getChartData:function(a){function i(a,e,f){function g(a,c){return-1!=b.dataFields.indexOf(a)?g([a,".",c].join("")):a}a&&b.exportTitles&&"gantt"!=c.setup.chart.type&&(d=g(a,f),b.dataFieldsMap[d]=a,b.dataFields.push(d),b.titles[d]=e||d)}var d,e,f,g,b=c.deepMerge({data:[],titles:{},dateFields:[],dataFields:[],dataFieldsMap:{},exportTitles:c.config.exportTitles,exportSelection:c.config.exportSelection},a||{},!0),h=["valueField","openField","closeField","highField","lowField","xField","yField"];if(0==b.data.length)if("stock"==c.setup.chart.type){for(b.data=c.setup.chart.mainDataSet.dataProvider,i(c.setup.chart.mainDataSet.categoryField),b.dateFields.push(c.setup.chart.mainDataSet.categoryField),e=0;e<c.setup.chart.mainDataSet.fieldMappings.length;e++){var j=c.setup.chart.mainDataSet.fieldMappings[e];
  for(f=0;f<c.setup.chart.panels.length;f++){var k=c.setup.chart.panels[f];for(g=0;g<k.stockGraphs.length;g++){var l=k.stockGraphs[g];for(i4=0;i4<h.length;i4++)l[h[i4]]==j.toField&&i(j.fromField,l.title,h[i4])}}}for(e=0;e<c.setup.chart.comparedGraphs.length;e++){var l=c.setup.chart.comparedGraphs[e];for(f=0;f<l.dataSet.dataProvider.length;f++)for(g=0;g<l.dataSet.fieldMappings.length;g++){var j=l.dataSet.fieldMappings[g],d=l.dataSet.id+"_"+j.toField;b.data[f][d]=l.dataSet.dataProvider[f][j.fromField],b.titles[d]||i(d,l.dataSet.title)}}}else if("gantt"==c.setup.chart.type){i(c.setup.chart.categoryField),b.dateFields.push(c.setup.chart.categoryField);var m=c.setup.chart.segmentsField;for(e=0;e<c.setup.chart.dataProvider.length;e++){var n=c.setup.chart.dataProvider[e];if(n[m])for(f=0;f<n[m].length;f++)n[m][f][c.setup.chart.categoryField]=n[c.setup.chart.categoryField],b.data.push(n[m][f])}for(e=0;e<c.setup.chart.graphs.length;e++){var l=c.setup.chart.graphs[e];for(f=0;f<h.length;f++){var o=h[f],p=l[o];l.title,i(p,l.title,o)}}}else if(-1!=["pie","funnel"].indexOf(c.setup.chart.type))b.data=c.setup.chart.dataProvider,i(c.setup.chart.titleField),b.dateFields.push(c.setup.chart.titleField),i(c.setup.chart.valueField);else if("map"!=c.setup.chart.type)for(b.data=c.setup.chart.dataProvider,c.setup.chart.categoryAxis&&(i(c.setup.chart.categoryField,c.setup.chart.categoryAxis.title),b.dateFields.push(c.setup.chart.categoryField)),e=0;e<c.setup.chart.graphs.length;e++){var l=c.setup.chart.graphs[e];for(f=0;f<h.length;f++){var o=h[f],p=l[o];i(p,l.title,o)}}return c.processData(b)},processData:function(b){var e,f,d=c.deepMerge({data:[],titles:{},dateFields:[],dataFields:[],dataFieldsMap:{},dataDateFormat:c.setup.chart.dataDateFormat,dateFormat:c.config.dateFormat||c.setup.chart.dataDateFormat||"YYYY-MM-DD",exportTitles:c.config.exportTitles,exportSelection:c.config.exportSelection},b||{},!0);if(d.data.length){for(e=0;e<d.data.length;e++)for(f in d.data[e])-1==d.dataFields.indexOf(f)&&(d.dataFields.push(f),d.dataFieldsMap[f]=f);var g=[];for(e=0;e<d.data.length;e++){var h={},i=!1;for(f=0;f<d.dataFields.length;f++){var j=d.dataFields[f],k=d.dataFieldsMap[j],l=d.titles[j]||j,m=d.data[e][k]||void 0;d.exportTitles&&"gantt"!=c.setup.chart.type&&l in h&&(l+=["( ",j," )"].join("")),-1!=d.dateFields.indexOf(k)&&(d.dataDateFormat&&(m instanceof String||"string"==typeof m)&&(m=AmCharts.stringToDate(m,d.dataDateFormat)),d.exportSelection&&(m instanceof Date?(m<a.startDate||m>a.endDate)&&(i=!0):(e<a.startIndex||e>a.endIndex)&&(i=!0)),d.dateFormat&&"dateObject"!=d.dateFormat&&m instanceof Date&&(m=AmCharts.formatDate(m,d.dateFormat))),h[l]=m}i||g.push(h)}d.data=g}return d.data},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()},createMenu:function(b,d){function f(b,d){var e,g,h=document.createElement("ul");for(e=0;e<b.length;e++){var i="string"==typeof b[e]?{format:b[e]}:b[e],j=document.createElement("li"),k=document.createElement("a"),l=document.createElement("img"),m=document.createElement("span"),n=String(i.action?i.action:i.format).toLowerCase();if(i.format=String(i.format).toUpperCase(),c.config.formats[i.format]?i=c.deepMerge({label:i.icon?"":i.format,format:i.format,mimeType:c.config.formats[i.format].mimeType,extension:c.config.formats[i.format].extension,capture:c.config.formats[i.format].capture,action:c.config.action,fileName:c.config.fileName},i):i.label||(i.label=i.label?i.label:c.i18l("menu.label."+n)),!(-1!=["CSV","JSON","XLSX"].indexOf(i.format)&&-1!=["map","gauge"].indexOf(c.setup.chart.type)||!c.setup.hasBlob&&"UNDEFINED"!=i.format&&i.mimeType&&"image"!=i.mimeType.split("/")[0]&&"text/plain"!=i.mimeType)){if("draw"==i.action)c.config.fabric.drawing.enabled?(i.menu=i.menu?i.menu:c.config.fabric.drawing.menu,i.click=function(a){return function(){this.capture(a,function(){this.createMenu(a.menu)})}}(i)):i.menu=[];else if(!i.populated&&i.action&&-1!=i.action.indexOf("draw.")){var o=i.action.split(".")[1],p=i[o]||c.config.fabric.drawing[o]||[];for(i.menu=[],i.populated=!0,g=0;g<p.length;g++){var q={label:p[g]};if("shapes"==o){var r=-1==p[g].indexOf("//"),s=(r?c.config.path+"shapes/":"")+p[g];q.action="add",q.url=s,q.icon=s,q.ignore=r,q["class"]="export-drawing-shape"}else"colors"==o?(q.style="background-color: "+p[g],q.action="change",q.color=p[g],q["class"]="export-drawing-color"):"widths"==o?(q.action="change",q.width=p[g],q.label=document.createElement("span"),q.label.style.width=c.numberToPx(p[g]),q.label.style.height=c.numberToPx(p[g]),q["class"]="export-drawing-width"):"opacities"==o?(q.style="opacity: "+p[g],q.action="change",q.opacity=p[g],q.label=100*p[g]+"%",q["class"]="export-drawing-opacity"):"modes"==o&&(q.label=c.i18l("menu.label.draw.modes."+p[g]),q.click=function(a){return function(){c.drawing.mode=a}}(p[g]),q["class"]="export-drawing-mode");i.menu.push(q)}}else i.click||i.menu||i.items||(c.drawing.handler[n]instanceof Function?(i.action=n,i.click=function(a){return function(){this.drawing.handler[a.action](a)}}(i)):c.drawing.buffer.enabled?i.click=function(a){return function(){this.drawing.handler.done(),this["to"+a.format](a,function(b){"download"==a.action&&this.download(b,a.mimeType,[a.fileName,a.extension].join("."))})}}(i):"UNDEFINED"!=i.format&&(i.click=function(a){return function(){if(a.capture||"print"==a.action||"PRINT"==a.format)this.capture(a,function(){this.drawing.handler.done(),this["to"+a.format](a,function(b){"download"==a.action&&this.download(b,a.mimeType,[a.fileName,a.extension].join("."))})});else{if(!this["to"+a.format])throw new Error("Invalid format. Could not determine output type.");this["to"+a.format](a,function(b){this.download(b,a.mimeType,[a.fileName,a.extension].join("."))})}}}(i)));(void 0===i.menu||i.menu.length)&&(k.setAttribute("href","#"),k.addEventListener("click",function(a,b){return function(d){d.preventDefault();var e=[d,b];return("draw"==b.action||"PRINT"==b.format||"UNDEFINED"!=b.format&&b.capture)&&!c.drawing.enabled&&(b.delay=b.delay?b.delay:c.config.delay,b.delay)?(c.delay(b,a),void 0):(a.apply(c,e),void 0)}}(i.click||function(a){a.preventDefault()},i)),j.appendChild(k),c.isElement(i.label)?m.appendChild(i.label):m.innerHTML=i.label,i["class"]&&(j.className=i["class"]),i.style&&j.setAttribute("style",i.style),i.icon&&(l.setAttribute("src",(i.ignore||-1!=i.icon.slice(0,10).indexOf("//")?"":a.pathToImages)+i.icon),k.appendChild(l)),i.label&&k.appendChild(m),i.title&&k.setAttribute("title",i.title),c.config.menuReviver&&(j=c.config.menuReviver.apply(c,[i,j])),i.elements={li:j,a:k,img:l,span:m},(i.menu||i.items)&&"draw"!=i.action?f(i.menu||i.items,j).childNodes.length&&h.appendChild(j):h.appendChild(j))}}return h.childNodes.length&&d.appendChild(h),h}return d||("string"==typeof c.config.divId?c.config.divId=d=document.getElementById(c.config.divId):d=c.isElement(c.config.divId)?c.config.divId:c.setup.chart.containerDiv),c.isElement(c.setup.menu)?c.setup.menu.innerHTML="":c.setup.menu=document.createElement("div"),c.setup.menu.setAttribute("class",c.setup.chart.classNamePrefix+"-export-menu "+c.setup.chart.classNamePrefix+"-export-menu-"+c.config.position+" amExportButton"),c.config.menuWalker&&(f=c.config.menuWalker),f.apply(this,[b,c.setup.menu]),c.setup.menu.childNodes.length&&d.appendChild(c.setup.menu),c.setup.menu},delay:function(a,b){var e,f,d=c.deepMerge({delay:3,precision:2},a||{}),g=Number(new Date),h=c.createMenu([{label:c.i18l("capturing.delayed.menu.label").replace("{{duration}}",AmCharts.toFixed(d.delay,d.precision)),title:c.i18l("capturing.delayed.menu.title"),"class":"export-delayed-capturing",click:function(){clearTimeout(e),clearTimeout(f),c.createMenu(c.config.menu)}}]),i=h.getElementsByTagName("a")[0];e=setInterval(function(){var a=d.delay-(Number(new Date)-g)/1e3;0>=a?(clearTimeout(e),"draw"!=d.action&&c.createMenu(c.config.menu)):i&&(i.innerHTML=c.i18l("capturing.delayed.menu.label").replace("{{duration}}",AmCharts.toFixed(a,2)))},10),f=setTimeout(function(){b.apply(c,arguments)},1e3*d.delay)},migrateSetup:function(a){function c(a){var d;for(d in a){var e=a[d];"export"==d.slice(0,6)&&e?b.menu.push(d.slice(6)):"userCFG"==d?c(e):"menuItems"==d?b.menu=e:"libs"==d?b.libs=e:"string"==typeof d&&(b[d]=e)}}var b={enabled:!0,migrated:!0,libs:{autoLoad:!0},menu:[]};return c(a),b},loadListeners:function(){function a(a){a&&(a.set({top:a.top+10,left:a.left+10}),c.setup.fabric.add(a))}c.config.keyListener&&"attached"!=c.config.keyListener&&(c.config.keyListener="attached",document.addEventListener("keydown",function(b){var d=c.drawing.buffer.target;8!=b.keyCode&&46!=b.keyCode||!d?27==b.keyCode&&c.drawing.enabled?(b.preventDefault(),c.drawing.handler.done()):67==b.keyCode&&(b.metaKey||b.ctrlKey)&&d?c.drawing.buffer.copy=d:88==b.keyCode&&(b.metaKey||b.ctrlKey)&&d?(c.drawing.buffer.copy=d,c.setup.fabric.remove(d)):86==b.keyCode&&(b.metaKey||b.ctrlKey)?c.drawing.buffer.copy&&a(c.drawing.buffer.copy.clone(a)):90==b.keyCode&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),b.shiftKey?c.drawing.handler.redo():c.drawing.handler.undo()):(b.preventDefault(),c.setup.fabric.remove(d))})),c.config.fileListener&&(c.setup.chart.containerDiv.addEventListener("dragover",c.handleDropbox),c.setup.chart.containerDiv.addEventListener("dragleave",c.handleDropbox),c.setup.chart.containerDiv.addEventListener("drop",c.handleDropbox))},init:function(){clearTimeout(c.timer),c.timer=setInterval(function(){c.setup.chart.containerDiv&&(clearTimeout(c.timer),c.config.enabled&&(c.setup.chart.AmExport=c,c.setup.chart.div.style.overflow="visible",c.loadListeners(),c.createMenu(c.config.menu)))},AmCharts.updateRate)},construct:function(){c.drawing.handler.cancel=c.drawing.handler.done;try{c.setup.hasBlob=!!new Blob}catch(a){}window.safari=window.safari?window.safari:{},c.defaults.fabric.drawing.fontSize=c.setup.chart.fontSize||11,c.config.drawing=c.deepMerge(c.defaults.fabric.drawing,c.config.drawing||{},!0),c.deepMerge(c.defaults.fabric,c.config,!0),c.deepMerge(c.defaults.fabric,c.config.fabric||{},!0),c.deepMerge(c.defaults.pdfMake,c.config,!0),c.deepMerge(c.defaults.pdfMake,c.config.pdfMake||{},!0),c.deepMerge(c.libs,c.config.libs||{},!0),c.config.drawing=c.defaults.fabric.drawing,c.config.fabric=c.defaults.fabric,c.config.pdfMake=c.defaults.pdfMake,c.config=c.deepMerge(c.defaults,c.config,!0),c.config.fabric.drawing.enabled&&void 0===c.config.fabric.drawing.menu&&(c.config.fabric.drawing.menu=[],c.deepMerge(c.config.fabric.drawing.menu,[{"class":"export-drawing",menu:[{label:c.i18l("menu.label.draw.add"),menu:[{label:c.i18l("menu.label.draw.shapes"),action:"draw.shapes"},{label:c.i18l("menu.label.draw.text"),action:"text"}]},{label:c.i18l("menu.label.draw.change"),menu:[{label:c.i18l("menu.label.draw.modes"),action:"draw.modes"},{label:c.i18l("menu.label.draw.colors"),action:"draw.colors"},{label:c.i18l("menu.label.draw.widths"),action:"draw.widths"},{label:c.i18l("menu.label.draw.opacities"),action:"draw.opacities"},"UNDO","REDO"]},{label:c.i18l("menu.label.save.image"),menu:["PNG","JPG","SVG","PDF"]},"PRINT","CANCEL"]}])),void 0===c.config.menu&&(c.config.menu=[],c.deepMerge(c.config,{menu:[{"class":"export-main",menu:[{label:c.i18l("menu.label.save.image"),menu:["PNG","JPG","SVG","PDF"]},{label:c.i18l("menu.label.save.data"),menu:["CSV","XLSX","JSON"]},{label:c.i18l("menu.label.draw"),action:"draw",menu:c.config.fabric.drawing.menu},{format:"PRINT",label:c.i18l("menu.label.print")}]}]})),c.libs.path||(c.libs.path=c.config.path+"libs/"),c.isSupported()&&(c.loadDependencies(c.libs.resources,c.libs.reload),c.setup.chart.addClassNames=!0,c.setup.chart[c.name]=c,c.init())}};if(b)c.config=b;else if(c.setup.chart[c.name])c.config=c.setup.chart[c.name];else{if(!c.setup.chart.amExport&&!c.setup.chart.exportConfig)return;c.config=c.migrateSetup(c.setup.chart.amExport||c.setup.chart.exportConfig)}return c.construct(),c.deepMerge(this,c)}}(),AmCharts.addInitHandler(function(a){new AmCharts["export"](a)},["pie","serial","xy","funnel","radar","gauge","stock","map","gantt"]);