tildefriends/core/jszip.min.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2 lines
77 KiB
JavaScript
Raw Permalink Normal View History

var t={Promise:Promise},e={base64:!0,array:!0,string:!0,nodebuffer:!1,nodestream:!1,get arraybuffer(){return"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array},get uint8array(){return"undefined"!=typeof Uint8Array},get blob(){return r()}},r=function(){var t;if("undefined"==typeof ArrayBuffer)t=!1;else{var e=new ArrayBuffer(0);try{t=0===new Blob([e],{type:"application/zip"}).size}catch(e){t=!1}}return r=function(){return t},t},i=e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function a(t){return t}function s(t,e){for(var r=0;r<t.length;++r)e[r]=255&t.charCodeAt(r);return e}function o(t,e,r){var i=[],n=0,a=t.length;if(a<=r)return String.fromCharCode.apply(null,t);for(;n<a;)"array"===e?i.push(String.fromCharCode.apply(null,t.slice(n,Math.min(n+r,a)))):i.push(String.fromCharCode.apply(null,t.subarray(n,Math.min(n+r,a)))),n+=r;return i.join("")}var h=function(){var t;try{t=i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){t=!1}return h=function(){return t},t};function l(t){var e=65536,r=p(t),i=!0;if("uint8array"===r&&(i=h()),i)for(;e>1;)try{return o(t,r,e)}catch(t){e=Math.floor(e/2)}return function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}(t)}var d=l;function u(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}var c={string:{string:a,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){return c.string.uint8array(t).buffer},uint8array:function(t){return s(t,new Uint8Array(t.length))}},array:{string:l,array:a,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)}},arraybuffer:{string:function(t){return l(new Uint8Array(t))},array:function(t){return u(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:a,uint8array:function(t){return new Uint8Array(t)}},uint8array:{string:l,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:a}},f=function(t,e){if(e||(e=""),!t)return e;m(t);var r=p(e);return c[r][t](e)},p=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":i.uint8array&&t instanceof Uint8Array?"uint8array":i.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},m=function(t){if(!i[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},_=function(t){var e,r,i="";for(r=0;r<(t||"").length;r++)i+="\\x"+((e=t.charCodeAt(r))<16?"0":"")+e.toString(16).toUpperCase();return i},g=function(t,e,r){setTimeout((function(){t.apply(r||null,e||[])}),0)},y=function(){var t,e,r=arguments,i={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.hasOwnProperty.call(r[t],e)&&void 0===i[e]&&(i[e]=r[t][e]);return i},v=function(e,r,a,o,h){return t.Promise.resolve(r).then((function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new t.Promise((function(t,r){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=function(t){r(t.target.error)},i.readAsArrayBuffer(e)})):e})).then((function(r){var l,d=p(r);return d?("arraybuffer"===d?r=f("uint8array",r):"string"===d&&(h?r=function(t){var e,r,a,s,o,h,l=0,d=0;if("data:"===t.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var u,c=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===n.charAt(64)&&c--,t.charAt(t.length-2)===n.charAt(64)&&c--,c%1!=0)throw new Error("Invalid base64 input, bad content length.");for(u=i.uint8array?new Uint8Array(0|c):new Array(0|c);l<t.length;)e=n.indexOf(t.charAt(l++))<<2|(s=n.indexOf(t.charAt(l++)))>>4,r=(15&s)<<4|(o=n.indexOf(t.charAt(l++)))>>2,a=(3&o)<<6|(h=n.indexOf(t.charAt(l++))),u[d++]=e,64!==o&&(u[d++]=r),64!==h&&(u[d++]=a);return u}(r):a&&!0!==o&&(r=s(l=r,i.uint8array?new Uint8Array(l.length):new Array(l.length)))),r):t.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))},w=function(t){thi