| 1 |
- import{as as d}from"./index-610a1d46.js";function c(e){const n=e.split(","),o=n[0].match(/:(.*?);/)[1],a=window.atob(n[1]);let t=a.length;const i=new Uint8Array(t);for(;t--;)i[t]=a.charCodeAt(t);return new Blob([i],{type:o})}function u(e){return new Promise((n,r)=>{e||r();const o=new FileReader;o.readAsDataURL(e),o.onload=function(a){const t=a.target.result;n(t)}})}function f(e,n,r,o){const a=c(e);l(a,n,r,o)}function l(e,n,r,o){const a=typeof o!="undefined"?[o,e]:[e],t=new Blob(a,{type:r||"application/octet-stream"}),i=window.URL.createObjectURL(t),s=document.createElement("a");s.style.display="none",s.href=i,s.setAttribute("download",n),typeof s.download=="undefined"&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(i)}function b({url:e,target:n="_blank",fileName:r}){const o=window.navigator.userAgent.toLowerCase().indexOf("chrome")>-1,a=window.navigator.userAgent.toLowerCase().indexOf("safari")>-1;if(/(iP)/g.test(window.navigator.userAgent))return console.error("Your browser does not support download!"),!1;if(o||a){const t=document.createElement("a");if(t.href=e,t.target=n,t.download!==void 0&&(t.download=r||e.substring(e.lastIndexOf("/")+1,e.length)),document.createEvent){const i=document.createEvent("MouseEvents");return i.initEvent("click",!0,!0),t.dispatchEvent(i),!0}}return e.indexOf("?")===-1&&(e+="?download"),d(e,{target:n}),!0}export{b as a,l as b,f as d,u as f};
|