var _global="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:this;function bom(blob,opts){return void 0===opts?opts={autoBom:!1}:"object"!=typeof opts&&(console.warn("Deprecated: Expected third argument to be a object"),opts={autoBom:!opts}),opts.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)?new Blob([String.fromCharCode(65279),blob],{type:blob.type}):blob}function download(url,name,opts){var xhr=new XMLHttpRequest;xhr.open("GET",url),xhr.responseType="blob",xhr.onload=function(){saveAs(xhr.response,name,opts)},xhr.onerror=function(){console.error("could not download file")},xhr.send()}function corsEnabled(url){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,!1);try{xhr.send()}catch(e){}return 200<=xhr.status&&xhr.status<=299}function click(node){try{node.dispatchEvent(new MouseEvent("click"))}catch(e){var evt=document.createEvent("MouseEvents");evt.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),node.dispatchEvent(evt)}}var isMacOSWebView=_global.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),saveAs=_global.saveAs||("object"!=typeof window||window!==_global?function(){}:"download"in HTMLAnchorElement.prototype&&!isMacOSWebView?function(blob,name,opts){var URL=_global.URL||_global.webkitURL,a=document.createElement("a");name=name||blob.name||"download",a.download=name,a.rel="noopener","string"==typeof blob?(a.href=blob,a.origin!==location.origin?corsEnabled(a.href)?download(blob,name,opts):click(a,a.target="_blank"):click(a)):(a.href=URL.createObjectURL(blob),setTimeout(function(){URL.revokeObjectURL(a.href)},4e4),setTimeout(function(){click(a)},0))}:"msSaveOrOpenBlob"in navigator?function(blob,name,opts){var a;name=name||blob.name||"download","string"==typeof blob?corsEnabled(blob)?download(blob,name,opts):((a=document.createElement("a")).href=blob,a.target="_blank",setTimeout(function(){click(a)})):navigator.msSaveOrOpenBlob(bom(blob,opts),name)}:function(blob,force,isSafari,popup){if((popup=popup||open("","_blank"))&&(popup.document.title=popup.document.body.innerText="downloading..."),"string"==typeof blob)return download(blob,force,isSafari);var reader,URL,url,force="application/octet-stream"===blob.type,isSafari=/constructor/i.test(_global.HTMLElement)||_global.safari,isChromeIOS=/CriOS\/[\d]+/.test(navigator.userAgent);(isChromeIOS||force&&isSafari||isMacOSWebView)&&"undefined"!=typeof FileReader?((reader=new FileReader).onloadend=function(){var url=reader.result,url=isChromeIOS?url:url.replace(/^data:[^;]*;/,"data:attachment/file;");popup?popup.location.href=url:location=url,popup=null},reader.readAsDataURL(blob)):(URL=_global.URL||_global.webkitURL,url=URL.createObjectURL(blob),popup?popup.location=url:location.href=url,popup=null,setTimeout(function(){URL.revokeObjectURL(url)},4e4))});_global.saveAs=saveAs.saveAs=saveAs,"undefined"!=typeof module&&(module.exports=saveAs);