download-DXlRgvqo.js 1.1 KB

1
  1. import{D as r}from"./entry/index-CmDd2f0j.js";import{d as c,u as l}from"./base64Conver-DEMZeTZS.js";function b(e,t,d,s){l(e).then(o=>{m(o,t)})}function m(e,t,d,s){const o=c(e);f(o,t)}function f(e,t,d,s){const o=[e],a=new Blob(o,{type:"application/octet-stream"}),i=window.URL.createObjectURL(a),n=document.createElement("a");n.style.display="none",n.href=i,n.setAttribute("download",t),typeof n.download=="undefined"&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(i)}function p({url:e,target:t="_blank",fileName:d}){const s=window.navigator.userAgent.toLowerCase().indexOf("chrome")>-1,o=window.navigator.userAgent.toLowerCase().indexOf("safari")>-1;if(/(iP)/g.test(window.navigator.userAgent))return!1;if(s||o){const a=document.createElement("a");if(a.href=e,a.target=t,a.download!==void 0&&(a.download=d||e.substring(e.lastIndexOf("/")+1,e.length)),document.createEvent){const i=document.createEvent("MouseEvents");return i.initEvent("click",!0,!0),a.dispatchEvent(i),!0}}return e.indexOf("?")===-1&&(e+="?download"),r(e,{target:t}),!0}export{p as a,f as b,b as c,m as d};