You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2 lines
46 KiB

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.4.20",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"],namespaces:{"pdfmake.js":"pdfMake","jszip.js":"JSZip","xlsx.js":"XLSX","fabric.js":"fabric","FileSaver.js":"saveAs"}},config:{},setup:{chart:a,hasBlob:!1,wrapper:!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(a,b){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(a){c.drawing.buffer.enabled=!1,c.drawing.undos=[],c.drawing.redos=[],c.createMenu(c.config.menu),c.setup.fabric.deactivateAll(),c.setup.wrapper&&(c.setup.chart.containerDiv.removeChild(c.setup.wrapper),c.setup.wrapper=!1)},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",overflow:!0,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,autoClose:!0},border:{fill:"",fillOpacity:0,stroke:"#000000",strokeWidth:1,strokeOpacity:1}},pdfMake:{pageSize:"A4",pageOrientation:"portrait",images:{},content:["Saved from:",window.location.href,{image:"reference",fit:[515.28,733.762]}]},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]||AmCharts.translations[c.name].en;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){var d,e,f,g,h,i,j=-1!=a.indexOf("//")?a:[c.libs.path,a].join(""),k=function(){if(b)for(d=0;d<b.length;d++)c.loadResource(b[d])};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}for(d in c.libs.namespaces){var l=c.libs.namespaces[d],h=a.toLowerCase(),g=d.toLowerCase();if(-1!=h.indexOf(g)&&void 0!==window[l]){e=!0;break}}(!e||c.libs.reload)&&(f.addEventListener("load",k),document.head.appendChild(f),c.listenersToRemove||(c.listenersToRemove=[]),c.listenersToRemove.push({node:f,method:k,event:"load"}))},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,b){return!a&&b?void 0: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]=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?c.deepMerge(a[e],f,d):a instanceof Array&&!d?a.push(f):a[e]=f);return a},isElement:function(a){return a instanceof Object&&a&&1===a.nodeType},isHashbanged:function(a){var b=String(a).replace(/\"/g,"");return"url"==b.slice(0,3)?b.slice(b.indexOf("#")+1,b.length-1):!1},isPressed:function(a){return"mousemove"==a.type&&1===a.which||("touchmove"==a.type||1===a.buttons||1===a.button||1===a.which?c.drawing.buffer.isPressed=!0:c.drawing.buffer.isPressed=!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},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){var h={},i=fabric.parseTransformAttribute(c.gatherAttribute(g,"transform"));for(f=0;f<g.childNodes.length;f++)g.childNodes[f].setAttribute("fill","transparent"),h={x:c.pxToNumber(g.childNodes[f].getAttribute("x")),y:c.pxToNumber(g.childNodes[f].getAttribute("y")),width:c.pxToNumber(g.childNodes[f].getAttribute("width")),height:c.pxToNumber(g.childNodes[f].getAttribute("height"))};a.clippings[g.id]={svg:g,bbox:h,transform:i}}else if("pattern"==g.tagName){var j={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&&(j.fill=g.childNodes[f].getAttribute("fill"));b.removeImages&&c.isTainted(j.source)?a.patterns[g.id]=j.fill?j.fill:"transparent":(d.included++,a.patterns[j.node.id]=j)}else"image"==g.tagName&&(d.included++,fabric.Image.fromURL(g.getAttribute("xlink:href"),function(a){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};fabric.ElementsParser.prototype.resolveGradient=function(a,b){var c=a.get(b);if(/^url\(/.test(c)){var d=c.slice(c.indexOf("#")+1,c.length-1);fabric.gradientDefs[this.svgUid][d]&&a.set(b,fabric.Gradient.fromElement(fabric.gradientDefs[this.svgUid][d],a))}},c.handleCallback(e.beforeCapture,e);var 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=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(a){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),void c.setup.fabric.renderAll()):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),void c.setup.fabric.renderAll()):(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,void(c.setup.fabric.isDrawingMode=!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)):("absolute"==j.parent.style.position?(j.offset.absolute=!0,j.offset.top=c.pxToNumber(j.parent.style.top),j.offset.right=c.pxToNumber(j.parent.style.right,!0),j.offset.bottom=c.pxToNumber(j.parent.style.bottom,!0),j.offset.left=c.pxToNumber(j.parent.style.left),j.offset.width=c.pxToNumber(j.parent.style.width),j.offset.height=c.pxToNumber(j.parent.style.height)):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.setup.chart.legend&&-1!=["left","right"].indexOf(c.setup.chart.legend.position)&&(j.offset.y=c.pxToNumber(j.parent.style.top),j.offset.x=c.pxToNumber(j.parent.style.left))),fabric.parseSVGDocument(j.svg,function(a){return function(d,i){var j,k=fabric.util.groupSVGElements(d,i),l=[],m={selectable:!1};for(a.offset.absolute?(void 0!==a.offset.bottom?m.top=g.height-a.offset.height-a.offset.bottom:m.top=a.offset.top,void 0!==a.offset.right?m.left=g.width-a.offset.width-a.offset.right:m.left=a.offset.left):(m.top=a.offset.y,m.left=a.offset.x),j=0;j<k.paths.length;j++){var n=null;if(k.paths[j]){if(e.removeImages&&c.isTainted(k.paths[j]["xlink:href"]))continue;if(k.paths[j].fill instanceof Object)"radial"==k.paths[j].fill.type&&-1==["pie","gauge"].indexOf(c.setup.chart.type)&&(k.paths[j].fill.coords.r2=-1*k.paths[j].fill.coords.r1,k.paths[j].fill.coords.r1=0,k.paths[j].set({opacity:k.paths[j].fillOpacity}));else if((n=c.isHashbanged(k.paths[j].fill))&&a.patterns&&a.patterns[n]){var o=a.patterns[n];fabric.Image.fromURL(o.source,function(a,b){return function(c){h.loaded++;var d=null,e=new fabric.StaticCanvas(void 0,{backgroundColor:a.fill});e.add(c),d=new fabric.Pattern({source:function(){return e.setDimensions({width:a.width,height:a.height}),e.getElement()},repeat:"repeat"}),k.paths[b].set({fill:d,opacity:k.paths[b].fillOpacity})}}(o,j))}if((n=c.isHashbanged(k.paths[j].clipPath))&&a.clippings&&a.clippings[n]&&(!function(b,c){var d=k.paths[b].toSVG;k.paths[b].toSVG=function(b){return d.apply(this,[function(d){return b(d,a.clippings[c])}])}}(j,n),k.paths[j].set({clipTo:function(b,d){return function(b){var e=a.clippings[d],f=this.transformMatrix||[1,0,0,1,0,0],g={top:e.bbox.y,left:e.bbox.x,width:e.bbox.width,height:e.bbox.height};"map"==c.setup.chart.type&&(g.top+=e.transform[5],g.left+=e.transform[4]),e.bbox.x&&f[4]&&e.bbox.y&&f[5]&&(g.top-=f[5],g.left-=f[4]),b.rect(g.left,g.top,g.width,g.height)}}(j,n)})),k.paths[j].TSPANWORKAROUND){for(var p=fabric.parseAttributes(k.paths[j].svg,fabric.Text.ATTRIBUTE_NAMES),i=fabric.util.object.extend({},p),q=[],r=0;r<k.paths[j].svg.childNodes.length;r++){var s=k.paths[j].svg.childNodes[r],t=fabric.Text.fromElement(s,i);t.set({left:0}),q.push(t)}k.paths[j].set({opacity:0});var u=new fabric.Group(q,{top:-1*k.paths[j].top});k.paths[j]=u}}l.push(k.paths[j])}if(k.paths=l,k.set(m),c.setup.fabric.add(k),a.svg.parentNode&&a.svg.parentNode.getElementsByTagName){var v=a.svg.parentNode.getElementsByClassName(c.setup.chart.classNamePrefix+"-balloon-div");for(j=0;j<v.length;j++)if(e.balloonFunction instanceof Function)e.balloonFunction.apply(c,[v[j],a]);else{var w=v[j],x=fabric.parseStyleAttribute(w),y=fabric.parseStyleAttribute(w.childNodes[0]),z=new fabric.Text(w.innerText||w.textContent||w.innerHTML,{selectable:!1,top:x.top+a.offset.y,left:x.left+a.offset.x,fill:y.color,fontSize:y.fontSize,fontFamily:y.fontFamily,textAlign:y["text-align"]});c.setup.fabric.add(z)}}if(a.svg.nextSibling&&"A"==a.svg.nextSibling.tagName){var w=a.svg.nextSibling,x=fabric.parseStyleAttribute(w),z=new fabric.Text(w.innerText||w.textContent||w.innerHTML,{selectable:!1,top:x.top+a.offset.y,left:x.left+a.offset.x,fill:x.color,fontSize:x.fontSize,fontFamily:x.fontFamily,opacity:x.opacity});c.setup.fabric.add(z)}if(f.pop(),!f.length)var A=setInterval(function(){h.loaded==h.included&&(clearTimeout(A),c.handleBorder(e),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");if(b.className=String(f),b.classList=String(f).split(" "),b.clipPath=h,b.svg=a,"text"==a.tagName&&a.childNodes.length>1&&(b.TSPANWORKAROUND=!0),"hidden"==g)b.opacity=0;else{var i=["fill","stroke"];for(d=0;d<i.length;d++){var j=i[d],k=String(a.getAttribute(j)||""),l=Number(a.getAttribute(j+"-opacity")||"1"),m=fabric.Color.fromHex(k).getSource();-1==b.classList.indexOf(c.setup.chart.classNamePrefix+"-guide-fill")||k||(l=0,m=fabric.Color.fromHex("#000000").getSource()),m&&(m.pop(),m.push(l),b[j]="rgba("+m.join()+")",b[j+c.capitalize("opacity")]=l)}}c.handleCallback(e.reviver,b,a)})}},toCanvas:function(a,b){var e=(c.deepMerge({},a||{}),c.setup.canvas);return c.handleCallback(b,e),e},toImage:function(a,b){var d=c.deepMerge({format:"png",quality:1,multiplier:this.config.multiplier},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:this.config.multiplier},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:this.config.multiplier},a||{}),e=c.setup.fabric.toDataURL(d);return c.handleCallback(b,e),e},toSVG:function(a,b){var d=[],e=c.deepMerge({reviver:function(a,b){var c=new RegExp(/\bstyle=(['"])(.*?)\1/),e=c.exec(a)[0].slice(7,-1),f=e.split(";"),g=[];for(i1=0;i1<f.length;i1++)if(f[i1]){var h=f[i1].replace(/\s/g,"").split(":"),i=h[0],j=h[1];if(-1!=["fill","stroke"].indexOf(i))if(j=fabric.Color.fromRgba(j),j&&j._source){var k="#"+j.toHex(),l=j._source[3];g.push([i,k].join(":")),g.push([i+"-opacity",l].join(":"))}else g.push(f[i1]);else"opactiy"!=i&&g.push(f[i1])}if(a=a.replace(e,g.join(";")),b){var m=2,n=a.slice(-m);"/>"!=n&&(m=3,n=a.slice(-m));var o=a.slice(0,a.length-m),p=' clip-path="url(#'+b.svg.id+')" ',q=(new XMLSerializer).serializeToString(b.svg);a=o+p+n,d.push(q)}return a}},a||{}),f=c.setup.fabric.toSVG(e,e.reviver);if(d.length){var g=f.slice(0,f.length-6),h=f.slice(-6);f=g+d.join("")+h}return e.getBase64&&(f="data:image/svg+xml;base64,"+btoa(f)),c.handleCallback(b,f),f},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({dateFormat:c.config.dateFormat||"dateObject"},a||{},!0);d.data=d.data?d.data:c.getChartData(d);var e=JSON.stringify(d.data,void 0," ");return c.handleCallback(b,e),e},toCSV:function(a,b){function j(a,b){return"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,withHeader:!0},a||{},!0),g="",h=[],i=[];for(l in f.data[0])i.push(j(l)),h.push(l);f.withHeader&&(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,b){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:c.config.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=null==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(f>>8&255),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)}},handleBorder:function(a){if(c.config.border instanceof Object){var b=c.deepMerge(c.defaults.fabric.border,a.border||{},!0),d=new fabric.Rect;b.width=c.setup.fabric.width-b.strokeWidth,b.height=c.setup.fabric.height-b.strokeWidth,d.set(b),c.setup.fabric.add(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,exportFields:c.config.exportFields,exportSelection:c.config.exportSelection,columnNames:c.config.columnNames},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;f<b.data.length&&(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),c.setup.chart.categoryAxis.parseDates!==!1&&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,exportFields:c.config.exportFields,exportSelection:c.config.exportSelection,columnNames:c.config.columnNames,processData:c.config.processData},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);void 0!==d.exportFields&&(d.dataFields=d.dataFields.filter(function(a){return-1!=d.exportFields.indexOf(a)}));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.columnNames&&d.columnNames[j]||d.titles[j]||j,m=d.data[e][k];null==m&&(m=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.dateFormat&&(m instanceof Number||"number"==typeof m)&&(m=new Date(m)),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 void 0!==d.processData?d.processData(d.data):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.config.drawing.autoClose&&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.config.drawing.autoClose&&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)?void c.delay(b,a):void a.apply(c,e)}}(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},clear:function(){c.setup=void 0,c.docListener&&document.removeEventListener("keydown",c.docListener);var a=c.listenersToRemove;if(a)for(var b=0;b<a.length;b++){var d=a[b];d.node.removeEventListener(d.event,d.method)}c.listenersToRemove=[]},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.docListener=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.keyListener="attached",document.addEventListener("keydown",c.docListener)),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.config.overflow&&(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.config.border&&(c.config.border=c.deepMerge(c.defaults.fabric.border,c.config.border||{},!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"]);