sheetjs/dist/xlsx.mini.min.js

10 lines
239 KiB
JavaScript
Raw Normal View History

/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
var XLSX={};function make_xlsx_lib(e){e.version="0.18.3";var r=1200,t=1252;var a=[874,932,936,949,950,1e4];for(var n=0;n<=8;++n)a.push(1250+n);var i={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969};var s=function(e){if(a.indexOf(e)==-1)return;t=i[0]=e};function l(){s(1252)}var o=function(e){r=e;s(e)};function c(){o(1200);l()}function f(e){var r=[];for(var t=0,a=e.length;t<a;++t)r[t]=e.charCodeAt(t);return r}function u(e){var r=[];for(var t=0;t<e.length>>1;++t)r[t]=String.fromCharCode(e.charCodeAt(2*t)+(e.charCodeAt(2*t+1)<<8));return r.join("")}function h(e){var r=[];for(var t=0;t<e.length>>1;++t)r[t]=String.fromCharCode(e.charCodeAt(2*t+1)+(e.charCodeAt(2*t)<<8));return r.join("")}var d=function(e){var r=e.charCodeAt(0),t=e.charCodeAt(1);if(r==255&&t==254)return u(e.slice(2));if(r==254&&t==255)return h(e.slice(2));if(r==65279)return e.slice(1);return e};var p=function fo(e){return String.fromCharCode(e)};var m=function uo(e){return String.fromCharCode(e)};var v=null;var g=true;var b=function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(r){var t="";var a=0,n=0,i=0,s=0,l=0,o=0,c=0;for(var f=0;f<r.length;){a=r.charCodeAt(f++);s=a>>2;n=r.charCodeAt(f++);l=(a&3)<<4|n>>4;i=r.charCodeAt(f++);o=(n&15)<<2|i>>6;c=i&63;if(isNaN(n)){o=c=64}else if(isNaN(i)){c=64}t+=e.charAt(s)+e.charAt(l)+e.charAt(o)+e.charAt(c)}return t},decode:function(r){var t="";var a=0,n=0,i=0,s=0,l=0,o=0,c=0;r=r.replace(/[^\w\+\/\=]/g,"");for(var f=0;f<r.length;){s=e.indexOf(r.charAt(f++));l=e.indexOf(r.charAt(f++));a=s<<2|l>>4;t+=String.fromCharCode(a);o=e.indexOf(r.charAt(f++));n=(l&15)<<4|o>>2;if(o!==64){t+=String.fromCharCode(n)}c=e.indexOf(r.charAt(f++));i=(o&3)<<6|c;if(c!==64){t+=String.fromCharCode(i)}}return t}}}();var w=typeof Buffer!=="undefined"&&typeof undefined!=="undefined"&&typeof{}!=="undefined"&&!!{}.node;var y=function(){};if(typeof Buffer!=="undefined"){var k=!Buffer.from;if(!k)try{Buffer.from("foo","utf8")}catch(x){k=true}y=k?function(e,r){return r?new Buffer(e,r):new Buffer(e)}:Buffer.from.bind(Buffer);if(!Buffer.alloc)Buffer.alloc=function(e){return new Buffer(e)};if(!Buffer.allocUnsafe)Buffer.allocUnsafe=function(e){return new Buffer(e)}}function S(e){return w?Buffer.alloc(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}function _(e){return w?Buffer.allocUnsafe(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}var C=function ho(e){if(w)return y(e,"binary");return e.split("").map(function(e){return e.charCodeAt(0)&255})};function A(e){if(typeof ArrayBuffer==="undefined")return C(e);var r=new ArrayBuffer(e.length),t=new Uint8Array(r);for(var a=0;a!=e.length;++a)t[a]=e.charCodeAt(a)&255;return r}function F(e){if(Array.isArray(e))return e.map(function(e){return String.fromCharCode(e)}).join("");var r=[];for(var t=0;t<e.length;++t)r[t]=String.fromCharCode(e[t]);return r.join("")}function E(e){if(typeof Uint8Array==="undefined")throw new Error("Unsupported");return new Uint8Array(e)}function T(e){if(typeof ArrayBuffer=="undefined")throw new Error("Unsupported");if(e instanceof ArrayBuffer)return T(new Uint8Array(e));var r=new Array(e.length);for(var t=0;t<e.length;++t)r[t]=e[t];return r}function D(e){var r=[],t=0,a=e.length+250;var n=S(e.length+255);for(var i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s<128)n[t++]=s;else if(s<2048){n[t++]=192|s>>6&31;n[t++]=128|s&63}else if(s>=55296&&s<57344){s=(s&1023)+64;var l=e.charCodeAt(++i)&1023;n[t++]=240|s>>8&7;n[t++]=128|s>>2&63;n[t++]=128|l>>6&15|(s&3)<<4;n[t++]=128|l&63}else{n[t++]=224|s>>12&15;n[t++]=128|s>>6&63;n[t++]=128|s&63}if(t>a){r.push(n.slice(0,t));t=0;n=S(65535);a=65530}}r.push(n.slice(0,t));return O(r)}var O=function(e){if(typeof Uint8Array!=="undefined"){var r=0,t=0;for(r=0;r<e.length;++r)t+=e[r].length;var a=new Uint8Array(t);var n=0;for(r=0,t=0;r<e.length;t+=n,++r){n=e[r].length;if(e[r]instanceof Uint8Array)a.set(e[r],t);else if(typeof e[r]=="string"){throw"wtf"}else a.set(new Uin
while(y<n)a=a>>>8^t[(a^e[y++])&255];return~a}function x(e,r){var a=r^-1;for(var n=0,i=e.length,s=0,l=0;n<i;){s=e.charCodeAt(n++);if(s<128){a=a>>>8^t[(a^s)&255]}else if(s<2048){a=a>>>8^t[(a^(192|s>>6&31))&255];a=a>>>8^t[(a^(128|s&63))&255]}else if(s>=55296&&s<57344){s=(s&1023)+64;l=e.charCodeAt(n++)&1023;a=a>>>8^t[(a^(240|s>>8&7))&255];a=a>>>8^t[(a^(128|s>>2&63))&255];a=a>>>8^t[(a^(128|l>>6&15|(s&3)<<4))&255];a=a>>>8^t[(a^(128|l&63))&255]}else{a=a>>>8^t[(a^(224|s>>12&15))&255];a=a>>>8^t[(a^(128|s>>6&63))&255];a=a>>>8^t[(a^(128|s&63))&255]}}return~a}e.table=t;e.bstr=y;e.buf=k;e.str=x});var H=function mo(){var e={};e.version="1.2.1";function r(e,r){var t=e.split("/"),a=r.split("/");for(var n=0,i=0,s=Math.min(t.length,a.length);n<s;++n){if(i=t[n].length-a[n].length)return i;if(t[n]!=a[n])return t[n]<a[n]?-1:1}return t.length-a.length}function t(e){if(e.charAt(e.length-1)=="/")return e.slice(0,-1).indexOf("/")===-1?e:t(e.slice(0,-1));var r=e.lastIndexOf("/");return r===-1?e:e.slice(0,r+1)}function a(e){if(e.charAt(e.length-1)=="/")return a(e.slice(0,-1));var r=e.lastIndexOf("/");return r===-1?e:e.slice(r+1)}function n(e,r){if(typeof r==="string")r=new Date(r);var t=r.getHours();t=t<<6|r.getMinutes();t=t<<5|r.getSeconds()>>>1;e._W(2,t);var a=r.getFullYear()-1980;a=a<<4|r.getMonth()+1;a=a<<5|r.getDate();e._W(2,a)}function i(e){var r=e._R(2)&65535;var t=e._R(2)&65535;var a=new Date;var n=t&31;t>>>=5;var i=t&15;t>>>=4;a.setMilliseconds(0);a.setFullYear(t+1980);a.setMonth(i-1);a.setDate(n);var s=r&31;r>>>=5;var l=r&63;r>>>=6;a.setHours(r);a.setMinutes(l);a.setSeconds(s<<1);return a}function s(e){Zr(e,0);var r={};var t=0;while(e.l<=e.length-4){var a=e._R(2);var n=e._R(2),i=e.l+n;var s={};switch(a){case 21589:{t=e._R(1);if(t&1)s.mtime=e._R(4);if(n>5){if(t&2)s.atime=e._R(4);if(t&4)s.ctime=e._R(4)}if(s.mtime)s.mt=new Date(s.mtime*1e3)}break;}e.l=i;r[a]=s}return r}var l;function o(){return l||(l=undefined)}function c(e,r){if(e[0]==80&&e[1]==75)return Me(e,r);if((e[0]|32)==109&&(e[1]|32)==105)return $e(e,r);if(e.length<512)throw new Error("CFB file size "+e.length+" < 512");var t=3;var a=512;var n=0;var i=0;var s=0;var l=0;var o=0;var c=[];var p=e.slice(0,512);Zr(p,0);var v=f(p);t=v[0];switch(t){case 3:a=512;break;case 4:a=4096;break;case 0:if(v[1]==0)return Me(e,r);default:throw new Error("Major Version: Expected 3 or 4 saw "+t);}if(a!==512){p=e.slice(0,a);Zr(p,28)}var b=e.slice(0,a);u(p,t);var w=p._R(4,"i");if(t===3&&w!==0)throw new Error("# Directory Sectors: Expected 0 saw "+w);p.l+=4;s=p._R(4,"i");p.l+=4;p.chk("00100000","Mini Stream Cutoff Size: ");l=p._R(4,"i");n=p._R(4,"i");o=p._R(4,"i");i=p._R(4,"i");for(var y=-1,x=0;x<109;++x){y=p._R(4,"i");if(y<0)break;c[x]=y}var S=h(e,a);m(o,i,S,a,c);var _=g(S,s,c,a);_[s].name="!Directory";if(n>0&&l!==L)_[l].name="!MiniFAT";_[c[0]].name="!FAT";_.fat_addrs=c;_.ssz=a;var C={},A=[],F=[],E=[];k(s,_,S,A,n,C,F,l);d(F,E,A);A.shift();var T={FileIndex:F,FullPaths:E};if(r&&r.raw)T.raw={header:b,sectors:S};return T}function f(e){if(e[e.l]==80&&e[e.l+1]==75)return[0,0];e.chk(B,"Header Signature: ");e.l+=16;var r=e._R(2,"u");return[e._R(2,"u"),r]}function u(e,r){var t=9;e.l+=2;switch(t=e._R(2)){case 9:if(r!=3)throw new Error("Sector Shift: Expected 9 saw "+t);break;case 12:if(r!=4)throw new Error("Sector Shift: Expected 12 saw "+t);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+t);}e.chk("0600","Mini Sector Shift: ");e.chk("000000000000","Reserved: ")}function h(e,r){var t=Math.ceil(e.length/r)-1;var a=[];for(var n=1;n<t;++n)a[n-1]=e.slice(n*r,(n+1)*r);a[t-1]=e.slice(t*r);return a}function d(e,r,t){var a=0,n=0,i=0,s=0,l=0,o=t.length;var c=[],f=[];for(;a<o;++a){c[a]=f[a]=a;r[a]=t[a]}for(;l<f.length;++l){a=f[l];n=e[a].L;i=e[a].R;s=e[a].C;if(c[a]===a){if(n!==-1&&c[n]!==n)c[a]=c[n];if(i!==-1&&c[i]!==i)c[a]=c[i]}if(s!==-1)c[s]=a;if(n!==-1&&a!=c[a]){c[n]=c[a];if(f.lastIndexOf(n)<l)f.push(n)}if(i!==-1&&a!=c[a]){c[i]=c[a];if(f.lastIndexOf(i)<l)f.push(i)}}for(a=1;a<o;++a)if(c[a]===a){if(i!==-1&&c[i]!==i)c[a]=c[i];else if(n!==-1&&c[n]!==n)c[a]=c[n]}for(a=1;a<o;++a){if(e[a].type===0)continue;l
return i}function fe(e,r){if(w&&Buffer.isBuffer(e)){if(r){if(e[0]==255&&e[1]==254)return e.slice(2).toString("utf16le");if(e[1]==254&&e[2]==255)return h(e.slice(2).toString("binary"))}return e.toString("binary")}var t=[];for(var a=0;a!=e.length;++a)t.push(String.fromCharCode(e[a]));return t.join("")}function ue(e){if(typeof JSON!="undefined"&&!Array.isArray(e))return JSON.parse(JSON.stringify(e));if(typeof e!="object"||e==null)return e;if(e instanceof Date)return new Date(e.getTime());var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))r[t]=ue(e[t]);return r}function he(e,r){var t="";while(t.length<r)t+=e;return t}function de(e){var r=Number(e);if(isFinite(r))return r;if(!isNaN(r))return NaN;if(!/\d/.test(e))return r;var t=1;var a=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){t*=100;return""});if(!isNaN(r=Number(a)))return r/t;a=a.replace(/[(](.*)[)]/,function(e,r){t=-t;return r});if(!isNaN(r=Number(a)))return r/t;return r}var pe=["january","february","march","april","may","june","july","august","september","october","november","december"];function me(e){var r=new Date(e),t=new Date(NaN);var a=r.getYear(),n=r.getMonth(),i=r.getDate();if(isNaN(i))return t;var s=e.toLowerCase();if(s.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){s=s.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");if(s.length>3&&pe.indexOf(s)==-1)return t}else if(s.match(/[a-z]/))return t;if(a<0||a>8099)return t;if((n>0||i>1)&&a!=101)return r;if(e.match(/[^-0-9:,\/\\]/))return t;return r}var ve="abacaba".split(/(:?b)/i).length==5;function ge(e,r,t){if(ve||typeof r=="string")return e.split(r);var a=e.split(r),n=[a[0]];for(var i=1;i<a.length;++i){n.push(t);n.push(a[i])}return n}function be(e){if(!e)return null;if(e.content&&e.type)return fe(e.content,true);if(e.data)return d(e.data);if(e.asNodeBuffer&&w)return d(e.asNodeBuffer().toString("binary"));if(e.asBinary)return d(e.asBinary());if(e._data&&e._data.getContent)return d(fe(Array.prototype.slice.call(e._data.getContent(),0)));return null}function we(e){if(!e)return null;if(e.data)return f(e.data);if(e.asNodeBuffer&&w)return e.asNodeBuffer();if(e._data&&e._data.getContent){var r=e._data.getContent();if(typeof r=="string")return f(r);return Array.prototype.slice.call(r)}if(e.content&&e.type)return e.content;return null}function ye(e){return e&&e.name.slice(-4)===".bin"?we(e):be(e)}function ke(e,r){var t=e.FullPaths||J(e.files);var a=r.toLowerCase().replace(/[\/]/g,"\\"),n=a.replace(/\\/g,"/");for(var i=0;i<t.length;++i){var s=t[i].replace(/^Root Entry[\/]/,"").toLowerCase();if(a==s||n==s)return e.files?e.files[t[i]]:e.FileIndex[i]}return null}function xe(e,r){var t=ke(e,r);if(t==null)throw new Error("Cannot find file "+r+" in zip");return t}function Se(e,r,t){if(!t)return ye(xe(e,r));if(!r)return null;try{return Se(e,r)}catch(a){return null}}function _e(e,r,t){if(!t)return be(xe(e,r));if(!r)return null;try{return _e(e,r)}catch(a){return null}}function Ce(e,r,t){if(!t)return we(xe(e,r));if(!r)return null;try{return Ce(e,r)}catch(a){return null}}function Ae(e){var r=e.FullPaths||J(e.files),t=[];for(var a=0;a<r.length;++a)if(r[a].slice(-1)!="/")t.push(r[a].replace(/^Root Entry[\/]/,""));return t.sort()}function Fe(e,r,t){if(e.FullPaths){if(typeof t=="string"){var a;if(w)a=y(t);else a=D(t);return H.utils.cfb_add(e,r,a)}H.utils.cfb_add(e,r,t)}else e.file(r,t)}function Ee(){return H.utils.cfb_new()}function Te(e,r){switch(r.type){case"base64":return H.read(e,{type:"base64"});case"binary":return H.read(e,{type:"binary"});case"buffer":;case"array":return H.read(e,{type:"buffer"});}throw new Error("Unrecognized type "+r.type)}function De(e,r){if(e.charAt(0)=="/")return e.slice(1);var t=r.split("/");if(r.slice(-1)!="/")t.pop();var a=e.split("/");while(a.length!==0){var n=a.shift();if(n==="..")t.pop();else if(n!==".")t.push(n)}return t.join("/")}var Oe='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';var Me=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g;var Ne=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*
xlam:"application/vnd.ms-excel.addin.macroEnabled.main+xml",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},comments:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",xlsb:"application/vnd.ms-excel.comments"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},charts:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",xlsb:"application/vnd.ms-excel.chartsheet"},dialogs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",xlsb:"application/vnd.ms-excel.dialogsheet"},macros:{xlsx:"application/vnd.ms-excel.macrosheet+xml",xlsb:"application/vnd.ms-excel.macrosheet"},metadata:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",xlsb:"application/vnd.ms-excel.sheetMetadata"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};J(e).forEach(function(r){["xlsm","xlam"].forEach(function(t){if(!e[r][t])e[r][t]=e[r].xlsx})});J(e).forEach(function(r){J(e[r]).forEach(function(t){qt[e[r][t]]=r})});return e}();var Qt=Q(qt);pr.CT="http://schemas.openxmlformats.org/package/2006/content-types";function ea(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],TODO:[],xmlns:""}}function ra(e){var r=ea();if(!e||!e.match)return r;var t={};(e.match(Ne)||[]).forEach(function(e){var a=Ie(e);switch(a[0].replace(Pe,"<")){case"<?xml":break;case"<Types":r.xmlns=a["xmlns"+(a[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":t[a.Extension]=a.ContentType;break;case"<Override":if(r[qt[a.ContentType]]!==undefined)r[qt[a.ContentType]].push(a.PartName);break;}});if(r.xmlns!==pr.CT)throw new Error("Unknown Namespace: "+r.xmlns);r.calcchain=r.calcchains.length>0?r.calcchains[0]:"";r.sst=r.strs.length>0?r.strs[0]:"";r.style=r.styles.length>0?r.styles[0]:"";r.defaults=t;delete r.calcchains;return r}var ta=ur("Types",null,{xmlns:pr.CT,"xmlns:xsd":pr.xsd,"xmlns:xsi":pr.xsi});var aa=[["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["data","application/vnd.openxmlformats-officedocument.model+data"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels",Qt.rels[0]]].map(function(e){return ur("Default",null,{Extension:e[0],ContentType:e[1]})});function na(e,r){var t=[],a;t[t.length]=Oe;t[t.length]=ta;t=t.concat(aa);var n=function(n){if(e[n]&&e[n].length>0){a=e[n][0];t[t.length]=ur("Override",null,{PartName:(a[0]=="/"?"":"/")+a,ContentType:Zt[n][r.bookType||"xlsx"]})}};var i=function(a){(e[a]||[]).forEach(function(e){t[t.length]=ur("Override",null,{PartName:(e[0]=="/"?"":"/")+e,ContentType:Zt[a][r.bookType||"xlsx"]})})};var s=function(r){(e[r]||[]).forEach(function(e){t[t.length]=ur("Override",null,{PartName:(e[0]=="/"?"":"/")+e,ContentType:Qt[r][0]})})};n("workbooks");i("sheets");i("charts");s("themes");["strs","styles"].forEach(n);["coreprops","extprops","custprops"].forEach(s);s("vba");s("comments");s("drawings");i("metadata");if(t.length>2){t[t.length]="</Types>";t[1]=t[1].replace("/>",">")}return t.join("")}var ia={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",XPATH:"http://schemas.openxmlf
a.z=t.dateNF||P._table[14];var n=0;if(g&&r.match(g)){r=U(r,t.dateNF,r.match(g)||[]);n=1}if(t.cellDates){a.t="d";a.v=ce(r,n)}else{a.t="n";a.v=re(ce(r,n))}if(t.cellText!==false)a.w=P.format(a.z,a.v instanceof Date?re(a.v):a.v);if(!t.cellNF)delete a.z}else{a.t="s";a.v=r}if(a.t=="z"){}else if(t.dense){if(!i[l])i[l]=[];i[l][o]=a}else i[bt({c:o,r:l})]=a;f=u+1;m=e.charCodeAt(f);if(s.e.c<o)s.e.c=o;if(s.e.r<l)s.e.r=l;if(p==h)++o;else{o=0;++l;if(t.sheetRows&&t.sheetRows<=l)return true}}e:for(;u<e.length;++u)switch(p=e.charCodeAt(u)){case 34:if(m===34)d=!d;break;case h:;case 10:;case 13:if(!d&&b())break e;break;default:break;}if(u-f>0)b();i["!ref"]=yt(s);return i}function s(e,t){if(!(t&&t.PRN))return i(e,t);if(t.FS)return i(e,t);if(e.slice(0,4)=="sep=")return i(e,t);if(e.indexOf("\t")>=0||e.indexOf(",")>=0||e.indexOf(";")>=0)return i(e,t);return At(r(e,t),t)}function l(e,r){var t="",a=r.type=="string"?[0,0,0,0]:wl(e,r);switch(r.type){case"base64":t=b.decode(e);break;case"binary":t=e;break;case"buffer":if(r.codepage==65001)t=e.toString("utf8");else if(r.codepage&&typeof cptable!=="undefined")t=cptable.utils.decode(r.codepage,e);else t=w&&Buffer.isBuffer(e)?e.toString("binary"):F(e);break;case"array":t=fe(e);break;case"string":t=e;break;default:throw new Error("Unrecognized type "+r.type);}if(a[0]==239&&a[1]==187&&a[2]==191)t=qe(t.slice(3));else if(r.type!="string"&&r.type!="buffer"&&r.codepage==65001)t=qe(t);else if(r.type=="binary"&&typeof cptable!=="undefined"&&r.codepage)t=cptable.utils.decode(r.codepage,cptable.utils.encode(28591,t));if(t.slice(0,19)=="socialcalc:version:")return Ba.to_sheet(r.type=="string"?t:qe(t),r);return s(t,r)}function o(e,r){return _t(l(e,r),r)}function c(e){var r=[];var t=kt(e["!ref"]),a;var n=Array.isArray(e);for(var i=t.s.r;i<=t.e.r;++i){var s=[];for(var l=t.s.c;l<=t.e.c;++l){var o=bt({r:i,c:l});a=n?(e[i]||[])[l]:e[o];if(!a||a.v==null){s.push(" ");continue}var c=(a.w||(St(a),a.w)||"").slice(0,10);while(c.length<10)c+=" ";s.push(c+(l===0?" ":""))}r.push(s.join(""))}return r.join("\n")}return{to_workbook:o,to_sheet:l,from_sheet:c}}();function Ua(e,r){var t=r||{},a=!!t.WTF;t.WTF=true;try{var n=Ia.to_workbook(e,t);t.WTF=a;return n}catch(i){t.WTF=a;if(!i.message.match(/SYLK bad record ID/)&&a)throw i;return za.to_workbook(e,r)}}function $a(e){var r={},t=e.match(Ne),a=0;var n=false;if(t)for(;a!=t.length;++a){var s=Ie(t[a]);switch(s[0].replace(/\w*:/g,"")){case"<condense":break;case"<extend":break;case"<shadow":if(!s.val)break;case"<shadow>":;case"<shadow/>":r.shadow=1;break;case"</shadow>":break;case"<charset":if(s.val=="1")break;r.cp=i[parseInt(s.val,10)];break;case"<outline":if(!s.val)break;case"<outline>":;case"<outline/>":r.outline=1;break;case"</outline>":break;case"<rFont":r.name=s.val;break;case"<sz":r.sz=s.val;break;case"<strike":if(!s.val)break;case"<strike>":;case"<strike/>":r.strike=1;break;case"</strike>":break;case"<u":if(!s.val)break;switch(s.val){case"double":r.uval="double";break;case"singleAccounting":r.uval="single-accounting";break;case"doubleAccounting":r.uval="double-accounting";break;};case"<u>":;case"<u/>":r.u=1;break;case"</u>":break;case"<b":if(s.val=="0")break;case"<b>":;case"<b/>":r.b=1;break;case"</b>":break;case"<i":if(s.val=="0")break;case"<i>":;case"<i/>":r.i=1;break;case"</i>":break;case"<color":if(s.rgb)r.color=s.rgb.slice(2,8);break;case"<color>":;case"<color/>":;case"</color>":break;case"<family":r.family=s.val;break;case"<family>":;case"<family/>":;case"</family>":break;case"<vertAlign":r.valign=s.val;break;case"<vertAlign>":;case"<vertAlign/>":;case"</vertAlign>":break;case"<scheme":break;case"<scheme>":;case"<scheme/>":;case"</scheme>":break;case"<extLst":;case"<extLst>":;case"</extLst>":break;case"<ext":n=true;break;case"</ext>":n=false;break;default:if(s[0].charCodeAt(1)!==47&&!n)throw new Error("Unrecognized rich format "+s[0]);}}return r}var Wa=function(){var e=tr("t"),r=tr("rPr");function t(t){var a=t.match(e);if(!a)return{t:"s",v:""};var n={t:"s",v:Ue(a[1])};var i=t.match(r);if(i)n.s=$a(i[1]);return n}var a=/<(?:\w+:)?r>/g,n=/<\/(?:\w+:)?r>/;return functi
var t=[21600,21600];var a=["m0,0l0",t[1],t[0],t[1],t[0],"0xe"].join(",");var n=[ur("xml",null,{"xmlns:v":mr.v,"xmlns:o":mr.o,"xmlns:x":mr.x,"xmlns:mv":mr.mv}).replace(/\/>/,">"),ur("o:shapelayout",ur("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),ur("v:shapetype",[ur("v:stroke",null,{joinstyle:"miter"}),ur("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:t.join(","),path:a})];while(Jn<e*1e3)Jn+=1e3;r.forEach(function(e){var r=gt(e[0]);var t={color2:"#BEFF82",type:"gradient"};if(t.type=="gradient")t.angle="-180";var a=t.type=="gradient"?ur("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null;var i=ur("v:fill",a,t);var s={on:"t",obscured:"t"};++Jn;n=n.concat(["<v:shape"+fr({id:"_x0000_s"+Jn,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(e[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",i,ur("v:shadow",null,s),ur("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",cr("x:Anchor",[r.c+1,0,r.r+1,0,r.c+3,20,r.r+5,20].join(",")),cr("x:AutoFill","False"),cr("x:Row",String(r.r)),cr("x:Column",String(r.c)),e[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])});n.push("</xml>");return n.join("")}ia.CMNT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";function qn(e,r){var t=Array.isArray(e);var a;r.forEach(function(r){var n=gt(r.ref);if(t){if(!e[n.r])e[n.r]=[];a=e[n.r][n.c]}else a=e[r.ref];if(!a){a={t:"z"};if(t)e[n.r][n.c]=a;else e[r.ref]=a;var i=kt(e["!ref"]||"BDWGO1000001:A1");if(i.s.r>n.r)i.s.r=n.r;if(i.e.r<n.r)i.e.r=n.r;if(i.s.c>n.c)i.s.c=n.c;if(i.e.c<n.c)i.e.c=n.c;var s=yt(i);if(s!==e["!ref"])e["!ref"]=s}if(!a.c)a.c=[];var l={a:r.author,t:r.t,r:r.r};if(r.h)l.h=r.h;a.c.push(l)})}function Zn(e,r){if(e.match(/<(?:\w+:)?comments *\/>/))return[];var t=[];var a=[];var n=e.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/);if(n&&n[1])n[1].split(/<\/\w*:?author>/).forEach(function(e){if(e===""||e.trim()==="")return;var r=e.match(/<(?:\w+:)?author[^>]*>(.*)/);if(r)t.push(r[1])});var i=e.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/);if(i&&i[1])i[1].split(/<\/\w*:?comment>/).forEach(function(e){if(e===""||e.trim()==="")return;var n=e.match(/<(?:\w+:)?comment[^>]*>/);if(!n)return;var i=Ie(n[0]);var s={author:i.authorId&&t[i.authorId]||"sheetjsghost",ref:i.ref,guid:i.guid};var l=gt(i.ref);if(r.sheetRows&&r.sheetRows<=l.r)return;var o=e.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/);var c=!!o&&!!o[1]&&Ga(o[1])||{r:"",t:"",h:""};s.r=c.r;if(c.r=="<t></t>")c.t=c.h="";s.t=(c.t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(r.cellHTML)s.h=c.h;a.push(s)});return a}var Qn=ur("comments",null,{xmlns:pr.main[0]});function ei(e){var r=[Oe,Qn];var t=[];r.push("<authors>");e.forEach(function(e){e[1].forEach(function(e){var a=je(e.a);if(t.indexOf(a)>-1)return;t.push(a);r.push("<author>"+a+"</author>")})});r.push("</authors>");r.push("<commentList>");e.forEach(function(e){e[1].forEach(function(a){r.push('<comment ref="'+e[0]+'" authorId="'+t.indexOf(je(a.a))+'"><text>');r.push(cr("t",a.t==null?"":je(a.t)));r.push("</text></comment>")})});r.push("</commentList>");if(r.length>2){r[r.length]="</comments>";r[1]=r[1].replace("/>",">")}return r.join("")}var ri="application/vnd.ms-office.vbaProject";function ti(e){var r=H.utils.cfb_new({root:"R"});e.FullPaths.forEach(function(t,a){if(t.slice(-1)==="/"||!t.match(/_VBA_PROJECT_CUR/))return;var n=t.replace(/^[^\/]*/,"R").replace(/\/_VBA_PROJECT_CUR\u0000*/,"");H.utils.cfb_add(r,n,e.FileIndex[a].content)});return H.write(r)}function ai(e,r){r.FullPaths.forEach(function(t,a){if(a==0)return;var n=t.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");if(n.slice(-1)!=="/")H.utils.cfb_add(e,n,r.FileIndex[a].content)})}var ni=["xlsb","xlsm","xlam","biff8","xla"];ia.DS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet";ia.MS="h
}function Vs(e,r,t){return(r.slice(-4)===".bin"?write_sst_bin:Qa)(e,t)}function Gs(e,r,t){return(r.slice(-4)===".bin"?write_comments_bin:ei)(e,t)}function Ys(e){return(e.slice(-4)===".bin"?write_xlmeta_bin:Xn)()}var Js=function(){function e(e,r){var t=r||{};if(v!=null&&t.dense==null)t.dense=v;var a=t.dense?[]:{};e=e.replace(/<!--.*?-->/g,"");var n=e.match(/<table/i);if(!n)throw new Error("Invalid HTML: could not find <table>");var i=e.match(/<\/table/i);var s=n.index,l=i&&i.index||e.length;var o=ge(e.slice(s,l),/(:?<tr[^>]*>)/i,"<tr>");var c=-1,f=0,u=0,h=0;var d={s:{r:1e7,c:1e7},e:{r:0,c:0}};var p=[];for(s=0;s<o.length;++s){var m=o[s].trim();var g=m.slice(0,3).toLowerCase();if(g=="<tr"){++c;if(t.sheetRows&&t.sheetRows<=c){--c;break}f=0;continue}if(g!="<td"&&g!="<th")continue;var b=m.split(/<\/t[dh]>/i);for(l=0;l<b.length;++l){var w=b[l].trim();if(!w.match(/<t[dh]/i))continue;var y=w,k=0;while(y.charAt(0)=="<"&&(k=y.indexOf(">"))>-1)y=y.slice(k+1);for(var x=0;x<p.length;++x){var S=p[x];if(S.s.c==f&&S.s.r<c&&c<=S.e.r){f=S.e.c+1;x=-1}}var _=Ie(w.slice(0,w.indexOf(">")));h=_.colspan?+_.colspan:1;if((u=+_.rowspan)>1||h>1)p.push({s:{r:c,c:f},e:{r:c+(u||1)-1,c:f+h-1}});var C=_.t||_["data-t"]||"";if(!y.length){f+=h;continue}y=ar(y);if(d.s.r>c)d.s.r=c;if(d.e.r<c)d.e.r=c;if(d.s.c>f)d.s.c=f;if(d.e.c<f)d.e.c=f;if(!y.length)continue;var A={t:"s",v:y};if(t.raw||!y.trim().length||C=="s"){}else if(y==="TRUE")A={t:"b",v:true};else if(y==="FALSE")A={t:"b",v:false};else if(!isNaN(de(y)))A={t:"n",v:de(y)};else if(!isNaN(me(y).getDate())){A={t:"d",v:ce(y)};if(!t.cellDates)A={t:"n",v:re(A.v)};A.z=t.dateNF||P._table[14]}if(t.dense){if(!a[c])a[c]=[];a[c][f]=A}else a[bt({r:c,c:f})]=A;f+=h}}a["!ref"]=yt(d);if(p.length)a["!merges"]=p;return a}function r(r,t){var a=r.match(/<table.*?>[\s\S]*?<\/table>/gi);if(!a||a.length==0)throw new Error("Invalid HTML: could not find <table>");if(a.length==1)return _t(e(a[0],t),t);var n=co.book_new();a.forEach(function(r,a){co.book_append_sheet(n,e(r,t),"Sheet"+(a+1))});return n}function t(e,r,t,a){var n=e["!merges"]||[];var i=[];for(var s=r.s.c;s<=r.e.c;++s){var l=0,o=0;for(var c=0;c<n.length;++c){if(n[c].s.r>t||n[c].s.c>s)continue;if(n[c].e.r<t||n[c].e.c<s)continue;if(n[c].s.r<t||n[c].s.c<s){l=-1;break}l=n[c].e.r-n[c].s.r+1;o=n[c].e.c-n[c].s.c+1;break}if(l<0)continue;var f=bt({r:t,c:s});var u=a.dense?(e[t]||[])[s]:e[f];var h=u&&u.v!=null&&(u.h||Ve(u.w||(St(u),u.w)||""))||"";var d={};if(l>1)d.rowspan=l;if(o>1)d.colspan=o;if(a.editable)h='<span contenteditable="true">'+h+"</span>";else if(u){d["data-t"]=u&&u.t||"z";if(u.v!=null)d["data-v"]=u.v;if(u.z!=null)d["data-z"]=u.z;if(u.l&&(u.l.Target||"#").charAt(0)!="#")h='<a href="'+u.l.Target+'">'+h+"</a>"}d.id=(a.id||"sjs")+"-"+f;i.push(ur("td",h,d))}var p="<tr>";return p+i.join("")+"</tr>"}function a(e,r,t){var a=[];return a.join("")+"<table"+(t&&t.id?' id="'+t.id+'"':"")+">"}var n='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>';var i="</body></html>";function s(e,r){var s=r||{};var l=s.header!=null?s.header:n;var o=s.footer!=null?s.footer:i;var c=[l];var f=wt(e["!ref"]);s.dense=Array.isArray(e);c.push(a(e,f,s));for(var u=f.s.r;u<=f.e.r;++u)c.push(t(e,f,u,s));c.push("</table>"+o);return c.join("")}return{to_workbook:r,to_sheet:e,_row:t,BEGIN:n,END:i,_preamble:a,from_sheet:s}}();function Ks(e,r,t){var a=t||{};if(v!=null)a.dense=v;var n=0,i=0;if(a.origin!=null){if(typeof a.origin=="number")n=a.origin;else{var s=typeof a.origin=="string"?gt(a.origin):a.origin;n=s.r;i=s.c}}var l=r.getElementsByTagName("tr");var o=Math.min(a.sheetRows||1e7,l.length);var c={s:{r:0,c:0},e:{r:n,c:i}};if(e["!ref"]){var f=wt(e["!ref"]);c.s.r=Math.min(c.s.r,f.s.r);c.s.c=Math.min(c.s.c,f.s.c);c.e.r=Math.max(c.e.r,f.e.r);c.e.c=Math.max(c.e.c,f.e.c);if(n==-1)c.e.r=n=f.e.r+1}var u=[],h=0;var d=e["!rows"]||(e["!rows"]=[]);var p=0,m=0,g=0,b=0,w=0,y=0;if(!e["!cols"])e["!cols"]=[];for(;p<l.length&&m<o;++p){var k=l[p];if(Qs(k)){if(a.display)continue;d[m]={hidden:true}}var x=k.children;for(g=b=0;g<x.length;++g){var S=x[g];if(a.display&&Qs(S))continue;var _=S.hasAttr
parse_Primary(n.content)}catch(l){}a="/EncryptionInfo";n=H.find(e,a);if(!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);var o=parse_EncryptionInfo(n.content);a="/EncryptedPackage";n=H.find(e,a);if(!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);if(o[0]==4&&typeof decrypt_agile!=="undefined")return decrypt_agile(o[1],n.content,t.password||"",t);if(o[0]==2&&typeof decrypt_std76!=="undefined")return decrypt_std76(o[1],n.content,t.password||"",t);throw new Error("File is password-protected")}function vl(e,r){if(r.bookType=="ods")return sl(e,r);return gl(e,r)}function gl(e,r){Jn=1024;if(e&&!e.SSF){e.SSF=P.get_table()}if(e&&e.SSF){R(P);P.load_table(e.SSF);r.revssf=Z(e.SSF);r.revssf[e.SSF[65535]]=0;r.ssf=e.SSF}r.rels={};r.wbrels={};r.Strings=[];r.Strings.Count=0;r.Strings.Unique=0;if(xi)r.revStrings=new Map;else{r.revStrings={};r.revStrings.foo=[];delete r.revStrings.foo}var t=r.bookType=="xlsb"?"bin":"xml";var a=ni.indexOf(r.bookType)>-1;var n=ea();cl(r=r||{});var i=Ee();var s="",l=0;r.cellXfs=[];Ai(r.cellXfs,{},{revssf:{General:0}});if(!e.Props)e.Props={};s="docProps/core.xml";Fe(i,s,_a(e.Props,r));n.coreprops.push(s);ua(r.rels,2,s,ia.CORE_PROPS);s="docProps/app.xml";if(e.Props&&e.Props.SheetNames){}else if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{var o=[];for(var c=0;c<e.SheetNames.length;++c)if((e.Workbook.Sheets[c]||{}).Hidden!=2)o.push(e.SheetNames[c]);e.Props.SheetNames=o}e.Props.Worksheets=e.Props.SheetNames.length;Fe(i,s,Da(e.Props,r));n.extprops.push(s);ua(r.rels,3,s,ia.EXT_PROPS);if(e.Custprops!==e.Props&&J(e.Custprops||{}).length>0){s="docProps/custom.xml";Fe(i,s,Pa(e.Custprops,r));n.custprops.push(s);ua(r.rels,4,s,ia.CUST_PROPS)}for(l=1;l<=e.SheetNames.length;++l){var f={"!id":{}};var u=e.Sheets[e.SheetNames[l-1]];var h=(u||{})["!type"]||"sheet";switch(h){case"chart":;default:s="xl/worksheets/sheet"+l+"."+t;Fe(i,s,js(l-1,s,r,e,f));n.sheets.push(s);ua(r.wbrels,-1,"worksheets/sheet"+l+"."+t,ia.WS[0]);}if(u){var d=u["!comments"];var p=false;if(d&&d.length>0){var m="xl/comments"+l+"."+t;Fe(i,m,Gs(d,m,r));n.comments.push(m);ua(f,-1,"../comments"+l+"."+t,ia.CMNT);p=true}if(u["!legacy"]){if(p)Fe(i,"xl/drawings/vmlDrawing"+l+".vml",Kn(l,u["!comments"]))}delete u["!comments"];delete u["!legacy"]}if(f["!id"].rId1)Fe(i,sa(s),ca(f))}if(r.Strings!=null&&r.Strings.length>0){s="xl/sharedStrings."+t;Fe(i,s,Vs(r.Strings,s,r));n.strs.push(s);ua(r.wbrels,-1,"sharedStrings."+t,ia.SST)}s="xl/workbook."+t;Fe(i,s,Ws(e,s,r));n.workbooks.push(s);ua(r.rels,1,s,ia.WB);s="xl/theme/theme1.xml";Fe(i,s,jn(e.Themes,r));n.themes.push(s);ua(r.wbrels,-1,"theme/theme1.xml",ia.THEME);s="xl/styles."+t;Fe(i,s,Xs(e,s,r));n.styles.push(s);ua(r.wbrels,-1,"styles."+t,ia.STY);if(e.vbaraw&&a){s="xl/vbaProject.bin";Fe(i,s,e.vbaraw);n.vba.push(s);ua(r.wbrels,-1,"vbaProject.bin",ia.VBA)}s="xl/metadata."+t;Fe(i,s,Ys(s));n.metadata.push(s);ua(r.wbrels,-1,"metadata."+t,ia.XLMETA);Fe(i,"[Content_Types].xml",na(n,r));Fe(i,"_rels/.rels",ca(r.rels));Fe(i,"xl/_rels/workbook."+t+".rels",ca(r.wbrels));delete r.revssf;delete r.ssf;return i}function bl(e,r){Jn=1024;if(e&&!e.SSF){e.SSF=P.get_table()}if(e&&e.SSF){R(P);P.load_table(e.SSF);r.revssf=Z(e.SSF);r.revssf[e.SSF[65535]]=0;r.ssf=e.SSF}r.rels={};r.wbrels={};r.Strings=[];r.Strings.Count=0;r.Strings.Unique=0;if(xi)r.revStrings=new Map;else{r.revStrings={};r.revStrings.foo=[];delete r.revStrings.foo}var t="xml";var a=ni.indexOf(r.bookType)>-1;var n=ea();cl(r=r||{});var i=Ee();var s="",l=0;r.cellXfs=[];Ai(r.cellXfs,{},{revssf:{General:0}});if(!e.Props)e.Props={};s="docProps/core.xml";Fe(i,s,_a(e.Props,r));n.coreprops.push(s);ua(r.rels,2,s,ia.CORE_PROPS);s="docProps/app.xml";if(e.Props&&e.Props.SheetNames){}else if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{var o=[];for(var c=0;c<e.SheetNames.length;++c)if((e.Workbook.Sheets[c]||{}).Hidden!=2)o.push(e.SheetNames[c]);e.Props.SheetNames=o}e.Props.Worksheets=e.Props.SheetNames.length;Fe(i,s,Da(e.Props,r));n.extprops.push(s);ua(r.rels,3,s,ia.EXT_PROPS);if(e.Custprops!==e.Props&&J(e.C