"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37697],{37697:(e,t,a)=>{a.r(t),a.d(t,{browserSvgToPng:()=>s,imagePlugin:()=>c});var i=a(49819),r=a(26885),l=a(9357);let n=async e=>(await fetch(e)).arrayBuffer(),s=async({buffer:e,width:t,height:a})=>{let i=new Blob([e],{type:"image/svg+xml"}),r=URL.createObjectURL(i);try{let e=new Image;e.src=r,await e.decode();let i=window.devicePixelRatio,l=document.createElement("canvas"),n=t*i,s=a*i;return l.width=n,l.height=s,l.getContext("2d").drawImage(e,0,0,n,s),new Promise(e=>{l.toBlob(t=>{t.arrayBuffer().then(e)},"image/png")})}finally{URL.revokeObjectURL(r)}},c=({load:e=n,fallbackSvg:t=s}={})=>{let a=new Map;return async({root:n,definition:s,images:c})=>{let o=[];if((0,r.YR)(n,"image",e=>{o.push(e)}),(0,r.YR)(n,"imageReference",e=>{let t=s(e.identifier);t&&o.push(t)}),0!==o.length){let r=new Map;o.forEach(({url:n})=>{if(!c.has(n)){if(a.has(n))return void c.set(n,a.get(n));r.has(n)||r.set(n,(async()=>{let r;try{r=await e(n)}catch(e){(0,i.w)(`Failed to load image: ${n} ${e}`);return}let{width:s,height:o,type:f}=(0,l.R9)(new Uint8Array(r));if(!(0,i.i)(f))return void(0,i.w)(`Not supported image type: ${f}`);if("svg"===f)try{let e=await t({buffer:r,width:s,height:o}),i={type:f,width:s,height:o,data:r,fallback:e};c.set(n,i),a.set(n,i)}catch(e){(0,i.w)(`Failed to create fallback image: ${n} ${e}`);return}else{let e={type:f,width:s,height:o,data:r};c.set(n,e),a.set(n,e)}})())}}),await Promise.all(r.values())}if(a.size>100){let e=a.size-100;for(let t of a.keys())if(a.delete(t),--e<=0)break}return{}}}},49819:(e,t,a)=>{a.d(t,{i:()=>n,w:()=>r});let i={};function r(e,t=!1){t||i[e]||(i[e]=!0,console.warn(e))}let l=["png","jpg","gif","bmp","svg"],n=e=>!!e&&!!l.includes(e)}}]);