| 
									
										
										
										
											2017-09-22 22:18:51 +00:00
										 |  |  | var XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n'; | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | var attregexg=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g; | 
					
						
							| 
									
										
										
										
											2022-03-20 01:54:41 +00:00
										 |  |  | var tagregex1=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg, tagregex2 = /<[^>]*>/g; | 
					
						
							|  |  |  | var tagregex = /*#__PURE__*/XML_HEADER.match(tagregex1) ? tagregex1 : tagregex2; | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | var nsregex=/<\w*:/, nsregex2 = /<(\/?)\w+:/; | 
					
						
							| 
									
										
										
										
											2019-11-15 01:46:49 +00:00
										 |  |  | function parsexmltag(tag/*:string*/, skip_root/*:?boolean*/, skip_LC/*:?boolean*/)/*:any*/ { | 
					
						
							| 
									
										
										
										
											2017-03-22 07:50:11 +00:00
										 |  |  | 	var z = ({}/*:any*/); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	var eq = 0, c = 0; | 
					
						
							|  |  |  | 	for(; eq !== tag.length; ++eq) if((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) break; | 
					
						
							| 
									
										
										
										
											2018-01-11 08:01:25 +00:00
										 |  |  | 	if(!skip_root) z[0] = tag.slice(0, eq); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	if(eq === tag.length) return z; | 
					
						
							| 
									
										
										
										
											2017-04-16 04:32:13 +00:00
										 |  |  | 	var m = tag.match(attregexg), j=0, v="", i=0, q="", cc="", quot = 1; | 
					
						
							| 
									
										
										
										
											2014-06-02 05:19:07 +00:00
										 |  |  | 	if(m) for(i = 0; i != m.length; ++i) { | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		cc = m[i]; | 
					
						
							|  |  |  | 		for(c=0; c != cc.length; ++c) if(cc.charCodeAt(c) === 61) break; | 
					
						
							| 
									
										
										
										
											2018-01-11 08:01:25 +00:00
										 |  |  | 		q = cc.slice(0,c).trim(); | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | 		while(cc.charCodeAt(c+1) == 32) ++c; | 
					
						
							| 
									
										
										
										
											2017-04-16 04:32:13 +00:00
										 |  |  | 		quot = ((eq=cc.charCodeAt(c+1)) == 34 || eq == 39) ? 1 : 0; | 
					
						
							| 
									
										
										
										
											2018-01-11 08:01:25 +00:00
										 |  |  | 		v = cc.slice(c+1+quot, cc.length-quot); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		for(j=0;j!=q.length;++j) if(q.charCodeAt(j) === 58) break; | 
					
						
							| 
									
										
										
										
											2017-03-10 01:09:18 +00:00
										 |  |  | 		if(j===q.length) { | 
					
						
							| 
									
										
										
										
											2018-01-11 08:01:25 +00:00
										 |  |  | 			if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods
 | 
					
						
							| 
									
										
										
										
											2017-03-10 01:09:18 +00:00
										 |  |  | 			z[q] = v; | 
					
						
							| 
									
										
										
										
											2019-11-15 01:46:49 +00:00
										 |  |  | 			if(!skip_LC) z[q.toLowerCase()] = v; | 
					
						
							| 
									
										
										
										
											2017-03-10 01:09:18 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		else { | 
					
						
							| 
									
										
										
										
											2018-01-11 08:01:25 +00:00
										 |  |  | 			var k = (j===5 && q.slice(0,5)==="xmlns"?"xmlns":"")+q.slice(j+1); | 
					
						
							|  |  |  | 			if(z[k] && q.slice(j-3,j) == "ext") continue; // from ods
 | 
					
						
							| 
									
										
										
										
											2017-03-10 01:09:18 +00:00
										 |  |  | 			z[k] = v; | 
					
						
							| 
									
										
										
										
											2019-11-15 01:46:49 +00:00
										 |  |  | 			if(!skip_LC) z[k.toLowerCase()] = v; | 
					
						
							| 
									
										
										
										
											2017-03-10 01:09:18 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2014-06-02 05:19:07 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	return z; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | function strip_ns(x/*:string*/)/*:string*/ { return x.replace(nsregex2, "<$1"); } | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | var encodings = { | 
					
						
							|  |  |  | 	'"': '"', | 
					
						
							|  |  |  | 	''': "'", | 
					
						
							|  |  |  | 	'>': '>', | 
					
						
							|  |  |  | 	'<': '<', | 
					
						
							|  |  |  | 	'&': '&' | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2022-03-20 01:54:41 +00:00
										 |  |  | var rencoding = /*#__PURE__*/evert(encodings); | 
					
						
							| 
									
										
										
										
											2017-05-09 18:07:57 +00:00
										 |  |  | //var rencstr = "&<>'\"".split("");
 | 
					
						
							| 
									
										
										
										
											2014-01-29 06:00:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | // TODO: CP remap (need to read file version to determine OS)
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var unescapexml/*:StringConv*/ = /*#__PURE__*/(function() { | 
					
						
							| 
									
										
										
										
											2017-03-06 02:27:21 +00:00
										 |  |  | 	/* 22.4.2.4 bstr (Basic String) */ | 
					
						
							| 
									
										
										
										
											2020-03-15 07:42:05 +00:00
										 |  |  | 	var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig; | 
					
						
							| 
									
										
										
										
											2022-04-20 17:31:11 +00:00
										 |  |  | 	function raw_unescapexml(text/*:string*/)/*:string*/ { | 
					
						
							| 
									
										
										
										
											2017-08-10 23:46:34 +00:00
										 |  |  | 		var s = text + '', i = s.indexOf("<![CDATA["); | 
					
						
							|  |  |  | 		if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));}); | 
					
						
							|  |  |  | 		var j = s.indexOf("]]>"); | 
					
						
							| 
									
										
										
										
											2022-04-20 17:31:11 +00:00
										 |  |  | 		return raw_unescapexml(s.slice(0, i)) + s.slice(i+9,j) + raw_unescapexml(s.slice(j+3)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return function unescapexml(text/*:string*/, xlsx/*:boolean*/) { | 
					
						
							|  |  |  | 		var out = raw_unescapexml(text); | 
					
						
							|  |  |  | 		return xlsx ? out.replace(/\r\n/g, "\n") : out; | 
					
						
							| 
									
										
										
										
											2015-04-02 20:32:22 +00:00
										 |  |  | 	}; | 
					
						
							|  |  |  | })(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-25 08:21:00 +00:00
										 |  |  | var decregex=/[&<>'"]/g, charegex = /[\u0000-\u0008\u000b-\u001f\uFFFE-\uFFFF]/g; | 
					
						
							| 
									
										
										
										
											2018-01-23 09:07:51 +00:00
										 |  |  | function escapexml(text/*:string*/)/*:string*/{ | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 	var s = text + ''; | 
					
						
							| 
									
										
										
										
											2017-02-22 06:57:59 +00:00
										 |  |  | 	return s.replace(decregex, function(y) { return rencoding[y]; }).replace(charegex,function(s) { return "_x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + "_";}); | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-03-14 08:19:51 +00:00
										 |  |  | function escapexmltag(text/*:string*/)/*:string*/{ return escapexml(text).replace(/ /g,"_x0020_"); } | 
					
						
							| 
									
										
										
										
											2014-01-28 16:38:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-16 04:32:13 +00:00
										 |  |  | var htmlcharegex = /[\u0000-\u001f]/g; | 
					
						
							| 
									
										
										
										
											2018-01-09 07:36:02 +00:00
										 |  |  | function escapehtml(text/*:string*/)/*:string*/{ | 
					
						
							| 
									
										
										
										
											2017-04-13 18:28:16 +00:00
										 |  |  | 	var s = text + ''; | 
					
						
							| 
									
										
										
										
											2018-08-25 23:44:35 +00:00
										 |  |  | 	return s.replace(decregex, function(y) { return rencoding[y]; }).replace(/\n/g, "<br/>").replace(htmlcharegex,function(s) { return "&#x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + ";"; }); | 
					
						
							| 
									
										
										
										
											2017-04-13 18:28:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 07:36:02 +00:00
										 |  |  | function escapexlml(text/*:string*/)/*:string*/{ | 
					
						
							|  |  |  | 	var s = text + ''; | 
					
						
							|  |  |  | 	return s.replace(decregex, function(y) { return rencoding[y]; }).replace(htmlcharegex,function(s) { return "&#x" + (s.charCodeAt(0).toString(16)).toUpperCase() + ";"; }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-02 20:32:22 +00:00
										 |  |  | /* TODO: handle codepages */ | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var xlml_fixstr/*:StringConv*/ = /*#__PURE__*/(function() { | 
					
						
							| 
									
										
										
										
											2015-04-02 20:32:22 +00:00
										 |  |  | 	var entregex = /&#(\d+);/g; | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | 	function entrepl($$/*:string*/,$1/*:string*/)/*:string*/ { return String.fromCharCode(parseInt($1,10)); } | 
					
						
							|  |  |  | 	return function xlml_fixstr(str/*:string*/)/*:string*/ { return str.replace(entregex,entrepl); }; | 
					
						
							| 
									
										
										
										
											2015-04-02 20:32:22 +00:00
										 |  |  | })(); | 
					
						
							| 
									
										
										
										
											2022-03-16 03:18:09 +00:00
										 |  |  | function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\
"); } | 
					
						
							| 
									
										
										
										
											2015-04-02 20:32:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-18 21:29:39 +00:00
										 |  |  | /* note: xsd:boolean valid values: true / 1 / false / 0 */ | 
					
						
							| 
									
										
										
										
											2018-01-23 09:07:51 +00:00
										 |  |  | function parsexmlbool(value/*:any*/)/*:boolean*/ { | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	switch(value) { | 
					
						
							| 
									
										
										
										
											2022-04-18 21:29:39 +00:00
										 |  |  | 		case 1: case true:  case '1': case 'true':  return true; | 
					
						
							|  |  |  | 		case 0: case false: case '0': case 'false': return false; | 
					
						
							|  |  |  | 		//default: throw new Error("Invalid xsd:boolean " + value);
 | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-04-18 21:29:39 +00:00
										 |  |  | 	return false; | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-20 01:54:41 +00:00
										 |  |  | function utf8reada(orig/*:string*/)/*:string*/ { | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0; | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	while (i < orig.length) { | 
					
						
							|  |  |  | 		c = orig.charCodeAt(i++); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		if (c < 128) { out += String.fromCharCode(c); continue; } | 
					
						
							|  |  |  | 		d = orig.charCodeAt(i++); | 
					
						
							| 
									
										
										
										
											2017-07-10 22:18:18 +00:00
										 |  |  | 		if (c>191 && c<224) { f = ((c & 31) << 6); f |= (d & 63); out += String.fromCharCode(f); continue; } | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		e = orig.charCodeAt(i++); | 
					
						
							|  |  |  | 		if (c < 240) { out += String.fromCharCode(((c & 15) << 12) | ((d & 63) << 6) | (e & 63)); continue; } | 
					
						
							|  |  |  | 		f = orig.charCodeAt(i++); | 
					
						
							|  |  |  | 		w = (((c & 7) << 18) | ((d & 63) << 12) | ((e & 63) << 6) | (f & 63))-65536; | 
					
						
							|  |  |  | 		out += String.fromCharCode(0xD800 + ((w>>>10)&1023)); | 
					
						
							|  |  |  | 		out += String.fromCharCode(0xDC00 + (w&1023)); | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	return out; | 
					
						
							| 
									
										
										
										
											2022-03-20 01:54:41 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function utf8readb(data) { | 
					
						
							|  |  |  | 	var out = new_raw_buf(2*data.length), w, i, j = 1, k = 0, ww=0, c; | 
					
						
							|  |  |  | 	for(i = 0; i < data.length; i+=j) { | 
					
						
							|  |  |  | 		j = 1; | 
					
						
							|  |  |  | 		if((c=data.charCodeAt(i)) < 128) w = c; | 
					
						
							|  |  |  | 		else if(c < 224) { w = (c&31)*64+(data.charCodeAt(i+1)&63); j=2; } | 
					
						
							|  |  |  | 		else if(c < 240) { w=(c&15)*4096+(data.charCodeAt(i+1)&63)*64+(data.charCodeAt(i+2)&63); j=3; } | 
					
						
							|  |  |  | 		else { j = 4; | 
					
						
							|  |  |  | 			w = (c & 7)*262144+(data.charCodeAt(i+1)&63)*4096+(data.charCodeAt(i+2)&63)*64+(data.charCodeAt(i+3)&63); | 
					
						
							|  |  |  | 			w -= 65536; ww = 0xD800 + ((w>>>10)&1023); w = 0xDC00 + (w&1023); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if(ww !== 0) { out[k++] = ww&255; out[k++] = ww>>>8; ww = 0; } | 
					
						
							|  |  |  | 		out[k++] = w%256; out[k++] = w>>>8; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return out.slice(0,k).toString('ucs2'); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-20 01:54:41 +00:00
										 |  |  | function utf8readc(data) { return Buffer_from(data, 'binary').toString('utf8'); } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var utf8corpus = "foo bar baz\u00e2\u0098\u0083\u00f0\u009f\u008d\u00a3"; | 
					
						
							|  |  |  | var utf8read = has_buf && (/*#__PURE__*/utf8readc(utf8corpus) == /*#__PURE__*/utf8reada(utf8corpus) && utf8readc || /*#__PURE__*/utf8readb(utf8corpus) == /*#__PURE__*/utf8reada(utf8corpus) && utf8readb) || utf8reada; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var utf8write/*:StringConv*/ = has_buf ? function(data) { return Buffer_from(data, 'utf8').toString("binary"); } : function(orig/*:string*/)/*:string*/ { | 
					
						
							| 
									
										
										
										
											2017-10-17 00:14:32 +00:00
										 |  |  | 	var out/*:Array<string>*/ = [], i = 0, c = 0, d = 0; | 
					
						
							| 
									
										
										
										
											2017-09-30 06:18:11 +00:00
										 |  |  | 	while(i < orig.length) { | 
					
						
							|  |  |  | 		c = orig.charCodeAt(i++); | 
					
						
							|  |  |  | 		switch(true) { | 
					
						
							|  |  |  | 			case c < 128: out.push(String.fromCharCode(c)); break; | 
					
						
							|  |  |  | 			case c < 2048: | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(192 + (c >> 6))); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(128 + (c & 63))); | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case c >= 55296 && c < 57344: | 
					
						
							|  |  |  | 				c -= 55296; d = orig.charCodeAt(i++) - 56320 + (c<<10); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(240 + ((d >>18) & 7))); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(144 + ((d >>12) & 63))); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(128 + ((d >> 6) & 63))); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(128 + (d & 63))); | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			default: | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(224 + (c >> 12))); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(128 + ((c >> 6) & 63))); | 
					
						
							|  |  |  | 				out.push(String.fromCharCode(128 + (c & 63))); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return out.join(""); | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | // matches <foo>...</foo> extracts content
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var matchtag = /*#__PURE__*/(function() { | 
					
						
							| 
									
										
										
										
											2017-03-12 18:02:43 +00:00
										 |  |  | 	var mtcache/*:{[k:string]:RegExp}*/ = ({}/*:any*/); | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | 	return function matchtag(f/*:string*/,g/*:?string*/)/*:RegExp*/ { | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | 		var t = f+"|"+(g||""); | 
					
						
							| 
									
										
										
										
											2017-03-12 18:02:43 +00:00
										 |  |  | 		if(mtcache[t]) return mtcache[t]; | 
					
						
							| 
									
										
										
										
											2017-06-24 06:51:37 +00:00
										 |  |  | 		return (mtcache[t] = new RegExp('<(?:\\w+:)?'+f+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?'+f+'>',((g||"")/*:any*/))); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	}; | 
					
						
							|  |  |  | })(); | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var htmldecode/*:{(s:string):string}*/ = /*#__PURE__*/(function() { | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | 	var entities/*:Array<[RegExp, string]>*/ = [ | 
					
						
							| 
									
										
										
										
											2017-12-09 07:17:25 +00:00
										 |  |  | 		['nbsp', ' '], ['middot', '·'], | 
					
						
							|  |  |  | 		['quot', '"'], ['apos', "'"], ['gt',   '>'], ['lt',   '<'], ['amp',  '&'] | 
					
						
							| 
									
										
										
										
											2020-03-15 07:42:05 +00:00
										 |  |  | 	].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; }); | 
					
						
							| 
									
										
										
										
											2017-12-09 07:17:25 +00:00
										 |  |  | 	return function htmldecode(str/*:string*/)/*:string*/ { | 
					
						
							| 
									
										
										
										
											2019-10-05 16:50:31 +00:00
										 |  |  | 		var o = str | 
					
						
							|  |  |  | 				// Remove new lines and spaces from start of content
 | 
					
						
							|  |  |  | 				.replace(/^[\t\n\r ]+/, "") | 
					
						
							|  |  |  | 				// Remove new lines and spaces from end of content
 | 
					
						
							|  |  |  | 				.replace(/[\t\n\r ]+$/,"") | 
					
						
							|  |  |  | 				// Added line which removes any white space characters after and before html tags
 | 
					
						
							|  |  |  | 				.replace(/>\s+/g,">").replace(/\s+</g,"<") | 
					
						
							|  |  |  | 				// Replace remaining new lines and spaces with space
 | 
					
						
							|  |  |  | 				.replace(/[\t\n\r ]+/g, " ") | 
					
						
							|  |  |  | 				// Replace <br> tags with new lines
 | 
					
						
							|  |  |  | 				.replace(/<\s*[bB][rR]\s*\/?>/g,"\n") | 
					
						
							|  |  |  | 				// Strip HTML elements
 | 
					
						
							|  |  |  | 				.replace(/<[^>]*>/g,""); | 
					
						
							| 
									
										
										
										
											2017-12-09 07:17:25 +00:00
										 |  |  | 		for(var i = 0; i < entities.length; ++i) o = o.replace(entities[i][0], entities[i][1]); | 
					
						
							|  |  |  | 		return o; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | })(); | 
					
						
							| 
									
										
										
										
											2017-09-30 06:18:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var vtregex = /*#__PURE__*/(function(){ var vt_cache = {}; | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	return function vt_regex(bt) { | 
					
						
							|  |  |  | 		if(vt_cache[bt] !== undefined) return vt_cache[bt]; | 
					
						
							| 
									
										
										
										
											2017-07-05 22:27:54 +00:00
										 |  |  | 		return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)</(?:vt:)?" + bt + ">", 'g') ); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | };})(); | 
					
						
							| 
									
										
										
										
											2017-07-05 22:27:54 +00:00
										 |  |  | var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)</; | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | function parseVector(data/*:string*/, opts)/*:Array<{v:string,t:string}>*/ { | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	var h = parsexmltag(data); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | 	var matches/*:Array<string>*/ = data.match(vtregex(h.baseType))||[]; | 
					
						
							|  |  |  | 	var res/*:Array<any>*/ = []; | 
					
						
							| 
									
										
										
										
											2017-08-03 15:51:16 +00:00
										 |  |  | 	if(matches.length != h.size) { | 
					
						
							|  |  |  | 		if(opts.WTF) throw new Error("unexpected vector length " + matches.length + " != " + h.size); | 
					
						
							|  |  |  | 		return res; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | 	matches.forEach(function(x/*:string*/) { | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		var v = x.replace(vtvregex,"").match(vtmregex); | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | 		if(v) res.push({v:utf8read(v[2]), t:v[1]}); | 
					
						
							| 
									
										
										
										
											2013-05-02 16:59:27 +00:00
										 |  |  | 	}); | 
					
						
							|  |  |  | 	return res; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | var wtregex = /(^\s|\s$|\n)/; | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | function writetag(f/*:string*/,g/*:string*/)/*:string*/ { return '<' + f + (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + '</' + f + '>'; } | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | function wxt_helper(h)/*:string*/ { return keys(h).map(function(k) { return " " + k + '="' + h[k] + '"';}).join(""); } | 
					
						
							| 
									
										
										
										
											2017-12-30 05:40:35 +00:00
										 |  |  | function writextag(f/*:string*/,g/*:?string*/,h) { return '<' + f + ((h != null) ? wxt_helper(h) : "") + ((g != null) ? (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + '</' + f : "/") + '>';} | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | function write_w3cdtf(d/*:Date*/, t/*:?boolean*/)/*:string*/ { try { return d.toISOString().replace(/\.\d*/,""); } catch(e) { if(t) throw e; } return ""; } | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-16 19:45:54 +00:00
										 |  |  | function write_vt(s, xlsx/*:?boolean*/)/*:string*/ { | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 	switch(typeof s) { | 
					
						
							| 
									
										
										
										
											2020-05-16 19:45:54 +00:00
										 |  |  | 		case 'string': | 
					
						
							|  |  |  | 			var o = writextag('vt:lpwstr', escapexml(s)); | 
					
						
							|  |  |  | 			if(xlsx) o = o.replace(/"/g, "_x0022_"); | 
					
						
							|  |  |  | 			return o; | 
					
						
							| 
									
										
										
										
											2019-11-27 09:47:16 +00:00
										 |  |  | 		case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s))); | 
					
						
							| 
									
										
										
										
											2014-06-29 18:29:45 +00:00
										 |  |  | 		case 'boolean': return writextag('vt:bool',s?'true':'false'); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s)); | 
					
						
							|  |  |  | 	throw new Error("Unable to serialize " + s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-09 01:44:10 +00:00
										 |  |  | function xlml_normalize(d)/*:string*/ { | 
					
						
							|  |  |  | 	if(has_buf &&/*::typeof Buffer !== "undefined" && d != null && d instanceof Buffer &&*/ Buffer.isBuffer(d)) return d.toString('utf8'); | 
					
						
							|  |  |  | 	if(typeof d === 'string') return d; | 
					
						
							|  |  |  | 	/* duktape */ | 
					
						
							|  |  |  | 	if(typeof Uint8Array !== 'undefined' && d instanceof Uint8Array) return utf8read(a2s(ab2a(d))); | 
					
						
							|  |  |  | 	throw new Error("Bad input format: expected Buffer or string"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | /* UOS uses CJK in tags */ | 
					
						
							| 
									
										
										
										
											2022-06-27 05:47:58 +00:00
										 |  |  | var xlmlregex = /<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/](?:[^>=]|="[^"]*?")*)?>/mg; | 
					
						
							| 
									
										
										
										
											2022-03-09 01:44:10 +00:00
										 |  |  | //var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/mg;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | var XMLNS = ({ | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | 	CORE_PROPS: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties', | 
					
						
							|  |  |  | 	CUST_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", | 
					
						
							|  |  |  | 	EXT_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", | 
					
						
							|  |  |  | 	CT: 'http://schemas.openxmlformats.org/package/2006/content-types', | 
					
						
							|  |  |  | 	RELS: 'http://schemas.openxmlformats.org/package/2006/relationships', | 
					
						
							| 
									
										
										
										
											2022-03-14 06:51:33 +00:00
										 |  |  | 	TCMNT: 'http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments', | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	'dc': 'http://purl.org/dc/elements/1.1/', | 
					
						
							|  |  |  | 	'dcterms': 'http://purl.org/dc/terms/', | 
					
						
							|  |  |  | 	'dcmitype': 'http://purl.org/dc/dcmitype/', | 
					
						
							|  |  |  | 	'mx': 'http://schemas.microsoft.com/office/mac/excel/2008/main', | 
					
						
							|  |  |  | 	'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', | 
					
						
							|  |  |  | 	'sjs': 'http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties', | 
					
						
							|  |  |  | 	'vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes', | 
					
						
							|  |  |  | 	'xsi': 'http://www.w3.org/2001/XMLSchema-instance', | 
					
						
							|  |  |  | 	'xsd': 'http://www.w3.org/2001/XMLSchema' | 
					
						
							| 
									
										
										
										
											2017-02-10 19:23:01 +00:00
										 |  |  | }/*:any*/); | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-12 14:05:57 +00:00
										 |  |  | var XMLNS_main = [ | 
					
						
							| 
									
										
										
										
											2014-05-16 00:33:34 +00:00
										 |  |  | 	'http://schemas.openxmlformats.org/spreadsheetml/2006/main', | 
					
						
							|  |  |  | 	'http://purl.oclc.org/ooxml/spreadsheetml/main', | 
					
						
							|  |  |  | 	'http://schemas.microsoft.com/office/excel/2006/main', | 
					
						
							|  |  |  | 	'http://schemas.microsoft.com/office/excel/2006/2' | 
					
						
							|  |  |  | ]; | 
					
						
							| 
									
										
										
										
											2015-04-02 20:32:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-14 08:19:51 +00:00
										 |  |  | var XLMLNS = ({ | 
					
						
							|  |  |  | 	'o':    'urn:schemas-microsoft-com:office:office', | 
					
						
							|  |  |  | 	'x':    'urn:schemas-microsoft-com:office:excel', | 
					
						
							|  |  |  | 	'ss':   'urn:schemas-microsoft-com:office:spreadsheet', | 
					
						
							|  |  |  | 	'dt':   'uuid:C2F41010-65B3-11d1-A29F-00AA00C14882', | 
					
						
							| 
									
										
										
										
											2017-04-02 06:47:25 +00:00
										 |  |  | 	'mv':   'http://macVmlSchemaUri', | 
					
						
							|  |  |  | 	'v':    'urn:schemas-microsoft-com:vml', | 
					
						
							| 
									
										
										
										
											2017-03-14 08:19:51 +00:00
										 |  |  | 	'html': 'http://www.w3.org/TR/REC-html40' | 
					
						
							|  |  |  | }/*:any*/); |