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","label.saved.from":"Saved from: "}),function(){AmCharts["export"]=function(a,b){var c={name:"export",version:"1.4.33",libs:{async:!0,autoLoad:!0,reload:!1,resources:["fabric.js/fabric.min.js","FileSaver.js/FileSaver.min.js","jszip/jszip.min.js","xlsx/xlsx.min.js",{"pdfmake/pdfmake.min.js":["pdfmake/vfs_fonts.js"]}],namespaces:{"pdfmake.js":"pdfMake","jszip.js":"JSZip","xlsx.js":"XLSX","fabric.js":"fabric","FileSaver.js":"saveAs"},loadTimeout:1e4},config:{},setup:{chart:a,hasBlob:!1,wrapper:!1,isIE:!!window.document.documentMode,IEversion:window.document.documentMode},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.enabled=!1,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=c.getRGBA(c.drawing.color),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=c.getRGBA(e.color),h.pop(),h.push(e.opacity),e.color="rgba("+h.join()+")"),g=0;g0?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;e1?g.set({left:g.getLeft()+h,top:g.getTop()+g.fontSize*(e.length-1)*(.18+g._fontSizeFraction),textAlign:b.originX,lineHeight:e.length>1?.965:1.16}):g.set({left:g.getLeft()+h,top:g.getTop()-g.getHeight()/2+g.fontSize*(.18+g._fontSizeFraction)}),g}},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};c.modifyFabric(),c.handleCallback(e.beforeCapture,e);var i=c.setup.chart.containerDiv.getElementsByTagName("svg");for(d=0;dg.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.enabled=e.drawing.enabled="draw"==e.action,c.drawing.buffer.enabled=c.drawing.enabled,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;dc.config.fabric.loadTimeout)&&(clearTimeout(w),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,"hidden"==g)b.opacity=0;else{var i=["fill","stroke"];for(d=0;d"!=o&&(n=3,o=a.slice(-n));var p=a.slice(0,a.length-n),q=' clip-path="url(#'+b.svg.id+')" ',r=(new XMLSerializer).serializeToString(b.svg);a=p+q+o,d.push(r)}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,e),f},toPDF:function(a,b){function f(a){if("number"==typeof a||a instanceof Number)a={ left:a,right:a,top:a,bottom:a};else if(a instanceof Array)if(2===a.length)a={left:a[0],top:a[1],right:a[0],bottom:a[1]};else{if(4!==a.length)throw"Invalid pageMargins definition";a={left:a[0],top:a[1],right:a[2],bottom:a[3]}}else a={left:c.defaults.pdfMake.pageMargins,top:c.defaults.pdfMake.pageMargins,right:c.defaults.pdfMake.pageMargins,bottom:c.defaults.pdfMake.pageMargins};return a}function g(a,b){var d=c.defaults.pdfMake.pageSizes[String(a).toUpperCase()].slice();if(!d)throw new Error('The given pageSize "'+a+'" does not exist!');return"landscape"==b&&d.reverse(),d}var d=c.deepMerge(c.deepMerge({multiplier:c.config.multiplier||2,pageOrigin:void 0===c.config.pageOrigin?!0:!1},c.config.pdfMake),a||{},!0),e=new pdfMake.createPdf(d);if(d.images.reference=c.toPNG(d),!d.content){var h=[],i=g(d.pageSize,d.pageOrientation),j=f(d.pageMargins);i[0]-=j.left+j.right,i[1]-=j.top+j.bottom,d.pageOrigin&&(h.push(c.i18l("label.saved.from")),h.push(window.location.href),i[1]-=28.128),h.push({image:"reference",fit:i}),d.content=h}return b&&e.getDataUrl(function(a){return function(b){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;de&&(d.s.r=e),d.s.c>f&&(d.s.c=f),d.e.rb?-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,d),k},handleCallback:function(a){var b,d=Array();if(a&&a instanceof Function){for(b=0;b0&&d.push(arguments[b]);return 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.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;bd.libs.loadTimeout||b in window)&&(clearTimeout(c),d.handleCallback(a,b,f-e>d.libs.loadTimeout))},AmCharts.updateRate)}(f)}},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;ea.endDate)&&(i=!0):(ea.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.data=c.handleCallback(d.processData,d.data,d)),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=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)))},AmCharts.updateRate),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