sogo/UI/WebServerResources/js/vendor/FileSaver.min.js
2019-06-19 16:07:30 -04:00

2 lines
2.5 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,o){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){a(n.response,t,o)},n.onerror=function(){console.error("could not download file")},n.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 o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(o)}}var a=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,o){var n=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,o):r(a,a.target="_blank"):r(a)):(a.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(a.href)},4e4),setTimeout(function(){r(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,o){if(t=t||e.name||"download","string"==typeof e)if(i(e))d(e,t,o);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){r(n)})}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,o),t)}:function(e,t,o,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),"string"==typeof e)return d(e,t,o);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)&&"object"==typeof FileReader){var l=new FileReader;l.onloadend=function(){var e=l.result;e=r?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=e:location=e,n=null},l.readAsDataURL(e)}else{var c=f.URL||f.webkitURL,s=c.createObjectURL(e);n?n.location=s:location.href=s,n=null,setTimeout(function(){c.revokeObjectURL(s)},4e4)}});f.saveAs=a.saveAs=a,"undefined"!=typeof module&&(module.exports=a)});
//# sourceMappingURL=FileSaver.min.js.map