/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/offline-exporting
 * @requires highcharts
 * @requires highcharts/modules/exporting
 *
 * Client side exporting module
 *
 * (c) 2015-2026 Highsoft AS
 * Author: Torstein Hønsi / Øystein Moseng
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,o={};o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=t.default;var n=o.n(r);let{isSafari:a,win:i,win:{document:l}}=n(),s=i.URL||i.webkitURL||i;function d(t){let e=t.replace(/filename=.*;/,"").match(/data:([^;]*)(;base64)?,([A-Z+\d\/]+)/i);if(e&&e.length>3&&i.atob&&i.ArrayBuffer&&i.Uint8Array&&i.Blob&&s.createObjectURL){let t=i.atob(e[3]),o=new i.ArrayBuffer(t.length),r=new i.Uint8Array(o);for(let e=0;e<r.length;++e)r[e]=t.charCodeAt(e);return s.createObjectURL(new i.Blob([r],{type:e[1]}))}}function c(t,e){let o=i.navigator,r=l.createElement("a");if("string"!=typeof t&&!(t instanceof String)&&o.msSaveOrOpenBlob)return void o.msSaveOrOpenBlob(t,e);if(t=""+t,o.userAgent.length>1e3)throw Error("Input too long");let n=/Edge\/\d+/.test(o.userAgent);if((a&&"string"==typeof t&&0===t.indexOf("data:application/pdf")||n||t.length>2e6)&&!(t=d(t)||""))throw Error("Failed to convert to blob");if(void 0!==r.download)r.href=t,r.download=e,l.body.appendChild(r),r.click(),l.body.removeChild(r);else try{if(!i.open(t,"chart"))throw Error("Failed to open window")}catch{i.location.href=t}}function f(t){return new Promise((e,o)=>{let n=l.getElementsByTagName("head")[0],a=l.createElement("script");a.type="text/javascript",a.src=t,a.onload=()=>{e()},a.onerror=()=>{let e=`Error loading script ${t}`;(0,r.error)(e),o(Error(e))},n.appendChild(a)})}let p=t.default.AST;var h=o.n(p);let u=t.default.Chart;var g=o.n(u);let y={exporting:{}},{getOptions:m,setOptions:w}=n(),{composed:b,doc:v,win:x}=n();!function(t){let e="Invalid exporting.libURL:";function o(){return!!(x&&x.jspdf?.jsPDF&&x.svg2pdf)}async function a(t,e,o,r){var n,a;let s,d,f,p,u,g=(n=t,a=r,f=v.createElement("div"),h().setElementHTML(f,n),p=f.getElementsByTagName("text"),u=function(t,e){let o=t;for(;o&&o!==f;){if(o.style[e]){let r=o.style[e];"fontSize"===e&&/em$/.test(r)&&(r=Math.round(16*parseFloat(r))+"px"),t.style[e]=r;break}o=o.parentNode}},[].forEach.call(p,function(t){for(["fontFamily","fontSize"].forEach(e=>{u(t,e)}),t.style.fontFamily=a?.normal?"HighchartsFont":String(t.style.fontFamily&&t.style.fontFamily.split(" ").splice(-1)),s=t.getElementsByTagName("title"),[].forEach.call(s,function(e){t.removeChild(e)}),d=t.getElementsByClassName("highcharts-text-outline");d.length>0;){let t=d[0];t.parentNode&&t.parentNode.removeChild(t)}}),f.querySelector("svg"));g&&(await i(g,r),c(await l(g,0,e),o))}async function i(t,e){let o,r,n=(t,e)=>{x.jspdf.jsPDF.API.events.push(["initialized",function(){this.addFileToVFS(t,e),this.addFont(t,"HighchartsFont",t),this.getFontList()?.HighchartsFont||this.setFont("HighchartsFont")}])};for(let a of(e&&(r=t.textContent||"",!/[^\u0000-\u007F\u200B]+/.test(r))&&(e=void 0),["normal","italic","bold","bolditalic"])){let t=e?.[a];if(t)try{let e=await x.fetch(t);if(!e.ok)throw Error(`Failed to fetch font: ${t}`);let r=await e.blob(),i=new FileReader,l=await new Promise((t,e)=>{i.onloadend=()=>{"string"==typeof i.result?t(i.result.split(",")[1]):e(Error("Failed to read font as base64"))},i.onerror=e,i.readAsDataURL(r)});n(a,l),"normal"===a&&(o=l)}catch{}else o&&n(a,o)}}async function l(t,e,o){let r=(Number(t.getAttribute("width"))+2*e)*o,n=(Number(t.getAttribute("height"))+2*e)*o,a=new x.jspdf.jsPDF(n>r?"p":"l","pt",[r,n]);[].forEach.call(t.querySelectorAll('*[visibility="hidden"]'),function(t){t.parentNode.removeChild(t)});let i=t.querySelectorAll("linearGradient");for(let t=0;t<i.length;t++){let e=i[t].querySelectorAll("stop"),o=0;for(;o<e.length&&"0"===e[o].getAttribute("offset")&&"0"===e[o+1].getAttribute("offset");)e[o].remove(),o++}return[].forEach.call(t.querySelectorAll("tspan"),t=>{"​"===t.textContent&&(t.textContent=" ",t.setAttribute("dx",-5))}),await a.svg(t,{x:0,y:0,width:r,height:n,removeInvalid:!0}),a.output("datauristring")}t.compose=function(t){if((0,r.addEvent)(t,"downloadSVG",async function(t){let{svg:i,exportingOptions:l,exporting:s,preventDefault:d}=t,c=s?.chart;if(l?.type==="application/pdf"){d?.();try{let{type:t,filename:r,scale:s}=n().Exporting.prepareImageOptions(l),d=l.libURL||c?.options.exporting?.libURL,p=function(t){let o;if(!t)return;let r="/"!==t.slice(-1)?t+"/":t;if(x.URL?.canParse)o=x.URL.canParse(r,v.baseURI);else try{o=!!new x.URL(r,v.baseURI).href}catch{o=!1}if(!o)throw Error(`${e} "${t}". Provide a valid URL or path to the jsPDF and svg2pdf scripts.`);return r}(d);if("application/pdf"===t){if(!o()){if(!p)throw Error("PDF export requires jsPDF and svg2pdf.");x.jspdf?.jsPDF||await f(`${p}jspdf.js`),x.svg2pdf||await f(`${p}svg2pdf.js`)}await a(i,s,r,l?.pdfFont)}}catch(t){l?.fallbackToExportServer!==!1&&0===t.message.indexOf(e)&&(0,r.error)(`${t.message} Falling back to export server.`,!1,c),await s?.fallbackToServer(l,t)}}}),!(0,r.pushUnique)(b,"OfflineExporting"))return;(0,r.addEvent)(g(),"load",function(){!(this.renderer.forExport||o())&&(this.options.exporting?.libURL||(0,r.error)("Warning: exporting.libURL not defined, PDF client side export will not work",!1,this))}),(0,r.extend)(g().prototype,{exportChartLocal:async function(t,e){await this.exporting?.exportChart(t,e)}}),w(y);let i=m().exporting?.buttons?.contextButton?.menuItems;i?.push("downloadPDF")},t.downloadSVGLocal=async function(t,e){await n().Exporting.prototype.downloadSVG.call(void 0,t,e)}}(e||(e={}));let E=e,F=n();F.dataURLtoBlob=F.dataURLtoBlob||d,F.downloadSVGLocal=E.downloadSVGLocal,F.downloadURL=F.downloadURL||c,E.compose(F.Exporting);let L=n();export{L as default};