sogo/UI/WebServerResources/js/vendor/FileSaver.min.js
2020-11-20 00:35:04 -05:00

2 lines
2.7 KiB
JavaScript

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