UNPKG

highcharts

Version:
13 lines 31.2 kB
!/** * Highcharts JS v12.6.0 (2026-04-13) * @module highcharts/modules/exporting * @requires highcharts * * Exporting module * * (c) 2010-2026 Highsoft AS * Author: Torstein Hønsi * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.AST,e._Highcharts.Chart):"function"==typeof define&&define.amd?define("highcharts/modules/exporting",["highcharts/highcharts"],function(e){return t(e,e.AST,e.Chart)}):"object"==typeof exports?exports["highcharts/modules/exporting"]=t(e._Highcharts,e._Highcharts.AST,e._Highcharts.Chart):e.Highcharts=t(e.Highcharts,e.Highcharts.AST,e.Highcharts.Chart)}("u"<typeof window?this:window,(e,t,n)=>(()=>{"use strict";var i,o,r={660:e=>{e.exports=t},944:t=>{t.exports=e},960:e=>{e.exports=n}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return r[e](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s={};l.d(s,{default:()=>el});var c=l(944),h=l.n(c),p=l(660),d=l.n(p),u=l(960),g=l.n(u),f=i||(i={});f.compose=function(e){return e.navigation||(e.navigation=new m(e)),e};class m{constructor(e){this.updates=[],this.chart=e}addUpdate(e){this.chart.navigation.updates.push(e)}update(e,t){this.updates.forEach(n=>{n.call(this.chart,e,t)})}}f.Additions=m;let y=i,{isSafari:x,win:w,win:{document:v}}=h(),b=w.URL||w.webkitURL||w;function S(e,t){let n=w.navigator,i=v.createElement("a");if("string"!=typeof e&&!(e instanceof String)&&n.msSaveOrOpenBlob)return void n.msSaveOrOpenBlob(e,t);if(e=""+e,n.userAgent.length>1e3)throw Error("Input too long");let o=/Edge\/\d+/.test(n.userAgent);if((x&&"string"==typeof e&&0===e.indexOf("data:application/pdf")||o||e.length>2e6)&&!(e=function(e){let t=e.replace(/filename=.*;/,"").match(/data:([^;]*)(;base64)?,([A-Z+\d\/]+)/i);if(t&&t.length>3&&w.atob&&w.ArrayBuffer&&w.Uint8Array&&w.Blob&&b.createObjectURL){let e=w.atob(t[3]),n=new w.ArrayBuffer(e.length),i=new w.Uint8Array(n);for(let t=0;t<i.length;++t)i[t]=e.charCodeAt(t);return b.createObjectURL(new w.Blob([i],{type:t[1]}))}}(e)||""))throw Error("Failed to convert to blob");if(void 0!==i.download)i.href=e,i.download=t,v.body.appendChild(i),i.click(),v.body.removeChild(i);else try{if(!w.open(e,"chart"))throw Error("Failed to open window")}catch{w.location.href=e}}let{isTouchDevice:E}=h(),C={exporting:{allowTableSorting:!0,libURL:"https://code.highcharts.com/12.6.0/lib/",local:!0,type:"image/png",url:`https://export-svg.highcharts.com?v=${h().version}`,pdfFont:{normal:void 0,bold:void 0,bolditalic:void 0,italic:void 0},printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",titleKey:"contextButtonTitle",menuItems:["viewFullscreen","printChart","separator","downloadPNG","downloadJPEG","downloadSVG"]}},menuItemDefinitions:{viewFullscreen:{textKey:"viewFullscreen",onclick:function(){this.fullscreen?.toggle()}},printChart:{textKey:"printChart",onclick:function(){this.exporting?.print()}},separator:{separator:!0},downloadPNG:{textKey:"downloadPNG",onclick:async function(){await this.exporting?.exportChart()}},downloadJPEG:{textKey:"downloadJPEG",onclick:async function(){await this.exporting?.exportChart({type:"image/jpeg"})}},downloadPDF:{textKey:"downloadPDF",onclick:async function(){await this.exporting?.exportChart({type:"application/pdf"})}},downloadSVG:{textKey:"downloadSVG",onclick:async function(){await this.exporting?.exportChart({type:"image/svg+xml"})}}}},lang:{viewFullscreen:"View in full screen",exitFullscreen:"Exit from full screen",printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"},navigation:{buttonOptions:{symbolSize:14,symbolX:14.5,symbolY:13.5,align:"right",buttonSpacing:5,height:28,y:-5,verticalAlign:"top",width:28,symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,theme:{fill:"#ffffff",padding:5,stroke:"none","stroke-linecap":"round"}},menuStyle:{border:"none",borderRadius:"3px",background:"#ffffff",padding:"0.5em"},menuItemStyle:{background:"none",borderRadius:"3px",color:"#333333",padding:"0.5em",fontSize:E?"0.9em":"0.8em",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"#f2f2f2"}}};!function(e){let t=[];function n(e,t,n,i){return[["M",e,t+2.5],["L",e+n,t+2.5],["M",e,t+i/2+.5],["L",e+n,t+i/2+.5],["M",e,t+i-1.5],["L",e+n,t+i-1.5]]}function i(e,t,n,i){let o=i/3-2,r=[];return r.concat(this.circle(n-o,t,o,o),this.circle(n-o,t+o+4,o,o),this.circle(n-o,t+2*(o+4),o,o))}e.compose=function(e){if(-1===t.indexOf(e)){t.push(e);let o=e.prototype.symbols;o.menu=n,o.menuball=i.bind(o)}}}(o||(o={}));let O=o,{doc:T,win:k}=h();function F(e,t,n,i={}){let o="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let r=o.hcEvents;h().Point&&e instanceof h().Point&&e.series&&e.series.chart&&(e.series.chart.runTrackerClick=!0);let a=e.addEventListener;a&&a.call(e,t,n,!!h().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==t.indexOf("touch"):i.passive,capture:!1}),r[t]||(r[t]=[]);let l={fn:n,order:"number"==typeof i.order?i.order:1/0};return r[t].push(l),r[t].sort((e,t)=>e.order-t.order),function(){V(e,t,n)}}function P(e,t,n,i,o){let r=T.createElement(e);return t&&A(r,t),o&&R(r,{padding:"0",border:"none",margin:"0"}),n&&R(r,n),i&&i.appendChild(r),r}function R(e,t){A(e.style,t)}function N(e){e?.parentElement?.removeChild(e)}function A(e,t){let n;for(n in e||(e={}),t)e[n]=t[n];return e}function L(e,t,n,i){if(n=n||{},T?.createEvent&&(e.dispatchEvent||e.fireEvent&&e!==h())){let i=T.createEvent("Events");i.initEvent(t,!0,!0),n=A(i,n),e.dispatchEvent?e.dispatchEvent(n):e.fireEvent(t,n)}else if(e.hcEvents){n.target||A(n,{preventDefault:function(){n.defaultPrevented=!0},target:e,type:t});let i=[],o=e,r=!1;for(;o.hcEvents;)Object.hasOwnProperty.call(o,"hcEvents")&&o.hcEvents[t]&&(i.length&&(r=!0),i.unshift.apply(i,o.hcEvents[t])),o=Object.getPrototypeOf(o);r&&i.sort((e,t)=>e.order-t.order),i.forEach(t=>{!1===t.fn.call(e,n,e)&&n.preventDefault()})}i&&!n.defaultPrevented&&i.call(e,n)}let D=Array.prototype.find?function(e,t){return e.find(t)}:function(e,t){let n,i=e.length;for(n=0;n<i;n++)if(t(e[n],n))return e[n]};function H(e){null!=e&&clearTimeout(e)}function M(e){return I(e)&&"number"==typeof e.nodeType}function j(e){let t=Object.prototype.toString.call(e);return"[object Array]"===t||"[object Array Iterator]"===t}function I(e,t){return!!e&&"object"==typeof e&&(!t||!j(e))}function U(e,...t){let n,i=[e,...t],o={},r=function(e,t){return"object"!=typeof e&&(e={}),B(t,function(n,i){if("__proto__"!==i&&"constructor"!==i){let o;!I(n,!0)||(o=n?.constructor,I(n,!0)&&!M(n)&&o?.name&&"Object"!==o.name)||M(n)?e[i]=t[i]:e[i]=r(e[i]||{},n)}}),e};!0===e&&(o=i[1],i=Array.prototype.slice.call(i,2));let a=i.length;for(n=0;n<a;n++)o=r(o,i[n]);return o}function B(e,t,n){for(let i in e)Object.hasOwnProperty.call(e,i)&&t.call(n||e[i],e[i],i,e)}function $(){let e=arguments,t=e.length;for(let n=0;n<t;n++){let t=e[n];if(null!=t)return t}}function G(e,t){return 0>e.indexOf(t)&&!!e.push(t)}function V(e,t,n){function i(t,n){let i=e.removeEventListener;i&&i.call(e,t,n,!1)}function o(n){let o,r;e.nodeName&&(t?(o={})[t]=!0:o=n,B(o,function(e,t){if(n[t])for(r=n[t].length;r--;)i(t,n[t][r].fn)}))}let r="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(r,"hcEvents")){let e=r.hcEvents;if(t){let r=e[t]||[];n?(e[t]=r.filter(function(e){return n!==e.fn}),i(t,n)):(o(e),e[t]=[])}else o(e),delete r.hcEvents}}let{composed:W}=h();function q(){this.fullscreen=new z(this)}class z{static compose(e){G(W,"Fullscreen")&&F(e,"beforeRender",q)}constructor(e){this.chart=e,this.isOpen=!1;const t=e.renderTo;!this.browserProps&&("function"==typeof t.requestFullscreen?this.browserProps={fullscreenChange:"fullscreenchange",requestFullscreen:"requestFullscreen",exitFullscreen:"exitFullscreen"}:t.mozRequestFullScreen?this.browserProps={fullscreenChange:"mozfullscreenchange",requestFullscreen:"mozRequestFullScreen",exitFullscreen:"mozCancelFullScreen"}:t.webkitRequestFullScreen?this.browserProps={fullscreenChange:"webkitfullscreenchange",requestFullscreen:"webkitRequestFullScreen",exitFullscreen:"webkitExitFullscreen"}:t.msRequestFullscreen&&(this.browserProps={fullscreenChange:"MSFullscreenChange",requestFullscreen:"msRequestFullscreen",exitFullscreen:"msExitFullscreen"}))}close(){let e=this,t=e.chart,n=t.options.chart;L(t,"fullscreenClose",void 0,function(){e.isOpen&&e.browserProps&&t.container.ownerDocument instanceof Document&&t.container.ownerDocument[e.browserProps.exitFullscreen](),e.unbindFullscreenEvent&&(e.unbindFullscreenEvent=e.unbindFullscreenEvent()),t.setSize(e.origWidth,e.origHeight,!1),e.origWidth=void 0,e.origHeight=void 0,n.width=e.origWidthOption,n.height=e.origHeightOption,e.origWidthOption=void 0,e.origHeightOption=void 0,e.isOpen=!1,e.setButtonText()})}open(){let e=this,t=e.chart,n=t.options.chart;L(t,"fullscreenOpen",void 0,function(){if(n&&(e.origWidthOption=n.width,e.origHeightOption=n.height),e.origWidth=t.chartWidth,e.origHeight=t.chartHeight,e.browserProps){let n=F(t.container.ownerDocument,e.browserProps.fullscreenChange,function(){e.isOpen?(e.isOpen=!1,e.close()):(t.setSize(null,null,!1),e.isOpen=!0,e.setButtonText())}),i=F(t,"destroy",n);e.unbindFullscreenEvent=()=>{n(),i()};let o=t.renderTo[e.browserProps.requestFullscreen]();o&&o.catch(function(){alert("Full screen is not supported inside a frame.")})}})}setButtonText(){let e=this.chart,t=e.exporting?.divElements,n=e.options.exporting,i=n&&n.buttons&&n.buttons.contextButton.menuItems,o=e.options.lang;if(n?.menuItemDefinitions&&o?.exitFullscreen&&o.viewFullscreen&&i&&t){let e=t[i.indexOf("viewFullscreen")];e&&d().setElementHTML(e,this.isOpen?o.exitFullscreen:n.menuItemDefinitions.viewFullscreen?.textKey||o.viewFullscreen)}}toggle(){this.isOpen?this.close():this.open()}}let{win:K}=h(),_={ajax:function(e){let t={json:"application/json",xml:"application/xml",text:"text/plain",octet:"application/octet-stream"},n=new XMLHttpRequest;function i(t,n){e.error&&e.error(t,n)}if(!e.url)return!1;n.open((e.type||"get").toUpperCase(),e.url,!0),e.headers?.["Content-Type"]||n.setRequestHeader("Content-Type",t[e.dataType||"json"]||t.text),B(e.headers,function(e,t){n.setRequestHeader(t,e)}),e.responseType&&(n.responseType=e.responseType),n.onreadystatechange=function(){let t;if(4===n.readyState){if(200===n.status){if("blob"!==e.responseType&&(t=n.responseText,"json"===e.dataType))try{t=JSON.parse(t)}catch(e){if(e instanceof Error)return i(n,e)}return e.success?.(t,n)}i(n,n.responseText)}},e.data&&"string"!=typeof e.data&&(e.data=JSON.stringify(e.data)),n.send(e.data)},getJSON:function(e,t){_.ajax({url:e,success:t,dataType:"json",headers:{"Content-Type":"text/plain"}})}};_.post=async function(e,t,n){let i=new K.FormData;B(t,function(e,t){i.append(t,e)}),i.append("b64","true");let o=await K.fetch(e,{method:"POST",body:i,...n});if(o.ok){let e=await o.text(),n=document.createElement("a");n.href=`data:${t.type};base64,${e}`,n.download=t.filename,n.click(),N(n)}};let{defaultOptions:J,setOptions:X}=h(),{composed:Y,doc:Z,isFirefox:Q,isMS:ee,isSafari:et,SVG_NS:en,win:ei}=h();d().allowedAttributes.push("data-z-index","fill-opacity","filter","preserveAspectRatio","rx","ry","stroke-dasharray","stroke-linejoin","stroke-opacity","text-anchor","transform","transform-origin","version","viewBox","visibility","xmlns","xmlns:xlink"),d().allowedTags.push("desc","clippath","fedropshadow","femorphology","g","image");let eo=ei.URL||ei.webkitURL||ei;class er{constructor(e,t){this.options={},this.chart=e,this.options=t,this.btnCount=0,this.buttonOffset=0,this.divElements=[],this.svgElements=[]}static hyphenate(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}static async imageToDataURL(e,t,n){let i=await er.loadImage(e),o=Z.createElement("canvas"),r=o?.getContext("2d");if(r)return o.height=i.height*t,o.width=i.width*t,r.drawImage(i,0,0,o.width,o.height),o.toDataURL(n);throw Error("No canvas found!")}static async fetchCSS(e){try{let t=await fetch(e),n=await t.text(),i=new CSSStyleSheet;return i.replaceSync(n),i}catch{(0,c.error)(`Warning: Failed to fetch CSS from ${e}`,!1)}}static async handleStyleSheet(e,t){try{for(let n of Array.from(e.cssRules)){if(n instanceof CSSImportRule){let e=await er.fetchCSS(n.href);e&&await er.handleStyleSheet(e,t)}if(n instanceof CSSFontFaceRule){let i=n.cssText;if(e.href){let t=e.href,n=/url\(\s*(['"]?)(?![a-z]+:|\/\/)([^'")]+?)\1\s*\)/gi;i=i.replace(n,(e,n,i)=>{let o=new URL(i,t).href;return`url(${n}${o}${n})`})}t.push(i)}}}catch{if(e.href){let n=await er.fetchCSS(e.href);n&&await er.handleStyleSheet(n,t)}}}static async fetchStyleSheets(){let e=[];for(let t of Array.from(Z.styleSheets))await er.handleStyleSheet(t,e);return e}static async inlineFonts(e){let t=await er.fetchStyleSheets(),n=/url\(([^)]+)\)/g,i=[],o=t.join("\n"),r;for(;r=n.exec(o);){let e=r[1].replace(/['"]/g,"");i.includes(e)||i.push(e)}let a=e=>{let t="",n=new Uint8Array(e);for(let e=0;e<n.byteLength;e++)t+=String.fromCharCode(n[e]);return btoa(t)},l={};for(let e of i)try{let t=await fetch(e),n=t.headers.get("Content-Type")||"",i=a(await t.arrayBuffer());l[e]=`data:${n};base64,${i}`}catch{}o=o.replace(n,(e,t)=>{let n=t.replace(/['"]/g,"");return`url(${l[n]||n})`});let s=document.createElementNS("http://www.w3.org/2000/svg","style");return s.textContent=o,e.append(s),e}static loadImage(e){return new Promise((t,n)=>{let i=new ei.Image;i.crossOrigin="Anonymous",i.onload=()=>{setTimeout(()=>{t(i)},er.loadEventDeferDelay)},i.onerror=e=>{n(e)},i.src=e})}static prepareImageOptions(e){let t=e?.type||"image/png",n=e?.libURL||J.exporting?.libURL;return{type:t,filename:(e?.filename||"chart")+"."+("image/svg+xml"===t?"svg":t.split("/")[1]),scale:e?.scale||1,libURL:n?.slice(-1)!=="/"?n+"/":n}}static sanitizeSVG(e,t){let n=e.indexOf("</svg>")+6,i=e.indexOf("<foreignObject")>-1,o=e.substr(n);return e=e.substr(0,n),i?e=e.replace(/(<(?:img|br).*?(?=\>))>/g,"$1 />").replace(/(<svg(?![^>]*xmlns=)[^>]*)>/g,'$1 xmlns="http://www.w3.org/2000/svg">'):o&&t?.exporting?.allowHTML&&(o='<foreignObject x="0" y="0" width="'+t.chart.width+'" height="'+t.chart.height+'"><body xmlns="http://www.w3.org/1999/xhtml">'+o.replace(/(<(?:img|br).*?(?=\>))>/g,"$1 />").replace(/(<svg(?![^>]*xmlns=)[^>]*)>/g,'$1 xmlns="http://www.w3.org/2000/svg">')+"</body></foreignObject>",e=e.replace("</svg>",o+"</svg>")),e=e.replace(/zIndex="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery\d+="[^"]+"/g,"").replace(/url\(("|&quot;)(.*?)("|&quot;)\;?\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ (NS\d+\:)?href=/g," xlink:href=").replace(/(<image[^>]*) xlink:href=/g,"$1 href=").replace(/\n+/g," ").replace(/&nbsp;/g,"\xa0").replace(/&shy;/g,"\xad")}static svgToDataURL(e){let t=ei.navigator.userAgent,n=t.indexOf("WebKit")>-1&&0>t.indexOf("Chrome");try{if(!n&&-1===e.indexOf("<foreignObject"))return eo.createObjectURL(new ei.Blob([e],{type:"image/svg+xml;charset-utf-16"}))}catch{}return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(e)}addButton(e){let t,n=this,i=n.chart,o=i.renderer,r=U(i.options.navigation?.buttonOptions,e),a=r.onclick,l=r.menuItems,s=r.symbolSize||12;if(!1===r.enabled||!r.theme)return;let c=i.styledMode?{}:r.theme,h=()=>{};a?h=function(e){e&&e.stopPropagation(),a.call(i,e,i)}:l&&(h=function(e){e&&e.stopPropagation(),n.contextMenu(p.menuClassName,l,p.translateX||0,p.translateY||0,p.width||0,p.height||0,p),p.setState(2)}),r.text&&r.symbol?c.paddingLeft=$(c.paddingLeft,30):r.text||A(c,{width:r.width,height:r.height,padding:0});let p=o.button(r.text||"",0,0,h,c,void 0,void 0,void 0,void 0,r.useHTML).addClass(e.className||"").attr({title:$(i.options.lang[r._titleKey||r.titleKey],"")});p.menuClassName=e.menuClassName||"highcharts-menu-"+n.btnCount++,r.symbol&&(t=o.symbol(r.symbol,Math.round((r.symbolX||0)-s/2),Math.round((r.symbolY||0)-s/2),s,s,{width:s,height:s}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(p),i.styledMode||t.attr({stroke:r.symbolStroke,fill:r.symbolFill,"stroke-width":r.symbolStrokeWidth||1})),p.add(n.group).align(A(r,{width:p.width,x:$(r.x,n.buttonOffset)}),!0,"spacingBox"),n.buttonOffset+=((p.width||0)+(r.buttonSpacing||0))*("right"===r.align?-1:1),n.svgElements.push(p,t)}afterPrint(){let e=this.chart;if(!this.printReverseInfo)return;let{childNodes:t,origDisplay:n,resetParams:i}=this.printReverseInfo;this.moveContainers(e.renderTo),[].forEach.call(t,function(e,t){1===e.nodeType&&(e.style.display=n[t]||"")}),this.isPrinting=!1,i&&e.setSize.apply(e,i),delete this.printReverseInfo,er.printingChart=void 0,L(e,"afterPrint")}beforePrint(){let e=this.chart,t=Z.body,n=this.options.printMaxWidth,i={childNodes:t.childNodes,origDisplay:[],resetParams:void 0};this.isPrinting=!0,e.pointer?.reset(void 0,0),L(e,"beforePrint"),n&&e.chartWidth>n&&(i.resetParams=[e.options.chart.width,void 0,!1],e.setSize(n,void 0,!1)),[].forEach.call(i.childNodes,function(e,t){1===e.nodeType&&(i.origDisplay[t]=e.style.display,e.style.display="none")}),this.moveContainers(t),this.printReverseInfo=i}contextMenu(e,t,n,i,o,r,a){let l=this,s=l.chart,c=s.options.navigation,h=s.chartWidth,p=s.chartHeight,u="cache-"+e,g=Math.max(o,r),f,m=s[u];m||(l.contextMenuEl=s[u]=m=P("div",{className:e},{position:"absolute",zIndex:1e3,padding:g+"px",pointerEvents:"auto",...s.renderer.style},s.scrollablePlotArea?.fixedDiv||s.container),f=P("ul",{className:"highcharts-menu"},s.styledMode?{}:{listStyle:"none",margin:0,padding:0},m),s.styledMode||R(f,A({MozBoxShadow:"3px 3px 10px #0008",WebkitBoxShadow:"3px 3px 10px #0008",boxShadow:"3px 3px 10px #0008"},c?.menuStyle||{})),m.hideMenu=function(){R(m,{display:"none"}),a&&a.setState(0),s.exporting&&(s.exporting.openMenu=!1),R(s.renderTo,{overflow:"hidden"}),R(s.container,{overflow:"hidden"}),H(m.hideTimer),L(s,"exportMenuHidden")},l.events?.push(F(m,"mouseleave",function(){m.hideTimer=ei.setTimeout(m.hideMenu,500)}),F(m,"mouseenter",function(){H(m.hideTimer)}),F(Z,"mouseup",function(t){s.pointer?.inClass(t.target,e)||m.hideMenu()}),F(m,"click",function(){s.exporting?.openMenu&&m.hideMenu()})),t.forEach(function(e){if("string"==typeof e&&l.options.menuItemDefinitions?.[e]&&(e=l.options.menuItemDefinitions[e]),I(e,!0)){let t;e.separator?t=P("hr",void 0,void 0,f):("viewData"===e.textKey&&l.isDataTableVisible&&(e.textKey="hideData"),t=P("li",{className:"highcharts-menu-item",onclick:function(t){t&&t.stopPropagation(),m.hideMenu(),"string"!=typeof e&&e.onclick&&e.onclick.apply(s,arguments)}},void 0,f),d().setElementHTML(t,e.text||s.options.lang[e.textKey]),s.styledMode||(t.onmouseover=function(){R(this,c?.menuItemHoverStyle||{})},t.onmouseout=function(){R(this,c?.menuItemStyle||{})},R(t,A({cursor:"pointer"},c?.menuItemStyle||{})))),l.divElements.push(t)}}),l.divElements.push(f,m),l.menuHeight=m.offsetHeight,l.menuWidth=m.offsetWidth);let y={display:"block"};n+(l.menuWidth||0)>h?y.right=h-n-o-g+"px":y.left=n-g+"px",i+r+(l.menuHeight||0)>p&&a.alignOptions?.verticalAlign!=="top"?y.bottom=p-i-g+"px":y.top=i+r-g+"px",R(m,y),R(s.renderTo,{overflow:""}),R(s.container,{overflow:""}),s.exporting&&(s.exporting.openMenu=!0),L(s,"exportMenuShown")}destroy(e){let t,n=e?e.target:this.chart,{divElements:i,events:o,svgElements:r}=this;r.forEach((e,i)=>{e&&(e.onclick=e.ontouchstart=null,n[t="cache-"+e.menuClassName]&&delete n[t],r[i]=e.destroy())}),r.length=0,this.group&&(this.group.destroy(),delete this.group),i.forEach(function(e,t){e&&(H(e.hideTimer),V(e,"mouseleave"),i[t]=e.onmouseout=e.onmouseover=e.ontouchstart=e.onclick=null,N(e))}),i.length=0,o&&(o.forEach(function(e){e()}),o.length=0)}async downloadSVG(e,t){let n,i={svg:e,exportingOptions:t,exporting:this};if(L(er.prototype,"downloadSVG",i),i.defaultPrevented)return;let{type:o,filename:r,scale:a,libURL:l}=er.prepareImageOptions(t);if("application/pdf"===o)throw Error("Offline exporting logic for PDF type is not found.");if("image/svg+xml"===o){if(void 0!==ei.MSBlobBuilder){let t=new ei.MSBlobBuilder;t.append(e),n=t.getBlob("image/svg+xml")}else n=er.svgToDataURL(e);S(n,r)}else{n=er.svgToDataURL(e);try{er.objectURLRevoke=!0;let e=await er.imageToDataURL(n,a,o);S(e,r)}catch(p){if("No canvas found!"===p.message)throw p;if(e.length>1e8)throw Error("Input too long");let t=Z.createElement("canvas"),n=t.getContext("2d"),i=e.match(/^<svg[^>]*\s{,1000}width\s{,1000}=\s{,1000}\"?(\d+)\"?[^>]*>/),h=e.match(/^<svg[^>]*\s{0,1000}height\s{,1000}=\s{,1000}\"?(\d+)\"?[^>]*>/);if(n&&i&&h){let p=i[1]*a,d=h[1]*a;if(t.width=p,t.height=d,!ei.canvg){var s;er.objectURLRevoke=!0,await (s=l+"canvg.js",new Promise((e,t)=>{let n=v.getElementsByTagName("head")[0],i=v.createElement("script");i.type="text/javascript",i.src=s,i.onload=()=>{e()},i.onerror=()=>{let e=`Error loading script ${s}`;(0,c.error)(e),t(Error(e))},n.appendChild(i)}))}ei.canvg.Canvg.fromString(n,e).start(),S(ei.navigator.msSaveOrOpenBlob?t.msToBlob():t.toDataURL(o),r)}}finally{if(er.objectURLRevoke)try{eo.revokeObjectURL(n)}catch{}}}}async exportChart(e,t){if((e=U(this.options,e)).local)await this.localExport(e,t||{});else{let n=await this.getSVGForExport(e,t);e.url&&await _.post(e.url,{filename:e.filename?e.filename.replace(/\//g,"-"):this.getFilename(),type:e.type,width:e.width,scale:e.scale,svg:n},e.fetchOptions)}}async fallbackToServer(e,t){!1===e.fallbackToExportServer?e.error?e.error(e,t):(0,c.error)(28,!0):"application/pdf"===e.type&&(e.local=!1,await this.exportChart(e))}getChartHTML(e){let t=this.chart;return e&&this.inlineStyles(),this.resolveCSSVariables(),t.container.querySelectorAll("canvas").forEach(function(e){let n=e.toDataURL("image/png"),i=e.parentNode,o=t.renderer.image(n,0,0,e.width,e.height);R(o.element,{width:e.style.width,height:e.style.height}),i.parentNode.insertBefore(o.element,i),i.remove()}),t.container.innerHTML}getFilename(){let e=this.chart.userOptions.title?.text,t=this.options.filename;return t?t.replace(/\//g,"-"):("string"==typeof e&&(t=e.toLowerCase().replace(/<\/?[^>]+(>|$)/g,"").replace(/[\s_]+/g,"-").replace(/[^a-z\d\-]/g,"").replace(/^[\-]+/g,"").replace(/[\-]+/g,"-").substr(0,24).replace(/[\-]+$/g,"")),(!t||t.length<5)&&(t="chart"),t)}getSVG(e,t){let n=this.chart,i,o,r=U(n.options,e);r.plotOptions=U(n.userOptions.plotOptions,e?.plotOptions),r.time=U(n.userOptions.time,e?.time);let a=P("div",void 0,{position:"absolute",top:"-9999em",width:n.chartWidth+"px",height:n.chartHeight+"px"},Z.body),l=n.renderTo.style.width,s=n.renderTo.style.height,h=r.exporting?.sourceWidth||r.chart.width||/px$/.test(l)&&parseInt(l,10)||(r.isGantt?800:600),p=r.exporting?.sourceHeight||r.chart.height||/px$/.test(s)&&parseInt(s,10)||400;A(r.chart,{animation:!1,renderTo:a,forExport:!0,renderer:"SVGRenderer",width:h,height:p}),r.exporting&&(r.exporting.enabled=!1),delete r.data,r.series=[],n.series.forEach(function(e){(o=U(e.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:e.visible})).isInternal||r?.series?.push(o)});let d={};n.axes.forEach(function(e){e.userOptions.internalKey||(e.userOptions.internalKey=(0,c.uniqueKey)()),r&&!e.options.isInternal&&(d[e.coll]||(d[e.coll]=!0,r[e.coll]=[]),r[e.coll].push(U(e.userOptions,{visible:e.visible,type:e.type,uniqueNames:e.uniqueNames})))}),r.colorAxis=n.userOptions.colorAxis;let u=t=>{e&&["xAxis","yAxis","series"].forEach(function(n){e[n]&&t.update({[n]:e[n]})}),n.axes.forEach(function(n){let i=D(t.axes,e=>e.options.internalKey===n.userOptions.internalKey);if(i){var o;let t=n.getExtremes(),r=(j(o=e?.[n.coll]||{})?o:[o])[0],a="min"in r?r.min:t.userMin,l="max"in r?r.max:t.userMax;(void 0!==a&&a!==i.min||void 0!==l&&l!==i.max)&&i.setExtremes(a??void 0,l??void 0,!0,!1)}});let o=t.exporting;return o?.options.applyStyleSheets&&this.applyShadowDOMStyles(t),i=o?.getChartHTML(n.styledMode||r?.exporting?.applyStyleSheets)||"",L(n,"getSVG",{chartCopy:t}),i=er.sanitizeSVG(i,r),r=void 0,t.destroy(),N(a),i};return t?new Promise(e=>new n.constructor(r||{},function(t){n.callback?.call(this,t),e(u(this))})):u(new n.constructor(r,n.callback))}applyShadowDOMStyles(e){let t=this.chart,n=[],i=t.container,o;for(;i&&(!(o=i.getRootNode())||"object"!=typeof o.host);)i=i.parentNode,o=null;o?.querySelectorAll("style").forEach(t=>{let i=t.cloneNode(!0);e.container.appendChild(i),n.push(i)}),F(t,"getSVG",()=>{n.forEach(e=>{e.remove()})})}async getSVGForExport(e,t){let n=this.options;return await this.getSVG(U({chart:{borderRadius:0}},n.chartOptions,t,{exporting:{sourceWidth:e?.sourceWidth||n.sourceWidth,sourceHeight:e?.sourceHeight||n.sourceHeight}}),!0)}inlineStyles(){let e,t=er.inlineDenylist,n=er.inlineAllowlist,i={},o=P("iframe",void 0,{width:"1px",height:"1px",visibility:"hidden"},Z.body),r=o.contentWindow?.document;r&&r.body.appendChild(r.createElementNS(en,"svg")),!function o(a){let l,s,c,h,p,d,u={};if(r&&1===a.nodeType&&-1===er.unstyledElements.indexOf(a.nodeName)){if(l=ei.getComputedStyle(a,null),s="svg"===a.nodeName?{}:ei.getComputedStyle(a.parentNode,null),!i[a.nodeName]){e=r.getElementsByTagName("svg")[0],c=r.createElementNS(a.namespaceURI,a.nodeName),e.appendChild(c);let t=ei.getComputedStyle(c,null),n={};for(let e in t)e.length<1e3&&"string"==typeof t[e]&&!/^\d+$/.test(e)&&(n[e]=t[e]);i[a.nodeName]=n,"text"===a.nodeName&&delete i.text.fill,e.removeChild(c)}for(let e in l)(Q||ee||et||Object.hasOwnProperty.call(l,e))&&function(e,o){if(h=p=!1,n.length){for(d=n.length;d--&&!p;)p=n[d].test(o);h=!p}for("transform"===o&&"none"===e&&(h=!0),d=t.length;d--&&!h;){if(o.length>1e3)throw Error("Input too long");h=t[d].test(o)||"function"==typeof e}!h&&(s[o]!==e||"svg"===a.nodeName)&&i[a.nodeName][o]!==e&&(er.inlineToAttributes&&-1===er.inlineToAttributes.indexOf(o)?u[o]=e:e&&a.setAttribute(er.hyphenate(o),e))}(l[e],e);if(R(a,u),"svg"===a.nodeName&&a.setAttribute("stroke-width","1px"),"text"===a.nodeName)return;[].forEach.call(a.children||a.childNodes,o)}}(this.chart.container.querySelector("svg")),e.parentNode.removeChild(e),o.parentNode.removeChild(o)}async localExport(e,t){let n=this.chart,i,o,r=null,a;if(ee&&n.styledMode&&!er.inlineAllowlist.length&&er.inlineAllowlist.push(/^blockSize/,/^border/,/^caretColor/,/^color/,/^columnRule/,/^columnRuleColor/,/^cssFloat/,/^cursor/,/^fill$/,/^fillOpacity/,/^font/,/^inlineSize/,/^length/,/^lineHeight/,/^opacity/,/^outline/,/^parentRule/,/^rx$/,/^ry$/,/^stroke/,/^textAlign/,/^textAnchor/,/^textDecoration/,/^transform/,/^vectorEffect/,/^visibility/,/^x$/,/^y$/),ee&&("application/pdf"===e.type||n.container.getElementsByTagName("image").length&&"image/svg+xml"!==e.type)||"application/pdf"===e.type&&[].some.call(n.container.getElementsByTagName("image"),function(e){let t=e.getAttribute("href");return""!==t&&"string"==typeof t&&0!==t.indexOf("data:")}))return void await this.fallbackToServer(e,Error("Image type not supported for this chart/browser."));let l=F(n,"getSVG",e=>{o=e.chartCopy.options,a=(i=e.chartCopy.container.cloneNode(!0))&&i.getElementsByTagName("image")||[]});try{let n;for(let n of(await this.getSVGForExport(e,t),a?Array.from(a):[]))if(r=n.getAttributeNS("http://www.w3.org/1999/xlink","href")){er.objectURLRevoke=!1;let t=await er.imageToDataURL(r,e?.scale||1,e?.type||"image/png");n.setAttributeNS("http://www.w3.org/1999/xlink","href",t)}else n.parentNode.removeChild(n);let l=i?.querySelector("svg");l&&!e.chartOptions?.chart?.style?.fontFamily&&await er.inlineFonts(l);let s=(n=i?.innerHTML,er.sanitizeSVG(n||"",o));if(s.indexOf("<foreignObject")>-1&&"image/svg+xml"!==e.type&&(ee||"application/pdf"===e.type))throw Error("Image type not supported for charts with embedded HTML");return await this.downloadSVG(s,A({filename:this.getFilename()},e)),s}catch(t){await this.fallbackToServer(e,t)}finally{l()}}moveContainers(e){let t=this.chart,{scrollablePlotArea:n}=t;(n?[n.fixedDiv,n.scrollingContainer]:[t.container]).forEach(function(t){e.appendChild(t)})}print(){let e=this.chart;this.isPrinting||(er.printingChart=e,et||this.beforePrint(),setTimeout(()=>{ei.focus(),ei.print(),et||setTimeout(()=>{e.exporting?.afterPrint()},1e3)},1))}render(){let e=this,{chart:t,options:n}=e,i=e?.isDirty||!e?.svgElements.length;e.buttonOffset=0,e.isDirty&&e.destroy(),i&&!1!==n.enabled&&(e.events=[],e.group||(e.group=t.renderer.g("exporting-group").attr({zIndex:3}).add()),B(n?.buttons,function(t){e.addButton(t)}),e.isDirty=!1)}resolveCSSVariables(){Array.from(this.chart.container.querySelectorAll("*")).forEach(e=>{["color","fill","stop-color","stroke"].forEach(t=>{let n=e.getAttribute(t);n?.includes("var(")&&e.setAttribute(t,getComputedStyle(e).getPropertyValue(t));let i=e.style?.[t];i?.includes("var(")&&(e.style[t]=getComputedStyle(e).getPropertyValue(t))})})}update(e,t){this.isDirty=!0,U(!0,this.options,e),$(t,!0)&&this.chart.redraw()}}er.inlineAllowlist=[],er.inlineDenylist=[/-/,/^(clipPath|cssText|d|height|width)$/,/^font$/,/[lL]ogical(Width|Height)$/,/^parentRule$/,/^(cssRules|ownerRules)$/,/perspective/,/TapHighlightColor/,/^transition/,/^length$/,/^\d+$/],er.inlineToAttributes=["fill","stroke","strokeLinecap","strokeLinejoin","strokeWidth","textAnchor","x","y"],er.loadEventDeferDelay=150*!!ee,er.unstyledElements=["clipPath","defs","desc"],function(e){function t(e){let t=e.exporting;t&&(t.render(),F(e,"redraw",function(){this.exporting?.render()}),F(e,"destroy",function(){this.exporting?.destroy()}))}function n(){let t=this;t.options.exporting&&(t.exporting=new e(t,t.options.exporting),y.compose(t).navigation.addUpdate((e,n)=>{t.exporting&&(t.exporting.isDirty=!0,U(!0,t.options.navigation,e),$(n,!0)&&t.redraw())}))}function i({alignTo:e,key:t,textPxLength:n}){let i=this.options.exporting,{align:o,buttonSpacing:r=0,verticalAlign:a,width:l=0}=U(this.options.navigation?.buttonOptions,i?.buttons?.contextButton),s=e.width-n,c=l+r;(i?.enabled??!0)&&"title"===t&&"right"===o&&"top"===a&&s<2*c&&(s<c?e.width-=c:this.title?.alignValue!=="left"&&(e.x-=c-s/2))}e.compose=function(o,r){O.compose(r),z.compose(o),G(Y,"Exporting")&&(A(g().prototype,{exportChart:async function(e,t){await this.exporting?.exportChart(e,t)},getChartHTML:function(e){return this.exporting?.getChartHTML(e)},getFilename:function(){return this.exporting?.getFilename()},getSVG:function(e){return this.exporting?.getSVG(e,!1)},print:function(){return this.exporting?.print()}}),o.prototype.callbacks.push(t),F(o,"afterInit",n),F(o,"layOutTitle",i),et&&ei.matchMedia("print").addListener(function(t){e.printingChart&&(t.matches?e.printingChart.exporting?.beforePrint():e.printingChart.exporting?.afterPrint())}),X(C))}}(er||(er={}));let ea=h();ea.Exporting=er,ea.HttpUtilities=ea.HttpUtilities||_,ea.ajax=ea.HttpUtilities.ajax,ea.getJSON=ea.HttpUtilities.getJSON,ea.post=ea.HttpUtilities.post,er.compose(ea.Chart,ea.Renderer);let el=h();return s.default})());