| 1 |
- function i(o){const a=o.split(","),r=a[0].match(/:(.*?);/)[1],t=window.atob(a[1]);let e=t.length;const n=new Uint8Array(e);for(;e--;)n[e]=t.charCodeAt(e);return new Blob([n],{type:r})}function l(o,a){return new Promise((s,r)=>{let t=document.createElement("CANVAS");const e=t.getContext("2d"),n=new Image;n.crossOrigin="",n.onload=function(){if(!t||!e)return r();t.height=n.height,t.width=n.width,e.drawImage(n,0,0);const c=t.toDataURL(a||"image/png");t=null,s(c)},n.src=o})}function u(o){return new Promise((a,s)=>{o||s();const r=new FileReader;r.readAsDataURL(o),r.onload=function(t){const e=t.target.result;a(e)}})}export{i as d,u as f,l as u};
|