From 88225f5fd565648a36a299d9628722c023af47a5 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sat, 12 Feb 2022 01:31:47 -0500 Subject: [PATCH] esm support and deno demo --- .gitignore | 1 + .spelling | 1 + Makefile | 7 +- README.md | 44 +- bits/19_fsutils.js | 11 + bits/20_jsutils.js | 2 +- bits/40_harb.js | 2 +- bits/87_read.js | 2 +- bits/88_write.js | 1 + demos/deno/Makefile | 11 + demos/deno/README.md | 74 + demos/deno/doit.ts | 43 + demos/deno/jspm.ts | 4 + demos/deno/mjs.ts | 6 + demos/deno/node.ts | 6 + demos/deno/x.ts | 4 + dist/cpexcel.full.mjs | 1502 +++ docbits/10_install.md | 40 +- misc/02_codepage.js | 20 +- misc/19_esmfs.js | 60 - misc/19_mjsfs.js | 15 +- misc/docs/README.md | 44 +- misc/esm.lst | 79 - types/index.d.ts | 15 +- types/xlsx-tests.ts | 2 +- xlsx.esm.mjs | 23215 ---------------------------------------- xlsx.mjs | 43 +- 27 files changed, 1869 insertions(+), 23385 deletions(-) create mode 100644 demos/deno/Makefile create mode 100644 demos/deno/README.md create mode 100644 demos/deno/doit.ts create mode 100644 demos/deno/jspm.ts create mode 100644 demos/deno/mjs.ts create mode 100644 demos/deno/node.ts create mode 100644 demos/deno/x.ts create mode 100644 dist/cpexcel.full.mjs delete mode 100644 misc/19_esmfs.js delete mode 100644 misc/esm.lst delete mode 100644 xlsx.esm.mjs diff --git a/.gitignore b/.gitignore index e160bd2..03476cc 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ tmp *.[oO][dD][sS] *.[fF][oO][dD][sS] *.[xX][mM][lL] +*.[xX][lL][mM][lL] *.[uU][oO][sS] *.[wW][kKqQbB][S1234567890] *.[qQ][pP][wW] diff --git a/.spelling b/.spelling index 99aa170..3dee765 100644 --- a/.spelling +++ b/.spelling @@ -35,6 +35,7 @@ tooltips Browserify CDNjs CommonJS +Deno Ethercalc ExtendScript IndexedDB diff --git a/Makefile b/Makefile index 3bdf469..1de742c 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,6 @@ MINITGT=xlsx.mini.js MINIFLOW=xlsx.mini.flow.js MINIDEPS=$(shell cat mini.lst) -NODESMTGT=xlsx.esm.mjs -NODESMDEPS=$(shell cat misc/esm.lst) ESMJSTGT=xlsx.mjs ESMJSDEPS=$(shell cat misc/mjs.lst) @@ -31,7 +29,7 @@ CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar ## Main Targets .PHONY: all -all: $(TARGET) $(AUXTARGETS) $(AUXSCPTS) $(MINITGT) $(NODESMTGT) $(ESMJSTGT) ## Build library and auxiliary scripts +all: $(TARGET) $(AUXTARGETS) $(AUXSCPTS) $(MINITGT) $(ESMJSTGT) ## Build library and auxiliary scripts $(FLOWTGTS): %.js : %.flow.js node -e 'process.stdout.write(require("fs").readFileSync("$<","utf8").replace(/^[ \t]*\/\*[:#][^*]*\*\/\s*(\n)?/gm,"").replace(/\/\*[:#][^*]*\*\//gm,""))' > $@ @@ -42,9 +40,6 @@ $(FLOWTARGET): $(DEPS) $(MINIFLOW): $(MINIDEPS) cat $^ | tr -d '\15\32' > $@ -$(NODESMTGT): $(NODESMDEPS) - cat $^ | tr -d '\15\32' > $@ - $(ESMJSTGT): $(ESMJSDEPS) cat $^ | tr -d '\15\32' > $@ diff --git a/README.md b/README.md index 58d1dba..364affb 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,8 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! ### Installation +**Standalone Browser Scripts** + The complete browser standalone build is saved to `dist/xlsx.full.min.js` and can be directly added to a page with a `script` tag: @@ -167,18 +169,50 @@ be configured to remove support with `resolve.alias`: +With [bower](https://bower.io/search/?q=js-xlsx): + +```bash +$ bower install js-xlsx +``` + +**Deno** + +The [`sheetjs`](https://deno.land/x/sheetjs) package is available on deno: + +```ts +import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs' +``` + +**NodeJS** + With [npm](https://www.npmjs.org/package/xlsx): ```bash $ npm install xlsx ``` -With [bower](https://bower.io/search/?q=js-xlsx): +By default, the module supports `require`: -```bash -$ bower install js-xlsx +```js +var XLSX = require("xlsx"); ``` +The module also ships with `xlsx.mjs` for use with `import`: + +```js +import * as XLSX from 'xlsx/xlsx.mjs'; + +/* load 'fs' for readFile and writeFile support */ +import * as fs from 'fs'; +XLSX.set_fs(fs); + +/* load the codepage support library for extended support with older formats */ +import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cpexcel); +``` + +**PhotoShop and InDesign** + `dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign that is included in the `npm` package. It can be directly referenced with a `#include` directive: @@ -1650,7 +1684,9 @@ data grid for previewing and modifying structured data in the web browser. The [`react-data-grid`](https://npm.im/react-data-grid) is a data grid tailored for react. It expects two properties: `rows` of data objects and `columns` which describe the columns. For the purposes of massaging the data to fit the react -data grid API it is easiest to start from an array of arrays: +data grid API it is easiest to start from an array of arrays. + +This demo starts by fetching a remote file and using `XLSX.read` to extract: ```js import { useEffect, useState } from "react"; diff --git a/bits/19_fsutils.js b/bits/19_fsutils.js index 70dc576..2d3a35d 100644 --- a/bits/19_fsutils.js +++ b/bits/19_fsutils.js @@ -11,6 +11,16 @@ function blobify(data) { function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); + if(typeof Deno !== 'undefined') { + /* in this spot, it's safe to assume typed arrays and TextEncoder/TextDecoder exist */ + if(enc) switch(enc) { + case "utf8": payload = new TextEncoder(enc).encode(payload); break; + case "binary": payload = s2ab(payload); break; + /* TODO: binary equivalent */ + default: throw new Error("Unsupported encoding " + enc); + } + return Deno.writeFileSync(fname, payload); + } var data = (enc == "utf8") ? utf8write(payload) : payload; /*:: declare var IE_SaveFile: any; */ if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); @@ -50,6 +60,7 @@ function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { /* read binary data from file */ function read_binary(path/*:string*/) { if(typeof _fs !== 'undefined') return _fs.readFileSync(path); + if(typeof Deno !== 'undefined') return Deno.readFileSync(path); // $FlowIgnore if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript // $FlowIgnore diff --git a/bits/20_jsutils.js b/bits/20_jsutils.js index d062e59..6164bcc 100644 --- a/bits/20_jsutils.js +++ b/bits/20_jsutils.js @@ -146,7 +146,7 @@ function fuzzydate(s/*:string*/)/*:Date*/ { if(isNaN(d)) return n; var lower = s.toLowerCase(); if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) { - lower = lower.replace(/[^a-z]/g,""); + lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""); if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n; } else if(lower.match(/[a-z]/)) return n; if(y < 0 || y > 8099) return n; diff --git a/bits/40_harb.js b/bits/40_harb.js index dd512e5..980ba1d 100644 --- a/bits/40_harb.js +++ b/bits/40_harb.js @@ -508,7 +508,7 @@ var SYLK = (function() { case 'b': o += cell.v ? "TRUE" : "FALSE"; break; case 'e': o += cell.w || cell.v; break; case 'd': o += '"' + (cell.w || cell.v) + '"'; break; - case 's': o += '"' + cell.v.replace(/"/g,"") + '"'; break; + case 's': o += '"' + cell.v.replace(/"/g,"").replace(/;/g, ";;") + '"'; break; } return o; } diff --git a/bits/87_read.js b/bits/87_read.js index 5ddcd1b..b698bcf 100644 --- a/bits/87_read.js +++ b/bits/87_read.js @@ -72,7 +72,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ { _ssfopts = {}; if(o.dateNF) _ssfopts.dateNF = o.dateNF; if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; - if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); } + if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); if(typeof Uint8Array !== 'undefined' && !has_buf) o.type = "array"; } if(o.type == "string") { str = true; o.type = "binary"; o.codepage = 65001; d = bstrify(data); } if(o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof ArrayBuffer !== 'undefined') { // $FlowIgnore diff --git a/bits/88_write.js b/bits/88_write.js index 7d066a4..fc580f6 100644 --- a/bits/88_write.js +++ b/bits/88_write.js @@ -48,6 +48,7 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { default: throw new Error("Unrecognized type " + o.type); } var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts); + if(typeof Deno !== "undefined" && typeof out == "string") out = new Uint8Array(s2ab(out)); /*jshint -W083 */ if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef /*jshint +W083 */ diff --git a/demos/deno/Makefile b/demos/deno/Makefile new file mode 100644 index 0000000..fa0a452 --- /dev/null +++ b/demos/deno/Makefile @@ -0,0 +1,11 @@ +TESTS= x mjs jspm +UNSTABLE= node +.PHONY: test +test: $(UNSTABLE) $(TESTS) + +$(TESTS): %: %.ts doit.ts + deno run --allow-read --allow-write $< + +# --unstable is required, see https://github.com/denoland/deno_std/issues/1900 +$(UNSTABLE): %: %.ts doit.ts + deno run --allow-read --allow-write --unstable $< diff --git a/demos/deno/README.md b/demos/deno/README.md new file mode 100644 index 0000000..7a1ea45 --- /dev/null +++ b/demos/deno/README.md @@ -0,0 +1,74 @@ +# Deno + +Deno is a runtime capable of running JS code including this library. There are +a few different builds and recommended use cases as covered in this demo. + +For user code, [the `sheetjs` module](https://deno.land/x/sheetjs) can be used. + +## Reading and Writing Files + +In general, the command-line flag `--allow-read` must be passed to enable file +reading. The flag `--allow-write` must be passed to enable file writing. + +Starting in version 0.18.1, this library will check for the `Deno` global and +use `Deno.readFileSync` and `Deno.writeFileSync` behind the scenes. + +For older versions, the API functions must be called from user code. + +_Reading a File_ + +```ts +const filedata = Deno.readFileSync("test.xlsx"); +const workbook = XLSX.read(filedata, {type: "buffer"}); +/* DO SOMETHING WITH workbook HERE */ +``` + +_Writing a File_ + +Older versions of the library did not properly detect features from Deno, so the +`buffer` export would return an array of bytes. Since `Deno.writeFileSync` does +not handle byte arrays, user code must generate a `Uint8Array` first: + +```ts +const buf = XLSX.write(workbook, {type: "buffer", bookType: "xlsb"}); +const u8: Uint8Array = new Uint8Array(buf); +Deno.writeFileSync("test.xlsb", u8); +``` + +## Demos + +All demos attempt to read a file and write a new file. [`doit.ts`](./doit.ts) +accepts the `XLSX` module as an argument. + +- `x` imports the ESM build without the codepage library: + +```ts +import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs'; +``` + +- `mjs` imports the ESM build and the associated codepage library: + +```ts +import * as XLSX from '../../xlsx.mjs'; +/* recommended for reading XLS files */ +import * as cptable from '../../dist/cptable.full.mjs'; +XLSX.set_cptable(cptable); +``` + +- `jspm` imports the browser standalone script using JSPM: + +```ts +import * as XLSX from 'https://jspm.dev/npm:xlsx!cjs'; +``` + +- `node` uses the node compatibility layer: + +```ts +import { createRequire } from 'https://deno.land/std/node/module.ts'; +const require = createRequire(import.meta.url); +const XLSX = require('../../'); +``` + + + +[![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/js-xlsx?pixel)](https://github.com/SheetJS/js-xlsx) diff --git a/demos/deno/doit.ts b/demos/deno/doit.ts new file mode 100644 index 0000000..d22a580 --- /dev/null +++ b/demos/deno/doit.ts @@ -0,0 +1,43 @@ +const bts = [ + "xlsx", + "xlsb", + "xls", + "csv", + "fods", + "xlml", + "slk" +]; +export default function doit(XLSX: any, tag: string) { + const path = "number_format_greek.xls"; + let workbook: any; + + /* read file */ + try { + workbook = XLSX.readFile(path); + } catch(e) { + console.log(e); + console.error("Cannot use readFile, falling back to read"); + const rawdata = Deno.readFileSync(path); + workbook = XLSX.read(rawdata, {type: "buffer"}); + } + + /* write file */ + try { + bts.forEach(bt => { + console.log(bt); + XLSX.writeFile(workbook, `${tag}.${bt}`); + }); + } catch(e) { + console.log(e); + console.error("Cannot use writeFile, falling back to write"); + bts.forEach(bt => { + console.log(bt); + const buf = XLSX.write(workbook, {type: "buffer", bookType: bt}); + if(typeof buf == "string") { + const nbuf = new Uint8Array(buf.length); + for(let i = 0; i < buf.length; ++i) nbuf[i] = buf.charCodeAt(i); + Deno.writeFileSync(`${tag}.${bt}`, nbuf); + } else Deno.writeFileSync(`${tag}.${bt}`, new Uint8Array(buf)); + }); + } +} diff --git a/demos/deno/jspm.ts b/demos/deno/jspm.ts new file mode 100644 index 0000000..4ecb6ca --- /dev/null +++ b/demos/deno/jspm.ts @@ -0,0 +1,4 @@ +import * as XLSX from 'https://jspm.dev/npm:xlsx!cjs' + +import doit from './doit.ts'; +doit(XLSX, "jspm"); diff --git a/demos/deno/mjs.ts b/demos/deno/mjs.ts new file mode 100644 index 0000000..b36323c --- /dev/null +++ b/demos/deno/mjs.ts @@ -0,0 +1,6 @@ +import * as XLSX from '../../xlsx.mjs'; +import * as cpexcel from '../../dist/cpexcel.full.mjs'; +XLSX.set_cptable(cpexcel); + +import doit from './doit.ts'; +doit(XLSX, "mjs"); diff --git a/demos/deno/node.ts b/demos/deno/node.ts new file mode 100644 index 0000000..7bd2c9d --- /dev/null +++ b/demos/deno/node.ts @@ -0,0 +1,6 @@ +import { createRequire } from 'https://deno.land/std/node/module.ts'; +const require = createRequire(import.meta.url); +const XLSX = require('../../'); + +import doit from './doit.ts'; +doit(XLSX, "node"); diff --git a/demos/deno/x.ts b/demos/deno/x.ts new file mode 100644 index 0000000..090021a --- /dev/null +++ b/demos/deno/x.ts @@ -0,0 +1,4 @@ +import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs'; + +import doit from './doit.ts'; +doit(XLSX, "x"); diff --git a/dist/cpexcel.full.mjs b/dist/cpexcel.full.mjs new file mode 100644 index 0000000..b4565ac --- /dev/null +++ b/dist/cpexcel.full.mjs @@ -0,0 +1,1502 @@ +/*! cpexcel.mjs (C) 2013-present SheetJS -- http://sheetjs.com */ +/*jshint -W100 */ +export const version = "1.15.0"; +const cptable = {}; +cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[620] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàąçêëèïîćÄĄĘęłôöĆûùŚÖÜ¢Ł¥śƒŹŻóÓńŃźż¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[737] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[850] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[852] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[857] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[861] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[865] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[866] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[874] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[895] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ČüéďäĎŤčěĚĹÍľǪÄÁÉžŽôöÓůÚýÖÜŠĽÝŘťáíóúňŇŮÔšřŕŔ¼§«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[932] = (function(){ var d = [], e = {}, D = [], j; +D[0] = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~���������������������������������。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚��������������������������������".split(""); +for(j = 0; j != D[0].length; ++j) if(D[0][j].charCodeAt(0) !== 0xFFFD) { e[D[0][j]] = 0 + j; d[0 + j] = D[0][j];} +D[129] = "���������������������������������������������������������������� 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈〉《》「」『』【】+-±×�÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓�����������∈∋⊆⊇⊂⊃∪∩��������∧∨¬⇒⇔∀∃�����������∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬�������ʼn♯♭♪†‡¶����◯���".split(""); +for(j = 0; j != D[129].length; ++j) if(D[129][j].charCodeAt(0) !== 0xFFFD) { e[D[129][j]] = 33024 + j; d[33024 + j] = D[129][j];} +D[130] = "�������������������������������������������������������������������������������0123456789�������ABCDEFGHIJKLMNOPQRSTUVWXYZ�������abcdefghijklmnopqrstuvwxyz����ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん��������������".split(""); +for(j = 0; j != D[130].length; ++j) if(D[130][j].charCodeAt(0) !== 0xFFFD) { e[D[130][j]] = 33280 + j; d[33280 + j] = D[130][j];} +D[131] = "����������������������������������������������������������������ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミ�ムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ��������ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ��������αβγδεζηθικλμνξοπρστυφχψω�����������������������������������������".split(""); +for(j = 0; j != D[131].length; ++j) if(D[131][j].charCodeAt(0) !== 0xFFFD) { e[D[131][j]] = 33536 + j; d[33536 + j] = D[131][j];} +D[132] = "����������������������������������������������������������������АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ���������������абвгдеёжзийклмн�опрстуфхцчшщъыьэюя�������������─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂�����������������������������������������������������������������".split(""); +for(j = 0; j != D[132].length; ++j) if(D[132][j].charCodeAt(0) !== 0xFFFD) { e[D[132][j]] = 33792 + j; d[33792 + j] = D[132][j];} +D[135] = "����������������������������������������������������������������①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ�㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡��������㍻�〝〟№㏍℡㊤㊥㊦㊧㊨㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪���������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[135].length; ++j) if(D[135][j].charCodeAt(0) !== 0xFFFD) { e[D[135][j]] = 34560 + j; d[34560 + j] = D[135][j];} +D[136] = "���������������������������������������������������������������������������������������������������������������������������������������������������������������亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭���".split(""); +for(j = 0; j != D[136].length; ++j) if(D[136][j].charCodeAt(0) !== 0xFFFD) { e[D[136][j]] = 34816 + j; d[34816 + j] = D[136][j];} +D[137] = "����������������������������������������������������������������院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円�園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改���".split(""); +for(j = 0; j != D[137].length; ++j) if(D[137][j].charCodeAt(0) !== 0xFFFD) { e[D[137][j]] = 35072 + j; d[35072 + j] = D[137][j];} +D[138] = "����������������������������������������������������������������魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫�橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄���".split(""); +for(j = 0; j != D[138].length; ++j) if(D[138][j].charCodeAt(0) !== 0xFFFD) { e[D[138][j]] = 35328 + j; d[35328 + j] = D[138][j];} +D[139] = "����������������������������������������������������������������機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救�朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈���".split(""); +for(j = 0; j != D[139].length; ++j) if(D[139][j].charCodeAt(0) !== 0xFFFD) { e[D[139][j]] = 35584 + j; d[35584 + j] = D[139][j];} +D[140] = "����������������������������������������������������������������掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨�劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向���".split(""); +for(j = 0; j != D[140].length; ++j) if(D[140][j].charCodeAt(0) !== 0xFFFD) { e[D[140][j]] = 35840 + j; d[35840 + j] = D[140][j];} +D[141] = "����������������������������������������������������������������后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降�項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷���".split(""); +for(j = 0; j != D[141].length; ++j) if(D[141][j].charCodeAt(0) !== 0xFFFD) { e[D[141][j]] = 36096 + j; d[36096 + j] = D[141][j];} +D[142] = "����������������������������������������������������������������察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止�死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周���".split(""); +for(j = 0; j != D[142].length; ++j) if(D[142][j].charCodeAt(0) !== 0xFFFD) { e[D[142][j]] = 36352 + j; d[36352 + j] = D[142][j];} +D[143] = "����������������������������������������������������������������宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳�準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾���".split(""); +for(j = 0; j != D[143].length; ++j) if(D[143][j].charCodeAt(0) !== 0xFFFD) { e[D[143][j]] = 36608 + j; d[36608 + j] = D[143][j];} +D[144] = "����������������������������������������������������������������拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨�逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線���".split(""); +for(j = 0; j != D[144].length; ++j) if(D[144][j].charCodeAt(0) !== 0xFFFD) { e[D[144][j]] = 36864 + j; d[36864 + j] = D[144][j];} +D[145] = "����������������������������������������������������������������繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻�操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只���".split(""); +for(j = 0; j != D[145].length; ++j) if(D[145][j].charCodeAt(0) !== 0xFFFD) { e[D[145][j]] = 37120 + j; d[37120 + j] = D[145][j];} +D[146] = "����������������������������������������������������������������叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄�逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓���".split(""); +for(j = 0; j != D[146].length; ++j) if(D[146][j].charCodeAt(0) !== 0xFFFD) { e[D[146][j]] = 37376 + j; d[37376 + j] = D[146][j];} +D[147] = "����������������������������������������������������������������邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬�凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入���".split(""); +for(j = 0; j != D[147].length; ++j) if(D[147][j].charCodeAt(0) !== 0xFFFD) { e[D[147][j]] = 37632 + j; d[37632 + j] = D[147][j];} +D[148] = "����������������������������������������������������������������如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅�楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美���".split(""); +for(j = 0; j != D[148].length; ++j) if(D[148][j].charCodeAt(0) !== 0xFFFD) { e[D[148][j]] = 37888 + j; d[37888 + j] = D[148][j];} +D[149] = "����������������������������������������������������������������鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷�斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋���".split(""); +for(j = 0; j != D[149].length; ++j) if(D[149][j].charCodeAt(0) !== 0xFFFD) { e[D[149][j]] = 38144 + j; d[38144 + j] = D[149][j];} +D[150] = "����������������������������������������������������������������法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆�摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒���".split(""); +for(j = 0; j != D[150].length; ++j) if(D[150][j].charCodeAt(0) !== 0xFFFD) { e[D[150][j]] = 38400 + j; d[38400 + j] = D[150][j];} +D[151] = "����������������������������������������������������������������諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲�沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯���".split(""); +for(j = 0; j != D[151].length; ++j) if(D[151][j].charCodeAt(0) !== 0xFFFD) { e[D[151][j]] = 38656 + j; d[38656 + j] = D[151][j];} +D[152] = "����������������������������������������������������������������蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕��������������������������������������������弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲���".split(""); +for(j = 0; j != D[152].length; ++j) if(D[152][j].charCodeAt(0) !== 0xFFFD) { e[D[152][j]] = 38912 + j; d[38912 + j] = D[152][j];} +D[153] = "����������������������������������������������������������������僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭�凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨���".split(""); +for(j = 0; j != D[153].length; ++j) if(D[153][j].charCodeAt(0) !== 0xFFFD) { e[D[153][j]] = 39168 + j; d[39168 + j] = D[153][j];} +D[154] = "����������������������������������������������������������������咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸�噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩���".split(""); +for(j = 0; j != D[154].length; ++j) if(D[154][j].charCodeAt(0) !== 0xFFFD) { e[D[154][j]] = 39424 + j; d[39424 + j] = D[154][j];} +D[155] = "����������������������������������������������������������������奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀�它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏���".split(""); +for(j = 0; j != D[155].length; ++j) if(D[155][j].charCodeAt(0) !== 0xFFFD) { e[D[155][j]] = 39680 + j; d[39680 + j] = D[155][j];} +D[156] = "����������������������������������������������������������������廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠�怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛���".split(""); +for(j = 0; j != D[156].length; ++j) if(D[156][j].charCodeAt(0) !== 0xFFFD) { e[D[156][j]] = 39936 + j; d[39936 + j] = D[156][j];} +D[157] = "����������������������������������������������������������������戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫�捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼���".split(""); +for(j = 0; j != D[157].length; ++j) if(D[157][j].charCodeAt(0) !== 0xFFFD) { e[D[157][j]] = 40192 + j; d[40192 + j] = D[157][j];} +D[158] = "����������������������������������������������������������������曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎�梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣���".split(""); +for(j = 0; j != D[158].length; ++j) if(D[158][j].charCodeAt(0) !== 0xFFFD) { e[D[158][j]] = 40448 + j; d[40448 + j] = D[158][j];} +D[159] = "����������������������������������������������������������������檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯�麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌���".split(""); +for(j = 0; j != D[159].length; ++j) if(D[159][j].charCodeAt(0) !== 0xFFFD) { e[D[159][j]] = 40704 + j; d[40704 + j] = D[159][j];} +D[224] = "����������������������������������������������������������������漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝�烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱���".split(""); +for(j = 0; j != D[224].length; ++j) if(D[224][j].charCodeAt(0) !== 0xFFFD) { e[D[224][j]] = 57344 + j; d[57344 + j] = D[224][j];} +D[225] = "����������������������������������������������������������������瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿�痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬���".split(""); +for(j = 0; j != D[225].length; ++j) if(D[225][j].charCodeAt(0) !== 0xFFFD) { e[D[225][j]] = 57600 + j; d[57600 + j] = D[225][j];} +D[226] = "����������������������������������������������������������������磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰�窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆���".split(""); +for(j = 0; j != D[226].length; ++j) if(D[226][j].charCodeAt(0) !== 0xFFFD) { e[D[226][j]] = 57856 + j; d[57856 + j] = D[226][j];} +D[227] = "����������������������������������������������������������������紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷�縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋���".split(""); +for(j = 0; j != D[227].length; ++j) if(D[227][j].charCodeAt(0) !== 0xFFFD) { e[D[227][j]] = 58112 + j; d[58112 + j] = D[227][j];} +D[228] = "����������������������������������������������������������������隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤�艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈���".split(""); +for(j = 0; j != D[228].length; ++j) if(D[228][j].charCodeAt(0) !== 0xFFFD) { e[D[228][j]] = 58368 + j; d[58368 + j] = D[228][j];} +D[229] = "����������������������������������������������������������������蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬�蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞���".split(""); +for(j = 0; j != D[229].length; ++j) if(D[229][j].charCodeAt(0) !== 0xFFFD) { e[D[229][j]] = 58624 + j; d[58624 + j] = D[229][j];} +D[230] = "����������������������������������������������������������������襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧�諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊���".split(""); +for(j = 0; j != D[230].length; ++j) if(D[230][j].charCodeAt(0) !== 0xFFFD) { e[D[230][j]] = 58880 + j; d[58880 + j] = D[230][j];} +D[231] = "����������������������������������������������������������������蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜�轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮���".split(""); +for(j = 0; j != D[231].length; ++j) if(D[231][j].charCodeAt(0) !== 0xFFFD) { e[D[231][j]] = 59136 + j; d[59136 + j] = D[231][j];} +D[232] = "����������������������������������������������������������������錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙�閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰���".split(""); +for(j = 0; j != D[232].length; ++j) if(D[232][j].charCodeAt(0) !== 0xFFFD) { e[D[232][j]] = 59392 + j; d[59392 + j] = D[232][j];} +D[233] = "����������������������������������������������������������������顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃�騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈���".split(""); +for(j = 0; j != D[233].length; ++j) if(D[233][j].charCodeAt(0) !== 0xFFFD) { e[D[233][j]] = 59648 + j; d[59648 + j] = D[233][j];} +D[234] = "����������������������������������������������������������������鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯�黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙�������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[234].length; ++j) if(D[234][j].charCodeAt(0) !== 0xFFFD) { e[D[234][j]] = 59904 + j; d[59904 + j] = D[234][j];} +D[237] = "����������������������������������������������������������������纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏�塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱���".split(""); +for(j = 0; j != D[237].length; ++j) if(D[237][j].charCodeAt(0) !== 0xFFFD) { e[D[237][j]] = 60672 + j; d[60672 + j] = D[237][j];} +D[238] = "����������������������������������������������������������������犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙�蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑��ⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹ¬¦'"���".split(""); +for(j = 0; j != D[238].length; ++j) if(D[238][j].charCodeAt(0) !== 0xFFFD) { e[D[238][j]] = 60928 + j; d[60928 + j] = D[238][j];} +D[250] = "����������������������������������������������������������������ⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊�兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯���".split(""); +for(j = 0; j != D[250].length; ++j) if(D[250][j].charCodeAt(0) !== 0xFFFD) { e[D[250][j]] = 64000 + j; d[64000 + j] = D[250][j];} +D[251] = "����������������������������������������������������������������涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神�祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙���".split(""); +for(j = 0; j != D[251].length; ++j) if(D[251][j].charCodeAt(0) !== 0xFFFD) { e[D[251][j]] = 64256 + j; d[64256 + j] = D[251][j];} +D[252] = "����������������������������������������������������������������髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[252].length; ++j) if(D[252][j].charCodeAt(0) !== 0xFFFD) { e[D[252][j]] = 64512 + j; d[64512 + j] = D[252][j];} +return {"enc": e, "dec": d }; })(); +cptable[936] = (function(){ var d = [], e = {}, D = [], j; +D[0] = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�������������������������������������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[0].length; ++j) if(D[0][j].charCodeAt(0) !== 0xFFFD) { e[D[0][j]] = 0 + j; d[0 + j] = D[0][j];} +D[129] = "����������������������������������������������������������������丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪乫乬乭乮乯乲乴乵乶乷乸乹乺乻乼乽乿亀亁亂亃亄亅亇亊�亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂伃伄伅伆伇伈伋伌伒伓伔伕伖伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾伿佀佁佂佄佅佇佈佉佊佋佌佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢�".split(""); +for(j = 0; j != D[129].length; ++j) if(D[129][j].charCodeAt(0) !== 0xFFFD) { e[D[129][j]] = 33024 + j; d[33024 + j] = D[129][j];} +D[130] = "����������������������������������������������������������������侤侫侭侰侱侲侳侴侶侷侸侹侺侻侼侽侾俀俁係俆俇俈俉俋俌俍俒俓俔俕俖俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿倀倁倂倃倄倅倆倇倈倉倊�個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯倰倱倲倳倴倵倶倷倸倹倻倽倿偀偁偂偄偅偆偉偊偋偍偐偑偒偓偔偖偗偘偙偛偝偞偟偠偡偢偣偤偦偧偨偩偪偫偭偮偯偰偱偲偳側偵偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎傏傐傑傒傓傔傕傖傗傘備傚傛傜傝傞傟傠傡傢傤傦傪傫傭傮傯傰傱傳傴債傶傷傸傹傼�".split(""); +for(j = 0; j != D[130].length; ++j) if(D[130][j].charCodeAt(0) !== 0xFFFD) { e[D[130][j]] = 33280 + j; d[33280 + j] = D[130][j];} +D[131] = "����������������������������������������������������������������傽傾傿僀僁僂僃僄僅僆僇僈僉僊僋僌働僎僐僑僒僓僔僕僗僘僙僛僜僝僞僟僠僡僢僣僤僥僨僩僪僫僯僰僱僲僴僶僷僸價僺僼僽僾僿儀儁儂儃億儅儈�儉儊儌儍儎儏儐儑儓儔儕儖儗儘儙儚儛儜儝儞償儠儢儣儤儥儦儧儨儩優儫儬儭儮儯儰儱儲儳儴儵儶儷儸儹儺儻儼儽儾兂兇兊兌兎兏児兒兓兗兘兙兛兝兞兟兠兡兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦冧冨冩冪冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒凓凔凕凖凗�".split(""); +for(j = 0; j != D[131].length; ++j) if(D[131][j].charCodeAt(0) !== 0xFFFD) { e[D[131][j]] = 33536 + j; d[33536 + j] = D[131][j];} +D[132] = "����������������������������������������������������������������凘凙凚凜凞凟凢凣凥処凧凨凩凪凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄剅剆則剈剉剋剎剏剒剓剕剗剘�剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳剴創剶剷剸剹剺剻剼剾劀劃劄劅劆劇劉劊劋劌劍劎劏劑劒劔劕劖劗劘劙劚劜劤劥劦劧劮劯劰労劵劶劷劸効劺劻劼劽勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務勚勛勜勝勞勠勡勢勣勥勦勧勨勩勪勫勬勭勮勯勱勲勳勴勵勶勷勸勻勼勽匁匂匃匄匇匉匊匋匌匎�".split(""); +for(j = 0; j != D[132].length; ++j) if(D[132][j].charCodeAt(0) !== 0xFFFD) { e[D[132][j]] = 33792 + j; d[33792 + j] = D[132][j];} +D[133] = "����������������������������������������������������������������匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯匰匱匲匳匴匵匶匷匸匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏�厐厑厒厓厔厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯厰厱厲厳厴厵厷厸厹厺厼厽厾叀參叄叅叆叇収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝呞呟呠呡呣呥呧呩呪呫呬呭呮呯呰呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡�".split(""); +for(j = 0; j != D[133].length; ++j) if(D[133][j].charCodeAt(0) !== 0xFFFD) { e[D[133][j]] = 34048 + j; d[34048 + j] = D[133][j];} +D[134] = "����������������������������������������������������������������咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠員哢哣哤哫哬哯哰哱哴哵哶哷哸哹哻哾唀唂唃唄唅唈唊唋唌唍唎唒唓唕唖唗唘唙唚唜唝唞唟唡唥唦�唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋啌啍啎問啑啒啓啔啗啘啙啚啛啝啞啟啠啢啣啨啩啫啯啰啱啲啳啴啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠喡喢喣喤喥喦喨喩喪喫喬喭單喯喰喲喴営喸喺喼喿嗀嗁嗂嗃嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗嗘嗙嗚嗛嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸嗹嗺嗻嗼嗿嘂嘃嘄嘅�".split(""); +for(j = 0; j != D[134].length; ++j) if(D[134][j].charCodeAt(0) !== 0xFFFD) { e[D[134][j]] = 34304 + j; d[34304 + j] = D[134][j];} +D[135] = "����������������������������������������������������������������嘆嘇嘊嘋嘍嘐嘑嘒嘓嘔嘕嘖嘗嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀噁噂噃噄噅噆噇噈噉噊噋噏噐噑噒噓噕噖噚噛噝噞噟噠噡�噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽噾噿嚀嚁嚂嚃嚄嚇嚈嚉嚊嚋嚌嚍嚐嚑嚒嚔嚕嚖嚗嚘嚙嚚嚛嚜嚝嚞嚟嚠嚡嚢嚤嚥嚦嚧嚨嚩嚪嚫嚬嚭嚮嚰嚱嚲嚳嚴嚵嚶嚸嚹嚺嚻嚽嚾嚿囀囁囂囃囄囅囆囇囈囉囋囌囍囎囏囐囑囒囓囕囖囘囙囜団囥囦囧囨囩囪囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國圌圍圎圏圐圑�".split(""); +for(j = 0; j != D[135].length; ++j) if(D[135][j].charCodeAt(0) !== 0xFFFD) { e[D[135][j]] = 34560 + j; d[34560 + j] = D[135][j];} +D[136] = "����������������������������������������������������������������園圓圔圕圖圗團圙圚圛圝圞圠圡圢圤圥圦圧圫圱圲圴圵圶圷圸圼圽圿坁坃坄坅坆坈坉坋坒坓坔坕坖坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀�垁垇垈垉垊垍垎垏垐垑垔垕垖垗垘垙垚垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹垺垻垼垽垾垿埀埁埄埅埆埇埈埉埊埌埍埐埑埓埖埗埛埜埞埡埢埣埥埦埧埨埩埪埫埬埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥堦堧堨堩堫堬堭堮堯報堲堳場堶堷堸堹堺堻堼堽�".split(""); +for(j = 0; j != D[136].length; ++j) if(D[136][j].charCodeAt(0) !== 0xFFFD) { e[D[136][j]] = 34816 + j; d[34816 + j] = D[136][j];} +D[137] = "����������������������������������������������������������������堾堿塀塁塂塃塅塆塇塈塉塊塋塎塏塐塒塓塕塖塗塙塚塛塜塝塟塠塡塢塣塤塦塧塨塩塪塭塮塯塰塱塲塳塴塵塶塷塸塹塺塻塼塽塿墂墄墆墇墈墊墋墌�墍墎墏墐墑墔墕墖増墘墛墜墝墠墡墢墣墤墥墦墧墪墫墬墭墮墯墰墱墲墳墴墵墶墷墸墹墺墻墽墾墿壀壂壃壄壆壇壈壉壊壋壌壍壎壏壐壒壓壔壖壗壘壙壚壛壜壝壞壟壠壡壢壣壥壦壧壨壩壪壭壯壱売壴壵壷壸壺壻壼壽壾壿夀夁夃夅夆夈変夊夋夌夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻�".split(""); +for(j = 0; j != D[137].length; ++j) if(D[137][j].charCodeAt(0) !== 0xFFFD) { e[D[137][j]] = 35072 + j; d[35072 + j] = D[137][j];} +D[138] = "����������������������������������������������������������������夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛奜奝奞奟奡奣奤奦奧奨奩奪奫奬奭奮奯奰奱奲奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦�妧妬妭妰妱妳妴妵妶妷妸妺妼妽妿姀姁姂姃姄姅姇姈姉姌姍姎姏姕姖姙姛姞姟姠姡姢姤姦姧姩姪姫姭姮姯姰姱姲姳姴姵姶姷姸姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪娫娬娭娮娯娰娳娵娷娸娹娺娻娽娾娿婁婂婃婄婅婇婈婋婌婍婎婏婐婑婒婓婔婖婗婘婙婛婜婝婞婟婠�".split(""); +for(j = 0; j != D[138].length; ++j) if(D[138][j].charCodeAt(0) !== 0xFFFD) { e[D[138][j]] = 35328 + j; d[35328 + j] = D[138][j];} +D[139] = "����������������������������������������������������������������婡婣婤婥婦婨婩婫婬婭婮婯婰婱婲婳婸婹婻婼婽婾媀媁媂媃媄媅媆媇媈媉媊媋媌媍媎媏媐媑媓媔媕媖媗媘媙媜媝媞媟媠媡媢媣媤媥媦媧媨媩媫媬�媭媮媯媰媱媴媶媷媹媺媻媼媽媿嫀嫃嫄嫅嫆嫇嫈嫊嫋嫍嫎嫏嫐嫑嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬嫭嫮嫯嫰嫲嫳嫴嫵嫶嫷嫸嫹嫺嫻嫼嫽嫾嫿嬀嬁嬂嬃嬄嬅嬆嬇嬈嬊嬋嬌嬍嬎嬏嬐嬑嬒嬓嬔嬕嬘嬙嬚嬛嬜嬝嬞嬟嬠嬡嬢嬣嬤嬥嬦嬧嬨嬩嬪嬫嬬嬭嬮嬯嬰嬱嬳嬵嬶嬸嬹嬺嬻嬼嬽嬾嬿孁孂孃孄孅孆孇�".split(""); +for(j = 0; j != D[139].length; ++j) if(D[139][j].charCodeAt(0) !== 0xFFFD) { e[D[139][j]] = 35584 + j; d[35584 + j] = D[139][j];} +D[140] = "����������������������������������������������������������������孈孉孊孋孌孍孎孏孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏�寑寔寕寖寗寘寙寚寛寜寠寢寣實寧審寪寫寬寭寯寱寲寳寴寵寶寷寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧屨屩屪屫屬屭屰屲屳屴屵屶屷屸屻屼屽屾岀岃岄岅岆岇岉岊岋岎岏岒岓岕岝岞岟岠岡岤岥岦岧岨�".split(""); +for(j = 0; j != D[140].length; ++j) if(D[140][j].charCodeAt(0) !== 0xFFFD) { e[D[140][j]] = 35840 + j; d[35840 + j] = D[140][j];} +D[141] = "����������������������������������������������������������������岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅峆峇峈峉峊峌峍峎峏峐峑峓峔峕峖峗峘峚峛峜峝峞峟峠峢峣峧峩峫峬峮峯峱峲峳峴峵島峷峸峹峺峼峽峾峿崀�崁崄崅崈崉崊崋崌崍崏崐崑崒崓崕崗崘崙崚崜崝崟崠崡崢崣崥崨崪崫崬崯崰崱崲崳崵崶崷崸崹崺崻崼崿嵀嵁嵂嵃嵄嵅嵆嵈嵉嵍嵎嵏嵐嵑嵒嵓嵔嵕嵖嵗嵙嵚嵜嵞嵟嵠嵡嵢嵣嵤嵥嵦嵧嵨嵪嵭嵮嵰嵱嵲嵳嵵嵶嵷嵸嵹嵺嵻嵼嵽嵾嵿嶀嶁嶃嶄嶅嶆嶇嶈嶉嶊嶋嶌嶍嶎嶏嶐嶑嶒嶓嶔嶕嶖嶗嶘嶚嶛嶜嶞嶟嶠�".split(""); +for(j = 0; j != D[141].length; ++j) if(D[141][j].charCodeAt(0) !== 0xFFFD) { e[D[141][j]] = 36096 + j; d[36096 + j] = D[141][j];} +D[142] = "����������������������������������������������������������������嶡嶢嶣嶤嶥嶦嶧嶨嶩嶪嶫嶬嶭嶮嶯嶰嶱嶲嶳嶴嶵嶶嶸嶹嶺嶻嶼嶽嶾嶿巀巁巂巃巄巆巇巈巉巊巋巌巎巏巐巑巒巓巔巕巖巗巘巙巚巜巟巠巣巤巪巬巭�巰巵巶巸巹巺巻巼巿帀帄帇帉帊帋帍帎帒帓帗帞帟帠帡帢帣帤帥帨帩帪師帬帯帰帲帳帴帵帶帹帺帾帿幀幁幃幆幇幈幉幊幋幍幎幏幐幑幒幓幖幗幘幙幚幜幝幟幠幣幤幥幦幧幨幩幪幫幬幭幮幯幰幱幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨庩庪庫庬庮庯庰庱庲庴庺庻庼庽庿廀廁廂廃廄廅�".split(""); +for(j = 0; j != D[142].length; ++j) if(D[142][j].charCodeAt(0) !== 0xFFFD) { e[D[142][j]] = 36352 + j; d[36352 + j] = D[142][j];} +D[143] = "����������������������������������������������������������������廆廇廈廋廌廍廎廏廐廔廕廗廘廙廚廜廝廞廟廠廡廢廣廤廥廦廧廩廫廬廭廮廯廰廱廲廳廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤�弨弫弬弮弰弲弳弴張弶強弸弻弽弾弿彁彂彃彄彅彆彇彈彉彊彋彌彍彎彏彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢徣徤徥徦徧復徫徬徯徰徱徲徳徴徶徸徹徺徻徾徿忀忁忂忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇�".split(""); +for(j = 0; j != D[143].length; ++j) if(D[143][j].charCodeAt(0) !== 0xFFFD) { e[D[143][j]] = 36608 + j; d[36608 + j] = D[143][j];} +D[144] = "����������������������������������������������������������������怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰怱怲怳怴怶怷怸怹怺怽怾恀恄恅恆恇恈恉恊恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀�悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽悾悿惀惁惂惃惄惇惈惉惌惍惎惏惐惒惓惔惖惗惙惛惞惡惢惣惤惥惪惱惲惵惷惸惻惼惽惾惿愂愃愄愅愇愊愋愌愐愑愒愓愔愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬愭愮愯愰愱愲愳愴愵愶愷愸愹愺愻愼愽愾慀慁慂慃慄慅慆�".split(""); +for(j = 0; j != D[144].length; ++j) if(D[144][j].charCodeAt(0) !== 0xFFFD) { e[D[144][j]] = 36864 + j; d[36864 + j] = D[144][j];} +D[145] = "����������������������������������������������������������������慇慉態慍慏慐慒慓慔慖慗慘慙慚慛慜慞慟慠慡慣慤慥慦慩慪慫慬慭慮慯慱慲慳慴慶慸慹慺慻慼慽慾慿憀憁憂憃憄憅憆憇憈憉憊憌憍憏憐憑憒憓憕�憖憗憘憙憚憛憜憞憟憠憡憢憣憤憥憦憪憫憭憮憯憰憱憲憳憴憵憶憸憹憺憻憼憽憿懀懁懃懄懅懆懇應懌懍懎懏懐懓懕懖懗懘懙懚懛懜懝懞懟懠懡懢懣懤懥懧懨懩懪懫懬懭懮懯懰懱懲懳懴懶懷懸懹懺懻懼懽懾戀戁戂戃戄戅戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸戹戺戻戼扂扄扅扆扊�".split(""); +for(j = 0; j != D[145].length; ++j) if(D[145][j].charCodeAt(0) !== 0xFFFD) { e[D[145][j]] = 37120 + j; d[37120 + j] = D[145][j];} +D[146] = "����������������������������������������������������������������扏扐払扖扗扙扚扜扝扞扟扠扡扢扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋抌抍抎抏抐抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁�拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳挴挵挶挷挸挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖捗捘捙捚捛捜捝捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙掚掛掜掝掞掟採掤掦掫掯掱掲掵掶掹掻掽掿揀�".split(""); +for(j = 0; j != D[146].length; ++j) if(D[146][j].charCodeAt(0) !== 0xFFFD) { e[D[146][j]] = 37376 + j; d[37376 + j] = D[146][j];} +D[147] = "����������������������������������������������������������������揁揂揃揅揇揈揊揋揌揑揓揔揕揗揘揙揚換揜揝揟揢揤揥揦揧揨揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆搇搈搉搊損搎搑搒搕搖搗搘搙搚搝搟搢搣搤�搥搧搨搩搫搮搯搰搱搲搳搵搶搷搸搹搻搼搾摀摂摃摉摋摌摍摎摏摐摑摓摕摖摗摙摚摛摜摝摟摠摡摢摣摤摥摦摨摪摫摬摮摯摰摱摲摳摴摵摶摷摻摼摽摾摿撀撁撃撆撈撉撊撋撌撍撎撏撐撓撔撗撘撚撛撜撝撟撠撡撢撣撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆擇擈擉擊擋擌擏擑擓擔擕擖擙據�".split(""); +for(j = 0; j != D[147].length; ++j) if(D[147][j].charCodeAt(0) !== 0xFFFD) { e[D[147][j]] = 37632 + j; d[37632 + j] = D[147][j];} +D[148] = "����������������������������������������������������������������擛擜擝擟擠擡擣擥擧擨擩擪擫擬擭擮擯擰擱擲擳擴擵擶擷擸擹擺擻擼擽擾擿攁攂攃攄攅攆攇攈攊攋攌攍攎攏攐攑攓攔攕攖攗攙攚攛攜攝攞攟攠攡�攢攣攤攦攧攨攩攪攬攭攰攱攲攳攷攺攼攽敀敁敂敃敄敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數敹敺敻敼敽敾敿斀斁斂斃斄斅斆斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱斲斳斴斵斶斷斸斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘旙旚旛旜旝旞旟旡旣旤旪旫�".split(""); +for(j = 0; j != D[148].length; ++j) if(D[148][j].charCodeAt(0) !== 0xFFFD) { e[D[148][j]] = 37888 + j; d[37888 + j] = D[148][j];} +D[149] = "����������������������������������������������������������������旲旳旴旵旸旹旻旼旽旾旿昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷昸昹昺昻昽昿晀時晄晅晆晇晈晉晊晍晎晐晑晘�晙晛晜晝晞晠晢晣晥晧晩晪晫晬晭晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘暙暚暛暜暞暟暠暡暢暣暤暥暦暩暪暫暬暭暯暰暱暲暳暵暶暷暸暺暻暼暽暿曀曁曂曃曄曅曆曇曈曉曊曋曌曍曎曏曐曑曒曓曔曕曖曗曘曚曞曟曠曡曢曣曤曥曧曨曪曫曬曭曮曯曱曵曶書曺曻曽朁朂會�".split(""); +for(j = 0; j != D[149].length; ++j) if(D[149][j].charCodeAt(0) !== 0xFFFD) { e[D[149][j]] = 38144 + j; d[38144 + j] = D[149][j];} +D[150] = "����������������������������������������������������������������朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠朡朢朣朤朥朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗杘杙杚杛杝杢杣杤杦杧杫杬杮東杴杶�杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹枺枻枼枽枾枿柀柂柅柆柇柈柉柊柋柌柍柎柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵柶柷柸柹柺査柼柾栁栂栃栄栆栍栐栒栔栕栘栙栚栛栜栞栟栠栢栣栤栥栦栧栨栫栬栭栮栯栰栱栴栵栶栺栻栿桇桋桍桏桒桖桗桘桙桚桛�".split(""); +for(j = 0; j != D[150].length; ++j) if(D[150][j].charCodeAt(0) !== 0xFFFD) { e[D[150][j]] = 38400 + j; d[38400 + j] = D[150][j];} +D[151] = "����������������������������������������������������������������桜桝桞桟桪桬桭桮桯桰桱桲桳桵桸桹桺桻桼桽桾桿梀梂梄梇梈梉梊梋梌梍梎梐梑梒梔梕梖梘梙梚梛梜條梞梟梠梡梣梤梥梩梪梫梬梮梱梲梴梶梷梸�梹梺梻梼梽梾梿棁棃棄棅棆棇棈棊棌棎棏棐棑棓棔棖棗棙棛棜棝棞棟棡棢棤棥棦棧棨棩棪棫棬棭棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆椇椈椉椊椌椏椑椓椔椕椖椗椘椙椚椛検椝椞椡椢椣椥椦椧椨椩椪椫椬椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃楄楅楆楇楈楉楊楋楌楍楎楏楐楑楒楓楕楖楘楙楛楜楟�".split(""); +for(j = 0; j != D[151].length; ++j) if(D[151][j].charCodeAt(0) !== 0xFFFD) { e[D[151][j]] = 38656 + j; d[38656 + j] = D[151][j];} +D[152] = "����������������������������������������������������������������楡楢楤楥楧楨楩楪楬業楯楰楲楳楴極楶楺楻楽楾楿榁榃榅榊榋榌榎榏榐榑榒榓榖榗榙榚榝榞榟榠榡榢榣榤榥榦榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽�榾榿槀槂槃槄槅槆槇槈槉構槍槏槑槒槓槕槖槗様槙槚槜槝槞槡槢槣槤槥槦槧槨槩槪槫槬槮槯槰槱槳槴槵槶槷槸槹槺槻槼槾樀樁樂樃樄樅樆樇樈樉樋樌樍樎樏樐樑樒樓樔樕樖標樚樛樜樝樞樠樢樣樤樥樦樧権樫樬樭樮樰樲樳樴樶樷樸樹樺樻樼樿橀橁橂橃橅橆橈橉橊橋橌橍橎橏橑橒橓橔橕橖橗橚�".split(""); +for(j = 0; j != D[152].length; ++j) if(D[152][j].charCodeAt(0) !== 0xFFFD) { e[D[152][j]] = 38912 + j; d[38912 + j] = D[152][j];} +D[153] = "����������������������������������������������������������������橜橝橞機橠橢橣橤橦橧橨橩橪橫橬橭橮橯橰橲橳橴橵橶橷橸橺橻橽橾橿檁檂檃檅檆檇檈檉檊檋檌檍檏檒檓檔檕檖檘檙檚檛檜檝檞檟檡檢檣檤檥檦�檧檨檪檭檮檯檰檱檲檳檴檵檶檷檸檹檺檻檼檽檾檿櫀櫁櫂櫃櫄櫅櫆櫇櫈櫉櫊櫋櫌櫍櫎櫏櫐櫑櫒櫓櫔櫕櫖櫗櫘櫙櫚櫛櫜櫝櫞櫟櫠櫡櫢櫣櫤櫥櫦櫧櫨櫩櫪櫫櫬櫭櫮櫯櫰櫱櫲櫳櫴櫵櫶櫷櫸櫹櫺櫻櫼櫽櫾櫿欀欁欂欃欄欅欆欇欈欉權欋欌欍欎欏欐欑欒欓欔欕欖欗欘欙欚欛欜欝欞欟欥欦欨欩欪欫欬欭欮�".split(""); +for(j = 0; j != D[153].length; ++j) if(D[153][j].charCodeAt(0) !== 0xFFFD) { e[D[153][j]] = 39168 + j; d[39168 + j] = D[153][j];} +D[154] = "����������������������������������������������������������������欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍歎歏歐歑歒歓歔歕歖歗歘歚歛歜歝歞歟歠歡歨歩歫歬歭歮歯歰歱歲歳歴歵歶歷歸歺歽歾歿殀殅殈�殌殎殏殐殑殔殕殗殘殙殜殝殞殟殠殢殣殤殥殦殧殨殩殫殬殭殮殯殰殱殲殶殸殹殺殻殼殽殾毀毃毄毆毇毈毉毊毌毎毐毑毘毚毜毝毞毟毠毢毣毤毥毦毧毨毩毬毭毮毰毱毲毴毶毷毸毺毻毼毾毿氀氁氂氃氄氈氉氊氋氌氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋汌汍汎汏汑汒汓汖汘�".split(""); +for(j = 0; j != D[154].length; ++j) if(D[154][j].charCodeAt(0) !== 0xFFFD) { e[D[154][j]] = 39424 + j; d[39424 + j] = D[154][j];} +D[155] = "����������������������������������������������������������������汙汚汢汣汥汦汧汫汬汭汮汯汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘�泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟洠洡洢洣洤洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽浾浿涀涁涃涄涆涇涊涋涍涏涐涒涖涗涘涙涚涜涢涥涬涭涰涱涳涴涶涷涹涺涻涼涽涾淁淂淃淈淉淊�".split(""); +for(j = 0; j != D[155].length; ++j) if(D[155][j].charCodeAt(0) !== 0xFFFD) { e[D[155][j]] = 39680 + j; d[39680 + j] = D[155][j];} +D[156] = "����������������������������������������������������������������淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽淾淿渀渁渂渃渄渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵�渶渷渹渻渼渽渾渿湀湁湂湅湆湇湈湉湊湋湌湏湐湑湒湕湗湙湚湜湝湞湠湡湢湣湤湥湦湧湨湩湪湬湭湯湰湱湲湳湴湵湶湷湸湹湺湻湼湽満溁溂溄溇溈溊溋溌溍溎溑溒溓溔溕準溗溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪滫滬滭滮滯�".split(""); +for(j = 0; j != D[156].length; ++j) if(D[156][j].charCodeAt(0) !== 0xFFFD) { e[D[156][j]] = 39936 + j; d[39936 + j] = D[156][j];} +D[157] = "����������������������������������������������������������������滰滱滲滳滵滶滷滸滺滻滼滽滾滿漀漁漃漄漅漇漈漊漋漌漍漎漐漑漒漖漗漘漙漚漛漜漝漞漟漡漢漣漥漦漧漨漬漮漰漲漴漵漷漸漹漺漻漼漽漿潀潁潂�潃潄潅潈潉潊潌潎潏潐潑潒潓潔潕潖潗潙潚潛潝潟潠潡潣潤潥潧潨潩潪潫潬潯潰潱潳潵潶潷潹潻潽潾潿澀澁澂澃澅澆澇澊澋澏澐澑澒澓澔澕澖澗澘澙澚澛澝澞澟澠澢澣澤澥澦澨澩澪澫澬澭澮澯澰澱澲澴澵澷澸澺澻澼澽澾澿濁濃濄濅濆濇濈濊濋濌濍濎濏濐濓濔濕濖濗濘濙濚濛濜濝濟濢濣濤濥�".split(""); +for(j = 0; j != D[157].length; ++j) if(D[157][j].charCodeAt(0) !== 0xFFFD) { e[D[157][j]] = 40192 + j; d[40192 + j] = D[157][j];} +D[158] = "����������������������������������������������������������������濦濧濨濩濪濫濬濭濰濱濲濳濴濵濶濷濸濹濺濻濼濽濾濿瀀瀁瀂瀃瀄瀅瀆瀇瀈瀉瀊瀋瀌瀍瀎瀏瀐瀒瀓瀔瀕瀖瀗瀘瀙瀜瀝瀞瀟瀠瀡瀢瀤瀥瀦瀧瀨瀩瀪�瀫瀬瀭瀮瀯瀰瀱瀲瀳瀴瀶瀷瀸瀺瀻瀼瀽瀾瀿灀灁灂灃灄灅灆灇灈灉灊灋灍灎灐灑灒灓灔灕灖灗灘灙灚灛灜灝灟灠灡灢灣灤灥灦灧灨灩灪灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞炟炠炡炢炣炤炥炦炧炨炩炪炰炲炴炵炶為炾炿烄烅烆烇烉烋烌烍烎烏烐烑烒烓烔烕烖烗烚�".split(""); +for(j = 0; j != D[158].length; ++j) if(D[158][j].charCodeAt(0) !== 0xFFFD) { e[D[158][j]] = 40448 + j; d[40448 + j] = D[158][j];} +D[159] = "����������������������������������������������������������������烜烝烞烠烡烢烣烥烪烮烰烱烲烳烴烵烶烸烺烻烼烾烿焀焁焂焃焄焅焆焇焈焋焌焍焎焏焑焒焔焗焛焜焝焞焟焠無焢焣焤焥焧焨焩焪焫焬焭焮焲焳焴�焵焷焸焹焺焻焼焽焾焿煀煁煂煃煄煆煇煈煉煋煍煏煐煑煒煓煔煕煖煗煘煙煚煛煝煟煠煡煢煣煥煩煪煫煬煭煯煰煱煴煵煶煷煹煻煼煾煿熀熁熂熃熅熆熇熈熉熋熌熍熎熐熑熒熓熕熖熗熚熛熜熝熞熡熢熣熤熥熦熧熩熪熫熭熮熯熰熱熲熴熶熷熸熺熻熼熽熾熿燀燁燂燄燅燆燇燈燉燊燋燌燍燏燐燑燒燓�".split(""); +for(j = 0; j != D[159].length; ++j) if(D[159][j].charCodeAt(0) !== 0xFFFD) { e[D[159][j]] = 40704 + j; d[40704 + j] = D[159][j];} +D[160] = "����������������������������������������������������������������燖燗燘燙燚燛燜燝燞營燡燢燣燤燦燨燩燪燫燬燭燯燰燱燲燳燴燵燶燷燸燺燻燼燽燾燿爀爁爂爃爄爅爇爈爉爊爋爌爍爎爏爐爑爒爓爔爕爖爗爘爙爚�爛爜爞爟爠爡爢爣爤爥爦爧爩爫爭爮爯爲爳爴爺爼爾牀牁牂牃牄牅牆牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅犆犇犈犉犌犎犐犑犓犔犕犖犗犘犙犚犛犜犝犞犠犡犢犣犤犥犦犧犨犩犪犫犮犱犲犳犵犺犻犼犽犾犿狀狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛�".split(""); +for(j = 0; j != D[160].length; ++j) if(D[160][j].charCodeAt(0) !== 0xFFFD) { e[D[160][j]] = 40960 + j; d[40960 + j] = D[160][j];} +D[161] = "����������������������������������������������������������������������������������������������������������������������������������������������������������������� 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈〉《》「」『』〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓�".split(""); +for(j = 0; j != D[161].length; ++j) if(D[161][j].charCodeAt(0) !== 0xFFFD) { e[D[161][j]] = 41216 + j; d[41216 + j] = D[161][j];} +D[162] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹ������⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇①②③④⑤⑥⑦⑧⑨⑩��㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩��ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ���".split(""); +for(j = 0; j != D[162].length; ++j) if(D[162][j].charCodeAt(0) !== 0xFFFD) { e[D[162][j]] = 41472 + j; d[41472 + j] = D[162][j];} +D[163] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������!"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ̄�".split(""); +for(j = 0; j != D[163].length; ++j) if(D[163][j].charCodeAt(0) !== 0xFFFD) { e[D[163][j]] = 41728 + j; d[41728 + j] = D[163][j];} +D[164] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん������������".split(""); +for(j = 0; j != D[164].length; ++j) if(D[164][j].charCodeAt(0) !== 0xFFFD) { e[D[164][j]] = 41984 + j; d[41984 + j] = D[164][j];} +D[165] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ���������".split(""); +for(j = 0; j != D[165].length; ++j) if(D[165][j].charCodeAt(0) !== 0xFFFD) { e[D[165][j]] = 42240 + j; d[42240 + j] = D[165][j];} +D[166] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ��������αβγδεζηθικλμνξοπρστυφχψω�������︵︶︹︺︿﹀︽︾﹁﹂﹃﹄��︻︼︷︸︱�︳︴����������".split(""); +for(j = 0; j != D[166].length; ++j) if(D[166][j].charCodeAt(0) !== 0xFFFD) { e[D[166][j]] = 42496 + j; d[42496 + j] = D[166][j];} +D[167] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ���������������абвгдеёжзийклмнопрстуфхцчшщъыьэюя��������������".split(""); +for(j = 0; j != D[167].length; ++j) if(D[167][j].charCodeAt(0) !== 0xFFFD) { e[D[167][j]] = 42752 + j; d[42752 + j] = D[167][j];} +D[168] = "����������������������������������������������������������������ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲╳▁▂▃▄▅▆▇�█▉▊▋▌▍▎▏▓▔▕▼▽◢◣◤◥☉⊕〒〝〞�����������āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ�ńň�ɡ����ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩ����������������������".split(""); +for(j = 0; j != D[168].length; ++j) if(D[168][j].charCodeAt(0) !== 0xFFFD) { e[D[168][j]] = 43008 + j; d[43008 + j] = D[168][j];} +D[169] = "����������������������������������������������������������������〡〢〣〤〥〦〧〨〩㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦�℡㈱�‐���ー゛゜ヽヾ〆ゝゞ﹉﹊﹋﹌﹍﹎﹏﹐﹑﹒﹔﹕﹖﹗﹙﹚﹛﹜﹝﹞﹟﹠﹡�﹢﹣﹤﹥﹦﹨﹩﹪﹫�������������〇�������������─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋����������������".split(""); +for(j = 0; j != D[169].length; ++j) if(D[169][j].charCodeAt(0) !== 0xFFFD) { e[D[169][j]] = 43264 + j; d[43264 + j] = D[169][j];} +D[170] = "����������������������������������������������������������������狜狝狟狢狣狤狥狦狧狪狫狵狶狹狽狾狿猀猂猄猅猆猇猈猉猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀獁獂獃獄獅獆獇獈�獉獊獋獌獎獏獑獓獔獕獖獘獙獚獛獜獝獞獟獡獢獣獤獥獦獧獨獩獪獫獮獰獱�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[170].length; ++j) if(D[170][j].charCodeAt(0) !== 0xFFFD) { e[D[170][j]] = 43520 + j; d[43520 + j] = D[170][j];} +D[171] = "����������������������������������������������������������������獲獳獴獵獶獷獸獹獺獻獼獽獿玀玁玂玃玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣玤玥玦玧玨玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃珄珅珆珇�珋珌珎珒珓珔珕珖珗珘珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳珴珵珶珷�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[171].length; ++j) if(D[171][j].charCodeAt(0) !== 0xFFFD) { e[D[171][j]] = 43776 + j; d[43776 + j] = D[171][j];} +D[172] = "����������������������������������������������������������������珸珹珺珻珼珽現珿琀琁琂琄琇琈琋琌琍琎琑琒琓琔琕琖琗琘琙琜琝琞琟琠琡琣琤琧琩琫琭琯琱琲琷琸琹琺琻琽琾琿瑀瑂瑃瑄瑅瑆瑇瑈瑉瑊瑋瑌瑍�瑎瑏瑐瑑瑒瑓瑔瑖瑘瑝瑠瑡瑢瑣瑤瑥瑦瑧瑨瑩瑪瑫瑬瑮瑯瑱瑲瑳瑴瑵瑸瑹瑺�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[172].length; ++j) if(D[172][j].charCodeAt(0) !== 0xFFFD) { e[D[172][j]] = 44032 + j; d[44032 + j] = D[172][j];} +D[173] = "����������������������������������������������������������������瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑璒璓璔璕璖璗璘璙璚璛璝璟璠璡璢璣璤璥璦璪璫璬璭璮璯環璱璲璳璴璵璶璷璸璹璻璼璽璾璿瓀瓁瓂瓃瓄瓅瓆瓇�瓈瓉瓊瓋瓌瓍瓎瓏瓐瓑瓓瓔瓕瓖瓗瓘瓙瓚瓛瓝瓟瓡瓥瓧瓨瓩瓪瓫瓬瓭瓰瓱瓲�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[173].length; ++j) if(D[173][j].charCodeAt(0) !== 0xFFFD) { e[D[173][j]] = 44288 + j; d[44288 + j] = D[173][j];} +D[174] = "����������������������������������������������������������������瓳瓵瓸瓹瓺瓻瓼瓽瓾甀甁甂甃甅甆甇甈甉甊甋甌甎甐甒甔甕甖甗甛甝甞甠甡產産甤甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘�畝畞畟畠畡畢畣畤畧畨畩畫畬畭畮畯異畱畳畵當畷畺畻畼畽畾疀疁疂疄疅疇�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[174].length; ++j) if(D[174][j].charCodeAt(0) !== 0xFFFD) { e[D[174][j]] = 44544 + j; d[44544 + j] = D[174][j];} +D[175] = "����������������������������������������������������������������疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦疧疨疩疪疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇�瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[175].length; ++j) if(D[175][j].charCodeAt(0) !== 0xFFFD) { e[D[175][j]] = 44800 + j; d[44800 + j] = D[175][j];} +D[176] = "����������������������������������������������������������������癅癆癇癈癉癊癋癎癏癐癑癒癓癕癗癘癙癚癛癝癟癠癡癢癤癥癦癧癨癩癪癬癭癮癰癱癲癳癴癵癶癷癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛�皜皝皞皟皠皡皢皣皥皦皧皨皩皪皫皬皭皯皰皳皵皶皷皸皹皺皻皼皽皾盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥�".split(""); +for(j = 0; j != D[176].length; ++j) if(D[176][j].charCodeAt(0) !== 0xFFFD) { e[D[176][j]] = 45056 + j; d[45056 + j] = D[176][j];} +D[177] = "����������������������������������������������������������������盄盇盉盋盌盓盕盙盚盜盝盞盠盡盢監盤盦盧盨盩盪盫盬盭盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎眏眐眑眒眓眔眕眖眗眘眛眜眝眞眡眣眤眥眧眪眫�眬眮眰眱眲眳眴眹眻眽眾眿睂睄睅睆睈睉睊睋睌睍睎睏睒睓睔睕睖睗睘睙睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳�".split(""); +for(j = 0; j != D[177].length; ++j) if(D[177][j].charCodeAt(0) !== 0xFFFD) { e[D[177][j]] = 45312 + j; d[45312 + j] = D[177][j];} +D[178] = "����������������������������������������������������������������睝睞睟睠睤睧睩睪睭睮睯睰睱睲睳睴睵睶睷睸睺睻睼瞁瞂瞃瞆瞇瞈瞉瞊瞋瞏瞐瞓瞔瞕瞖瞗瞘瞙瞚瞛瞜瞝瞞瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶瞷瞸瞹瞺�瞼瞾矀矁矂矃矄矅矆矇矈矉矊矋矌矎矏矐矑矒矓矔矕矖矘矙矚矝矞矟矠矡矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖�".split(""); +for(j = 0; j != D[178].length; ++j) if(D[178][j].charCodeAt(0) !== 0xFFFD) { e[D[178][j]] = 45568 + j; d[45568 + j] = D[178][j];} +D[179] = "����������������������������������������������������������������矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃砄砅砆砇砈砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚�硛硜硞硟硠硡硢硣硤硥硦硧硨硩硯硰硱硲硳硴硵硶硸硹硺硻硽硾硿碀碁碂碃场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚�".split(""); +for(j = 0; j != D[179].length; ++j) if(D[179][j].charCodeAt(0) !== 0xFFFD) { e[D[179][j]] = 45824 + j; d[45824 + j] = D[179][j];} +D[180] = "����������������������������������������������������������������碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨碩碪碫碬碭碮碯碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚磛磜磝磞磟磠磡磢磣�磤磥磦磧磩磪磫磭磮磯磰磱磳磵磶磸磹磻磼磽磾磿礀礂礃礄礆礇礈礉礊礋礌础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮�".split(""); +for(j = 0; j != D[180].length; ++j) if(D[180][j].charCodeAt(0) !== 0xFFFD) { e[D[180][j]] = 46080 + j; d[46080 + j] = D[180][j];} +D[181] = "����������������������������������������������������������������礍礎礏礐礑礒礔礕礖礗礘礙礚礛礜礝礟礠礡礢礣礥礦礧礨礩礪礫礬礭礮礯礰礱礲礳礵礶礷礸礹礽礿祂祃祄祅祇祊祋祌祍祎祏祐祑祒祔祕祘祙祡祣�祤祦祩祪祫祬祮祰祱祲祳祴祵祶祹祻祼祽祾祿禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠�".split(""); +for(j = 0; j != D[181].length; ++j) if(D[181][j].charCodeAt(0) !== 0xFFFD) { e[D[181][j]] = 46336 + j; d[46336 + j] = D[181][j];} +D[182] = "����������������������������������������������������������������禓禔禕禖禗禘禙禛禜禝禞禟禠禡禢禣禤禥禦禨禩禪禫禬禭禮禯禰禱禲禴禵禶禷禸禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙秚秛秜秝秞秠秡秢秥秨秪�秬秮秱秲秳秴秵秶秷秹秺秼秾秿稁稄稅稇稈稉稊稌稏稐稑稒稓稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二�".split(""); +for(j = 0; j != D[182].length; ++j) if(D[182][j].charCodeAt(0) !== 0xFFFD) { e[D[182][j]] = 46592 + j; d[46592 + j] = D[182][j];} +D[183] = "����������������������������������������������������������������稝稟稡稢稤稥稦稧稨稩稪稫稬稭種稯稰稱稲稴稵稶稸稺稾穀穁穂穃穄穅穇穈穉穊穋穌積穎穏穐穒穓穔穕穖穘穙穚穛穜穝穞穟穠穡穢穣穤穥穦穧穨�穩穪穫穬穭穮穯穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服�".split(""); +for(j = 0; j != D[183].length; ++j) if(D[183][j].charCodeAt(0) !== 0xFFFD) { e[D[183][j]] = 46848 + j; d[46848 + j] = D[183][j];} +D[184] = "����������������������������������������������������������������窣窤窧窩窪窫窮窯窰窱窲窴窵窶窷窸窹窺窻窼窽窾竀竁竂竃竄竅竆竇竈竉竊竌竍竎竏竐竑竒竓竔竕竗竘竚竛竜竝竡竢竤竧竨竩竪竫竬竮竰竱竲竳�竴竵競竷竸竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹�".split(""); +for(j = 0; j != D[184].length; ++j) if(D[184][j].charCodeAt(0) !== 0xFFFD) { e[D[184][j]] = 47104 + j; d[47104 + j] = D[184][j];} +D[185] = "����������������������������������������������������������������笯笰笲笴笵笶笷笹笻笽笿筀筁筂筃筄筆筈筊筍筎筓筕筗筙筜筞筟筡筣筤筥筦筧筨筩筪筫筬筭筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆箇箈箉箊箋箌箎箏�箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹箺箻箼箽箾箿節篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈�".split(""); +for(j = 0; j != D[185].length; ++j) if(D[185][j].charCodeAt(0) !== 0xFFFD) { e[D[185][j]] = 47360 + j; d[47360 + j] = D[185][j];} +D[186] = "����������������������������������������������������������������篅篈築篊篋篍篎篏篐篒篔篕篖篗篘篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲篳篴篵篶篸篹篺篻篽篿簀簁簂簃簄簅簆簈簉簊簍簎簐簑簒簓簔簕簗簘簙�簚簛簜簝簞簠簡簢簣簤簥簨簩簫簬簭簮簯簰簱簲簳簴簵簶簷簹簺簻簼簽簾籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖�".split(""); +for(j = 0; j != D[186].length; ++j) if(D[186][j].charCodeAt(0) !== 0xFFFD) { e[D[186][j]] = 47616 + j; d[47616 + j] = D[186][j];} +D[187] = "����������������������������������������������������������������籃籄籅籆籇籈籉籊籋籌籎籏籐籑籒籓籔籕籖籗籘籙籚籛籜籝籞籟籠籡籢籣籤籥籦籧籨籩籪籫籬籭籮籯籰籱籲籵籶籷籸籹籺籾籿粀粁粂粃粄粅粆粇�粈粊粋粌粍粎粏粐粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴粵粶粷粸粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕�".split(""); +for(j = 0; j != D[187].length; ++j) if(D[187][j].charCodeAt(0) !== 0xFFFD) { e[D[187][j]] = 47872 + j; d[47872 + j] = D[187][j];} +D[188] = "����������������������������������������������������������������粿糀糂糃糄糆糉糋糎糏糐糑糒糓糔糘糚糛糝糞糡糢糣糤糥糦糧糩糪糫糬糭糮糰糱糲糳糴糵糶糷糹糺糼糽糾糿紀紁紂紃約紅紆紇紈紉紋紌納紎紏紐�紑紒紓純紕紖紗紘紙級紛紜紝紞紟紡紣紤紥紦紨紩紪紬紭紮細紱紲紳紴紵紶肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件�".split(""); +for(j = 0; j != D[188].length; ++j) if(D[188][j].charCodeAt(0) !== 0xFFFD) { e[D[188][j]] = 48128 + j; d[48128 + j] = D[188][j];} +D[189] = "����������������������������������������������������������������紷紸紹紺紻紼紽紾紿絀絁終絃組絅絆絇絈絉絊絋経絍絎絏結絑絒絓絔絕絖絗絘絙絚絛絜絝絞絟絠絡絢絣絤絥給絧絨絩絪絫絬絭絯絰統絲絳絴絵絶�絸絹絺絻絼絽絾絿綀綁綂綃綄綅綆綇綈綉綊綋綌綍綎綏綐綑綒經綔綕綖綗綘健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸�".split(""); +for(j = 0; j != D[189].length; ++j) if(D[189][j].charCodeAt(0) !== 0xFFFD) { e[D[189][j]] = 48384 + j; d[48384 + j] = D[189][j];} +D[190] = "����������������������������������������������������������������継続綛綜綝綞綟綠綡綢綣綤綥綧綨綩綪綫綬維綯綰綱網綳綴綵綶綷綸綹綺綻綼綽綾綿緀緁緂緃緄緅緆緇緈緉緊緋緌緍緎総緐緑緒緓緔緕緖緗緘緙�線緛緜緝緞緟締緡緢緣緤緥緦緧編緩緪緫緬緭緮緯緰緱緲緳練緵緶緷緸緹緺尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻�".split(""); +for(j = 0; j != D[190].length; ++j) if(D[190][j].charCodeAt(0) !== 0xFFFD) { e[D[190][j]] = 48640 + j; d[48640 + j] = D[190][j];} +D[191] = "����������������������������������������������������������������緻緼緽緾緿縀縁縂縃縄縅縆縇縈縉縊縋縌縍縎縏縐縑縒縓縔縕縖縗縘縙縚縛縜縝縞縟縠縡縢縣縤縥縦縧縨縩縪縫縬縭縮縯縰縱縲縳縴縵縶縷縸縹�縺縼總績縿繀繂繃繄繅繆繈繉繊繋繌繍繎繏繐繑繒繓織繕繖繗繘繙繚繛繜繝俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀�".split(""); +for(j = 0; j != D[191].length; ++j) if(D[191][j].charCodeAt(0) !== 0xFFFD) { e[D[191][j]] = 48896 + j; d[48896 + j] = D[191][j];} +D[192] = "����������������������������������������������������������������繞繟繠繡繢繣繤繥繦繧繨繩繪繫繬繭繮繯繰繱繲繳繴繵繶繷繸繹繺繻繼繽繾繿纀纁纃纄纅纆纇纈纉纊纋續纍纎纏纐纑纒纓纔纕纖纗纘纙纚纜纝纞�纮纴纻纼绖绤绬绹缊缐缞缷缹缻缼缽缾缿罀罁罃罆罇罈罉罊罋罌罍罎罏罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐�".split(""); +for(j = 0; j != D[192].length; ++j) if(D[192][j].charCodeAt(0) !== 0xFFFD) { e[D[192][j]] = 49152 + j; d[49152 + j] = D[192][j];} +D[193] = "����������������������������������������������������������������罖罙罛罜罝罞罠罣罤罥罦罧罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂羃羄羅羆羇羈羉羋羍羏羐羑羒羓羕羖羗羘羙羛羜羠羢羣羥羦羨義羪羫羬羭羮羱�羳羴羵羶羷羺羻羾翀翂翃翄翆翇翈翉翋翍翏翐翑習翓翖翗翙翚翛翜翝翞翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿�".split(""); +for(j = 0; j != D[193].length; ++j) if(D[193][j].charCodeAt(0) !== 0xFFFD) { e[D[193][j]] = 49408 + j; d[49408 + j] = D[193][j];} +D[194] = "����������������������������������������������������������������翤翧翨翪翫翬翭翯翲翴翵翶翷翸翹翺翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫耬耭耮耯耰耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗�聙聛聜聝聞聟聠聡聢聣聤聥聦聧聨聫聬聭聮聯聰聲聳聴聵聶職聸聹聺聻聼聽隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫�".split(""); +for(j = 0; j != D[194].length; ++j) if(D[194][j].charCodeAt(0) !== 0xFFFD) { e[D[194][j]] = 49664 + j; d[49664 + j] = D[194][j];} +D[195] = "����������������������������������������������������������������聾肁肂肅肈肊肍肎肏肐肑肒肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇胈胉胊胋胏胐胑胒胓胔胕胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋�脌脕脗脙脛脜脝脟脠脡脢脣脤脥脦脧脨脩脪脫脭脮脰脳脴脵脷脹脺脻脼脽脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸�".split(""); +for(j = 0; j != D[195].length; ++j) if(D[195][j].charCodeAt(0) !== 0xFFFD) { e[D[195][j]] = 49920 + j; d[49920 + j] = D[195][j];} +D[196] = "����������������������������������������������������������������腀腁腂腃腄腅腇腉腍腎腏腒腖腗腘腛腜腝腞腟腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃膄膅膆膇膉膋膌膍膎膐膒膓膔膕膖膗膙膚膞膟膠膡膢膤膥�膧膩膫膬膭膮膯膰膱膲膴膵膶膷膸膹膼膽膾膿臄臅臇臈臉臋臍臎臏臐臑臒臓摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁�".split(""); +for(j = 0; j != D[196].length; ++j) if(D[196][j].charCodeAt(0) !== 0xFFFD) { e[D[196][j]] = 50176 + j; d[50176 + j] = D[196][j];} +D[197] = "����������������������������������������������������������������臔臕臖臗臘臙臚臛臜臝臞臟臠臡臢臤臥臦臨臩臫臮臯臰臱臲臵臶臷臸臹臺臽臿舃與興舉舊舋舎舏舑舓舕舖舗舘舙舚舝舠舤舥舦舧舩舮舲舺舼舽舿�艀艁艂艃艅艆艈艊艌艍艎艐艑艒艓艔艕艖艗艙艛艜艝艞艠艡艢艣艤艥艦艧艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗�".split(""); +for(j = 0; j != D[197].length; ++j) if(D[197][j].charCodeAt(0) !== 0xFFFD) { e[D[197][j]] = 50432 + j; d[50432 + j] = D[197][j];} +D[198] = "����������������������������������������������������������������艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸�苺苼苽苾苿茀茊茋茍茐茒茓茖茘茙茝茞茟茠茡茢茣茤茥茦茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐�".split(""); +for(j = 0; j != D[198].length; ++j) if(D[198][j].charCodeAt(0) !== 0xFFFD) { e[D[198][j]] = 50688 + j; d[50688 + j] = D[198][j];} +D[199] = "����������������������������������������������������������������茾茿荁荂荄荅荈荊荋荌荍荎荓荕荖荗荘荙荝荢荰荱荲荳荴荵荶荹荺荾荿莀莁莂莃莄莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡莢莣莤莥莦莧莬莭莮�莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠�".split(""); +for(j = 0; j != D[199].length; ++j) if(D[199][j].charCodeAt(0) !== 0xFFFD) { e[D[199][j]] = 50944 + j; d[50944 + j] = D[199][j];} +D[200] = "����������������������������������������������������������������菮華菳菴菵菶菷菺菻菼菾菿萀萂萅萇萈萉萊萐萒萓萔萕萖萗萙萚萛萞萟萠萡萢萣萩萪萫萬萭萮萯萰萲萳萴萵萶萷萹萺萻萾萿葀葁葂葃葄葅葇葈葉�葊葋葌葍葎葏葐葒葓葔葕葖葘葝葞葟葠葢葤葥葦葧葨葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁�".split(""); +for(j = 0; j != D[200].length; ++j) if(D[200][j].charCodeAt(0) !== 0xFFFD) { e[D[200][j]] = 51200 + j; d[51200 + j] = D[200][j];} +D[201] = "����������������������������������������������������������������葽葾葿蒀蒁蒃蒄蒅蒆蒊蒍蒏蒐蒑蒒蒓蒔蒕蒖蒘蒚蒛蒝蒞蒟蒠蒢蒣蒤蒥蒦蒧蒨蒩蒪蒫蒬蒭蒮蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗�蓘蓙蓚蓛蓜蓞蓡蓢蓤蓧蓨蓩蓪蓫蓭蓮蓯蓱蓲蓳蓴蓵蓶蓷蓸蓹蓺蓻蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳�".split(""); +for(j = 0; j != D[201].length; ++j) if(D[201][j].charCodeAt(0) !== 0xFFFD) { e[D[201][j]] = 51456 + j; d[51456 + j] = D[201][j];} +D[202] = "����������������������������������������������������������������蔃蔄蔅蔆蔇蔈蔉蔊蔋蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢蔣蔤蔥蔦蔧蔨蔩蔪蔭蔮蔯蔰蔱蔲蔳蔴蔵蔶蔾蔿蕀蕁蕂蕄蕅蕆蕇蕋蕌蕍蕎蕏蕐蕑蕒蕓蕔蕕�蕗蕘蕚蕛蕜蕝蕟蕠蕡蕢蕣蕥蕦蕧蕩蕪蕫蕬蕭蕮蕯蕰蕱蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱�".split(""); +for(j = 0; j != D[202].length; ++j) if(D[202][j].charCodeAt(0) !== 0xFFFD) { e[D[202][j]] = 51712 + j; d[51712 + j] = D[202][j];} +D[203] = "����������������������������������������������������������������薂薃薆薈薉薊薋薌薍薎薐薑薒薓薔薕薖薗薘薙薚薝薞薟薠薡薢薣薥薦薧薩薫薬薭薱薲薳薴薵薶薸薺薻薼薽薾薿藀藂藃藄藅藆藇藈藊藋藌藍藎藑藒�藔藖藗藘藙藚藛藝藞藟藠藡藢藣藥藦藧藨藪藫藬藭藮藯藰藱藲藳藴藵藶藷藸恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔�".split(""); +for(j = 0; j != D[203].length; ++j) if(D[203][j].charCodeAt(0) !== 0xFFFD) { e[D[203][j]] = 51968 + j; d[51968 + j] = D[203][j];} +D[204] = "����������������������������������������������������������������藹藺藼藽藾蘀蘁蘂蘃蘄蘆蘇蘈蘉蘊蘋蘌蘍蘎蘏蘐蘒蘓蘔蘕蘗蘘蘙蘚蘛蘜蘝蘞蘟蘠蘡蘢蘣蘤蘥蘦蘨蘪蘫蘬蘭蘮蘯蘰蘱蘲蘳蘴蘵蘶蘷蘹蘺蘻蘽蘾蘿虀�虁虂虃虄虅虆虇虈虉虊虋虌虒虓處虖虗虘虙虛虜虝號虠虡虣虤虥虦虧虨虩虪獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃�".split(""); +for(j = 0; j != D[204].length; ++j) if(D[204][j].charCodeAt(0) !== 0xFFFD) { e[D[204][j]] = 52224 + j; d[52224 + j] = D[204][j];} +D[205] = "����������������������������������������������������������������虭虯虰虲虳虴虵虶虷虸蚃蚄蚅蚆蚇蚈蚉蚎蚏蚐蚑蚒蚔蚖蚗蚘蚙蚚蚛蚞蚟蚠蚡蚢蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻蚼蚽蚾蚿蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜�蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威�".split(""); +for(j = 0; j != D[205].length; ++j) if(D[205][j].charCodeAt(0) !== 0xFFFD) { e[D[205][j]] = 52480 + j; d[52480 + j] = D[205][j];} +D[206] = "����������������������������������������������������������������蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀蝁蝂蝃蝄蝅蝆蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚蝛蝜蝝蝞蝟蝡蝢蝦蝧蝨蝩蝪蝫蝬蝭蝯蝱蝲蝳蝵�蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎螏螐螑螒螔螕螖螘螙螚螛螜螝螞螠螡螢螣螤巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺�".split(""); +for(j = 0; j != D[206].length; ++j) if(D[206][j].charCodeAt(0) !== 0xFFFD) { e[D[206][j]] = 52736 + j; d[52736 + j] = D[206][j];} +D[207] = "����������������������������������������������������������������螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁蟂蟃蟄蟅蟇蟈蟉蟌蟍蟎蟏蟐蟔蟕蟖蟗蟘蟙蟚蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯蟰蟱蟲蟳蟴蟵蟶蟷蟸�蟺蟻蟼蟽蟿蠀蠁蠂蠄蠅蠆蠇蠈蠉蠋蠌蠍蠎蠏蠐蠑蠒蠔蠗蠘蠙蠚蠜蠝蠞蠟蠠蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓�".split(""); +for(j = 0; j != D[207].length; ++j) if(D[207][j].charCodeAt(0) !== 0xFFFD) { e[D[207][j]] = 52992 + j; d[52992 + j] = D[207][j];} +D[208] = "����������������������������������������������������������������蠤蠥蠦蠧蠨蠩蠪蠫蠬蠭蠮蠯蠰蠱蠳蠴蠵蠶蠷蠸蠺蠻蠽蠾蠿衁衂衃衆衇衈衉衊衋衎衏衐衑衒術衕衖衘衚衛衜衝衞衟衠衦衧衪衭衯衱衳衴衵衶衸衹衺�衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗袘袙袚袛袝袞袟袠袡袣袥袦袧袨袩袪小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄�".split(""); +for(j = 0; j != D[208].length; ++j) if(D[208][j].charCodeAt(0) !== 0xFFFD) { e[D[208][j]] = 53248 + j; d[53248 + j] = D[208][j];} +D[209] = "����������������������������������������������������������������袬袮袯袰袲袳袴袵袶袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚裛補裝裞裠裡裦裧裩裪裫裬裭裮裯裲裵裶裷裺裻製裿褀褁褃褄褅褆複褈�褉褋褌褍褎褏褑褔褕褖褗褘褜褝褞褟褠褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶�".split(""); +for(j = 0; j != D[209].length; ++j) if(D[209][j].charCodeAt(0) !== 0xFFFD) { e[D[209][j]] = 53504 + j; d[53504 + j] = D[209][j];} +D[210] = "����������������������������������������������������������������褸褹褺褻褼褽褾褿襀襂襃襅襆襇襈襉襊襋襌襍襎襏襐襑襒襓襔襕襖襗襘襙襚襛襜襝襠襡襢襣襤襥襧襨襩襪襫襬襭襮襯襰襱襲襳襴襵襶襷襸襹襺襼�襽襾覀覂覄覅覇覈覉覊見覌覍覎規覐覑覒覓覔覕視覗覘覙覚覛覜覝覞覟覠覡摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐�".split(""); +for(j = 0; j != D[210].length; ++j) if(D[210][j].charCodeAt(0) !== 0xFFFD) { e[D[210][j]] = 53760 + j; d[53760 + j] = D[210][j];} +D[211] = "����������������������������������������������������������������覢覣覤覥覦覧覨覩親覫覬覭覮覯覰覱覲観覴覵覶覷覸覹覺覻覼覽覾覿觀觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴觵觶觷觸觹觺�觻觼觽觾觿訁訂訃訄訅訆計訉訊訋訌訍討訏訐訑訒訓訔訕訖託記訙訚訛訜訝印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉�".split(""); +for(j = 0; j != D[211].length; ++j) if(D[211][j].charCodeAt(0) !== 0xFFFD) { e[D[211][j]] = 54016 + j; d[54016 + j] = D[211][j];} +D[212] = "����������������������������������������������������������������訞訟訠訡訢訣訤訥訦訧訨訩訪訫訬設訮訯訰許訲訳訴訵訶訷訸訹診註証訽訿詀詁詂詃詄詅詆詇詉詊詋詌詍詎詏詐詑詒詓詔評詖詗詘詙詚詛詜詝詞�詟詠詡詢詣詤詥試詧詨詩詪詫詬詭詮詯詰話該詳詴詵詶詷詸詺詻詼詽詾詿誀浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧�".split(""); +for(j = 0; j != D[212].length; ++j) if(D[212][j].charCodeAt(0) !== 0xFFFD) { e[D[212][j]] = 54272 + j; d[54272 + j] = D[212][j];} +D[213] = "����������������������������������������������������������������誁誂誃誄誅誆誇誈誋誌認誎誏誐誑誒誔誕誖誗誘誙誚誛誜誝語誟誠誡誢誣誤誥誦誧誨誩說誫説読誮誯誰誱課誳誴誵誶誷誸誹誺誻誼誽誾調諀諁諂�諃諄諅諆談諈諉諊請諌諍諎諏諐諑諒諓諔諕論諗諘諙諚諛諜諝諞諟諠諡諢諣铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政�".split(""); +for(j = 0; j != D[213].length; ++j) if(D[213][j].charCodeAt(0) !== 0xFFFD) { e[D[213][j]] = 54528 + j; d[54528 + j] = D[213][j];} +D[214] = "����������������������������������������������������������������諤諥諦諧諨諩諪諫諬諭諮諯諰諱諲諳諴諵諶諷諸諹諺諻諼諽諾諿謀謁謂謃謄謅謆謈謉謊謋謌謍謎謏謐謑謒謓謔謕謖謗謘謙謚講謜謝謞謟謠謡謢謣�謤謥謧謨謩謪謫謬謭謮謯謰謱謲謳謴謵謶謷謸謹謺謻謼謽謾謿譀譁譂譃譄譅帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑�".split(""); +for(j = 0; j != D[214].length; ++j) if(D[214][j].charCodeAt(0) !== 0xFFFD) { e[D[214][j]] = 54784 + j; d[54784 + j] = D[214][j];} +D[215] = "����������������������������������������������������������������譆譇譈證譊譋譌譍譎譏譐譑譒譓譔譕譖譗識譙譚譛譜譝譞譟譠譡譢譣譤譥譧譨譩譪譫譭譮譯議譱譲譳譴譵譶護譸譹譺譻譼譽譾譿讀讁讂讃讄讅讆�讇讈讉變讋讌讍讎讏讐讑讒讓讔讕讖讗讘讙讚讛讜讝讞讟讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座������".split(""); +for(j = 0; j != D[215].length; ++j) if(D[215][j].charCodeAt(0) !== 0xFFFD) { e[D[215][j]] = 55040 + j; d[55040 + j] = D[215][j];} +D[216] = "����������������������������������������������������������������谸谹谺谻谼谽谾谿豀豂豃豄豅豈豊豋豍豎豏豐豑豒豓豔豖豗豘豙豛豜豝豞豟豠豣豤豥豦豧豨豩豬豭豮豯豰豱豲豴豵豶豷豻豼豽豾豿貀貁貃貄貆貇�貈貋貍貎貏貐貑貒貓貕貖貗貙貚貛貜貝貞貟負財貢貣貤貥貦貧貨販貪貫責貭亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝�".split(""); +for(j = 0; j != D[216].length; ++j) if(D[216][j].charCodeAt(0) !== 0xFFFD) { e[D[216][j]] = 55296 + j; d[55296 + j] = D[216][j];} +D[217] = "����������������������������������������������������������������貮貯貰貱貲貳貴貵貶買貸貹貺費貼貽貾貿賀賁賂賃賄賅賆資賈賉賊賋賌賍賎賏賐賑賒賓賔賕賖賗賘賙賚賛賜賝賞賟賠賡賢賣賤賥賦賧賨賩質賫賬�賭賮賯賰賱賲賳賴賵賶賷賸賹賺賻購賽賾賿贀贁贂贃贄贅贆贇贈贉贊贋贌贍佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼�".split(""); +for(j = 0; j != D[217].length; ++j) if(D[217][j].charCodeAt(0) !== 0xFFFD) { e[D[217][j]] = 55552 + j; d[55552 + j] = D[217][j];} +D[218] = "����������������������������������������������������������������贎贏贐贑贒贓贔贕贖贗贘贙贚贛贜贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸赹赺赻赼赽赾赿趀趂趃趆趇趈趉趌趍趎趏趐趒趓趕趖趗趘趙趚趛趜趝趞趠趡�趢趤趥趦趧趨趩趪趫趬趭趮趯趰趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺�".split(""); +for(j = 0; j != D[218].length; ++j) if(D[218][j].charCodeAt(0) !== 0xFFFD) { e[D[218][j]] = 55808 + j; d[55808 + j] = D[218][j];} +D[219] = "����������������������������������������������������������������跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾跿踀踁踂踃踄踆踇踈踋踍踎踐踑踒踓踕踖踗踘踙踚踛踜踠踡踤踥踦踧踨踫踭踰踲踳踴踶踷踸踻踼踾�踿蹃蹅蹆蹌蹍蹎蹏蹐蹓蹔蹕蹖蹗蹘蹚蹛蹜蹝蹞蹟蹠蹡蹢蹣蹤蹥蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝�".split(""); +for(j = 0; j != D[219].length; ++j) if(D[219][j].charCodeAt(0) !== 0xFFFD) { e[D[219][j]] = 56064 + j; d[56064 + j] = D[219][j];} +D[220] = "����������������������������������������������������������������蹳蹵蹷蹸蹹蹺蹻蹽蹾躀躂躃躄躆躈躉躊躋躌躍躎躑躒躓躕躖躗躘躙躚躛躝躟躠躡躢躣躤躥躦躧躨躩躪躭躮躰躱躳躴躵躶躷躸躹躻躼躽躾躿軀軁軂�軃軄軅軆軇軈軉車軋軌軍軏軐軑軒軓軔軕軖軗軘軙軚軛軜軝軞軟軠軡転軣軤堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥�".split(""); +for(j = 0; j != D[220].length; ++j) if(D[220][j].charCodeAt(0) !== 0xFFFD) { e[D[220][j]] = 56320 + j; d[56320 + j] = D[220][j];} +D[221] = "����������������������������������������������������������������軥軦軧軨軩軪軫軬軭軮軯軰軱軲軳軴軵軶軷軸軹軺軻軼軽軾軿輀輁輂較輄輅輆輇輈載輊輋輌輍輎輏輐輑輒輓輔輕輖輗輘輙輚輛輜輝輞輟輠輡輢輣�輤輥輦輧輨輩輪輫輬輭輮輯輰輱輲輳輴輵輶輷輸輹輺輻輼輽輾輿轀轁轂轃轄荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺�".split(""); +for(j = 0; j != D[221].length; ++j) if(D[221][j].charCodeAt(0) !== 0xFFFD) { e[D[221][j]] = 56576 + j; d[56576 + j] = D[221][j];} +D[222] = "����������������������������������������������������������������轅轆轇轈轉轊轋轌轍轎轏轐轑轒轓轔轕轖轗轘轙轚轛轜轝轞轟轠轡轢轣轤轥轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆�迉迊迋迌迍迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖�".split(""); +for(j = 0; j != D[222].length; ++j) if(D[222][j].charCodeAt(0) !== 0xFFFD) { e[D[222][j]] = 56832 + j; d[56832 + j] = D[222][j];} +D[223] = "����������������������������������������������������������������這逜連逤逥逧逨逩逪逫逬逰週進逳逴逷逹逺逽逿遀遃遅遆遈遉遊運遌過達違遖遙遚遜遝遞遟遠遡遤遦遧適遪遫遬遯遰遱遲遳遶遷選遹遺遻遼遾邁�還邅邆邇邉邊邌邍邎邏邐邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼�".split(""); +for(j = 0; j != D[223].length; ++j) if(D[223][j].charCodeAt(0) !== 0xFFFD) { e[D[223][j]] = 57088 + j; d[57088 + j] = D[223][j];} +D[224] = "����������������������������������������������������������������郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅鄆鄇鄈鄉鄊鄋鄌鄍鄎鄏鄐鄑鄒鄓鄔鄕鄖鄗鄘鄚鄛鄜�鄝鄟鄠鄡鄤鄥鄦鄧鄨鄩鄪鄫鄬鄭鄮鄰鄲鄳鄴鄵鄶鄷鄸鄺鄻鄼鄽鄾鄿酀酁酂酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼�".split(""); +for(j = 0; j != D[224].length; ++j) if(D[224][j].charCodeAt(0) !== 0xFFFD) { e[D[224][j]] = 57344 + j; d[57344 + j] = D[224][j];} +D[225] = "����������������������������������������������������������������酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀醁醂醃醄醆醈醊醎醏醓醔醕醖醗醘醙醜醝醞醟醠醡醤醥醦醧醨醩醫醬醰醱醲醳醶醷醸醹醻�醼醽醾醿釀釁釂釃釄釅釆釈釋釐釒釓釔釕釖釗釘釙釚釛針釞釟釠釡釢釣釤釥帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺�".split(""); +for(j = 0; j != D[225].length; ++j) if(D[225][j].charCodeAt(0) !== 0xFFFD) { e[D[225][j]] = 57600 + j; d[57600 + j] = D[225][j];} +D[226] = "����������������������������������������������������������������釦釧釨釩釪釫釬釭釮釯釰釱釲釳釴釵釶釷釸釹釺釻釼釽釾釿鈀鈁鈂鈃鈄鈅鈆鈇鈈鈉鈊鈋鈌鈍鈎鈏鈐鈑鈒鈓鈔鈕鈖鈗鈘鈙鈚鈛鈜鈝鈞鈟鈠鈡鈢鈣鈤�鈥鈦鈧鈨鈩鈪鈫鈬鈭鈮鈯鈰鈱鈲鈳鈴鈵鈶鈷鈸鈹鈺鈻鈼鈽鈾鈿鉀鉁鉂鉃鉄鉅狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧饨饩饪饫饬饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂�".split(""); +for(j = 0; j != D[226].length; ++j) if(D[226][j].charCodeAt(0) !== 0xFFFD) { e[D[226][j]] = 57856 + j; d[57856 + j] = D[226][j];} +D[227] = "����������������������������������������������������������������鉆鉇鉈鉉鉊鉋鉌鉍鉎鉏鉐鉑鉒鉓鉔鉕鉖鉗鉘鉙鉚鉛鉜鉝鉞鉟鉠鉡鉢鉣鉤鉥鉦鉧鉨鉩鉪鉫鉬鉭鉮鉯鉰鉱鉲鉳鉵鉶鉷鉸鉹鉺鉻鉼鉽鉾鉿銀銁銂銃銄銅�銆銇銈銉銊銋銌銍銏銐銑銒銓銔銕銖銗銘銙銚銛銜銝銞銟銠銡銢銣銤銥銦銧恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾�".split(""); +for(j = 0; j != D[227].length; ++j) if(D[227][j].charCodeAt(0) !== 0xFFFD) { e[D[227][j]] = 58112 + j; d[58112 + j] = D[227][j];} +D[228] = "����������������������������������������������������������������銨銩銪銫銬銭銯銰銱銲銳銴銵銶銷銸銹銺銻銼銽銾銿鋀鋁鋂鋃鋄鋅鋆鋇鋉鋊鋋鋌鋍鋎鋏鋐鋑鋒鋓鋔鋕鋖鋗鋘鋙鋚鋛鋜鋝鋞鋟鋠鋡鋢鋣鋤鋥鋦鋧鋨�鋩鋪鋫鋬鋭鋮鋯鋰鋱鋲鋳鋴鋵鋶鋷鋸鋹鋺鋻鋼鋽鋾鋿錀錁錂錃錄錅錆錇錈錉洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑�".split(""); +for(j = 0; j != D[228].length; ++j) if(D[228][j].charCodeAt(0) !== 0xFFFD) { e[D[228][j]] = 58368 + j; d[58368 + j] = D[228][j];} +D[229] = "����������������������������������������������������������������錊錋錌錍錎錏錐錑錒錓錔錕錖錗錘錙錚錛錜錝錞錟錠錡錢錣錤錥錦錧錨錩錪錫錬錭錮錯錰錱録錳錴錵錶錷錸錹錺錻錼錽錿鍀鍁鍂鍃鍄鍅鍆鍇鍈鍉�鍊鍋鍌鍍鍎鍏鍐鍑鍒鍓鍔鍕鍖鍗鍘鍙鍚鍛鍜鍝鍞鍟鍠鍡鍢鍣鍤鍥鍦鍧鍨鍩鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣�".split(""); +for(j = 0; j != D[229].length; ++j) if(D[229][j].charCodeAt(0) !== 0xFFFD) { e[D[229][j]] = 58624 + j; d[58624 + j] = D[229][j];} +D[230] = "����������������������������������������������������������������鍬鍭鍮鍯鍰鍱鍲鍳鍴鍵鍶鍷鍸鍹鍺鍻鍼鍽鍾鍿鎀鎁鎂鎃鎄鎅鎆鎇鎈鎉鎊鎋鎌鎍鎎鎐鎑鎒鎓鎔鎕鎖鎗鎘鎙鎚鎛鎜鎝鎞鎟鎠鎡鎢鎣鎤鎥鎦鎧鎨鎩鎪鎫�鎬鎭鎮鎯鎰鎱鎲鎳鎴鎵鎶鎷鎸鎹鎺鎻鎼鎽鎾鎿鏀鏁鏂鏃鏄鏅鏆鏇鏈鏉鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩�".split(""); +for(j = 0; j != D[230].length; ++j) if(D[230][j].charCodeAt(0) !== 0xFFFD) { e[D[230][j]] = 58880 + j; d[58880 + j] = D[230][j];} +D[231] = "����������������������������������������������������������������鏎鏏鏐鏑鏒鏓鏔鏕鏗鏘鏙鏚鏛鏜鏝鏞鏟鏠鏡鏢鏣鏤鏥鏦鏧鏨鏩鏪鏫鏬鏭鏮鏯鏰鏱鏲鏳鏴鏵鏶鏷鏸鏹鏺鏻鏼鏽鏾鏿鐀鐁鐂鐃鐄鐅鐆鐇鐈鐉鐊鐋鐌鐍�鐎鐏鐐鐑鐒鐓鐔鐕鐖鐗鐘鐙鐚鐛鐜鐝鐞鐟鐠鐡鐢鐣鐤鐥鐦鐧鐨鐩鐪鐫鐬鐭鐮纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡缢缣缤缥缦缧缪缫缬缭缯缰缱缲缳缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬�".split(""); +for(j = 0; j != D[231].length; ++j) if(D[231][j].charCodeAt(0) !== 0xFFFD) { e[D[231][j]] = 59136 + j; d[59136 + j] = D[231][j];} +D[232] = "����������������������������������������������������������������鐯鐰鐱鐲鐳鐴鐵鐶鐷鐸鐹鐺鐻鐼鐽鐿鑀鑁鑂鑃鑄鑅鑆鑇鑈鑉鑊鑋鑌鑍鑎鑏鑐鑑鑒鑓鑔鑕鑖鑗鑘鑙鑚鑛鑜鑝鑞鑟鑠鑡鑢鑣鑤鑥鑦鑧鑨鑩鑪鑬鑭鑮鑯�鑰鑱鑲鑳鑴鑵鑶鑷鑸鑹鑺鑻鑼鑽鑾鑿钀钁钂钃钄钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹�".split(""); +for(j = 0; j != D[232].length; ++j) if(D[232][j].charCodeAt(0) !== 0xFFFD) { e[D[232][j]] = 59392 + j; d[59392 + j] = D[232][j];} +D[233] = "����������������������������������������������������������������锧锳锽镃镈镋镕镚镠镮镴镵長镸镹镺镻镼镽镾門閁閂閃閄閅閆閇閈閉閊開閌閍閎閏閐閑閒間閔閕閖閗閘閙閚閛閜閝閞閟閠閡関閣閤閥閦閧閨閩閪�閫閬閭閮閯閰閱閲閳閴閵閶閷閸閹閺閻閼閽閾閿闀闁闂闃闄闅闆闇闈闉闊闋椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋�".split(""); +for(j = 0; j != D[233].length; ++j) if(D[233][j].charCodeAt(0) !== 0xFFFD) { e[D[233][j]] = 59648 + j; d[59648 + j] = D[233][j];} +D[234] = "����������������������������������������������������������������闌闍闎闏闐闑闒闓闔闕闖闗闘闙闚闛關闝闞闟闠闡闢闣闤闥闦闧闬闿阇阓阘阛阞阠阣阤阥阦阧阨阩阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗�陘陙陚陜陝陞陠陣陥陦陫陭陮陯陰陱陳陸陹険陻陼陽陾陿隀隁隂隃隄隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰�".split(""); +for(j = 0; j != D[234].length; ++j) if(D[234][j].charCodeAt(0) !== 0xFFFD) { e[D[234][j]] = 59904 + j; d[59904 + j] = D[234][j];} +D[235] = "����������������������������������������������������������������隌階隑隒隓隕隖隚際隝隞隟隠隡隢隣隤隥隦隨隩險隫隬隭隮隯隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖雗雘雙雚雛雜雝雞雟雡離難雤雥雦雧雫�雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗霘霙霚霛霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻�".split(""); +for(j = 0; j != D[235].length; ++j) if(D[235][j].charCodeAt(0) !== 0xFFFD) { e[D[235][j]] = 60160 + j; d[60160 + j] = D[235][j];} +D[236] = "����������������������������������������������������������������霡霢霣霤霥霦霧霨霩霫霬霮霯霱霳霴霵霶霷霺霻霼霽霿靀靁靂靃靄靅靆靇靈靉靊靋靌靍靎靏靐靑靔靕靗靘靚靜靝靟靣靤靦靧靨靪靫靬靭靮靯靰靱�靲靵靷靸靹靺靻靽靾靿鞀鞁鞂鞃鞄鞆鞇鞈鞉鞊鞌鞎鞏鞐鞓鞕鞖鞗鞙鞚鞛鞜鞝臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐�".split(""); +for(j = 0; j != D[236].length; ++j) if(D[236][j].charCodeAt(0) !== 0xFFFD) { e[D[236][j]] = 60416 + j; d[60416 + j] = D[236][j];} +D[237] = "����������������������������������������������������������������鞞鞟鞡鞢鞤鞥鞦鞧鞨鞩鞪鞬鞮鞰鞱鞳鞵鞶鞷鞸鞹鞺鞻鞼鞽鞾鞿韀韁韂韃韄韅韆韇韈韉韊韋韌韍韎韏韐韑韒韓韔韕韖韗韘韙韚韛韜韝韞韟韠韡韢韣�韤韥韨韮韯韰韱韲韴韷韸韹韺韻韼韽韾響頀頁頂頃頄項順頇須頉頊頋頌頍頎怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨�".split(""); +for(j = 0; j != D[237].length; ++j) if(D[237][j].charCodeAt(0) !== 0xFFFD) { e[D[237][j]] = 60672 + j; d[60672 + j] = D[237][j];} +D[238] = "����������������������������������������������������������������頏預頑頒頓頔頕頖頗領頙頚頛頜頝頞頟頠頡頢頣頤頥頦頧頨頩頪頫頬頭頮頯頰頱頲頳頴頵頶頷頸頹頺頻頼頽頾頿顀顁顂顃顄顅顆顇顈顉顊顋題額�顎顏顐顑顒顓顔顕顖顗願顙顚顛顜顝類顟顠顡顢顣顤顥顦顧顨顩顪顫顬顭顮睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶钷钸钹钺钼钽钿铄铈铉铊铋铌铍铎铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪�".split(""); +for(j = 0; j != D[238].length; ++j) if(D[238][j].charCodeAt(0) !== 0xFFFD) { e[D[238][j]] = 60928 + j; d[60928 + j] = D[238][j];} +D[239] = "����������������������������������������������������������������顯顰顱顲顳顴颋颎颒颕颙颣風颩颪颫颬颭颮颯颰颱颲颳颴颵颶颷颸颹颺颻颼颽颾颿飀飁飂飃飄飅飆飇飈飉飊飋飌飍飏飐飔飖飗飛飜飝飠飡飢飣飤�飥飦飩飪飫飬飭飮飯飰飱飲飳飴飵飶飷飸飹飺飻飼飽飾飿餀餁餂餃餄餅餆餇铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒锓锔锕锖锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤镥镦镧镨镩镪镫镬镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔�".split(""); +for(j = 0; j != D[239].length; ++j) if(D[239][j].charCodeAt(0) !== 0xFFFD) { e[D[239][j]] = 61184 + j; d[61184 + j] = D[239][j];} +D[240] = "����������������������������������������������������������������餈餉養餋餌餎餏餑餒餓餔餕餖餗餘餙餚餛餜餝餞餟餠餡餢餣餤餥餦餧館餩餪餫餬餭餯餰餱餲餳餴餵餶餷餸餹餺餻餼餽餾餿饀饁饂饃饄饅饆饇饈饉�饊饋饌饍饎饏饐饑饒饓饖饗饘饙饚饛饜饝饞饟饠饡饢饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨鸩鸪鸫鸬鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦鹧鹨鹩鹪鹫鹬鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙�".split(""); +for(j = 0; j != D[240].length; ++j) if(D[240][j].charCodeAt(0) !== 0xFFFD) { e[D[240][j]] = 61440 + j; d[61440 + j] = D[240][j];} +D[241] = "����������������������������������������������������������������馌馎馚馛馜馝馞馟馠馡馢馣馤馦馧馩馪馫馬馭馮馯馰馱馲馳馴馵馶馷馸馹馺馻馼馽馾馿駀駁駂駃駄駅駆駇駈駉駊駋駌駍駎駏駐駑駒駓駔駕駖駗駘�駙駚駛駜駝駞駟駠駡駢駣駤駥駦駧駨駩駪駫駬駭駮駯駰駱駲駳駴駵駶駷駸駹瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃�".split(""); +for(j = 0; j != D[241].length; ++j) if(D[241][j].charCodeAt(0) !== 0xFFFD) { e[D[241][j]] = 61696 + j; d[61696 + j] = D[241][j];} +D[242] = "����������������������������������������������������������������駺駻駼駽駾駿騀騁騂騃騄騅騆騇騈騉騊騋騌騍騎騏騐騑騒験騔騕騖騗騘騙騚騛騜騝騞騟騠騡騢騣騤騥騦騧騨騩騪騫騬騭騮騯騰騱騲騳騴騵騶騷騸�騹騺騻騼騽騾騿驀驁驂驃驄驅驆驇驈驉驊驋驌驍驎驏驐驑驒驓驔驕驖驗驘驙颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒�".split(""); +for(j = 0; j != D[242].length; ++j) if(D[242][j].charCodeAt(0) !== 0xFFFD) { e[D[242][j]] = 61952 + j; d[61952 + j] = D[242][j];} +D[243] = "����������������������������������������������������������������驚驛驜驝驞驟驠驡驢驣驤驥驦驧驨驩驪驫驲骃骉骍骎骔骕骙骦骩骪骫骬骭骮骯骲骳骴骵骹骻骽骾骿髃髄髆髇髈髉髊髍髎髏髐髒體髕髖髗髙髚髛髜�髝髞髠髢髣髤髥髧髨髩髪髬髮髰髱髲髳髴髵髶髷髸髺髼髽髾髿鬀鬁鬂鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋�".split(""); +for(j = 0; j != D[243].length; ++j) if(D[243][j].charCodeAt(0) !== 0xFFFD) { e[D[243][j]] = 62208 + j; d[62208 + j] = D[243][j];} +D[244] = "����������������������������������������������������������������鬇鬉鬊鬋鬌鬍鬎鬐鬑鬒鬔鬕鬖鬗鬘鬙鬚鬛鬜鬝鬞鬠鬡鬢鬤鬥鬦鬧鬨鬩鬪鬫鬬鬭鬮鬰鬱鬳鬴鬵鬶鬷鬸鬹鬺鬽鬾鬿魀魆魊魋魌魎魐魒魓魕魖魗魘魙魚�魛魜魝魞魟魠魡魢魣魤魥魦魧魨魩魪魫魬魭魮魯魰魱魲魳魴魵魶魷魸魹魺魻簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤�".split(""); +for(j = 0; j != D[244].length; ++j) if(D[244][j].charCodeAt(0) !== 0xFFFD) { e[D[244][j]] = 62464 + j; d[62464 + j] = D[244][j];} +D[245] = "����������������������������������������������������������������魼魽魾魿鮀鮁鮂鮃鮄鮅鮆鮇鮈鮉鮊鮋鮌鮍鮎鮏鮐鮑鮒鮓鮔鮕鮖鮗鮘鮙鮚鮛鮜鮝鮞鮟鮠鮡鮢鮣鮤鮥鮦鮧鮨鮩鮪鮫鮬鮭鮮鮯鮰鮱鮲鮳鮴鮵鮶鮷鮸鮹鮺�鮻鮼鮽鮾鮿鯀鯁鯂鯃鯄鯅鯆鯇鯈鯉鯊鯋鯌鯍鯎鯏鯐鯑鯒鯓鯔鯕鯖鯗鯘鯙鯚鯛酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜�".split(""); +for(j = 0; j != D[245].length; ++j) if(D[245][j].charCodeAt(0) !== 0xFFFD) { e[D[245][j]] = 62720 + j; d[62720 + j] = D[245][j];} +D[246] = "����������������������������������������������������������������鯜鯝鯞鯟鯠鯡鯢鯣鯤鯥鯦鯧鯨鯩鯪鯫鯬鯭鯮鯯鯰鯱鯲鯳鯴鯵鯶鯷鯸鯹鯺鯻鯼鯽鯾鯿鰀鰁鰂鰃鰄鰅鰆鰇鰈鰉鰊鰋鰌鰍鰎鰏鰐鰑鰒鰓鰔鰕鰖鰗鰘鰙鰚�鰛鰜鰝鰞鰟鰠鰡鰢鰣鰤鰥鰦鰧鰨鰩鰪鰫鰬鰭鰮鰯鰰鰱鰲鰳鰴鰵鰶鰷鰸鰹鰺鰻觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅龆龇龈龉龊龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞鲟鲠鲡鲢鲣鲥鲦鲧鲨鲩鲫鲭鲮鲰鲱鲲鲳鲴鲵鲶鲷鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋�".split(""); +for(j = 0; j != D[246].length; ++j) if(D[246][j].charCodeAt(0) !== 0xFFFD) { e[D[246][j]] = 62976 + j; d[62976 + j] = D[246][j];} +D[247] = "����������������������������������������������������������������鰼鰽鰾鰿鱀鱁鱂鱃鱄鱅鱆鱇鱈鱉鱊鱋鱌鱍鱎鱏鱐鱑鱒鱓鱔鱕鱖鱗鱘鱙鱚鱛鱜鱝鱞鱟鱠鱡鱢鱣鱤鱥鱦鱧鱨鱩鱪鱫鱬鱭鱮鱯鱰鱱鱲鱳鱴鱵鱶鱷鱸鱹鱺�鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾鲿鳀鳁鳂鳈鳉鳑鳒鳚鳛鳠鳡鳌鳍鳎鳏鳐鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄�".split(""); +for(j = 0; j != D[247].length; ++j) if(D[247][j].charCodeAt(0) !== 0xFFFD) { e[D[247][j]] = 63232 + j; d[63232 + j] = D[247][j];} +D[248] = "����������������������������������������������������������������鳣鳤鳥鳦鳧鳨鳩鳪鳫鳬鳭鳮鳯鳰鳱鳲鳳鳴鳵鳶鳷鳸鳹鳺鳻鳼鳽鳾鳿鴀鴁鴂鴃鴄鴅鴆鴇鴈鴉鴊鴋鴌鴍鴎鴏鴐鴑鴒鴓鴔鴕鴖鴗鴘鴙鴚鴛鴜鴝鴞鴟鴠鴡�鴢鴣鴤鴥鴦鴧鴨鴩鴪鴫鴬鴭鴮鴯鴰鴱鴲鴳鴴鴵鴶鴷鴸鴹鴺鴻鴼鴽鴾鴿鵀鵁鵂�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[248].length; ++j) if(D[248][j].charCodeAt(0) !== 0xFFFD) { e[D[248][j]] = 63488 + j; d[63488 + j] = D[248][j];} +D[249] = "����������������������������������������������������������������鵃鵄鵅鵆鵇鵈鵉鵊鵋鵌鵍鵎鵏鵐鵑鵒鵓鵔鵕鵖鵗鵘鵙鵚鵛鵜鵝鵞鵟鵠鵡鵢鵣鵤鵥鵦鵧鵨鵩鵪鵫鵬鵭鵮鵯鵰鵱鵲鵳鵴鵵鵶鵷鵸鵹鵺鵻鵼鵽鵾鵿鶀鶁�鶂鶃鶄鶅鶆鶇鶈鶉鶊鶋鶌鶍鶎鶏鶐鶑鶒鶓鶔鶕鶖鶗鶘鶙鶚鶛鶜鶝鶞鶟鶠鶡鶢�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[249].length; ++j) if(D[249][j].charCodeAt(0) !== 0xFFFD) { e[D[249][j]] = 63744 + j; d[63744 + j] = D[249][j];} +D[250] = "����������������������������������������������������������������鶣鶤鶥鶦鶧鶨鶩鶪鶫鶬鶭鶮鶯鶰鶱鶲鶳鶴鶵鶶鶷鶸鶹鶺鶻鶼鶽鶾鶿鷀鷁鷂鷃鷄鷅鷆鷇鷈鷉鷊鷋鷌鷍鷎鷏鷐鷑鷒鷓鷔鷕鷖鷗鷘鷙鷚鷛鷜鷝鷞鷟鷠鷡�鷢鷣鷤鷥鷦鷧鷨鷩鷪鷫鷬鷭鷮鷯鷰鷱鷲鷳鷴鷵鷶鷷鷸鷹鷺鷻鷼鷽鷾鷿鸀鸁鸂�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[250].length; ++j) if(D[250][j].charCodeAt(0) !== 0xFFFD) { e[D[250][j]] = 64000 + j; d[64000 + j] = D[250][j];} +D[251] = "����������������������������������������������������������������鸃鸄鸅鸆鸇鸈鸉鸊鸋鸌鸍鸎鸏鸐鸑鸒鸓鸔鸕鸖鸗鸘鸙鸚鸛鸜鸝鸞鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴鹵鹶鹷鹸鹹鹺鹻鹼鹽麀�麁麃麄麅麆麉麊麌麍麎麏麐麑麔麕麖麗麘麙麚麛麜麞麠麡麢麣麤麥麧麨麩麪�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[251].length; ++j) if(D[251][j].charCodeAt(0) !== 0xFFFD) { e[D[251][j]] = 64256 + j; d[64256 + j] = D[251][j];} +D[252] = "����������������������������������������������������������������麫麬麭麮麯麰麱麲麳麵麶麷麹麺麼麿黀黁黂黃黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰黱黲黳黴黵黶黷黸黺黽黿鼀鼁鼂鼃鼄鼅�鼆鼇鼈鼉鼊鼌鼏鼑鼒鼔鼕鼖鼘鼚鼛鼜鼝鼞鼟鼡鼣鼤鼥鼦鼧鼨鼩鼪鼫鼭鼮鼰鼱�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[252].length; ++j) if(D[252][j].charCodeAt(0) !== 0xFFFD) { e[D[252][j]] = 64512 + j; d[64512 + j] = D[252][j];} +D[253] = "����������������������������������������������������������������鼲鼳鼴鼵鼶鼸鼺鼼鼿齀齁齂齃齅齆齇齈齉齊齋齌齍齎齏齒齓齔齕齖齗齘齙齚齛齜齝齞齟齠齡齢齣齤齥齦齧齨齩齪齫齬齭齮齯齰齱齲齳齴齵齶齷齸�齹齺齻齼齽齾龁龂龍龎龏龐龑龒龓龔龕龖龗龘龜龝龞龡龢龣龤龥郎凉秊裏隣�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[253].length; ++j) if(D[253][j].charCodeAt(0) !== 0xFFFD) { e[D[253][j]] = 64768 + j; d[64768 + j] = D[253][j];} +D[254] = "����������������������������������������������������������������兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[254].length; ++j) if(D[254][j].charCodeAt(0) !== 0xFFFD) { e[D[254][j]] = 65024 + j; d[65024 + j] = D[254][j];} +return {"enc": e, "dec": d }; })(); +cptable[949] = (function(){ var d = [], e = {}, D = [], j; +D[0] = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[0].length; ++j) if(D[0][j].charCodeAt(0) !== 0xFFFD) { e[D[0][j]] = 0 + j; d[0 + j] = D[0][j];} +D[129] = "�����������������������������������������������������������������갂갃갅갆갋갌갍갎갏갘갞갟갡갢갣갥갦갧갨갩갪갫갮갲갳갴������갵갶갷갺갻갽갾갿걁걂걃걄걅걆걇걈걉걊걌걎걏걐걑걒걓걕������걖걗걙걚걛걝걞걟걠걡걢걣걤걥걦걧걨걩걪걫걬걭걮걯걲걳걵걶걹걻걼걽걾걿겂겇겈겍겎겏겑겒겓겕겖겗겘겙겚겛겞겢겣겤겥겦겧겫겭겮겱겲겳겴겵겶겷겺겾겿곀곂곃곅곆곇곉곊곋곍곎곏곐곑곒곓곔곖곘곙곚곛곜곝곞곟곢곣곥곦곩곫곭곮곲곴곷곸곹곺곻곾곿괁괂괃괅괇괈괉괊괋괎괐괒괓�".split(""); +for(j = 0; j != D[129].length; ++j) if(D[129][j].charCodeAt(0) !== 0xFFFD) { e[D[129][j]] = 33024 + j; d[33024 + j] = D[129][j];} +D[130] = "�����������������������������������������������������������������괔괕괖괗괙괚괛괝괞괟괡괢괣괤괥괦괧괨괪괫괮괯괰괱괲괳������괶괷괹괺괻괽괾괿굀굁굂굃굆굈굊굋굌굍굎굏굑굒굓굕굖굗������굙굚굛굜굝굞굟굠굢굤굥굦굧굨굩굪굫굮굯굱굲굷굸굹굺굾궀궃궄궅궆궇궊궋궍궎궏궑궒궓궔궕궖궗궘궙궚궛궞궟궠궡궢궣궥궦궧궨궩궪궫궬궭궮궯궰궱궲궳궴궵궶궸궹궺궻궼궽궾궿귂귃귅귆귇귉귊귋귌귍귎귏귒귔귕귖귗귘귙귚귛귝귞귟귡귢귣귥귦귧귨귩귪귫귬귭귮귯귰귱귲귳귴귵귶귷�".split(""); +for(j = 0; j != D[130].length; ++j) if(D[130][j].charCodeAt(0) !== 0xFFFD) { e[D[130][j]] = 33280 + j; d[33280 + j] = D[130][j];} +D[131] = "�����������������������������������������������������������������귺귻귽귾긂긃긄긅긆긇긊긌긎긏긐긑긒긓긕긖긗긘긙긚긛긜������긝긞긟긠긡긢긣긤긥긦긧긨긩긪긫긬긭긮긯긲긳긵긶긹긻긼������긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗깘깙깚깛깞깢깣깤깦깧깪깫깭깮깯깱깲깳깴깵깶깷깺깾깿꺀꺁꺂꺃꺆꺇꺈꺉꺊꺋꺍꺎꺏꺐꺑꺒꺓꺔꺕꺖꺗꺘꺙꺚꺛꺜꺝꺞꺟꺠꺡꺢꺣꺤꺥꺦꺧꺨꺩꺪꺫꺬꺭꺮꺯꺰꺱꺲꺳꺴꺵꺶꺷꺸꺹꺺꺻꺿껁껂껃껅껆껇껈껉껊껋껎껒껓껔껕껖껗껚껛껝껞껟껠껡껢껣껤껥�".split(""); +for(j = 0; j != D[131].length; ++j) if(D[131][j].charCodeAt(0) !== 0xFFFD) { e[D[131][j]] = 33536 + j; d[33536 + j] = D[131][j];} +D[132] = "�����������������������������������������������������������������껦껧껩껪껬껮껯껰껱껲껳껵껶껷껹껺껻껽껾껿꼀꼁꼂꼃꼄꼅������꼆꼉꼊꼋꼌꼎꼏꼑꼒꼓꼔꼕꼖꼗꼘꼙꼚꼛꼜꼝꼞꼟꼠꼡꼢꼣������꼤꼥꼦꼧꼨꼩꼪꼫꼮꼯꼱꼳꼵꼶꼷꼸꼹꼺꼻꼾꽀꽄꽅꽆꽇꽊꽋꽌꽍꽎꽏꽑꽒꽓꽔꽕꽖꽗꽘꽙꽚꽛꽞꽟꽠꽡꽢꽣꽦꽧꽨꽩꽪꽫꽬꽭꽮꽯꽰꽱꽲꽳꽴꽵꽶꽷꽸꽺꽻꽼꽽꽾꽿꾁꾂꾃꾅꾆꾇꾉꾊꾋꾌꾍꾎꾏꾒꾓꾔꾖꾗꾘꾙꾚꾛꾝꾞꾟꾠꾡꾢꾣꾤꾥꾦꾧꾨꾩꾪꾫꾬꾭꾮꾯꾰꾱꾲꾳꾴꾵꾶꾷꾺꾻꾽꾾�".split(""); +for(j = 0; j != D[132].length; ++j) if(D[132][j].charCodeAt(0) !== 0xFFFD) { e[D[132][j]] = 33792 + j; d[33792 + j] = D[132][j];} +D[133] = "�����������������������������������������������������������������꾿꿁꿂꿃꿄꿅꿆꿊꿌꿏꿐꿑꿒꿓꿕꿖꿗꿘꿙꿚꿛꿝꿞꿟꿠꿡������꿢꿣꿤꿥꿦꿧꿪꿫꿬꿭꿮꿯꿲꿳꿵꿶꿷꿹꿺꿻꿼꿽꿾꿿뀂뀃������뀅뀆뀇뀈뀉뀊뀋뀍뀎뀏뀑뀒뀓뀕뀖뀗뀘뀙뀚뀛뀞뀟뀠뀡뀢뀣뀤뀥뀦뀧뀩뀪뀫뀬뀭뀮뀯뀰뀱뀲뀳뀴뀵뀶뀷뀸뀹뀺뀻뀼뀽뀾뀿끀끁끂끃끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞끟끠끡끢끣끤끥끦끧끨끩끪끫끬끭끮끯끰끱끲끳끴끵끶끷끸끹끺끻끾끿낁낂낃낅낆낇낈낉낊낋낎낐낒낓낔낕낖낗낛낝낞낣낤�".split(""); +for(j = 0; j != D[133].length; ++j) if(D[133][j].charCodeAt(0) !== 0xFFFD) { e[D[133][j]] = 34048 + j; d[34048 + j] = D[133][j];} +D[134] = "�����������������������������������������������������������������낥낦낧낪낰낲낶낷낹낺낻낽낾낿냀냁냂냃냆냊냋냌냍냎냏냒������냓냕냖냗냙냚냛냜냝냞냟냡냢냣냤냦냧냨냩냪냫냬냭냮냯냰������냱냲냳냴냵냶냷냸냹냺냻냼냽냾냿넀넁넂넃넄넅넆넇넊넍넎넏넑넔넕넖넗넚넞넟넠넡넢넦넧넩넪넫넭넮넯넰넱넲넳넶넺넻넼넽넾넿녂녃녅녆녇녉녊녋녌녍녎녏녒녓녖녗녙녚녛녝녞녟녡녢녣녤녥녦녧녨녩녪녫녬녭녮녯녰녱녲녳녴녵녶녷녺녻녽녾녿놁놃놄놅놆놇놊놌놎놏놐놑놕놖놗놙놚놛놝�".split(""); +for(j = 0; j != D[134].length; ++j) if(D[134][j].charCodeAt(0) !== 0xFFFD) { e[D[134][j]] = 34304 + j; d[34304 + j] = D[134][j];} +D[135] = "�����������������������������������������������������������������놞놟놠놡놢놣놤놥놦놧놩놪놫놬놭놮놯놰놱놲놳놴놵놶놷놸������놹놺놻놼놽놾놿뇀뇁뇂뇃뇄뇅뇆뇇뇈뇉뇊뇋뇍뇎뇏뇑뇒뇓뇕������뇖뇗뇘뇙뇚뇛뇞뇠뇡뇢뇣뇤뇥뇦뇧뇪뇫뇭뇮뇯뇱뇲뇳뇴뇵뇶뇷뇸뇺뇼뇾뇿눀눁눂눃눆눇눉눊눍눎눏눐눑눒눓눖눘눚눛눜눝눞눟눡눢눣눤눥눦눧눨눩눪눫눬눭눮눯눰눱눲눳눵눶눷눸눹눺눻눽눾눿뉀뉁뉂뉃뉄뉅뉆뉇뉈뉉뉊뉋뉌뉍뉎뉏뉐뉑뉒뉓뉔뉕뉖뉗뉙뉚뉛뉝뉞뉟뉡뉢뉣뉤뉥뉦뉧뉪뉫뉬뉭뉮�".split(""); +for(j = 0; j != D[135].length; ++j) if(D[135][j].charCodeAt(0) !== 0xFFFD) { e[D[135][j]] = 34560 + j; d[34560 + j] = D[135][j];} +D[136] = "�����������������������������������������������������������������뉯뉰뉱뉲뉳뉶뉷뉸뉹뉺뉻뉽뉾뉿늀늁늂늃늆늇늈늊늋늌늍늎������늏늒늓늕늖늗늛늜늝늞늟늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷������늸늹늺늻늼늽늾늿닀닁닂닃닄닅닆닇닊닋닍닎닏닑닓닔닕닖닗닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉댊댋댌댍댎댏댒댖댗댘댙댚댛댝댞댟댠댡댢댣댤댥댦댧댨댩댪댫댬댭댮댯댰댱댲댳댴댵댶댷댸댹댺댻댼댽댾댿덀덁덂덃덄덅덆덇덈덉덊덋덌덍덎덏덐덑덒덓덗덙덚덝덠덡덢덣�".split(""); +for(j = 0; j != D[136].length; ++j) if(D[136][j].charCodeAt(0) !== 0xFFFD) { e[D[136][j]] = 34816 + j; d[34816 + j] = D[136][j];} +D[137] = "�����������������������������������������������������������������덦덨덪덬덭덯덲덳덵덶덷덹덺덻덼덽덾덿뎂뎆뎇뎈뎉뎊뎋뎍������뎎뎏뎑뎒뎓뎕뎖뎗뎘뎙뎚뎛뎜뎝뎞뎟뎢뎣뎤뎥뎦뎧뎩뎪뎫뎭������뎮뎯뎰뎱뎲뎳뎴뎵뎶뎷뎸뎹뎺뎻뎼뎽뎾뎿돀돁돂돃돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩돪돫돬돭돮돯돰돱돲돳돴돵돶돷돸돹돺돻돽돾돿됀됁됂됃됄됅됆됇됈됉됊됋됌됍됎됏됑됒됓됔됕됖됗됙됚됛됝됞됟됡됢됣됤됥됦됧됪됬됭됮됯됰됱됲됳됵됶됷됸됹됺됻됼됽됾됿둀둁둂둃둄�".split(""); +for(j = 0; j != D[137].length; ++j) if(D[137][j].charCodeAt(0) !== 0xFFFD) { e[D[137][j]] = 35072 + j; d[35072 + j] = D[137][j];} +D[138] = "�����������������������������������������������������������������둅둆둇둈둉둊둋둌둍둎둏둒둓둕둖둗둙둚둛둜둝둞둟둢둤둦������둧둨둩둪둫둭둮둯둰둱둲둳둴둵둶둷둸둹둺둻둼둽둾둿뒁뒂������뒃뒄뒅뒆뒇뒉뒊뒋뒌뒍뒎뒏뒐뒑뒒뒓뒔뒕뒖뒗뒘뒙뒚뒛뒜뒞뒟뒠뒡뒢뒣뒥뒦뒧뒩뒪뒫뒭뒮뒯뒰뒱뒲뒳뒴뒶뒸뒺뒻뒼뒽뒾뒿듁듂듃듅듆듇듉듊듋듌듍듎듏듑듒듓듔듖듗듘듙듚듛듞듟듡듢듥듧듨듩듪듫듮듰듲듳듴듵듶듷듹듺듻듼듽듾듿딀딁딂딃딄딅딆딇딈딉딊딋딌딍딎딏딐딑딒딓딖딗딙딚딝�".split(""); +for(j = 0; j != D[138].length; ++j) if(D[138][j].charCodeAt(0) !== 0xFFFD) { e[D[138][j]] = 35328 + j; d[35328 + j] = D[138][j];} +D[139] = "�����������������������������������������������������������������딞딟딠딡딢딣딦딫딬딭딮딯딲딳딵딶딷딹딺딻딼딽딾딿땂땆������땇땈땉땊땎땏땑땒땓땕땖땗땘땙땚땛땞땢땣땤땥땦땧땨땩땪������땫땬땭땮땯땰땱땲땳땴땵땶땷땸땹땺땻땼땽땾땿떀떁떂떃떄떅떆떇떈떉떊떋떌떍떎떏떐떑떒떓떔떕떖떗떘떙떚떛떜떝떞떟떢떣떥떦떧떩떬떭떮떯떲떶떷떸떹떺떾떿뗁뗂뗃뗅뗆뗇뗈뗉뗊뗋뗎뗒뗓뗔뗕뗖뗗뗙뗚뗛뗜뗝뗞뗟뗠뗡뗢뗣뗤뗥뗦뗧뗨뗩뗪뗫뗭뗮뗯뗰뗱뗲뗳뗴뗵뗶뗷뗸뗹뗺뗻뗼뗽뗾뗿�".split(""); +for(j = 0; j != D[139].length; ++j) if(D[139][j].charCodeAt(0) !== 0xFFFD) { e[D[139][j]] = 35584 + j; d[35584 + j] = D[139][j];} +D[140] = "�����������������������������������������������������������������똀똁똂똃똄똅똆똇똈똉똊똋똌똍똎똏똒똓똕똖똗똙똚똛똜똝������똞똟똠똡똢똣똤똦똧똨똩똪똫똭똮똯똰똱똲똳똵똶똷똸똹똺������똻똼똽똾똿뙀뙁뙂뙃뙄뙅뙆뙇뙉뙊뙋뙌뙍뙎뙏뙐뙑뙒뙓뙔뙕뙖뙗뙘뙙뙚뙛뙜뙝뙞뙟뙠뙡뙢뙣뙥뙦뙧뙩뙪뙫뙬뙭뙮뙯뙰뙱뙲뙳뙴뙵뙶뙷뙸뙹뙺뙻뙼뙽뙾뙿뚀뚁뚂뚃뚄뚅뚆뚇뚈뚉뚊뚋뚌뚍뚎뚏뚐뚑뚒뚓뚔뚕뚖뚗뚘뚙뚚뚛뚞뚟뚡뚢뚣뚥뚦뚧뚨뚩뚪뚭뚮뚯뚰뚲뚳뚴뚵뚶뚷뚸뚹뚺뚻뚼뚽뚾뚿뛀뛁뛂�".split(""); +for(j = 0; j != D[140].length; ++j) if(D[140][j].charCodeAt(0) !== 0xFFFD) { e[D[140][j]] = 35840 + j; d[35840 + j] = D[140][j];} +D[141] = "�����������������������������������������������������������������뛃뛄뛅뛆뛇뛈뛉뛊뛋뛌뛍뛎뛏뛐뛑뛒뛓뛕뛖뛗뛘뛙뛚뛛뛜뛝������뛞뛟뛠뛡뛢뛣뛤뛥뛦뛧뛨뛩뛪뛫뛬뛭뛮뛯뛱뛲뛳뛵뛶뛷뛹뛺������뛻뛼뛽뛾뛿뜂뜃뜄뜆뜇뜈뜉뜊뜋뜌뜍뜎뜏뜐뜑뜒뜓뜔뜕뜖뜗뜘뜙뜚뜛뜜뜝뜞뜟뜠뜡뜢뜣뜤뜥뜦뜧뜪뜫뜭뜮뜱뜲뜳뜴뜵뜶뜷뜺뜼뜽뜾뜿띀띁띂띃띅띆띇띉띊띋띍띎띏띐띑띒띓띖띗띘띙띚띛띜띝띞띟띡띢띣띥띦띧띩띪띫띬띭띮띯띲띴띶띷띸띹띺띻띾띿랁랂랃랅랆랇랈랉랊랋랎랓랔랕랚랛랝랞�".split(""); +for(j = 0; j != D[141].length; ++j) if(D[141][j].charCodeAt(0) !== 0xFFFD) { e[D[141][j]] = 36096 + j; d[36096 + j] = D[141][j];} +D[142] = "�����������������������������������������������������������������랟랡랢랣랤랥랦랧랪랮랯랰랱랲랳랶랷랹랺랻랼랽랾랿럀럁������럂럃럄럅럆럈럊럋럌럍럎럏럐럑럒럓럔럕럖럗럘럙럚럛럜럝������럞럟럠럡럢럣럤럥럦럧럨럩럪럫럮럯럱럲럳럵럶럷럸럹럺럻럾렂렃렄렅렆렊렋렍렎렏렑렒렓렔렕렖렗렚렜렞렟렠렡렢렣렦렧렩렪렫렭렮렯렰렱렲렳렶렺렻렼렽렾렿롁롂롃롅롆롇롈롉롊롋롌롍롎롏롐롒롔롕롖롗롘롙롚롛롞롟롡롢롣롥롦롧롨롩롪롫롮롰롲롳롴롵롶롷롹롺롻롽롾롿뢀뢁뢂뢃뢄�".split(""); +for(j = 0; j != D[142].length; ++j) if(D[142][j].charCodeAt(0) !== 0xFFFD) { e[D[142][j]] = 36352 + j; d[36352 + j] = D[142][j];} +D[143] = "�����������������������������������������������������������������뢅뢆뢇뢈뢉뢊뢋뢌뢎뢏뢐뢑뢒뢓뢔뢕뢖뢗뢘뢙뢚뢛뢜뢝뢞뢟������뢠뢡뢢뢣뢤뢥뢦뢧뢩뢪뢫뢬뢭뢮뢯뢱뢲뢳뢵뢶뢷뢹뢺뢻뢼뢽������뢾뢿룂룄룆룇룈룉룊룋룍룎룏룑룒룓룕룖룗룘룙룚룛룜룞룠룢룣룤룥룦룧룪룫룭룮룯룱룲룳룴룵룶룷룺룼룾룿뤀뤁뤂뤃뤅뤆뤇뤈뤉뤊뤋뤌뤍뤎뤏뤐뤑뤒뤓뤔뤕뤖뤗뤙뤚뤛뤜뤝뤞뤟뤡뤢뤣뤤뤥뤦뤧뤨뤩뤪뤫뤬뤭뤮뤯뤰뤱뤲뤳뤴뤵뤶뤷뤸뤹뤺뤻뤾뤿륁륂륃륅륆륇륈륉륊륋륍륎륐륒륓륔륕륖륗�".split(""); +for(j = 0; j != D[143].length; ++j) if(D[143][j].charCodeAt(0) !== 0xFFFD) { e[D[143][j]] = 36608 + j; d[36608 + j] = D[143][j];} +D[144] = "�����������������������������������������������������������������륚륛륝륞륟륡륢륣륤륥륦륧륪륬륮륯륰륱륲륳륶륷륹륺륻륽������륾륿릀릁릂릃릆릈릋릌릏릐릑릒릓릔릕릖릗릘릙릚릛릜릝릞������릟릠릡릢릣릤릥릦릧릨릩릪릫릮릯릱릲릳릵릶릷릸릹릺릻릾맀맂맃맄맅맆맇맊맋맍맓맔맕맖맗맚맜맟맠맢맦맧맩맪맫맭맮맯맰맱맲맳맶맻맼맽맾맿먂먃먄먅먆먇먉먊먋먌먍먎먏먐먑먒먓먔먖먗먘먙먚먛먜먝먞먟먠먡먢먣먤먥먦먧먨먩먪먫먬먭먮먯먰먱먲먳먴먵먶먷먺먻먽먾먿멁멃멄멅멆�".split(""); +for(j = 0; j != D[144].length; ++j) if(D[144][j].charCodeAt(0) !== 0xFFFD) { e[D[144][j]] = 36864 + j; d[36864 + j] = D[144][j];} +D[145] = "�����������������������������������������������������������������멇멊멌멏멐멑멒멖멗멙멚멛멝멞멟멠멡멢멣멦멪멫멬멭멮멯������멲멳멵멶멷멹멺멻멼멽멾멿몀몁몂몆몈몉몊몋몍몎몏몐몑몒������몓몔몕몖몗몘몙몚몛몜몝몞몟몠몡몢몣몤몥몦몧몪몭몮몯몱몳몴몵몶몷몺몼몾몿뫀뫁뫂뫃뫅뫆뫇뫉뫊뫋뫌뫍뫎뫏뫐뫑뫒뫓뫔뫕뫖뫗뫚뫛뫜뫝뫞뫟뫠뫡뫢뫣뫤뫥뫦뫧뫨뫩뫪뫫뫬뫭뫮뫯뫰뫱뫲뫳뫴뫵뫶뫷뫸뫹뫺뫻뫽뫾뫿묁묂묃묅묆묇묈묉묊묋묌묎묐묒묓묔묕묖묗묙묚묛묝묞묟묡묢묣묤묥묦묧�".split(""); +for(j = 0; j != D[145].length; ++j) if(D[145][j].charCodeAt(0) !== 0xFFFD) { e[D[145][j]] = 37120 + j; d[37120 + j] = D[145][j];} +D[146] = "�����������������������������������������������������������������묨묪묬묭묮묯묰묱묲묳묷묹묺묿뭀뭁뭂뭃뭆뭈뭊뭋뭌뭎뭑뭒������뭓뭕뭖뭗뭙뭚뭛뭜뭝뭞뭟뭠뭢뭤뭥뭦뭧뭨뭩뭪뭫뭭뭮뭯뭰뭱������뭲뭳뭴뭵뭶뭷뭸뭹뭺뭻뭼뭽뭾뭿뮀뮁뮂뮃뮄뮅뮆뮇뮉뮊뮋뮍뮎뮏뮑뮒뮓뮔뮕뮖뮗뮘뮙뮚뮛뮜뮝뮞뮟뮠뮡뮢뮣뮥뮦뮧뮩뮪뮫뮭뮮뮯뮰뮱뮲뮳뮵뮶뮸뮹뮺뮻뮼뮽뮾뮿믁믂믃믅믆믇믉믊믋믌믍믎믏믑믒믔믕믖믗믘믙믚믛믜믝믞믟믠믡믢믣믤믥믦믧믨믩믪믫믬믭믮믯믰믱믲믳믴믵믶믷믺믻믽믾밁�".split(""); +for(j = 0; j != D[146].length; ++j) if(D[146][j].charCodeAt(0) !== 0xFFFD) { e[D[146][j]] = 37376 + j; d[37376 + j] = D[146][j];} +D[147] = "�����������������������������������������������������������������밃밄밅밆밇밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵������밶밷밹밺밻밼밽밾밿뱂뱆뱇뱈뱊뱋뱎뱏뱑뱒뱓뱔뱕뱖뱗뱘뱙������뱚뱛뱜뱞뱟뱠뱡뱢뱣뱤뱥뱦뱧뱨뱩뱪뱫뱬뱭뱮뱯뱰뱱뱲뱳뱴뱵뱶뱷뱸뱹뱺뱻뱼뱽뱾뱿벀벁벂벃벆벇벉벊벍벏벐벑벒벓벖벘벛벜벝벞벟벢벣벥벦벩벪벫벬벭벮벯벲벶벷벸벹벺벻벾벿볁볂볃볅볆볇볈볉볊볋볌볎볒볓볔볖볗볙볚볛볝볞볟볠볡볢볣볤볥볦볧볨볩볪볫볬볭볮볯볰볱볲볳볷볹볺볻볽�".split(""); +for(j = 0; j != D[147].length; ++j) if(D[147][j].charCodeAt(0) !== 0xFFFD) { e[D[147][j]] = 37632 + j; d[37632 + j] = D[147][j];} +D[148] = "�����������������������������������������������������������������볾볿봀봁봂봃봆봈봊봋봌봍봎봏봑봒봓봕봖봗봘봙봚봛봜봝������봞봟봠봡봢봣봥봦봧봨봩봪봫봭봮봯봰봱봲봳봴봵봶봷봸봹������봺봻봼봽봾봿뵁뵂뵃뵄뵅뵆뵇뵊뵋뵍뵎뵏뵑뵒뵓뵔뵕뵖뵗뵚뵛뵜뵝뵞뵟뵠뵡뵢뵣뵥뵦뵧뵩뵪뵫뵬뵭뵮뵯뵰뵱뵲뵳뵴뵵뵶뵷뵸뵹뵺뵻뵼뵽뵾뵿붂붃붅붆붋붌붍붎붏붒붔붖붗붘붛붝붞붟붠붡붢붣붥붦붧붨붩붪붫붬붭붮붯붱붲붳붴붵붶붷붹붺붻붼붽붾붿뷀뷁뷂뷃뷄뷅뷆뷇뷈뷉뷊뷋뷌뷍뷎뷏뷐뷑�".split(""); +for(j = 0; j != D[148].length; ++j) if(D[148][j].charCodeAt(0) !== 0xFFFD) { e[D[148][j]] = 37888 + j; d[37888 + j] = D[148][j];} +D[149] = "�����������������������������������������������������������������뷒뷓뷖뷗뷙뷚뷛뷝뷞뷟뷠뷡뷢뷣뷤뷥뷦뷧뷨뷪뷫뷬뷭뷮뷯뷱������뷲뷳뷵뷶뷷뷹뷺뷻뷼뷽뷾뷿븁븂븄븆븇븈븉븊븋븎븏븑븒븓������븕븖븗븘븙븚븛븞븠븡븢븣븤븥븦븧븨븩븪븫븬븭븮븯븰븱븲븳븴븵븶븷븸븹븺븻븼븽븾븿빀빁빂빃빆빇빉빊빋빍빏빐빑빒빓빖빘빜빝빞빟빢빣빥빦빧빩빫빬빭빮빯빲빶빷빸빹빺빾빿뺁뺂뺃뺅뺆뺇뺈뺉뺊뺋뺎뺒뺓뺔뺕뺖뺗뺚뺛뺜뺝뺞뺟뺠뺡뺢뺣뺤뺥뺦뺧뺩뺪뺫뺬뺭뺮뺯뺰뺱뺲뺳뺴뺵뺶뺷�".split(""); +for(j = 0; j != D[149].length; ++j) if(D[149][j].charCodeAt(0) !== 0xFFFD) { e[D[149][j]] = 38144 + j; d[38144 + j] = D[149][j];} +D[150] = "�����������������������������������������������������������������뺸뺹뺺뺻뺼뺽뺾뺿뻀뻁뻂뻃뻄뻅뻆뻇뻈뻉뻊뻋뻌뻍뻎뻏뻒뻓������뻕뻖뻙뻚뻛뻜뻝뻞뻟뻡뻢뻦뻧뻨뻩뻪뻫뻭뻮뻯뻰뻱뻲뻳뻴뻵������뻶뻷뻸뻹뻺뻻뻼뻽뻾뻿뼀뼂뼃뼄뼅뼆뼇뼊뼋뼌뼍뼎뼏뼐뼑뼒뼓뼔뼕뼖뼗뼚뼞뼟뼠뼡뼢뼣뼤뼥뼦뼧뼨뼩뼪뼫뼬뼭뼮뼯뼰뼱뼲뼳뼴뼵뼶뼷뼸뼹뼺뼻뼼뼽뼾뼿뽂뽃뽅뽆뽇뽉뽊뽋뽌뽍뽎뽏뽒뽓뽔뽖뽗뽘뽙뽚뽛뽜뽝뽞뽟뽠뽡뽢뽣뽤뽥뽦뽧뽨뽩뽪뽫뽬뽭뽮뽯뽰뽱뽲뽳뽴뽵뽶뽷뽸뽹뽺뽻뽼뽽뽾뽿뾀뾁뾂�".split(""); +for(j = 0; j != D[150].length; ++j) if(D[150][j].charCodeAt(0) !== 0xFFFD) { e[D[150][j]] = 38400 + j; d[38400 + j] = D[150][j];} +D[151] = "�����������������������������������������������������������������뾃뾄뾅뾆뾇뾈뾉뾊뾋뾌뾍뾎뾏뾐뾑뾒뾓뾕뾖뾗뾘뾙뾚뾛뾜뾝������뾞뾟뾠뾡뾢뾣뾤뾥뾦뾧뾨뾩뾪뾫뾬뾭뾮뾯뾱뾲뾳뾴뾵뾶뾷뾸������뾹뾺뾻뾼뾽뾾뾿뿀뿁뿂뿃뿄뿆뿇뿈뿉뿊뿋뿎뿏뿑뿒뿓뿕뿖뿗뿘뿙뿚뿛뿝뿞뿠뿢뿣뿤뿥뿦뿧뿨뿩뿪뿫뿬뿭뿮뿯뿰뿱뿲뿳뿴뿵뿶뿷뿸뿹뿺뿻뿼뿽뿾뿿쀀쀁쀂쀃쀄쀅쀆쀇쀈쀉쀊쀋쀌쀍쀎쀏쀐쀑쀒쀓쀔쀕쀖쀗쀘쀙쀚쀛쀜쀝쀞쀟쀠쀡쀢쀣쀤쀥쀦쀧쀨쀩쀪쀫쀬쀭쀮쀯쀰쀱쀲쀳쀴쀵쀶쀷쀸쀹쀺쀻쀽쀾쀿�".split(""); +for(j = 0; j != D[151].length; ++j) if(D[151][j].charCodeAt(0) !== 0xFFFD) { e[D[151][j]] = 38656 + j; d[38656 + j] = D[151][j];} +D[152] = "�����������������������������������������������������������������쁀쁁쁂쁃쁄쁅쁆쁇쁈쁉쁊쁋쁌쁍쁎쁏쁐쁒쁓쁔쁕쁖쁗쁙쁚쁛������쁝쁞쁟쁡쁢쁣쁤쁥쁦쁧쁪쁫쁬쁭쁮쁯쁰쁱쁲쁳쁴쁵쁶쁷쁸쁹������쁺쁻쁼쁽쁾쁿삀삁삂삃삄삅삆삇삈삉삊삋삌삍삎삏삒삓삕삖삗삙삚삛삜삝삞삟삢삤삦삧삨삩삪삫삮삱삲삷삸삹삺삻삾샂샃샄샆샇샊샋샍샎샏샑샒샓샔샕샖샗샚샞샟샠샡샢샣샦샧샩샪샫샭샮샯샰샱샲샳샶샸샺샻샼샽샾샿섁섂섃섅섆섇섉섊섋섌섍섎섏섑섒섓섔섖섗섘섙섚섛섡섢섥섨섩섪섫섮�".split(""); +for(j = 0; j != D[152].length; ++j) if(D[152][j].charCodeAt(0) !== 0xFFFD) { e[D[152][j]] = 38912 + j; d[38912 + j] = D[152][j];} +D[153] = "�����������������������������������������������������������������섲섳섴섵섷섺섻섽섾섿셁셂셃셄셅셆셇셊셎셏셐셑셒셓셖셗������셙셚셛셝셞셟셠셡셢셣셦셪셫셬셭셮셯셱셲셳셵셶셷셹셺셻������셼셽셾셿솀솁솂솃솄솆솇솈솉솊솋솏솑솒솓솕솗솘솙솚솛솞솠솢솣솤솦솧솪솫솭솮솯솱솲솳솴솵솶솷솸솹솺솻솼솾솿쇀쇁쇂쇃쇅쇆쇇쇉쇊쇋쇍쇎쇏쇐쇑쇒쇓쇕쇖쇙쇚쇛쇜쇝쇞쇟쇡쇢쇣쇥쇦쇧쇩쇪쇫쇬쇭쇮쇯쇲쇴쇵쇶쇷쇸쇹쇺쇻쇾쇿숁숂숃숅숆숇숈숉숊숋숎숐숒숓숔숕숖숗숚숛숝숞숡숢숣�".split(""); +for(j = 0; j != D[153].length; ++j) if(D[153][j].charCodeAt(0) !== 0xFFFD) { e[D[153][j]] = 39168 + j; d[39168 + j] = D[153][j];} +D[154] = "�����������������������������������������������������������������숤숥숦숧숪숬숮숰숳숵숶숷숸숹숺숻숼숽숾숿쉀쉁쉂쉃쉄쉅������쉆쉇쉉쉊쉋쉌쉍쉎쉏쉒쉓쉕쉖쉗쉙쉚쉛쉜쉝쉞쉟쉡쉢쉣쉤쉦������쉧쉨쉩쉪쉫쉮쉯쉱쉲쉳쉵쉶쉷쉸쉹쉺쉻쉾슀슂슃슄슅슆슇슊슋슌슍슎슏슑슒슓슔슕슖슗슙슚슜슞슟슠슡슢슣슦슧슩슪슫슮슯슰슱슲슳슶슸슺슻슼슽슾슿싀싁싂싃싄싅싆싇싈싉싊싋싌싍싎싏싐싑싒싓싔싕싖싗싘싙싚싛싞싟싡싢싥싦싧싨싩싪싮싰싲싳싴싵싷싺싽싾싿쌁쌂쌃쌄쌅쌆쌇쌊쌋쌎쌏�".split(""); +for(j = 0; j != D[154].length; ++j) if(D[154][j].charCodeAt(0) !== 0xFFFD) { e[D[154][j]] = 39424 + j; d[39424 + j] = D[154][j];} +D[155] = "�����������������������������������������������������������������쌐쌑쌒쌖쌗쌙쌚쌛쌝쌞쌟쌠쌡쌢쌣쌦쌧쌪쌫쌬쌭쌮쌯쌰쌱쌲������쌳쌴쌵쌶쌷쌸쌹쌺쌻쌼쌽쌾쌿썀썁썂썃썄썆썇썈썉썊썋썌썍������썎썏썐썑썒썓썔썕썖썗썘썙썚썛썜썝썞썟썠썡썢썣썤썥썦썧썪썫썭썮썯썱썳썴썵썶썷썺썻썾썿쎀쎁쎂쎃쎅쎆쎇쎉쎊쎋쎍쎎쎏쎐쎑쎒쎓쎔쎕쎖쎗쎘쎙쎚쎛쎜쎝쎞쎟쎠쎡쎢쎣쎤쎥쎦쎧쎨쎩쎪쎫쎬쎭쎮쎯쎰쎱쎲쎳쎴쎵쎶쎷쎸쎹쎺쎻쎼쎽쎾쎿쏁쏂쏃쏄쏅쏆쏇쏈쏉쏊쏋쏌쏍쏎쏏쏐쏑쏒쏓쏔쏕쏖쏗쏚�".split(""); +for(j = 0; j != D[155].length; ++j) if(D[155][j].charCodeAt(0) !== 0xFFFD) { e[D[155][j]] = 39680 + j; d[39680 + j] = D[155][j];} +D[156] = "�����������������������������������������������������������������쏛쏝쏞쏡쏣쏤쏥쏦쏧쏪쏫쏬쏮쏯쏰쏱쏲쏳쏶쏷쏹쏺쏻쏼쏽쏾������쏿쐀쐁쐂쐃쐄쐅쐆쐇쐉쐊쐋쐌쐍쐎쐏쐑쐒쐓쐔쐕쐖쐗쐘쐙쐚������쐛쐜쐝쐞쐟쐠쐡쐢쐣쐥쐦쐧쐨쐩쐪쐫쐭쐮쐯쐱쐲쐳쐵쐶쐷쐸쐹쐺쐻쐾쐿쑀쑁쑂쑃쑄쑅쑆쑇쑉쑊쑋쑌쑍쑎쑏쑐쑑쑒쑓쑔쑕쑖쑗쑘쑙쑚쑛쑜쑝쑞쑟쑠쑡쑢쑣쑦쑧쑩쑪쑫쑭쑮쑯쑰쑱쑲쑳쑶쑷쑸쑺쑻쑼쑽쑾쑿쒁쒂쒃쒄쒅쒆쒇쒈쒉쒊쒋쒌쒍쒎쒏쒐쒑쒒쒓쒕쒖쒗쒘쒙쒚쒛쒝쒞쒟쒠쒡쒢쒣쒤쒥쒦쒧쒨쒩�".split(""); +for(j = 0; j != D[156].length; ++j) if(D[156][j].charCodeAt(0) !== 0xFFFD) { e[D[156][j]] = 39936 + j; d[39936 + j] = D[156][j];} +D[157] = "�����������������������������������������������������������������쒪쒫쒬쒭쒮쒯쒰쒱쒲쒳쒴쒵쒶쒷쒹쒺쒻쒽쒾쒿쓀쓁쓂쓃쓄쓅������쓆쓇쓈쓉쓊쓋쓌쓍쓎쓏쓐쓑쓒쓓쓔쓕쓖쓗쓘쓙쓚쓛쓜쓝쓞쓟������쓠쓡쓢쓣쓤쓥쓦쓧쓨쓪쓫쓬쓭쓮쓯쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂씃씄씅씆씇씈씉씊씋씍씎씏씑씒씓씕씖씗씘씙씚씛씝씞씟씠씡씢씣씤씥씦씧씪씫씭씮씯씱씲씳씴씵씶씷씺씼씾씿앀앁앂앃앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩앪앫앬앭앮앯앲앶앷앸앹앺앻앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔�".split(""); +for(j = 0; j != D[157].length; ++j) if(D[157][j].charCodeAt(0) !== 0xFFFD) { e[D[157][j]] = 40192 + j; d[40192 + j] = D[157][j];} +D[158] = "�����������������������������������������������������������������얖얙얚얛얝얞얟얡얢얣얤얥얦얧얨얪얫얬얭얮얯얰얱얲얳얶������얷얺얿엀엁엂엃엋엍엏엒엓엕엖엗엙엚엛엜엝엞엟엢엤엦엧������엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑옒옓옔옕옖옗옚옝옞옟옠옡옢옣옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉왊왋왌왍왎왏왒왖왗왘왙왚왛왞왟왡왢왣왤왥왦왧왨왩왪왫왭왮왰왲왳왴왵왶왷왺왻왽왾왿욁욂욃욄욅욆욇욊욌욎욏욐욑욒욓욖욗욙욚욛욝욞욟욠욡욢욣욦�".split(""); +for(j = 0; j != D[158].length; ++j) if(D[158][j].charCodeAt(0) !== 0xFFFD) { e[D[158][j]] = 40448 + j; d[40448 + j] = D[158][j];} +D[159] = "�����������������������������������������������������������������욨욪욫욬욭욮욯욲욳욵욶욷욻욼욽욾욿웂웄웆웇웈웉웊웋웎������웏웑웒웓웕웖웗웘웙웚웛웞웟웢웣웤웥웦웧웪웫웭웮웯웱웲������웳웴웵웶웷웺웻웼웾웿윀윁윂윃윆윇윉윊윋윍윎윏윐윑윒윓윖윘윚윛윜윝윞윟윢윣윥윦윧윩윪윫윬윭윮윯윲윴윶윸윹윺윻윾윿읁읂읃읅읆읇읈읉읋읎읐읙읚읛읝읞읟읡읢읣읤읥읦읧읩읪읬읭읮읯읰읱읲읳읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛잜잝잞잟잢잧잨잩잪잫잮잯잱잲잳잵잶잷�".split(""); +for(j = 0; j != D[159].length; ++j) if(D[159][j].charCodeAt(0) !== 0xFFFD) { e[D[159][j]] = 40704 + j; d[40704 + j] = D[159][j];} +D[160] = "�����������������������������������������������������������������잸잹잺잻잾쟂쟃쟄쟅쟆쟇쟊쟋쟍쟏쟑쟒쟓쟔쟕쟖쟗쟙쟚쟛쟜������쟞쟟쟠쟡쟢쟣쟥쟦쟧쟩쟪쟫쟭쟮쟯쟰쟱쟲쟳쟴쟵쟶쟷쟸쟹쟺������쟻쟼쟽쟾쟿젂젃젅젆젇젉젋젌젍젎젏젒젔젗젘젙젚젛젞젟젡젢젣젥젦젧젨젩젪젫젮젰젲젳젴젵젶젷젹젺젻젽젾젿졁졂졃졄졅졆졇졊졋졎졏졐졑졒졓졕졖졗졘졙졚졛졜졝졞졟졠졡졢졣졤졥졦졧졨졩졪졫졬졭졮졯졲졳졵졶졷졹졻졼졽졾졿좂좄좈좉좊좎좏좐좑좒좓좕좖좗좘좙좚좛좜좞좠좢좣좤�".split(""); +for(j = 0; j != D[160].length; ++j) if(D[160][j].charCodeAt(0) !== 0xFFFD) { e[D[160][j]] = 40960 + j; d[40960 + j] = D[160][j];} +D[161] = "�����������������������������������������������������������������좥좦좧좩좪좫좬좭좮좯좰좱좲좳좴좵좶좷좸좹좺좻좾좿죀죁������죂죃죅죆죇죉죊죋죍죎죏죐죑죒죓죖죘죚죛죜죝죞죟죢죣죥������죦죧죨죩죪죫죬죭죮죯죰죱죲죳죴죶죷죸죹죺죻죾죿줁줂줃줇줈줉줊줋줎 、。·‥…¨〃­―∥\∼‘’“”〔〕〈〉《》「」『』【】±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬�".split(""); +for(j = 0; j != D[161].length; ++j) if(D[161][j].charCodeAt(0) !== 0xFFFD) { e[D[161][j]] = 41216 + j; d[41216 + j] = D[161][j];} +D[162] = "�����������������������������������������������������������������줐줒줓줔줕줖줗줙줚줛줜줝줞줟줠줡줢줣줤줥줦줧줨줩줪줫������줭줮줯줰줱줲줳줵줶줷줸줹줺줻줼줽줾줿쥀쥁쥂쥃쥄쥅쥆쥇������쥈쥉쥊쥋쥌쥍쥎쥏쥒쥓쥕쥖쥗쥙쥚쥛쥜쥝쥞쥟쥢쥤쥥쥦쥧쥨쥩쥪쥫쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®������������������������".split(""); +for(j = 0; j != D[162].length; ++j) if(D[162][j].charCodeAt(0) !== 0xFFFD) { e[D[162][j]] = 41472 + j; d[41472 + j] = D[162][j];} +D[163] = "�����������������������������������������������������������������쥱쥲쥳쥵쥶쥷쥸쥹쥺쥻쥽쥾쥿즀즁즂즃즄즅즆즇즊즋즍즎즏������즑즒즓즔즕즖즗즚즜즞즟즠즡즢즣즤즥즦즧즨즩즪즫즬즭즮������즯즰즱즲즳즴즵즶즷즸즹즺즻즼즽즾즿짂짃짅짆짉짋짌짍짎짏짒짔짗짘짛!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[₩]^_`abcdefghijklmnopqrstuvwxyz{|} ̄�".split(""); +for(j = 0; j != D[163].length; ++j) if(D[163][j].charCodeAt(0) !== 0xFFFD) { e[D[163][j]] = 41728 + j; d[41728 + j] = D[163][j];} +D[164] = "�����������������������������������������������������������������짞짟짡짣짥짦짨짩짪짫짮짲짳짴짵짶짷짺짻짽짾짿쨁쨂쨃쨄������쨅쨆쨇쨊쨎쨏쨐쨑쨒쨓쨕쨖쨗쨙쨚쨛쨜쨝쨞쨟쨠쨡쨢쨣쨤쨥������쨦쨧쨨쨪쨫쨬쨭쨮쨯쨰쨱쨲쨳쨴쨵쨶쨷쨸쨹쨺쨻쨼쨽쨾쨿쩀쩁쩂쩃쩄쩅쩆ㄱㄲㄳㄴㄵㄶㄷㄸㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅃㅄㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣㅤㅥㅦㅧㅨㅩㅪㅫㅬㅭㅮㅯㅰㅱㅲㅳㅴㅵㅶㅷㅸㅹㅺㅻㅼㅽㅾㅿㆀㆁㆂㆃㆄㆅㆆㆇㆈㆉㆊㆋㆌㆍㆎ�".split(""); +for(j = 0; j != D[164].length; ++j) if(D[164][j].charCodeAt(0) !== 0xFFFD) { e[D[164][j]] = 41984 + j; d[41984 + j] = D[164][j];} +D[165] = "�����������������������������������������������������������������쩇쩈쩉쩊쩋쩎쩏쩑쩒쩓쩕쩖쩗쩘쩙쩚쩛쩞쩢쩣쩤쩥쩦쩧쩩쩪������쩫쩬쩭쩮쩯쩰쩱쩲쩳쩴쩵쩶쩷쩸쩹쩺쩻쩼쩾쩿쪀쪁쪂쪃쪅쪆������쪇쪈쪉쪊쪋쪌쪍쪎쪏쪐쪑쪒쪓쪔쪕쪖쪗쪙쪚쪛쪜쪝쪞쪟쪠쪡쪢쪣쪤쪥쪦쪧ⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹ�����ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ�������ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ��������αβγδεζηθικλμνξοπρστυφχψω�������".split(""); +for(j = 0; j != D[165].length; ++j) if(D[165][j].charCodeAt(0) !== 0xFFFD) { e[D[165][j]] = 42240 + j; d[42240 + j] = D[165][j];} +D[166] = "�����������������������������������������������������������������쪨쪩쪪쪫쪬쪭쪮쪯쪰쪱쪲쪳쪴쪵쪶쪷쪸쪹쪺쪻쪾쪿쫁쫂쫃쫅������쫆쫇쫈쫉쫊쫋쫎쫐쫒쫔쫕쫖쫗쫚쫛쫜쫝쫞쫟쫡쫢쫣쫤쫥쫦쫧������쫨쫩쫪쫫쫭쫮쫯쫰쫱쫲쫳쫵쫶쫷쫸쫹쫺쫻쫼쫽쫾쫿쬀쬁쬂쬃쬄쬅쬆쬇쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃╄╅╆╇╈╉╊���������������������������".split(""); +for(j = 0; j != D[166].length; ++j) if(D[166][j].charCodeAt(0) !== 0xFFFD) { e[D[166][j]] = 42496 + j; d[42496 + j] = D[166][j];} +D[167] = "�����������������������������������������������������������������쬋쬌쬍쬎쬏쬑쬒쬓쬕쬖쬗쬙쬚쬛쬜쬝쬞쬟쬢쬣쬤쬥쬦쬧쬨쬩������쬪쬫쬬쬭쬮쬯쬰쬱쬲쬳쬴쬵쬶쬷쬸쬹쬺쬻쬼쬽쬾쬿쭀쭂쭃쭄������쭅쭆쭇쭊쭋쭍쭎쭏쭑쭒쭓쭔쭕쭖쭗쭚쭛쭜쭞쭟쭠쭡쭢쭣쭥쭦쭧쭨쭩쭪쭫쭬㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙㎚㎛㎜㎝㎞㎟㎠㎡㎢㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰㎱㎲㎳㎴㎵㎶㎷㎸㎹㎀㎁㎂㎃㎄㎺㎻㎼㎽㎾㎿㎐㎑㎒㎓㎔Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆����������������".split(""); +for(j = 0; j != D[167].length; ++j) if(D[167][j].charCodeAt(0) !== 0xFFFD) { e[D[167][j]] = 42752 + j; d[42752 + j] = D[167][j];} +D[168] = "�����������������������������������������������������������������쭭쭮쭯쭰쭱쭲쭳쭴쭵쭶쭷쭺쭻쭼쭽쭾쭿쮀쮁쮂쮃쮄쮅쮆쮇쮈������쮉쮊쮋쮌쮍쮎쮏쮐쮑쮒쮓쮔쮕쮖쮗쮘쮙쮚쮛쮝쮞쮟쮠쮡쮢쮣������쮤쮥쮦쮧쮨쮩쮪쮫쮬쮭쮮쮯쮰쮱쮲쮳쮴쮵쮶쮷쮹쮺쮻쮼쮽쮾쮿쯀쯁쯂쯃쯄ÆЪĦ�IJ�ĿŁØŒºÞŦŊ�㉠㉡㉢㉣㉤㉥㉦㉧㉨㉩㉪㉫㉬㉭㉮㉯㉰㉱㉲㉳㉴㉵㉶㉷㉸㉹㉺㉻ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮½⅓⅔¼¾⅛⅜⅝⅞�".split(""); +for(j = 0; j != D[168].length; ++j) if(D[168][j].charCodeAt(0) !== 0xFFFD) { e[D[168][j]] = 43008 + j; d[43008 + j] = D[168][j];} +D[169] = "�����������������������������������������������������������������쯅쯆쯇쯈쯉쯊쯋쯌쯍쯎쯏쯐쯑쯒쯓쯕쯖쯗쯘쯙쯚쯛쯜쯝쯞쯟������쯠쯡쯢쯣쯥쯦쯨쯪쯫쯬쯭쯮쯯쯰쯱쯲쯳쯴쯵쯶쯷쯸쯹쯺쯻쯼������쯽쯾쯿찀찁찂찃찄찅찆찇찈찉찊찋찎찏찑찒찓찕찖찗찘찙찚찛찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀㈁㈂㈃㈄㈅㈆㈇㈈㈉㈊㈋㈌㈍㈎㈏㈐㈑㈒㈓㈔㈕㈖㈗㈘㈙㈚㈛⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂¹²³⁴ⁿ₁₂₃₄�".split(""); +for(j = 0; j != D[169].length; ++j) if(D[169][j].charCodeAt(0) !== 0xFFFD) { e[D[169][j]] = 43264 + j; d[43264 + j] = D[169][j];} +D[170] = "�����������������������������������������������������������������찥찦찪찫찭찯찱찲찳찴찵찶찷찺찿챀챁챂챃챆챇챉챊챋챍챎������챏챐챑챒챓챖챚챛챜챝챞챟챡챢챣챥챧챩챪챫챬챭챮챯챱챲������챳챴챶챷챸챹챺챻챼챽챾챿첀첁첂첃첄첅첆첇첈첉첊첋첌첍첎첏첐첑첒첓ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん������������".split(""); +for(j = 0; j != D[170].length; ++j) if(D[170][j].charCodeAt(0) !== 0xFFFD) { e[D[170][j]] = 43520 + j; d[43520 + j] = D[170][j];} +D[171] = "�����������������������������������������������������������������첔첕첖첗첚첛첝첞첟첡첢첣첤첥첦첧첪첮첯첰첱첲첳첶첷첹������첺첻첽첾첿쳀쳁쳂쳃쳆쳈쳊쳋쳌쳍쳎쳏쳑쳒쳓쳕쳖쳗쳘쳙쳚������쳛쳜쳝쳞쳟쳠쳡쳢쳣쳥쳦쳧쳨쳩쳪쳫쳭쳮쳯쳱쳲쳳쳴쳵쳶쳷쳸쳹쳺쳻쳼쳽ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ���������".split(""); +for(j = 0; j != D[171].length; ++j) if(D[171][j].charCodeAt(0) !== 0xFFFD) { e[D[171][j]] = 43776 + j; d[43776 + j] = D[171][j];} +D[172] = "�����������������������������������������������������������������쳾쳿촀촂촃촄촅촆촇촊촋촍촎촏촑촒촓촔촕촖촗촚촜촞촟촠������촡촢촣촥촦촧촩촪촫촭촮촯촰촱촲촳촴촵촶촷촸촺촻촼촽촾������촿쵀쵁쵂쵃쵄쵅쵆쵇쵈쵉쵊쵋쵌쵍쵎쵏쵐쵑쵒쵓쵔쵕쵖쵗쵘쵙쵚쵛쵝쵞쵟АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ���������������абвгдеёжзийклмнопрстуфхцчшщъыьэюя��������������".split(""); +for(j = 0; j != D[172].length; ++j) if(D[172][j].charCodeAt(0) !== 0xFFFD) { e[D[172][j]] = 44032 + j; d[44032 + j] = D[172][j];} +D[173] = "�����������������������������������������������������������������쵡쵢쵣쵥쵦쵧쵨쵩쵪쵫쵮쵰쵲쵳쵴쵵쵶쵷쵹쵺쵻쵼쵽쵾쵿춀������춁춂춃춄춅춆춇춉춊춋춌춍춎춏춐춑춒춓춖춗춙춚춛춝춞춟������춠춡춢춣춦춨춪춫춬춭춮춯춱춲춳춴춵춶춷춸춹춺춻춼춽춾춿췀췁췂췃췅�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[173].length; ++j) if(D[173][j].charCodeAt(0) !== 0xFFFD) { e[D[173][j]] = 44288 + j; d[44288 + j] = D[173][j];} +D[174] = "�����������������������������������������������������������������췆췇췈췉췊췋췍췎췏췑췒췓췔췕췖췗췘췙췚췛췜췝췞췟췠췡������췢췣췤췥췦췧췩췪췫췭췮췯췱췲췳췴췵췶췷췺췼췾췿츀츁츂������츃츅츆츇츉츊츋츍츎츏츐츑츒츓츕츖츗츘츚츛츜츝츞츟츢츣츥츦츧츩츪츫�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[174].length; ++j) if(D[174][j].charCodeAt(0) !== 0xFFFD) { e[D[174][j]] = 44544 + j; d[44544 + j] = D[174][j];} +D[175] = "�����������������������������������������������������������������츬츭츮츯츲츴츶츷츸츹츺츻츼츽츾츿칀칁칂칃칄칅칆칇칈칉������칊칋칌칍칎칏칐칑칒칓칔칕칖칗칚칛칝칞칢칣칤칥칦칧칪칬������칮칯칰칱칲칳칶칷칹칺칻칽칾칿캀캁캂캃캆캈캊캋캌캍캎캏캒캓캕캖캗캙�����������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[175].length; ++j) if(D[175][j].charCodeAt(0) !== 0xFFFD) { e[D[175][j]] = 44800 + j; d[44800 + j] = D[175][j];} +D[176] = "�����������������������������������������������������������������캚캛캜캝캞캟캢캦캧캨캩캪캫캮캯캰캱캲캳캴캵캶캷캸캹캺������캻캼캽캾캿컀컂컃컄컅컆컇컈컉컊컋컌컍컎컏컐컑컒컓컔컕������컖컗컘컙컚컛컜컝컞컟컠컡컢컣컦컧컩컪컭컮컯컰컱컲컳컶컺컻컼컽컾컿가각간갇갈갉갊감갑값갓갔강갖갗같갚갛개객갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆�".split(""); +for(j = 0; j != D[176].length; ++j) if(D[176][j].charCodeAt(0) !== 0xFFFD) { e[D[176][j]] = 45056 + j; d[45056 + j] = D[176][j];} +D[177] = "�����������������������������������������������������������������켂켃켅켆켇켉켊켋켌켍켎켏켒켔켖켗켘켙켚켛켝켞켟켡켢켣������켥켦켧켨켩켪켫켮켲켳켴켵켶켷켹켺켻켼켽켾켿콀콁콂콃콄������콅콆콇콈콉콊콋콌콍콎콏콐콑콒콓콖콗콙콚콛콝콞콟콠콡콢콣콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸�".split(""); +for(j = 0; j != D[177].length; ++j) if(D[177][j].charCodeAt(0) !== 0xFFFD) { e[D[177][j]] = 45312 + j; d[45312 + j] = D[177][j];} +D[178] = "�����������������������������������������������������������������콭콮콯콲콳콵콶콷콹콺콻콼콽콾콿쾁쾂쾃쾄쾆쾇쾈쾉쾊쾋쾍������쾎쾏쾐쾑쾒쾓쾔쾕쾖쾗쾘쾙쾚쾛쾜쾝쾞쾟쾠쾢쾣쾤쾥쾦쾧쾩������쾪쾫쾬쾭쾮쾯쾱쾲쾳쾴쾵쾶쾷쾸쾹쾺쾻쾼쾽쾾쾿쿀쿁쿂쿃쿅쿆쿇쿈쿉쿊쿋깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙�".split(""); +for(j = 0; j != D[178].length; ++j) if(D[178][j].charCodeAt(0) !== 0xFFFD) { e[D[178][j]] = 45568 + j; d[45568 + j] = D[178][j];} +D[179] = "�����������������������������������������������������������������쿌쿍쿎쿏쿐쿑쿒쿓쿔쿕쿖쿗쿘쿙쿚쿛쿜쿝쿞쿟쿢쿣쿥쿦쿧쿩������쿪쿫쿬쿭쿮쿯쿲쿴쿶쿷쿸쿹쿺쿻쿽쿾쿿퀁퀂퀃퀅퀆퀇퀈퀉퀊������퀋퀌퀍퀎퀏퀐퀒퀓퀔퀕퀖퀗퀙퀚퀛퀜퀝퀞퀟퀠퀡퀢퀣퀤퀥퀦퀧퀨퀩퀪퀫퀬끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫났낭낮낯낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝�".split(""); +for(j = 0; j != D[179].length; ++j) if(D[179][j].charCodeAt(0) !== 0xFFFD) { e[D[179][j]] = 45824 + j; d[45824 + j] = D[179][j];} +D[180] = "�����������������������������������������������������������������퀮퀯퀰퀱퀲퀳퀶퀷퀹퀺퀻퀽퀾퀿큀큁큂큃큆큈큊큋큌큍큎큏������큑큒큓큕큖큗큙큚큛큜큝큞큟큡큢큣큤큥큦큧큨큩큪큫큮큯������큱큲큳큵큶큷큸큹큺큻큾큿킀킂킃킄킅킆킇킈킉킊킋킌킍킎킏킐킑킒킓킔뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫달닭닮닯닳담답닷닸당닺닻닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥�".split(""); +for(j = 0; j != D[180].length; ++j) if(D[180][j].charCodeAt(0) !== 0xFFFD) { e[D[180][j]] = 46080 + j; d[46080 + j] = D[180][j];} +D[181] = "�����������������������������������������������������������������킕킖킗킘킙킚킛킜킝킞킟킠킡킢킣킦킧킩킪킫킭킮킯킰킱킲������킳킶킸킺킻킼킽킾킿탂탃탅탆탇탊탋탌탍탎탏탒탖탗탘탙탚������탛탞탟탡탢탣탥탦탧탨탩탪탫탮탲탳탴탵탶탷탹탺탻탼탽탾탿턀턁턂턃턄덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸�".split(""); +for(j = 0; j != D[181].length; ++j) if(D[181][j].charCodeAt(0) !== 0xFFFD) { e[D[181][j]] = 46336 + j; d[46336 + j] = D[181][j];} +D[182] = "�����������������������������������������������������������������턅턆턇턈턉턊턋턌턎턏턐턑턒턓턔턕턖턗턘턙턚턛턜턝턞턟������턠턡턢턣턤턥턦턧턨턩턪턫턬턭턮턯턲턳턵턶턷턹턻턼턽턾������턿텂텆텇텈텉텊텋텎텏텑텒텓텕텖텗텘텙텚텛텞텠텢텣텤텥텦텧텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗�".split(""); +for(j = 0; j != D[182].length; ++j) if(D[182][j].charCodeAt(0) !== 0xFFFD) { e[D[182][j]] = 46592 + j; d[46592 + j] = D[182][j];} +D[183] = "�����������������������������������������������������������������텮텯텰텱텲텳텴텵텶텷텸텹텺텻텽텾텿톀톁톂톃톅톆톇톉톊������톋톌톍톎톏톐톑톒톓톔톕톖톗톘톙톚톛톜톝톞톟톢톣톥톦톧������톩톪톫톬톭톮톯톲톴톶톷톸톹톻톽톾톿퇁퇂퇃퇄퇅퇆퇇퇈퇉퇊퇋퇌퇍퇎퇏래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩�".split(""); +for(j = 0; j != D[183].length; ++j) if(D[183][j].charCodeAt(0) !== 0xFFFD) { e[D[183][j]] = 46848 + j; d[46848 + j] = D[183][j];} +D[184] = "�����������������������������������������������������������������퇐퇑퇒퇓퇔퇕퇖퇗퇙퇚퇛퇜퇝퇞퇟퇠퇡퇢퇣퇤퇥퇦퇧퇨퇩퇪������퇫퇬퇭퇮퇯퇰퇱퇲퇳퇵퇶퇷퇹퇺퇻퇼퇽퇾퇿툀툁툂툃툄툅툆������툈툊툋툌툍툎툏툑툒툓툔툕툖툗툘툙툚툛툜툝툞툟툠툡툢툣툤툥툦툧툨툩륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많맏말맑맒맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼�".split(""); +for(j = 0; j != D[184].length; ++j) if(D[184][j].charCodeAt(0) !== 0xFFFD) { e[D[184][j]] = 47104 + j; d[47104 + j] = D[184][j];} +D[185] = "�����������������������������������������������������������������툪툫툮툯툱툲툳툵툶툷툸툹툺툻툾퉀퉂퉃퉄퉅퉆퉇퉉퉊퉋퉌������퉍퉎퉏퉐퉑퉒퉓퉔퉕퉖퉗퉘퉙퉚퉛퉝퉞퉟퉠퉡퉢퉣퉥퉦퉧퉨������퉩퉪퉫퉬퉭퉮퉯퉰퉱퉲퉳퉴퉵퉶퉷퉸퉹퉺퉻퉼퉽퉾퉿튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바박밖밗반받발밝밞밟밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗�".split(""); +for(j = 0; j != D[185].length; ++j) if(D[185][j].charCodeAt(0) !== 0xFFFD) { e[D[185][j]] = 47360 + j; d[47360 + j] = D[185][j];} +D[186] = "�����������������������������������������������������������������튍튎튏튒튓튔튖튗튘튙튚튛튝튞튟튡튢튣튥튦튧튨튩튪튫튭������튮튯튰튲튳튴튵튶튷튺튻튽튾틁틃틄틅틆틇틊틌틍틎틏틐틑������틒틓틕틖틗틙틚틛틝틞틟틠틡틢틣틦틧틨틩틪틫틬틭틮틯틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤�".split(""); +for(j = 0; j != D[186].length; ++j) if(D[186][j].charCodeAt(0) !== 0xFFFD) { e[D[186][j]] = 47616 + j; d[47616 + j] = D[186][j];} +D[187] = "�����������������������������������������������������������������틻틼틽틾틿팂팄팆팇팈팉팊팋팏팑팒팓팕팗팘팙팚팛팞팢팣������팤팦팧팪팫팭팮팯팱팲팳팴팵팶팷팺팾팿퍀퍁퍂퍃퍆퍇퍈퍉������퍊퍋퍌퍍퍎퍏퍐퍑퍒퍓퍔퍕퍖퍗퍘퍙퍚퍛퍜퍝퍞퍟퍠퍡퍢퍣퍤퍥퍦퍧퍨퍩빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤�".split(""); +for(j = 0; j != D[187].length; ++j) if(D[187][j].charCodeAt(0) !== 0xFFFD) { e[D[187][j]] = 47872 + j; d[47872 + j] = D[187][j];} +D[188] = "�����������������������������������������������������������������퍪퍫퍬퍭퍮퍯퍰퍱퍲퍳퍴퍵퍶퍷퍸퍹퍺퍻퍾퍿펁펂펃펅펆펇������펈펉펊펋펎펒펓펔펕펖펗펚펛펝펞펟펡펢펣펤펥펦펧펪펬펮������펯펰펱펲펳펵펶펷펹펺펻펽펾펿폀폁폂폃폆폇폊폋폌폍폎폏폑폒폓폔폕폖샥샨샬샴샵샷샹섀섄섈섐섕서석섞섟선섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭�".split(""); +for(j = 0; j != D[188].length; ++j) if(D[188][j].charCodeAt(0) !== 0xFFFD) { e[D[188][j]] = 48128 + j; d[48128 + j] = D[188][j];} +D[189] = "�����������������������������������������������������������������폗폙폚폛폜폝폞폟폠폢폤폥폦폧폨폩폪폫폮폯폱폲폳폵폶폷������폸폹폺폻폾퐀퐂퐃퐄퐅퐆퐇퐉퐊퐋퐌퐍퐎퐏퐐퐑퐒퐓퐔퐕퐖������퐗퐘퐙퐚퐛퐜퐞퐟퐠퐡퐢퐣퐤퐥퐦퐧퐨퐩퐪퐫퐬퐭퐮퐯퐰퐱퐲퐳퐴퐵퐶퐷숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰�".split(""); +for(j = 0; j != D[189].length; ++j) if(D[189][j].charCodeAt(0) !== 0xFFFD) { e[D[189][j]] = 48384 + j; d[48384 + j] = D[189][j];} +D[190] = "�����������������������������������������������������������������퐸퐹퐺퐻퐼퐽퐾퐿푁푂푃푅푆푇푈푉푊푋푌푍푎푏푐푑푒푓������푔푕푖푗푘푙푚푛푝푞푟푡푢푣푥푦푧푨푩푪푫푬푮푰푱푲������푳푴푵푶푷푺푻푽푾풁풃풄풅풆풇풊풌풎풏풐풑풒풓풕풖풗풘풙풚풛풜풝쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄업없엇었엉엊엌엎�".split(""); +for(j = 0; j != D[190].length; ++j) if(D[190][j].charCodeAt(0) !== 0xFFFD) { e[D[190][j]] = 48640 + j; d[48640 + j] = D[190][j];} +D[191] = "�����������������������������������������������������������������풞풟풠풡풢풣풤풥풦풧풨풪풫풬풭풮풯풰풱풲풳풴풵풶풷풸������풹풺풻풼풽풾풿퓀퓁퓂퓃퓄퓅퓆퓇퓈퓉퓊퓋퓍퓎퓏퓑퓒퓓퓕������퓖퓗퓘퓙퓚퓛퓝퓞퓠퓡퓢퓣퓤퓥퓦퓧퓩퓪퓫퓭퓮퓯퓱퓲퓳퓴퓵퓶퓷퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염엽엾엿였영옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨�".split(""); +for(j = 0; j != D[191].length; ++j) if(D[191][j].charCodeAt(0) !== 0xFFFD) { e[D[191][j]] = 48896 + j; d[48896 + j] = D[191][j];} +D[192] = "�����������������������������������������������������������������퓾퓿픀픁픂픃픅픆픇픉픊픋픍픎픏픐픑픒픓픖픘픙픚픛픜픝������픞픟픠픡픢픣픤픥픦픧픨픩픪픫픬픭픮픯픰픱픲픳픴픵픶픷������픸픹픺픻픾픿핁핂핃핅핆핇핈핉핊핋핎핐핒핓핔핕핖핗핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응읒읓읔읕읖읗의읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊�".split(""); +for(j = 0; j != D[192].length; ++j) if(D[192][j].charCodeAt(0) !== 0xFFFD) { e[D[192][j]] = 49152 + j; d[49152 + j] = D[192][j];} +D[193] = "�����������������������������������������������������������������핤핦핧핪핬핮핯핰핱핲핳핶핷핹핺핻핽핾핿햀햁햂햃햆햊햋������햌햍햎햏햑햒햓햔햕햖햗햘햙햚햛햜햝햞햟햠햡햢햣햤햦햧������햨햩햪햫햬햭햮햯햰햱햲햳햴햵햶햷햸햹햺햻햼햽햾햿헀헁헂헃헄헅헆헇점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓�".split(""); +for(j = 0; j != D[193].length; ++j) if(D[193][j].charCodeAt(0) !== 0xFFFD) { e[D[193][j]] = 49408 + j; d[49408 + j] = D[193][j];} +D[194] = "�����������������������������������������������������������������헊헋헍헎헏헑헓헔헕헖헗헚헜헞헟헠헡헢헣헦헧헩헪헫헭헮������헯헰헱헲헳헶헸헺헻헼헽헾헿혂혃혅혆혇혉혊혋혌혍혎혏혒������혖혗혘혙혚혛혝혞혟혡혢혣혥혦혧혨혩혪혫혬혮혯혰혱혲혳혴혵혶혷혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻�".split(""); +for(j = 0; j != D[194].length; ++j) if(D[194][j].charCodeAt(0) !== 0xFFFD) { e[D[194][j]] = 49664 + j; d[49664 + j] = D[194][j];} +D[195] = "�����������������������������������������������������������������혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝홞홟홠홡������홢홣홤홥홦홨홪홫홬홭홮홯홲홳홵홶홷홸홹홺홻홼홽홾홿횀������횁횂횄횆횇횈횉횊횋횎횏횑횒횓횕횖횗횘횙횚횛횜횞횠횢횣횤횥횦횧횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층�".split(""); +for(j = 0; j != D[195].length; ++j) if(D[195][j].charCodeAt(0) !== 0xFFFD) { e[D[195][j]] = 49920 + j; d[49920 + j] = D[195][j];} +D[196] = "�����������������������������������������������������������������횫횭횮횯횱횲횳횴횵횶횷횸횺횼횽횾횿훀훁훂훃훆훇훉훊훋������훍훎훏훐훒훓훕훖훘훚훛훜훝훞훟훡훢훣훥훦훧훩훪훫훬훭������훮훯훱훲훳훴훶훷훸훹훺훻훾훿휁휂휃휅휆휇휈휉휊휋휌휍휎휏휐휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼�".split(""); +for(j = 0; j != D[196].length; ++j) if(D[196][j].charCodeAt(0) !== 0xFFFD) { e[D[196][j]] = 50176 + j; d[50176 + j] = D[196][j];} +D[197] = "�����������������������������������������������������������������휕휖휗휚휛휝휞휟휡휢휣휤휥휦휧휪휬휮휯휰휱휲휳휶휷휹������휺휻휽휾휿흀흁흂흃흅흆흈흊흋흌흍흎흏흒흓흕흚흛흜흝흞������흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵흶흷흸흹흺흻흾흿힀힂힃힄힅힆힇힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜�".split(""); +for(j = 0; j != D[197].length; ++j) if(D[197][j].charCodeAt(0) !== 0xFFFD) { e[D[197][j]] = 50432 + j; d[50432 + j] = D[197][j];} +D[198] = "�����������������������������������������������������������������힍힎힏힑힒힓힔힕힖힗힚힜힞힟힠힡힢힣������������������������������������������������������������������������������퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁�".split(""); +for(j = 0; j != D[198].length; ++j) if(D[198][j].charCodeAt(0) !== 0xFFFD) { e[D[198][j]] = 50688 + j; d[50688 + j] = D[198][j];} +D[199] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠�".split(""); +for(j = 0; j != D[199].length; ++j) if(D[199][j].charCodeAt(0) !== 0xFFFD) { e[D[199][j]] = 50944 + j; d[50944 + j] = D[199][j];} +D[200] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝�".split(""); +for(j = 0; j != D[200].length; ++j) if(D[200][j].charCodeAt(0) !== 0xFFFD) { e[D[200][j]] = 51200 + j; d[51200 + j] = D[200][j];} +D[202] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕�".split(""); +for(j = 0; j != D[202].length; ++j) if(D[202][j].charCodeAt(0) !== 0xFFFD) { e[D[202][j]] = 51712 + j; d[51712 + j] = D[202][j];} +D[203] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢�".split(""); +for(j = 0; j != D[203].length; ++j) if(D[203][j].charCodeAt(0) !== 0xFFFD) { e[D[203][j]] = 51968 + j; d[51968 + j] = D[203][j];} +D[204] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械�".split(""); +for(j = 0; j != D[204].length; ++j) if(D[204][j].charCodeAt(0) !== 0xFFFD) { e[D[204][j]] = 52224 + j; d[52224 + j] = D[204][j];} +D[205] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜�".split(""); +for(j = 0; j != D[205].length; ++j) if(D[205][j].charCodeAt(0) !== 0xFFFD) { e[D[205][j]] = 52480 + j; d[52480 + j] = D[205][j];} +D[206] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾�".split(""); +for(j = 0; j != D[206].length; ++j) if(D[206][j].charCodeAt(0) !== 0xFFFD) { e[D[206][j]] = 52736 + j; d[52736 + j] = D[206][j];} +D[207] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴�".split(""); +for(j = 0; j != D[207].length; ++j) if(D[207][j].charCodeAt(0) !== 0xFFFD) { e[D[207][j]] = 52992 + j; d[52992 + j] = D[207][j];} +D[208] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣�".split(""); +for(j = 0; j != D[208].length; ++j) if(D[208][j].charCodeAt(0) !== 0xFFFD) { e[D[208][j]] = 53248 + j; d[53248 + j] = D[208][j];} +D[209] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩羅蘿螺裸邏那樂洛烙珞落諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉�".split(""); +for(j = 0; j != D[209].length; ++j) if(D[209][j].charCodeAt(0) !== 0xFFFD) { e[D[209][j]] = 53504 + j; d[53504 + j] = D[209][j];} +D[210] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������納臘蠟衲囊娘廊朗浪狼郎乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧老蘆虜路露駑魯鷺碌祿綠菉錄鹿論壟弄濃籠聾膿農惱牢磊腦賂雷尿壘屢樓淚漏累縷陋嫩訥杻紐勒肋凜凌稜綾能菱陵尼泥匿溺多茶�".split(""); +for(j = 0; j != D[210].length; ++j) if(D[210][j].charCodeAt(0) !== 0xFFFD) { e[D[210][j]] = 53760 + j; d[53760 + j] = D[210][j];} +D[211] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃�".split(""); +for(j = 0; j != D[211].length; ++j) if(D[211][j].charCodeAt(0) !== 0xFFFD) { e[D[211][j]] = 54016 + j; d[54016 + j] = D[211][j];} +D[212] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅�".split(""); +for(j = 0; j != D[212].length; ++j) if(D[212][j].charCodeAt(0) !== 0xFFFD) { e[D[212][j]] = 54272 + j; d[54272 + j] = D[212][j];} +D[213] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣�".split(""); +for(j = 0; j != D[213].length; ++j) if(D[213][j].charCodeAt(0) !== 0xFFFD) { e[D[213][j]] = 54528 + j; d[54528 + j] = D[213][j];} +D[214] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼�".split(""); +for(j = 0; j != D[214].length; ++j) if(D[214][j].charCodeAt(0) !== 0xFFFD) { e[D[214][j]] = 54784 + j; d[54784 + j] = D[214][j];} +D[215] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬�".split(""); +for(j = 0; j != D[215].length; ++j) if(D[215][j].charCodeAt(0) !== 0xFFFD) { e[D[215][j]] = 55040 + j; d[55040 + j] = D[215][j];} +D[216] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅�".split(""); +for(j = 0; j != D[216].length; ++j) if(D[216][j].charCodeAt(0) !== 0xFFFD) { e[D[216][j]] = 55296 + j; d[55296 + j] = D[216][j];} +D[217] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文�".split(""); +for(j = 0; j != D[217].length; ++j) if(D[217][j].charCodeAt(0) !== 0xFFFD) { e[D[217][j]] = 55552 + j; d[55552 + j] = D[217][j];} +D[218] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑�".split(""); +for(j = 0; j != D[218].length; ++j) if(D[218][j].charCodeAt(0) !== 0xFFFD) { e[D[218][j]] = 55808 + j; d[55808 + j] = D[218][j];} +D[219] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖�".split(""); +for(j = 0; j != D[219].length; ++j) if(D[219][j].charCodeAt(0) !== 0xFFFD) { e[D[219][j]] = 56064 + j; d[56064 + j] = D[219][j];} +D[220] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦�".split(""); +for(j = 0; j != D[220].length; ++j) if(D[220][j].charCodeAt(0) !== 0xFFFD) { e[D[220][j]] = 56320 + j; d[56320 + j] = D[220][j];} +D[221] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥�".split(""); +for(j = 0; j != D[221].length; ++j) if(D[221][j].charCodeAt(0) !== 0xFFFD) { e[D[221][j]] = 56576 + j; d[56576 + j] = D[221][j];} +D[222] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索�".split(""); +for(j = 0; j != D[222].length; ++j) if(D[222][j].charCodeAt(0) !== 0xFFFD) { e[D[222][j]] = 56832 + j; d[56832 + j] = D[222][j];} +D[223] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署�".split(""); +for(j = 0; j != D[223].length; ++j) if(D[223][j].charCodeAt(0) !== 0xFFFD) { e[D[223][j]] = 57088 + j; d[57088 + j] = D[223][j];} +D[224] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬�".split(""); +for(j = 0; j != D[224].length; ++j) if(D[224][j].charCodeAt(0) !== 0xFFFD) { e[D[224][j]] = 57344 + j; d[57344 + j] = D[224][j];} +D[225] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁�".split(""); +for(j = 0; j != D[225].length; ++j) if(D[225][j].charCodeAt(0) !== 0xFFFD) { e[D[225][j]] = 57600 + j; d[57600 + j] = D[225][j];} +D[226] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧�".split(""); +for(j = 0; j != D[226].length; ++j) if(D[226][j].charCodeAt(0) !== 0xFFFD) { e[D[226][j]] = 57856 + j; d[57856 + j] = D[226][j];} +D[227] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁�".split(""); +for(j = 0; j != D[227].length; ++j) if(D[227][j].charCodeAt(0) !== 0xFFFD) { e[D[227][j]] = 58112 + j; d[58112 + j] = D[227][j];} +D[228] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額�".split(""); +for(j = 0; j != D[228].length; ++j) if(D[228][j].charCodeAt(0) !== 0xFFFD) { e[D[228][j]] = 58368 + j; d[58368 + j] = D[228][j];} +D[229] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬�".split(""); +for(j = 0; j != D[229].length; ++j) if(D[229][j].charCodeAt(0) !== 0xFFFD) { e[D[229][j]] = 58624 + j; d[58624 + j] = D[229][j];} +D[230] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒�".split(""); +for(j = 0; j != D[230].length; ++j) if(D[230][j].charCodeAt(0) !== 0xFFFD) { e[D[230][j]] = 58880 + j; d[58880 + j] = D[230][j];} +D[231] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳�".split(""); +for(j = 0; j != D[231].length; ++j) if(D[231][j].charCodeAt(0) !== 0xFFFD) { e[D[231][j]] = 59136 + j; d[59136 + j] = D[231][j];} +D[232] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療�".split(""); +for(j = 0; j != D[232].length; ++j) if(D[232][j].charCodeAt(0) !== 0xFFFD) { e[D[232][j]] = 59392 + j; d[59392 + j] = D[232][j];} +D[233] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓�".split(""); +for(j = 0; j != D[233].length; ++j) if(D[233][j].charCodeAt(0) !== 0xFFFD) { e[D[233][j]] = 59648 + j; d[59648 + j] = D[233][j];} +D[234] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜�".split(""); +for(j = 0; j != D[234].length; ++j) if(D[234][j].charCodeAt(0) !== 0xFFFD) { e[D[234][j]] = 59904 + j; d[59904 + j] = D[234][j];} +D[235] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼�".split(""); +for(j = 0; j != D[235].length; ++j) if(D[235][j].charCodeAt(0) !== 0xFFFD) { e[D[235][j]] = 60160 + j; d[60160 + j] = D[235][j];} +D[236] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄�".split(""); +for(j = 0; j != D[236].length; ++j) if(D[236][j].charCodeAt(0) !== 0xFFFD) { e[D[236][j]] = 60416 + j; d[60416 + j] = D[236][j];} +D[237] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長�".split(""); +for(j = 0; j != D[237].length; ++j) if(D[237][j].charCodeAt(0) !== 0xFFFD) { e[D[237][j]] = 60672 + j; d[60672 + j] = D[237][j];} +D[238] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱�".split(""); +for(j = 0; j != D[238].length; ++j) if(D[238][j].charCodeAt(0) !== 0xFFFD) { e[D[238][j]] = 60928 + j; d[60928 + j] = D[238][j];} +D[239] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖�".split(""); +for(j = 0; j != D[239].length; ++j) if(D[239][j].charCodeAt(0) !== 0xFFFD) { e[D[239][j]] = 61184 + j; d[61184 + j] = D[239][j];} +D[240] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫�".split(""); +for(j = 0; j != D[240].length; ++j) if(D[240][j].charCodeAt(0) !== 0xFFFD) { e[D[240][j]] = 61440 + j; d[61440 + j] = D[240][j];} +D[241] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只�".split(""); +for(j = 0; j != D[241].length; ++j) if(D[241][j].charCodeAt(0) !== 0xFFFD) { e[D[241][j]] = 61696 + j; d[61696 + j] = D[241][j];} +D[242] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯�".split(""); +for(j = 0; j != D[242].length; ++j) if(D[242][j].charCodeAt(0) !== 0xFFFD) { e[D[242][j]] = 61952 + j; d[61952 + j] = D[242][j];} +D[243] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策�".split(""); +for(j = 0; j != D[243].length; ++j) if(D[243][j].charCodeAt(0) !== 0xFFFD) { e[D[243][j]] = 62208 + j; d[62208 + j] = D[243][j];} +D[244] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢�".split(""); +for(j = 0; j != D[244].length; ++j) if(D[244][j].charCodeAt(0) !== 0xFFFD) { e[D[244][j]] = 62464 + j; d[62464 + j] = D[244][j];} +D[245] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃�".split(""); +for(j = 0; j != D[245].length; ++j) if(D[245][j].charCodeAt(0) !== 0xFFFD) { e[D[245][j]] = 62720 + j; d[62720 + j] = D[245][j];} +D[246] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託�".split(""); +for(j = 0; j != D[246].length; ++j) if(D[246][j].charCodeAt(0) !== 0xFFFD) { e[D[246][j]] = 62976 + j; d[62976 + j] = D[246][j];} +D[247] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑�".split(""); +for(j = 0; j != D[247].length; ++j) if(D[247][j].charCodeAt(0) !== 0xFFFD) { e[D[247][j]] = 63232 + j; d[63232 + j] = D[247][j];} +D[248] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃�".split(""); +for(j = 0; j != D[248].length; ++j) if(D[248][j].charCodeAt(0) !== 0xFFFD) { e[D[248][j]] = 63488 + j; d[63488 + j] = D[248][j];} +D[249] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航�".split(""); +for(j = 0; j != D[249].length; ++j) if(D[249][j].charCodeAt(0) !== 0xFFFD) { e[D[249][j]] = 63744 + j; d[63744 + j] = D[249][j];} +D[250] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型�".split(""); +for(j = 0; j != D[250].length; ++j) if(D[250][j].charCodeAt(0) !== 0xFFFD) { e[D[250][j]] = 64000 + j; d[64000 + j] = D[250][j];} +D[251] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵�".split(""); +for(j = 0; j != D[251].length; ++j) if(D[251][j].charCodeAt(0) !== 0xFFFD) { e[D[251][j]] = 64256 + j; d[64256 + j] = D[251][j];} +D[252] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆�".split(""); +for(j = 0; j != D[252].length; ++j) if(D[252][j].charCodeAt(0) !== 0xFFFD) { e[D[252][j]] = 64512 + j; d[64512 + j] = D[252][j];} +D[253] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰�".split(""); +for(j = 0; j != D[253].length; ++j) if(D[253][j].charCodeAt(0) !== 0xFFFD) { e[D[253][j]] = 64768 + j; d[64768 + j] = D[253][j];} +return {"enc": e, "dec": d }; })(); +cptable[950] = (function(){ var d = [], e = {}, D = [], j; +D[0] = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[0].length; ++j) if(D[0][j].charCodeAt(0) !== 0xFFFD) { e[D[0][j]] = 0 + j; d[0 + j] = D[0][j];} +D[161] = "���������������������������������������������������������������� ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚����������������������������������﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢﹣﹤﹥﹦~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/�".split(""); +for(j = 0; j != D[161].length; ++j) if(D[161][j].charCodeAt(0) !== 0xFFFD) { e[D[161][j]] = 41216 + j; d[41216 + j] = D[161][j];} +D[162] = "����������������������������������������������������������������\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁▂▃▄▅▆▇█▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭����������������������������������╮╰╯═╞╪╡◢◣◥◤╱╲╳0123456789ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ〡〢〣〤〥〦〧〨〩十卄卅ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv�".split(""); +for(j = 0; j != D[162].length; ++j) if(D[162][j].charCodeAt(0) !== 0xFFFD) { e[D[162][j]] = 41472 + j; d[41472 + j] = D[162][j];} +D[163] = "����������������������������������������������������������������wxyzΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏ����������������������������������ㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩ˙ˉˊˇˋ���������������������������������€������������������������������".split(""); +for(j = 0; j != D[163].length; ++j) if(D[163][j].charCodeAt(0) !== 0xFFFD) { e[D[163][j]] = 41728 + j; d[41728 + j] = D[163][j];} +D[164] = "����������������������������������������������������������������一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才����������������������������������丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙�".split(""); +for(j = 0; j != D[164].length; ++j) if(D[164][j].charCodeAt(0) !== 0xFFFD) { e[D[164][j]] = 41984 + j; d[41984 + j] = D[164][j];} +D[165] = "����������������������������������������������������������������世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外����������������������������������央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全�".split(""); +for(j = 0; j != D[165].length; ++j) if(D[165][j].charCodeAt(0) !== 0xFFFD) { e[D[165][j]] = 42240 + j; d[42240 + j] = D[165][j];} +D[166] = "����������������������������������������������������������������共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年����������������������������������式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣�".split(""); +for(j = 0; j != D[166].length; ++j) if(D[166][j].charCodeAt(0) !== 0xFFFD) { e[D[166][j]] = 42496 + j; d[42496 + j] = D[166][j];} +D[167] = "����������������������������������������������������������������作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍����������������������������������均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠�".split(""); +for(j = 0; j != D[167].length; ++j) if(D[167][j].charCodeAt(0) !== 0xFFFD) { e[D[167][j]] = 42752 + j; d[42752 + j] = D[167][j];} +D[168] = "����������������������������������������������������������������杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒����������������������������������芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵�".split(""); +for(j = 0; j != D[168].length; ++j) if(D[168][j].charCodeAt(0) !== 0xFFFD) { e[D[168][j]] = 43008 + j; d[43008 + j] = D[168][j];} +D[169] = "����������������������������������������������������������������咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居����������������������������������屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊�".split(""); +for(j = 0; j != D[169].length; ++j) if(D[169][j].charCodeAt(0) !== 0xFFFD) { e[D[169][j]] = 43264 + j; d[43264 + j] = D[169][j];} +D[170] = "����������������������������������������������������������������昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠����������������������������������炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附�".split(""); +for(j = 0; j != D[170].length; ++j) if(D[170][j].charCodeAt(0) !== 0xFFFD) { e[D[170][j]] = 43520 + j; d[43520 + j] = D[170][j];} +D[171] = "����������������������������������������������������������������陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品����������������������������������哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷�".split(""); +for(j = 0; j != D[171].length; ++j) if(D[171][j].charCodeAt(0) !== 0xFFFD) { e[D[171][j]] = 43776 + j; d[43776 + j] = D[171][j];} +D[172] = "����������������������������������������������������������������拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗����������������������������������活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄�".split(""); +for(j = 0; j != D[172].length; ++j) if(D[172][j].charCodeAt(0) !== 0xFFFD) { e[D[172][j]] = 44032 + j; d[44032 + j] = D[172][j];} +D[173] = "����������������������������������������������������������������耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥����������������������������������迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪�".split(""); +for(j = 0; j != D[173].length; ++j) if(D[173][j].charCodeAt(0) !== 0xFFFD) { e[D[173][j]] = 44288 + j; d[44288 + j] = D[173][j];} +D[174] = "����������������������������������������������������������������哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙����������������������������������恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓�".split(""); +for(j = 0; j != D[174].length; ++j) if(D[174][j].charCodeAt(0) !== 0xFFFD) { e[D[174][j]] = 44544 + j; d[44544 + j] = D[174][j];} +D[175] = "����������������������������������������������������������������浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷����������������������������������砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃�".split(""); +for(j = 0; j != D[175].length; ++j) if(D[175][j].charCodeAt(0) !== 0xFFFD) { e[D[175][j]] = 44800 + j; d[44800 + j] = D[175][j];} +D[176] = "����������������������������������������������������������������虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡����������������������������������陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀�".split(""); +for(j = 0; j != D[176].length; ++j) if(D[176][j].charCodeAt(0) !== 0xFFFD) { e[D[176][j]] = 45056 + j; d[45056 + j] = D[176][j];} +D[177] = "����������������������������������������������������������������娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽����������������������������������情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺�".split(""); +for(j = 0; j != D[177].length; ++j) if(D[177][j].charCodeAt(0) !== 0xFFFD) { e[D[177][j]] = 45312 + j; d[45312 + j] = D[177][j];} +D[178] = "����������������������������������������������������������������毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶����������������������������������瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼�".split(""); +for(j = 0; j != D[178].length; ++j) if(D[178][j].charCodeAt(0) !== 0xFFFD) { e[D[178][j]] = 45568 + j; d[45568 + j] = D[178][j];} +D[179] = "����������������������������������������������������������������莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途����������������������������������部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠�".split(""); +for(j = 0; j != D[179].length; ++j) if(D[179][j].charCodeAt(0) !== 0xFFFD) { e[D[179][j]] = 45824 + j; d[45824 + j] = D[179][j];} +D[180] = "����������������������������������������������������������������婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍����������������������������������插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋�".split(""); +for(j = 0; j != D[180].length; ++j) if(D[180][j].charCodeAt(0) !== 0xFFFD) { e[D[180][j]] = 46080 + j; d[46080 + j] = D[180][j];} +D[181] = "����������������������������������������������������������������溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘����������������������������������窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁�".split(""); +for(j = 0; j != D[181].length; ++j) if(D[181][j].charCodeAt(0) !== 0xFFFD) { e[D[181][j]] = 46336 + j; d[46336 + j] = D[181][j];} +D[182] = "����������������������������������������������������������������詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑����������������������������������間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼�".split(""); +for(j = 0; j != D[182].length; ++j) if(D[182][j].charCodeAt(0) !== 0xFFFD) { e[D[182][j]] = 46592 + j; d[46592 + j] = D[182][j];} +D[183] = "����������������������������������������������������������������媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業����������������������������������楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督�".split(""); +for(j = 0; j != D[183].length; ++j) if(D[183][j].charCodeAt(0) !== 0xFFFD) { e[D[183][j]] = 46848 + j; d[46848 + j] = D[183][j];} +D[184] = "����������������������������������������������������������������睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫����������������������������������腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊�".split(""); +for(j = 0; j != D[184].length; ++j) if(D[184][j].charCodeAt(0) !== 0xFFFD) { e[D[184][j]] = 47104 + j; d[47104 + j] = D[184][j];} +D[185] = "����������������������������������������������������������������辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴����������������������������������飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇�".split(""); +for(j = 0; j != D[185].length; ++j) if(D[185][j].charCodeAt(0) !== 0xFFFD) { e[D[185][j]] = 47360 + j; d[47360 + j] = D[185][j];} +D[186] = "����������������������������������������������������������������愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢����������������������������������滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬�".split(""); +for(j = 0; j != D[186].length; ++j) if(D[186][j].charCodeAt(0) !== 0xFFFD) { e[D[186][j]] = 47616 + j; d[47616 + j] = D[186][j];} +D[187] = "����������������������������������������������������������������罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤����������������������������������說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜�".split(""); +for(j = 0; j != D[187].length; ++j) if(D[187][j].charCodeAt(0) !== 0xFFFD) { e[D[187][j]] = 47872 + j; d[47872 + j] = D[187][j];} +D[188] = "����������������������������������������������������������������劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂����������������������������������慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃�".split(""); +for(j = 0; j != D[188].length; ++j) if(D[188][j].charCodeAt(0) !== 0xFFFD) { e[D[188][j]] = 48128 + j; d[48128 + j] = D[188][j];} +D[189] = "����������������������������������������������������������������瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯����������������������������������翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞�".split(""); +for(j = 0; j != D[189].length; ++j) if(D[189][j].charCodeAt(0) !== 0xFFFD) { e[D[189][j]] = 48384 + j; d[48384 + j] = D[189][j];} +D[190] = "����������������������������������������������������������������輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉����������������������������������鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡�".split(""); +for(j = 0; j != D[190].length; ++j) if(D[190][j].charCodeAt(0) !== 0xFFFD) { e[D[190][j]] = 48640 + j; d[48640 + j] = D[190][j];} +D[191] = "����������������������������������������������������������������濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊����������������������������������縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚�".split(""); +for(j = 0; j != D[191].length; ++j) if(D[191][j].charCodeAt(0) !== 0xFFFD) { e[D[191][j]] = 48896 + j; d[48896 + j] = D[191][j];} +D[192] = "����������������������������������������������������������������錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇����������������������������������嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬�".split(""); +for(j = 0; j != D[192].length; ++j) if(D[192][j].charCodeAt(0) !== 0xFFFD) { e[D[192][j]] = 49152 + j; d[49152 + j] = D[192][j];} +D[193] = "����������������������������������������������������������������瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪����������������������������������薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁�".split(""); +for(j = 0; j != D[193].length; ++j) if(D[193][j].charCodeAt(0) !== 0xFFFD) { e[D[193][j]] = 49408 + j; d[49408 + j] = D[193][j];} +D[194] = "����������������������������������������������������������������駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘����������������������������������癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦�".split(""); +for(j = 0; j != D[194].length; ++j) if(D[194][j].charCodeAt(0) !== 0xFFFD) { e[D[194][j]] = 49664 + j; d[49664 + j] = D[194][j];} +D[195] = "����������������������������������������������������������������鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸����������������������������������獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類�".split(""); +for(j = 0; j != D[195].length; ++j) if(D[195][j].charCodeAt(0) !== 0xFFFD) { e[D[195][j]] = 49920 + j; d[49920 + j] = D[195][j];} +D[196] = "����������������������������������������������������������������願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼����������������������������������纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴�".split(""); +for(j = 0; j != D[196].length; ++j) if(D[196][j].charCodeAt(0) !== 0xFFFD) { e[D[196][j]] = 50176 + j; d[50176 + j] = D[196][j];} +D[197] = "����������������������������������������������������������������護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬����������������������������������禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒�".split(""); +for(j = 0; j != D[197].length; ++j) if(D[197][j].charCodeAt(0) !== 0xFFFD) { e[D[197][j]] = 50432 + j; d[50432 + j] = D[197][j];} +D[198] = "����������������������������������������������������������������讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲���������������������������������������������������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[198].length; ++j) if(D[198][j].charCodeAt(0) !== 0xFFFD) { e[D[198][j]] = 50688 + j; d[50688 + j] = D[198][j];} +D[201] = "����������������������������������������������������������������乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕����������������������������������氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋�".split(""); +for(j = 0; j != D[201].length; ++j) if(D[201][j].charCodeAt(0) !== 0xFFFD) { e[D[201][j]] = 51456 + j; d[51456 + j] = D[201][j];} +D[202] = "����������������������������������������������������������������汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘����������������������������������吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇�".split(""); +for(j = 0; j != D[202].length; ++j) if(D[202][j].charCodeAt(0) !== 0xFFFD) { e[D[202][j]] = 51712 + j; d[51712 + j] = D[202][j];} +D[203] = "����������������������������������������������������������������杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓����������������������������������芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢�".split(""); +for(j = 0; j != D[203].length; ++j) if(D[203][j].charCodeAt(0) !== 0xFFFD) { e[D[203][j]] = 51968 + j; d[51968 + j] = D[203][j];} +D[204] = "����������������������������������������������������������������坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋����������������������������������怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲�".split(""); +for(j = 0; j != D[204].length; ++j) if(D[204][j].charCodeAt(0) !== 0xFFFD) { e[D[204][j]] = 52224 + j; d[52224 + j] = D[204][j];} +D[205] = "����������������������������������������������������������������泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺����������������������������������矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏�".split(""); +for(j = 0; j != D[205].length; ++j) if(D[205][j].charCodeAt(0) !== 0xFFFD) { e[D[205][j]] = 52480 + j; d[52480 + j] = D[205][j];} +D[206] = "����������������������������������������������������������������哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛����������������������������������峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺�".split(""); +for(j = 0; j != D[206].length; ++j) if(D[206][j].charCodeAt(0) !== 0xFFFD) { e[D[206][j]] = 52736 + j; d[52736 + j] = D[206][j];} +D[207] = "����������������������������������������������������������������柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂����������������������������������洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀�".split(""); +for(j = 0; j != D[207].length; ++j) if(D[207][j].charCodeAt(0) !== 0xFFFD) { e[D[207][j]] = 52992 + j; d[52992 + j] = D[207][j];} +D[208] = "����������������������������������������������������������������穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪����������������������������������苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱�".split(""); +for(j = 0; j != D[208].length; ++j) if(D[208][j].charCodeAt(0) !== 0xFFFD) { e[D[208][j]] = 53248 + j; d[53248 + j] = D[208][j];} +D[209] = "����������������������������������������������������������������唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧����������������������������������恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤�".split(""); +for(j = 0; j != D[209].length; ++j) if(D[209][j].charCodeAt(0) !== 0xFFFD) { e[D[209][j]] = 53504 + j; d[53504 + j] = D[209][j];} +D[210] = "����������������������������������������������������������������毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸����������������������������������牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐�".split(""); +for(j = 0; j != D[210].length; ++j) if(D[210][j].charCodeAt(0) !== 0xFFFD) { e[D[210][j]] = 53760 + j; d[53760 + j] = D[210][j];} +D[211] = "����������������������������������������������������������������笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢����������������������������������荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐�".split(""); +for(j = 0; j != D[211].length; ++j) if(D[211][j].charCodeAt(0) !== 0xFFFD) { e[D[211][j]] = 54016 + j; d[54016 + j] = D[211][j];} +D[212] = "����������������������������������������������������������������酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅����������������������������������唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏�".split(""); +for(j = 0; j != D[212].length; ++j) if(D[212][j].charCodeAt(0) !== 0xFFFD) { e[D[212][j]] = 54272 + j; d[54272 + j] = D[212][j];} +D[213] = "����������������������������������������������������������������崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟����������������������������������捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉�".split(""); +for(j = 0; j != D[213].length; ++j) if(D[213][j].charCodeAt(0) !== 0xFFFD) { e[D[213][j]] = 54528 + j; d[54528 + j] = D[213][j];} +D[214] = "����������������������������������������������������������������淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏����������������������������������痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟�".split(""); +for(j = 0; j != D[214].length; ++j) if(D[214][j].charCodeAt(0) !== 0xFFFD) { e[D[214][j]] = 54784 + j; d[54784 + j] = D[214][j];} +D[215] = "����������������������������������������������������������������耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷����������������������������������蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪�".split(""); +for(j = 0; j != D[215].length; ++j) if(D[215][j].charCodeAt(0) !== 0xFFFD) { e[D[215][j]] = 55040 + j; d[55040 + j] = D[215][j];} +D[216] = "����������������������������������������������������������������釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷����������������������������������堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔�".split(""); +for(j = 0; j != D[216].length; ++j) if(D[216][j].charCodeAt(0) !== 0xFFFD) { e[D[216][j]] = 55296 + j; d[55296 + j] = D[216][j];} +D[217] = "����������������������������������������������������������������惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒����������������������������������晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞�".split(""); +for(j = 0; j != D[217].length; ++j) if(D[217][j].charCodeAt(0) !== 0xFFFD) { e[D[217][j]] = 55552 + j; d[55552 + j] = D[217][j];} +D[218] = "����������������������������������������������������������������湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖����������������������������������琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥�".split(""); +for(j = 0; j != D[218].length; ++j) if(D[218][j].charCodeAt(0) !== 0xFFFD) { e[D[218][j]] = 55808 + j; d[55808 + j] = D[218][j];} +D[219] = "����������������������������������������������������������������罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳����������������������������������菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺�".split(""); +for(j = 0; j != D[219].length; ++j) if(D[219][j].charCodeAt(0) !== 0xFFFD) { e[D[219][j]] = 56064 + j; d[56064 + j] = D[219][j];} +D[220] = "����������������������������������������������������������������軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈����������������������������������隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆�".split(""); +for(j = 0; j != D[220].length; ++j) if(D[220][j].charCodeAt(0) !== 0xFFFD) { e[D[220][j]] = 56320 + j; d[56320 + j] = D[220][j];} +D[221] = "����������������������������������������������������������������媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤����������������������������������搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼�".split(""); +for(j = 0; j != D[221].length; ++j) if(D[221][j].charCodeAt(0) !== 0xFFFD) { e[D[221][j]] = 56576 + j; d[56576 + j] = D[221][j];} +D[222] = "����������������������������������������������������������������毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓����������������������������������煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓�".split(""); +for(j = 0; j != D[222].length; ++j) if(D[222][j].charCodeAt(0) !== 0xFFFD) { e[D[222][j]] = 56832 + j; d[56832 + j] = D[222][j];} +D[223] = "����������������������������������������������������������������稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯����������������������������������腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤�".split(""); +for(j = 0; j != D[223].length; ++j) if(D[223][j].charCodeAt(0) !== 0xFFFD) { e[D[223][j]] = 57088 + j; d[57088 + j] = D[223][j];} +D[224] = "����������������������������������������������������������������觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿����������������������������������遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠�".split(""); +for(j = 0; j != D[224].length; ++j) if(D[224][j].charCodeAt(0) !== 0xFFFD) { e[D[224][j]] = 57344 + j; d[57344 + j] = D[224][j];} +D[225] = "����������������������������������������������������������������凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠����������������������������������寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉�".split(""); +for(j = 0; j != D[225].length; ++j) if(D[225][j].charCodeAt(0) !== 0xFFFD) { e[D[225][j]] = 57600 + j; d[57600 + j] = D[225][j];} +D[226] = "����������������������������������������������������������������榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊����������������������������������漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓�".split(""); +for(j = 0; j != D[226].length; ++j) if(D[226][j].charCodeAt(0) !== 0xFFFD) { e[D[226][j]] = 57856 + j; d[57856 + j] = D[226][j];} +D[227] = "����������������������������������������������������������������禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞����������������������������������耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻�".split(""); +for(j = 0; j != D[227].length; ++j) if(D[227][j].charCodeAt(0) !== 0xFFFD) { e[D[227][j]] = 58112 + j; d[58112 + j] = D[227][j];} +D[228] = "����������������������������������������������������������������裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍����������������������������������銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘�".split(""); +for(j = 0; j != D[228].length; ++j) if(D[228][j].charCodeAt(0) !== 0xFFFD) { e[D[228][j]] = 58368 + j; d[58368 + j] = D[228][j];} +D[229] = "����������������������������������������������������������������噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉����������������������������������憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒�".split(""); +for(j = 0; j != D[229].length; ++j) if(D[229][j].charCodeAt(0) !== 0xFFFD) { e[D[229][j]] = 58624 + j; d[58624 + j] = D[229][j];} +D[230] = "����������������������������������������������������������������澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙����������������������������������獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟�".split(""); +for(j = 0; j != D[230].length; ++j) if(D[230][j].charCodeAt(0) !== 0xFFFD) { e[D[230][j]] = 58880 + j; d[58880 + j] = D[230][j];} +D[231] = "����������������������������������������������������������������膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢����������������������������������蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧�".split(""); +for(j = 0; j != D[231].length; ++j) if(D[231][j].charCodeAt(0) !== 0xFFFD) { e[D[231][j]] = 59136 + j; d[59136 + j] = D[231][j];} +D[232] = "����������������������������������������������������������������踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓����������������������������������銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮�".split(""); +for(j = 0; j != D[232].length; ++j) if(D[232][j].charCodeAt(0) !== 0xFFFD) { e[D[232][j]] = 59392 + j; d[59392 + j] = D[232][j];} +D[233] = "����������������������������������������������������������������噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺����������������������������������憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸�".split(""); +for(j = 0; j != D[233].length; ++j) if(D[233][j].charCodeAt(0) !== 0xFFFD) { e[D[233][j]] = 59648 + j; d[59648 + j] = D[233][j];} +D[234] = "����������������������������������������������������������������澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙����������������������������������瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘�".split(""); +for(j = 0; j != D[234].length; ++j) if(D[234][j].charCodeAt(0) !== 0xFFFD) { e[D[234][j]] = 59904 + j; d[59904 + j] = D[234][j];} +D[235] = "����������������������������������������������������������������蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠����������������������������������諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌�".split(""); +for(j = 0; j != D[235].length; ++j) if(D[235][j].charCodeAt(0) !== 0xFFFD) { e[D[235][j]] = 60160 + j; d[60160 + j] = D[235][j];} +D[236] = "����������������������������������������������������������������錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕����������������������������������魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎�".split(""); +for(j = 0; j != D[236].length; ++j) if(D[236][j].charCodeAt(0) !== 0xFFFD) { e[D[236][j]] = 60416 + j; d[60416 + j] = D[236][j];} +D[237] = "����������������������������������������������������������������檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶����������������������������������瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞�".split(""); +for(j = 0; j != D[237].length; ++j) if(D[237][j].charCodeAt(0) !== 0xFFFD) { e[D[237][j]] = 60672 + j; d[60672 + j] = D[237][j];} +D[238] = "����������������������������������������������������������������蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞����������������������������������謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜�".split(""); +for(j = 0; j != D[238].length; ++j) if(D[238][j].charCodeAt(0) !== 0xFFFD) { e[D[238][j]] = 60928 + j; d[60928 + j] = D[238][j];} +D[239] = "����������������������������������������������������������������鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰����������������������������������鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶�".split(""); +for(j = 0; j != D[239].length; ++j) if(D[239][j].charCodeAt(0) !== 0xFFFD) { e[D[239][j]] = 61184 + j; d[61184 + j] = D[239][j];} +D[240] = "����������������������������������������������������������������璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒����������������������������������臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧�".split(""); +for(j = 0; j != D[240].length; ++j) if(D[240][j].charCodeAt(0) !== 0xFFFD) { e[D[240][j]] = 61440 + j; d[61440 + j] = D[240][j];} +D[241] = "����������������������������������������������������������������蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪����������������������������������鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰�".split(""); +for(j = 0; j != D[241].length; ++j) if(D[241][j].charCodeAt(0) !== 0xFFFD) { e[D[241][j]] = 61696 + j; d[61696 + j] = D[241][j];} +D[242] = "����������������������������������������������������������������徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛����������������������������������礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕�".split(""); +for(j = 0; j != D[242].length; ++j) if(D[242][j].charCodeAt(0) !== 0xFFFD) { e[D[242][j]] = 61952 + j; d[61952 + j] = D[242][j];} +D[243] = "����������������������������������������������������������������譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦����������������������������������鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲�".split(""); +for(j = 0; j != D[243].length; ++j) if(D[243][j].charCodeAt(0) !== 0xFFFD) { e[D[243][j]] = 62208 + j; d[62208 + j] = D[243][j];} +D[244] = "����������������������������������������������������������������嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩����������������������������������禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿�".split(""); +for(j = 0; j != D[244].length; ++j) if(D[244][j].charCodeAt(0) !== 0xFFFD) { e[D[244][j]] = 62464 + j; d[62464 + j] = D[244][j];} +D[245] = "����������������������������������������������������������������鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛����������������������������������鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥�".split(""); +for(j = 0; j != D[245].length; ++j) if(D[245][j].charCodeAt(0) !== 0xFFFD) { e[D[245][j]] = 62720 + j; d[62720 + j] = D[245][j];} +D[246] = "����������������������������������������������������������������蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺����������������������������������騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚�".split(""); +for(j = 0; j != D[246].length; ++j) if(D[246][j].charCodeAt(0) !== 0xFFFD) { e[D[246][j]] = 62976 + j; d[62976 + j] = D[246][j];} +D[247] = "����������������������������������������������������������������糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊����������������������������������驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾�".split(""); +for(j = 0; j != D[247].length; ++j) if(D[247][j].charCodeAt(0) !== 0xFFFD) { e[D[247][j]] = 63232 + j; d[63232 + j] = D[247][j];} +D[248] = "����������������������������������������������������������������讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏����������������������������������齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚�".split(""); +for(j = 0; j != D[248].length; ++j) if(D[248][j].charCodeAt(0) !== 0xFFFD) { e[D[248][j]] = 63488 + j; d[63488 + j] = D[248][j];} +D[249] = "����������������������������������������������������������������纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊����������������������������������龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓�".split(""); +for(j = 0; j != D[249].length; ++j) if(D[249][j].charCodeAt(0) !== 0xFFFD) { e[D[249][j]] = 63744 + j; d[63744 + j] = D[249][j];} +return {"enc": e, "dec": d }; })(); +cptable[1250] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1251] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1252] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1253] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1254] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1255] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹ�ֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1256] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1257] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1258] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[10000] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[10006] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[10007] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[10008] = (function(){ var d = [], e = {}, D = [], j; +D[0] = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€���������������������������������������������������������������������������������������".split(""); +for(j = 0; j != D[0].length; ++j) if(D[0][j].charCodeAt(0) !== 0xFFFD) { e[D[0][j]] = 0 + j; d[0 + j] = D[0][j];} +D[161] = "����������������������������������������������������������������������������������������������������������������������������������������������������������������� 、。・ˉˇ¨〃々―~�…‘’“”〔〕〈〉《》「」『』〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓�".split(""); +for(j = 0; j != D[161].length; ++j) if(D[161][j].charCodeAt(0) !== 0xFFFD) { e[D[161][j]] = 41216 + j; d[41216 + j] = D[161][j];} +D[162] = "���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇①②③④⑤⑥⑦⑧⑨⑩��㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩��ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ���".split(""); +for(j = 0; j != D[162].length; ++j) if(D[162][j].charCodeAt(0) !== 0xFFFD) { e[D[162][j]] = 41472 + j; d[41472 + j] = D[162][j];} +D[163] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������!"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ̄�".split(""); +for(j = 0; j != D[163].length; ++j) if(D[163][j].charCodeAt(0) !== 0xFFFD) { e[D[163][j]] = 41728 + j; d[41728 + j] = D[163][j];} +D[164] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん������������".split(""); +for(j = 0; j != D[164].length; ++j) if(D[164][j].charCodeAt(0) !== 0xFFFD) { e[D[164][j]] = 41984 + j; d[41984 + j] = D[164][j];} +D[165] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ���������".split(""); +for(j = 0; j != D[165].length; ++j) if(D[165][j].charCodeAt(0) !== 0xFFFD) { e[D[165][j]] = 42240 + j; d[42240 + j] = D[165][j];} +D[166] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ��������αβγδεζηθικλμνξοπρστυφχψω���������������������������������������".split(""); +for(j = 0; j != D[166].length; ++j) if(D[166][j].charCodeAt(0) !== 0xFFFD) { e[D[166][j]] = 42496 + j; d[42496 + j] = D[166][j];} +D[167] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ���������������абвгдеёжзийклмнопрстуфхцчшщъыьэюя��������������".split(""); +for(j = 0; j != D[167].length; ++j) if(D[167][j].charCodeAt(0) !== 0xFFFD) { e[D[167][j]] = 42752 + j; d[42752 + j] = D[167][j];} +D[168] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüê����������ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩ����������������������".split(""); +for(j = 0; j != D[168].length; ++j) if(D[168][j].charCodeAt(0) !== 0xFFFD) { e[D[168][j]] = 43008 + j; d[43008 + j] = D[168][j];} +D[169] = "��������������������������������������������������������������������������������������������������������������������������������������������������������������������─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋����������������".split(""); +for(j = 0; j != D[169].length; ++j) if(D[169][j].charCodeAt(0) !== 0xFFFD) { e[D[169][j]] = 43264 + j; d[43264 + j] = D[169][j];} +D[176] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥�".split(""); +for(j = 0; j != D[176].length; ++j) if(D[176][j].charCodeAt(0) !== 0xFFFD) { e[D[176][j]] = 45056 + j; d[45056 + j] = D[176][j];} +D[177] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳�".split(""); +for(j = 0; j != D[177].length; ++j) if(D[177][j].charCodeAt(0) !== 0xFFFD) { e[D[177][j]] = 45312 + j; d[45312 + j] = D[177][j];} +D[178] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖�".split(""); +for(j = 0; j != D[178].length; ++j) if(D[178][j].charCodeAt(0) !== 0xFFFD) { e[D[178][j]] = 45568 + j; d[45568 + j] = D[178][j];} +D[179] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚�".split(""); +for(j = 0; j != D[179].length; ++j) if(D[179][j].charCodeAt(0) !== 0xFFFD) { e[D[179][j]] = 45824 + j; d[45824 + j] = D[179][j];} +D[180] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮�".split(""); +for(j = 0; j != D[180].length; ++j) if(D[180][j].charCodeAt(0) !== 0xFFFD) { e[D[180][j]] = 46080 + j; d[46080 + j] = D[180][j];} +D[181] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠�".split(""); +for(j = 0; j != D[181].length; ++j) if(D[181][j].charCodeAt(0) !== 0xFFFD) { e[D[181][j]] = 46336 + j; d[46336 + j] = D[181][j];} +D[182] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二�".split(""); +for(j = 0; j != D[182].length; ++j) if(D[182][j].charCodeAt(0) !== 0xFFFD) { e[D[182][j]] = 46592 + j; d[46592 + j] = D[182][j];} +D[183] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服�".split(""); +for(j = 0; j != D[183].length; ++j) if(D[183][j].charCodeAt(0) !== 0xFFFD) { e[D[183][j]] = 46848 + j; d[46848 + j] = D[183][j];} +D[184] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹�".split(""); +for(j = 0; j != D[184].length; ++j) if(D[184][j].charCodeAt(0) !== 0xFFFD) { e[D[184][j]] = 47104 + j; d[47104 + j] = D[184][j];} +D[185] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈�".split(""); +for(j = 0; j != D[185].length; ++j) if(D[185][j].charCodeAt(0) !== 0xFFFD) { e[D[185][j]] = 47360 + j; d[47360 + j] = D[185][j];} +D[186] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖�".split(""); +for(j = 0; j != D[186].length; ++j) if(D[186][j].charCodeAt(0) !== 0xFFFD) { e[D[186][j]] = 47616 + j; d[47616 + j] = D[186][j];} +D[187] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕�".split(""); +for(j = 0; j != D[187].length; ++j) if(D[187][j].charCodeAt(0) !== 0xFFFD) { e[D[187][j]] = 47872 + j; d[47872 + j] = D[187][j];} +D[188] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件�".split(""); +for(j = 0; j != D[188].length; ++j) if(D[188][j].charCodeAt(0) !== 0xFFFD) { e[D[188][j]] = 48128 + j; d[48128 + j] = D[188][j];} +D[189] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸�".split(""); +for(j = 0; j != D[189].length; ++j) if(D[189][j].charCodeAt(0) !== 0xFFFD) { e[D[189][j]] = 48384 + j; d[48384 + j] = D[189][j];} +D[190] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻�".split(""); +for(j = 0; j != D[190].length; ++j) if(D[190][j].charCodeAt(0) !== 0xFFFD) { e[D[190][j]] = 48640 + j; d[48640 + j] = D[190][j];} +D[191] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀�".split(""); +for(j = 0; j != D[191].length; ++j) if(D[191][j].charCodeAt(0) !== 0xFFFD) { e[D[191][j]] = 48896 + j; d[48896 + j] = D[191][j];} +D[192] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐�".split(""); +for(j = 0; j != D[192].length; ++j) if(D[192][j].charCodeAt(0) !== 0xFFFD) { e[D[192][j]] = 49152 + j; d[49152 + j] = D[192][j];} +D[193] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿�".split(""); +for(j = 0; j != D[193].length; ++j) if(D[193][j].charCodeAt(0) !== 0xFFFD) { e[D[193][j]] = 49408 + j; d[49408 + j] = D[193][j];} +D[194] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫�".split(""); +for(j = 0; j != D[194].length; ++j) if(D[194][j].charCodeAt(0) !== 0xFFFD) { e[D[194][j]] = 49664 + j; d[49664 + j] = D[194][j];} +D[195] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸�".split(""); +for(j = 0; j != D[195].length; ++j) if(D[195][j].charCodeAt(0) !== 0xFFFD) { e[D[195][j]] = 49920 + j; d[49920 + j] = D[195][j];} +D[196] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁�".split(""); +for(j = 0; j != D[196].length; ++j) if(D[196][j].charCodeAt(0) !== 0xFFFD) { e[D[196][j]] = 50176 + j; d[50176 + j] = D[196][j];} +D[197] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗�".split(""); +for(j = 0; j != D[197].length; ++j) if(D[197][j].charCodeAt(0) !== 0xFFFD) { e[D[197][j]] = 50432 + j; d[50432 + j] = D[197][j];} +D[198] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐�".split(""); +for(j = 0; j != D[198].length; ++j) if(D[198][j].charCodeAt(0) !== 0xFFFD) { e[D[198][j]] = 50688 + j; d[50688 + j] = D[198][j];} +D[199] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠�".split(""); +for(j = 0; j != D[199].length; ++j) if(D[199][j].charCodeAt(0) !== 0xFFFD) { e[D[199][j]] = 50944 + j; d[50944 + j] = D[199][j];} +D[200] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁�".split(""); +for(j = 0; j != D[200].length; ++j) if(D[200][j].charCodeAt(0) !== 0xFFFD) { e[D[200][j]] = 51200 + j; d[51200 + j] = D[200][j];} +D[201] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳�".split(""); +for(j = 0; j != D[201].length; ++j) if(D[201][j].charCodeAt(0) !== 0xFFFD) { e[D[201][j]] = 51456 + j; d[51456 + j] = D[201][j];} +D[202] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱�".split(""); +for(j = 0; j != D[202].length; ++j) if(D[202][j].charCodeAt(0) !== 0xFFFD) { e[D[202][j]] = 51712 + j; d[51712 + j] = D[202][j];} +D[203] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔�".split(""); +for(j = 0; j != D[203].length; ++j) if(D[203][j].charCodeAt(0) !== 0xFFFD) { e[D[203][j]] = 51968 + j; d[51968 + j] = D[203][j];} +D[204] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃�".split(""); +for(j = 0; j != D[204].length; ++j) if(D[204][j].charCodeAt(0) !== 0xFFFD) { e[D[204][j]] = 52224 + j; d[52224 + j] = D[204][j];} +D[205] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威�".split(""); +for(j = 0; j != D[205].length; ++j) if(D[205][j].charCodeAt(0) !== 0xFFFD) { e[D[205][j]] = 52480 + j; d[52480 + j] = D[205][j];} +D[206] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺�".split(""); +for(j = 0; j != D[206].length; ++j) if(D[206][j].charCodeAt(0) !== 0xFFFD) { e[D[206][j]] = 52736 + j; d[52736 + j] = D[206][j];} +D[207] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓�".split(""); +for(j = 0; j != D[207].length; ++j) if(D[207][j].charCodeAt(0) !== 0xFFFD) { e[D[207][j]] = 52992 + j; d[52992 + j] = D[207][j];} +D[208] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄�".split(""); +for(j = 0; j != D[208].length; ++j) if(D[208][j].charCodeAt(0) !== 0xFFFD) { e[D[208][j]] = 53248 + j; d[53248 + j] = D[208][j];} +D[209] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶�".split(""); +for(j = 0; j != D[209].length; ++j) if(D[209][j].charCodeAt(0) !== 0xFFFD) { e[D[209][j]] = 53504 + j; d[53504 + j] = D[209][j];} +D[210] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐�".split(""); +for(j = 0; j != D[210].length; ++j) if(D[210][j].charCodeAt(0) !== 0xFFFD) { e[D[210][j]] = 53760 + j; d[53760 + j] = D[210][j];} +D[211] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉�".split(""); +for(j = 0; j != D[211].length; ++j) if(D[211][j].charCodeAt(0) !== 0xFFFD) { e[D[211][j]] = 54016 + j; d[54016 + j] = D[211][j];} +D[212] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧�".split(""); +for(j = 0; j != D[212].length; ++j) if(D[212][j].charCodeAt(0) !== 0xFFFD) { e[D[212][j]] = 54272 + j; d[54272 + j] = D[212][j];} +D[213] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政�".split(""); +for(j = 0; j != D[213].length; ++j) if(D[213][j].charCodeAt(0) !== 0xFFFD) { e[D[213][j]] = 54528 + j; d[54528 + j] = D[213][j];} +D[214] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑�".split(""); +for(j = 0; j != D[214].length; ++j) if(D[214][j].charCodeAt(0) !== 0xFFFD) { e[D[214][j]] = 54784 + j; d[54784 + j] = D[214][j];} +D[215] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座������".split(""); +for(j = 0; j != D[215].length; ++j) if(D[215][j].charCodeAt(0) !== 0xFFFD) { e[D[215][j]] = 55040 + j; d[55040 + j] = D[215][j];} +D[216] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝�".split(""); +for(j = 0; j != D[216].length; ++j) if(D[216][j].charCodeAt(0) !== 0xFFFD) { e[D[216][j]] = 55296 + j; d[55296 + j] = D[216][j];} +D[217] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼�".split(""); +for(j = 0; j != D[217].length; ++j) if(D[217][j].charCodeAt(0) !== 0xFFFD) { e[D[217][j]] = 55552 + j; d[55552 + j] = D[217][j];} +D[218] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺�".split(""); +for(j = 0; j != D[218].length; ++j) if(D[218][j].charCodeAt(0) !== 0xFFFD) { e[D[218][j]] = 55808 + j; d[55808 + j] = D[218][j];} +D[219] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝�".split(""); +for(j = 0; j != D[219].length; ++j) if(D[219][j].charCodeAt(0) !== 0xFFFD) { e[D[219][j]] = 56064 + j; d[56064 + j] = D[219][j];} +D[220] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥�".split(""); +for(j = 0; j != D[220].length; ++j) if(D[220][j].charCodeAt(0) !== 0xFFFD) { e[D[220][j]] = 56320 + j; d[56320 + j] = D[220][j];} +D[221] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺�".split(""); +for(j = 0; j != D[221].length; ++j) if(D[221][j].charCodeAt(0) !== 0xFFFD) { e[D[221][j]] = 56576 + j; d[56576 + j] = D[221][j];} +D[222] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖�".split(""); +for(j = 0; j != D[222].length; ++j) if(D[222][j].charCodeAt(0) !== 0xFFFD) { e[D[222][j]] = 56832 + j; d[56832 + j] = D[222][j];} +D[223] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼�".split(""); +for(j = 0; j != D[223].length; ++j) if(D[223][j].charCodeAt(0) !== 0xFFFD) { e[D[223][j]] = 57088 + j; d[57088 + j] = D[223][j];} +D[224] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼�".split(""); +for(j = 0; j != D[224].length; ++j) if(D[224][j].charCodeAt(0) !== 0xFFFD) { e[D[224][j]] = 57344 + j; d[57344 + j] = D[224][j];} +D[225] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺�".split(""); +for(j = 0; j != D[225].length; ++j) if(D[225][j].charCodeAt(0) !== 0xFFFD) { e[D[225][j]] = 57600 + j; d[57600 + j] = D[225][j];} +D[226] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧饨饩饪饫饬饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂�".split(""); +for(j = 0; j != D[226].length; ++j) if(D[226][j].charCodeAt(0) !== 0xFFFD) { e[D[226][j]] = 57856 + j; d[57856 + j] = D[226][j];} +D[227] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾�".split(""); +for(j = 0; j != D[227].length; ++j) if(D[227][j].charCodeAt(0) !== 0xFFFD) { e[D[227][j]] = 58112 + j; d[58112 + j] = D[227][j];} +D[228] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑�".split(""); +for(j = 0; j != D[228].length; ++j) if(D[228][j].charCodeAt(0) !== 0xFFFD) { e[D[228][j]] = 58368 + j; d[58368 + j] = D[228][j];} +D[229] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣�".split(""); +for(j = 0; j != D[229].length; ++j) if(D[229][j].charCodeAt(0) !== 0xFFFD) { e[D[229][j]] = 58624 + j; d[58624 + j] = D[229][j];} +D[230] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩�".split(""); +for(j = 0; j != D[230].length; ++j) if(D[230][j].charCodeAt(0) !== 0xFFFD) { e[D[230][j]] = 58880 + j; d[58880 + j] = D[230][j];} +D[231] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡缢缣缤缥缦缧缪缫缬缭缯缰缱缲缳缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬�".split(""); +for(j = 0; j != D[231].length; ++j) if(D[231][j].charCodeAt(0) !== 0xFFFD) { e[D[231][j]] = 59136 + j; d[59136 + j] = D[231][j];} +D[232] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹�".split(""); +for(j = 0; j != D[232].length; ++j) if(D[232][j].charCodeAt(0) !== 0xFFFD) { e[D[232][j]] = 59392 + j; d[59392 + j] = D[232][j];} +D[233] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋�".split(""); +for(j = 0; j != D[233].length; ++j) if(D[233][j].charCodeAt(0) !== 0xFFFD) { e[D[233][j]] = 59648 + j; d[59648 + j] = D[233][j];} +D[234] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰�".split(""); +for(j = 0; j != D[234].length; ++j) if(D[234][j].charCodeAt(0) !== 0xFFFD) { e[D[234][j]] = 59904 + j; d[59904 + j] = D[234][j];} +D[235] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻�".split(""); +for(j = 0; j != D[235].length; ++j) if(D[235][j].charCodeAt(0) !== 0xFFFD) { e[D[235][j]] = 60160 + j; d[60160 + j] = D[235][j];} +D[236] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐�".split(""); +for(j = 0; j != D[236].length; ++j) if(D[236][j].charCodeAt(0) !== 0xFFFD) { e[D[236][j]] = 60416 + j; d[60416 + j] = D[236][j];} +D[237] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨�".split(""); +for(j = 0; j != D[237].length; ++j) if(D[237][j].charCodeAt(0) !== 0xFFFD) { e[D[237][j]] = 60672 + j; d[60672 + j] = D[237][j];} +D[238] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶钷钸钹钺钼钽钿铄铈铉铊铋铌铍铎铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪�".split(""); +for(j = 0; j != D[238].length; ++j) if(D[238][j].charCodeAt(0) !== 0xFFFD) { e[D[238][j]] = 60928 + j; d[60928 + j] = D[238][j];} +D[239] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒锓锔锕锖锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤镥镦镧镨镩镪镫镬镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔�".split(""); +for(j = 0; j != D[239].length; ++j) if(D[239][j].charCodeAt(0) !== 0xFFFD) { e[D[239][j]] = 61184 + j; d[61184 + j] = D[239][j];} +D[240] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨鸩鸪鸫鸬鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦鹧鹨鹩鹪鹫鹬鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙�".split(""); +for(j = 0; j != D[240].length; ++j) if(D[240][j].charCodeAt(0) !== 0xFFFD) { e[D[240][j]] = 61440 + j; d[61440 + j] = D[240][j];} +D[241] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃�".split(""); +for(j = 0; j != D[241].length; ++j) if(D[241][j].charCodeAt(0) !== 0xFFFD) { e[D[241][j]] = 61696 + j; d[61696 + j] = D[241][j];} +D[242] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒�".split(""); +for(j = 0; j != D[242].length; ++j) if(D[242][j].charCodeAt(0) !== 0xFFFD) { e[D[242][j]] = 61952 + j; d[61952 + j] = D[242][j];} +D[243] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋�".split(""); +for(j = 0; j != D[243].length; ++j) if(D[243][j].charCodeAt(0) !== 0xFFFD) { e[D[243][j]] = 62208 + j; d[62208 + j] = D[243][j];} +D[244] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤�".split(""); +for(j = 0; j != D[244].length; ++j) if(D[244][j].charCodeAt(0) !== 0xFFFD) { e[D[244][j]] = 62464 + j; d[62464 + j] = D[244][j];} +D[245] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜�".split(""); +for(j = 0; j != D[245].length; ++j) if(D[245][j].charCodeAt(0) !== 0xFFFD) { e[D[245][j]] = 62720 + j; d[62720 + j] = D[245][j];} +D[246] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅龆龇龈龉龊龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞鲟鲠鲡鲢鲣鲥鲦鲧鲨鲩鲫鲭鲮鲰鲱鲲鲳鲴鲵鲶鲷鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋�".split(""); +for(j = 0; j != D[246].length; ++j) if(D[246][j].charCodeAt(0) !== 0xFFFD) { e[D[246][j]] = 62976 + j; d[62976 + j] = D[246][j];} +D[247] = "�����������������������������������������������������������������������������������������������������������������������������������������������������������������鳌鳍鳎鳏鳐鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄�".split(""); +for(j = 0; j != D[247].length; ++j) if(D[247][j].charCodeAt(0) !== 0xFFFD) { e[D[247][j]] = 63232 + j; d[63232 + j] = D[247][j];} +return {"enc": e, "dec": d }; })(); +cptable[10029] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[10079] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[10081] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[28591] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +export { cptable }; +/*! cputils.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/* vim: set ft=javascript: */ +var cpt = cptable; + /*global module, Buffer */ + var magic/*:{[id:CPIndex]:string}*/ = { + "1200":"utf16le", + "1201":"utf16be", + "12000":"utf32le", + "12001":"utf32be", + "16969":"utf64le", + "20127":"ascii", + "65000":"utf7", + "65001":"utf8" + }; + + var sbcs_cache/*:Array*/ = [874,1250,1251,1252,1253,1254,1255,1256,10000]; + var dbcs_cache/*:Array*/ = [932,936,949,950]; + var magic_cache/*:Array*/ = [65001]; + var magic_decode/*:DecoderMap*/ = {}; + var magic_encode/*:EncoderMap*/ = {}; + var cpdcache/*:DecoderMap*/ = {}; + var cpecache/*:EncoderMap*/ = {}; + + var sfcc = function sfcc(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; + var cca = function cca(x/*:string*/)/*:number*/ { return x.charCodeAt(0); }; + + var has_buf/*:boolean*/ = (typeof Buffer !== 'undefined'); + var Buffer_from = function(){}; + if(has_buf) { + var nbfs = !Buffer.from; + if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; } + Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer); + // $FlowIgnore + if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); }; + + var mdl = 1024, mdb = Buffer.allocUnsafe(mdl); + var make_EE = function make_EE(E/*:EMap*/)/*:Buffer*/{ + var EE = Buffer.allocUnsafe(65536); + for(var i = 0; i < 65536;++i) EE[i] = 0; + var keys/*:Array*/ = Object.keys(E), len = keys.length; + for(var ee = 0, e = keys[ee]; ee < len; ++ee) { + if(!(e = keys[ee])) continue; + EE[e.charCodeAt(0)] = E[e]; + } + return EE; + }; + var sbcs_encode = function make_sbcs_encode(cp/*:CPIndex*/)/*:Encoder*/ { + var EE/*:Buffer*/ = make_EE(cpt[cp].enc); + return function sbcs_e(data/*:StrData*/, ofmt/*:?string*/) { + var len = data.length; + var out/*:Buffer*/, i=0, j=0, D=0, w=0; + if(typeof data === 'string') { + out = Buffer.allocUnsafe(len); + for(i = 0; i < len; ++i) out[i] = EE[data.charCodeAt(i)]; + } else if(/*:: data instanceof Buffer && */Buffer.isBuffer(data)) { + out = Buffer.allocUnsafe(2*len); + j = 0; + for(i = 0; i < len; ++i) { + D = data[i]; + if(D < 128) out[j++] = EE[D]; + else if(D < 224) { out[j++] = EE[((D&31)<<6)+(data[i+1]&63)]; ++i; } + else if(D < 240) { out[j++] = EE[((D&15)<<12)+((data[i+1]&63)<<6)+(data[i+2]&63)]; i+=2; } + else { + w = ((D&7)<<18)+((data[i+1]&63)<<12)+((data[i+2]&63)<<6)+(data[i+3]&63); i+=3; + if(w < 65536) out[j++] = EE[w]; + else { w -= 65536; out[j++] = EE[0xD800 + ((w>>10)&1023)]; out[j++] = EE[0xDC00 + (w&1023)]; } + } + } + out = out.slice(0,j); + } else { + out = Buffer.allocUnsafe(len); + for(i = 0; i < len; ++i) out[i] = EE[/*::(*/data[i]/*:: :any)*/.charCodeAt(0)]; + } + if(!ofmt || ofmt === 'buf') return out; + if(ofmt !== 'arr') return out.toString('binary'); + return [].slice.call(out); + }; + }; + var sbcs_decode = function make_sbcs_decode(cp/*:CPIndex*/)/*:Decoder*/ { + var D/*:DMap*/ = cpt[cp].dec; + var DD = Buffer.allocUnsafe(131072), d=0, c=""; + for(d=0;d>8; + } + return function sbcs_d(data/*:Data*/)/*:string*/ { + var len = data.length, i=0, j=0; + if(2 * len > mdl) { mdl = 2 * len; mdb = Buffer.allocUnsafe(mdl); } + if(/*::data instanceof Buffer && */Buffer.isBuffer(data)) { + for(i = 0; i < len; i++) { + j = 2*data[i]; + mdb[2*i] = DD[j]; mdb[2*i+1] = DD[j+1]; + } + } else if(typeof data === "string") { + for(i = 0; i < len; i++) { + j = 2*data.charCodeAt(i); + mdb[2*i] = DD[j]; mdb[2*i+1] = DD[j+1]; + } + } else { + for(i = 0; i < len; i++) { + j = 2*data[i]; + mdb[2*i] = DD[j]; mdb[2*i+1] = DD[j+1]; + } + } + return mdb.slice(0, 2 * len).toString('ucs2'); + }; + }; + var dbcs_encode = function make_dbcs_encode(cp/*:CPIndex*/)/*:Encoder*/ { + var E/*:EMap*/ = cpt[cp].enc; + var EE = Buffer.allocUnsafe(131072); + for(var i = 0; i < 131072; ++i) EE[i] = 0; + var keys = Object.keys(E); + for(var ee = 0, e = keys[ee]; ee < keys.length; ++ee) { + if(!(e = keys[ee])) continue; + var f = e.charCodeAt(0); + EE[2*f] = E[e] & 255; EE[2*f+1] = E[e]>>8; + } + return function dbcs_e(data/*:StrData*/, ofmt/*:?string*/)/*:any*/ { + var len = data.length, out = Buffer.allocUnsafe(2*len), i=0, j=0, jj=0, k=0, D=0; + if(typeof data === 'string') { + for(i = k = 0; i < len; ++i) { + j = data.charCodeAt(i)*2; + out[k++] = EE[j+1] || EE[j]; if(EE[j+1] > 0) out[k++] = EE[j]; + } + out = out.slice(0,k); + } else if(/*::data instanceof Buffer && */Buffer.isBuffer(data)) { + for(i = k = 0; i < len; ++i) { + D = data[i]; + if(D < 128) j = D; + else if(D < 224) { j = ((D&31)<<6)+(data[i+1]&63); ++i; } + else if(D < 240) { j = ((D&15)<<12)+((data[i+1]&63)<<6)+(data[i+2]&63); i+=2; } + else { j = ((D&7)<<18)+((data[i+1]&63)<<12)+((data[i+2]&63)<<6)+(data[i+3]&63); i+=3; } + if(j<65536) { j*=2; out[k++] = EE[j+1] || EE[j]; if(EE[j+1] > 0) out[k++] = EE[j]; } + else { jj = j-65536; + j=2*(0xD800 + ((jj>>10)&1023)); out[k++] = EE[j+1] || EE[j]; if(EE[j+1] > 0) out[k++] = EE[j]; + j=2*(0xDC00 + (jj&1023)); out[k++] = EE[j+1] || EE[j]; if(EE[j+1] > 0) out[k++] = EE[j]; + } + } + out = out.slice(0,k); + } else { + for(i = k = 0; i < len; i++) { + j = /*::(*/data[i]/*:: :any)*/.charCodeAt(0)*2; + out[k++] = EE[j+1] || EE[j]; if(EE[j+1] > 0) out[k++] = EE[j]; + } + } + if(!ofmt || ofmt === 'buf') return out; + if(ofmt !== 'arr') return out.toString('binary'); + return [].slice.call(out); + }; + }; + var dbcs_decode = function make_dbcs_decode(cp/*:CPIndex*/)/*:Decoder*/ { + var D/*:DMap*/ = cpt[cp].dec; + var DD = Buffer.allocUnsafe(131072), d=0, c, w=0, j=0, i=0; + for(i = 0; i < 65536; ++i) { DD[2*i] = 0xFF; DD[2*i+1] = 0xFD;} + for(d = 0; d < D.length; ++d) { + if(!(c=D[d])) continue; + w = c.charCodeAt(0); + j = 2*d; + DD[j] = w&255; DD[j+1] = w>>8; + } + return function dbcs_d(data/*:Data*/)/*:string*/ { + var len = data.length, out = Buffer.allocUnsafe(2*len), i=0, j=0, k=0; + if(/*::data instanceof Buffer && */Buffer.isBuffer(data)) { + for(i = 0; i < len; i++) { + j = 2*data[i]; + if(DD[j]===0xFF && DD[j+1]===0xFD) { j=2*((data[i]<<8)+data[i+1]); ++i; } + out[k++] = DD[j]; out[k++] = DD[j+1]; + } + } else if(typeof data === "string") { + for(i = 0; i < len; i++) { + j = 2*data.charCodeAt(i); + if(DD[j]===0xFF && DD[j+1]===0xFD) { j=2*((data.charCodeAt(i)<<8)+data.charCodeAt(i+1)); ++i; } + out[k++] = DD[j]; out[k++] = DD[j+1]; + } + } else { + for(i = 0; i < len; i++) { + j = 2*data[i]; + if(DD[j]===0xFF && DD[j+1]===0xFD) { j=2*((data[i]<<8)+data[i+1]); ++i; } + out[k++] = DD[j]; out[k++] = DD[j+1]; + } + } + return out.slice(0,k).toString('ucs2'); + }; + }; + magic_decode[65001] = function utf8_d(data/*:Data*/)/*:string*/ { + if(typeof data === "string") return utf8_d(data.split("").map(cca)); + var len = data.length, w = 0, ww = 0; + if(4 * len > mdl) { mdl = 4 * len; mdb = Buffer.allocUnsafe(mdl); } + var i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(var j = 1, k = 0, D = 0; i < len; i+=j) { + j = 1; D = data[i]; + if(D < 128) w = D; + else if(D < 224) { w=(D&31)*64+(data[i+1]&63); j=2; } + else if(D < 240) { w=((D&15)<<12)+(data[i+1]&63)*64+(data[i+2]&63); j=3; } + else { w=(D&7)*262144+((data[i+1]&63)<<12)+(data[i+2]&63)*64+(data[i+3]&63); j=4; } + if(w < 65536) { mdb[k++] = w&255; mdb[k++] = w>>8; } + else { + w -= 65536; ww = 0xD800 + ((w>>10)&1023); w = 0xDC00 + (w&1023); + mdb[k++] = ww&255; mdb[k++] = ww>>>8; mdb[k++] = w&255; mdb[k++] = (w>>>8)&255; + } + } + return mdb.slice(0,k).toString('ucs2'); + }; + magic_encode[65001] = function utf8_e(data/*:StrData*/, ofmt/*:?string*/)/*:any*/ { + if(has_buf && /*::data instanceof Buffer && */Buffer.isBuffer(data)) { + if(!ofmt || ofmt === 'buf') return data; + if(ofmt !== 'arr') return data.toString('binary'); + return [].slice.call(data); + } +/*:: + // data cannot be a buffer at this point + if(data instanceof Buffer) throw ""; +*/ + var len = data.length, w = 0, ww = 0, j = 0; + var direct = typeof data === "string"; + if(4 * len > mdl) { mdl = 4 * len; mdb = Buffer.allocUnsafe(mdl); } + for(var i = 0; i < len; ++i) { + w = direct /*::&& typeof data === "string" */? data.charCodeAt(i) : data[i].charCodeAt(0); + if(w <= 0x007F) mdb[j++] = w; + else if(w <= 0x07FF) { + mdb[j++] = 192 + (w >> 6); + mdb[j++] = 128 + (w&63); + } else if(w >= 0xD800 && w <= 0xDFFF) { + w -= 0xD800; ++i; + ww = (direct /*::&& typeof data === "string" */? data.charCodeAt(i) : data[i].charCodeAt(0)) - 0xDC00 + (w << 10); + mdb[j++] = 240 + ((ww>>>18) & 0x07); + mdb[j++] = 144 + ((ww>>>12) & 0x3F); + mdb[j++] = 128 + ((ww>>>6) & 0x3F); + mdb[j++] = 128 + (ww & 0x3F); + } else { + mdb[j++] = 224 + (w >> 12); + mdb[j++] = 128 + ((w >> 6)&63); + mdb[j++] = 128 + (w&63); + } + } + if(!ofmt || ofmt === 'buf') return mdb.slice(0,j); + if(ofmt !== 'arr') return mdb.slice(0,j).toString('binary'); + return [].slice.call(mdb, 0, j); + }; + } + + var encache = function encache() { + if(has_buf) { + if(cpdcache[sbcs_cache[0]]) return; + var i=0, s=0; + for(i = 0; i < sbcs_cache.length; ++i) { + s = sbcs_cache[i]; + if(cpt[s]) { + cpdcache[s] = sbcs_decode(s); + cpecache[s] = sbcs_encode(s); + } + } + for(i = 0; i < dbcs_cache.length; ++i) { + s = dbcs_cache[i]; + if(cpt[s]) { + cpdcache[s] = dbcs_decode(s); + cpecache[s] = dbcs_encode(s); + } + } + for(i = 0; i < magic_cache.length; ++i) { + s = magic_cache[i]; + if(magic_decode[s]) cpdcache[s] = magic_decode[s]; + if(magic_encode[s]) cpecache[s] = magic_encode[s]; + } + } + }; + var null_enc = function(data/*:StrData*/, ofmt/*:?string*/) { void ofmt; return ""; }; + var cp_decache = function cp_decache(cp/*:CPIndex*/)/*:void*/ { delete cpdcache[cp]; delete cpecache[cp]; }; + var decache = function decache() { + if(has_buf) { + if(!cpdcache[sbcs_cache[0]]) return; + sbcs_cache.forEach(cp_decache); + dbcs_cache.forEach(cp_decache); + magic_cache.forEach(cp_decache); + } + last_enc = null_enc; last_cp = 0; + }; + var cache = { + encache: encache, + decache: decache, + sbcs: sbcs_cache, + dbcs: dbcs_cache + }; + + encache(); + + var BM = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var SetD = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?"; + var last_enc/*:Encoder*/ = null_enc, last_cp/*:CPIndex*/ = 0; + var encode = function encode(cp/*:CPIndex*/, data/*:StrData*/, ofmt/*:?string*/)/*:OutType*/ { + if(cp === last_cp && last_enc) { return last_enc(data, ofmt); } + if(cpecache[cp]) { last_enc = cpecache[last_cp=cp]; return last_enc(data, ofmt); } + if(has_buf && /*::data instanceof Buffer && */Buffer.isBuffer(data)) data = data.toString('utf8'); +/*:: + // data cannot be a buffer at this point + if(data instanceof Buffer) throw ""; +*/ + var len = data.length; + var out = has_buf ? Buffer.allocUnsafe(4*len) : [], w=0, i=0, j = 0, ww=0; + var C/*:CPEntry*/ = cpt[cp], E/*:EMap*/, M/*:string*/ = ""; + var isstr = typeof data === 'string'; + if(C && (E=C.enc)) for(i = 0; i < len; ++i, ++j) { + w = E[isstr/*:: && typeof data == 'string' */? data.charAt(i) : data[i]]; + if(w > 255) { + out[j] = w>>8; + out[++j] = w&255; + } else out[j] = w&255; + } + else if((M=magic[cp])) switch(M) { + case "utf8": + if(has_buf && isstr/*:: && typeof data == 'string' */) { out = Buffer_from(data, M); j = out.length; break; } + for(i = 0; i < len; ++i, ++j) { + w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0); + if(w <= 0x007F) out[j] = w; + else if(w <= 0x07FF) { + out[j] = 192 + (w >> 6); + out[++j] = 128 + (w&63); + } else if(w >= 0xD800 && w <= 0xDFFF) { + w -= 0xD800; + ww = (isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(++i) : data[++i].charCodeAt(0)) - 0xDC00 + (w << 10); + out[j] = 240 + ((ww>>>18) & 0x07); + out[++j] = 144 + ((ww>>>12) & 0x3F); + out[++j] = 128 + ((ww>>>6) & 0x3F); + out[++j] = 128 + (ww & 0x3F); + } else { + out[j] = 224 + (w >> 12); + out[++j] = 128 + ((w >> 6)&63); + out[++j] = 128 + (w&63); + } + } + break; + case "ascii": + if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; } + for(i = 0; i < len; ++i, ++j) { + w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0); + if(w <= 0x007F) out[j] = w; + else throw new Error("bad ascii " + w); + } + break; + case "utf16le": + if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; } + for(i = 0; i < len; ++i) { + w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0); + out[j++] = w&255; + out[j++] = w>>8; + } + break; + case "utf16be": + for(i = 0; i < len; ++i) { + w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0); + out[j++] = w>>8; + out[j++] = w&255; + } + break; + case "utf32le": + for(i = 0; i < len; ++i) { + w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0); + if(w >= 0xD800 && w <= 0xDFFF) w = 0x10000 + ((w - 0xD800) << 10) + (data[++i].charCodeAt(0) - 0xDC00); + out[j++] = w&255; w >>= 8; + out[j++] = w&255; w >>= 8; + out[j++] = w&255; w >>= 8; + out[j++] = w&255; + } + break; + case "utf32be": + for(i = 0; i < len; ++i) { + w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0); + if(w >= 0xD800 && w <= 0xDFFF) w = 0x10000 + ((w - 0xD800) << 10) + (data[++i].charCodeAt(0) - 0xDC00); + out[j+3] = w&255; w >>= 8; + out[j+2] = w&255; w >>= 8; + out[j+1] = w&255; w >>= 8; + out[j] = w&255; + j+=4; + } + break; + case "utf7": + for(i = 0; i < len; i++) { +/*:: + // data cannot be a buffer at this point + if(data instanceof Buffer) throw ""; +*/ + var c/*:string*/ = isstr/*:: && typeof data == 'string' */ ? data.charAt(i) : data[i].charAt(0); + if(c === "+") { out[j++] = 0x2b; out[j++] = 0x2d; continue; } + if(SetD.indexOf(c) > -1) { out[j++] = c.charCodeAt(0); continue; } + var tt = encode(1201, c); + out[j++] = 0x2b; + out[j++] = BM.charCodeAt(tt[0]>>2); + out[j++] = BM.charCodeAt(((tt[0]&0x03)<<4) + ((tt[1]||0)>>4)); + out[j++] = BM.charCodeAt(((tt[1]&0x0F)<<2) + ((tt[2]||0)>>6)); + out[j++] = 0x2d; + } + break; + default: throw new Error("Unsupported magic: " + cp + " " + magic[cp]); + } + else throw new Error("Unrecognized CP: " + cp); + out = out.slice(0,j); + if(!has_buf) return (ofmt == 'str') ? (out/*:any*/).map(sfcc).join("") : out; + if(!ofmt || ofmt === 'buf') return out; + if(ofmt !== 'arr') return /*::((*/out/*:: :any) :Buffer)*/.toString('binary'); + return [].slice.call(out); + }; + var decode = function decode(cp/*:CPIndex*/, data/*:Data*/)/*:string*/ { + var F/*:Decoder*/; if((F=cpdcache[cp])) return F(data); + if(typeof data === "string") return decode(cp, data.split("").map(cca)); + var len = data.length, out = new Array(len), s="", w=0, i=0, j=1, k=0, ww=0; + var C/*:CPEntry*/ = cpt[cp], D/*:DMap*/, M=""; + if(C && (D=C.dec)) { + for(i = 0; i < len; i+=j) { + j = 2; + s = D[(data[i]<<8)+ data[i+1]]; + if(!s) { + j = 1; + s = D[data[i]]; + } + if(!s) throw new Error('Unrecognized code: ' + data[i] + ' ' + data[i+j-1] + ' ' + i + ' ' + j + ' ' + D[data[i]]); + out[k++] = s; + } + } + else if((M=magic[cp])) switch(M) { + case "utf8": + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(; i < len; i+=j) { + j = 1; + if(data[i] < 128) w = data[i]; + else if(data[i] < 224) { w=(data[i]&31)*64+(data[i+1]&63); j=2; } + else if(data[i] < 240) { w=((data[i]&15)<<12)+(data[i+1]&63)*64+(data[i+2]&63); j=3; } + else { w=(data[i]&7)*262144+((data[i+1]&63)<<12)+(data[i+2]&63)*64+(data[i+3]&63); j=4; } + if(w < 65536) { out[k++] = String.fromCharCode(w); } + else { + w -= 65536; ww = 0xD800 + ((w>>10)&1023); w = 0xDC00 + (w&1023); + out[k++] = String.fromCharCode(ww); out[k++] = String.fromCharCode(w); + } + } + break; + case "ascii": + if(has_buf && /*::data instanceof Buffer && */Buffer.isBuffer(data)) return data.toString(M); + for(i = 0; i < len; i++) out[i] = String.fromCharCode(data[i]); + k = len; break; + case "utf16le": + if(len >= 2 && data[0] == 0xFF) if(data[1] == 0xFE) i = 2; + if(has_buf && /*::data instanceof Buffer && */Buffer.isBuffer(data)) return data.toString(M); + j = 2; + for(; i+1 < len; i+=j) { + out[k++] = String.fromCharCode((data[i+1]<<8) + data[i]); + } + break; + case "utf16be": + if(len >= 2 && data[0] == 0xFE) if(data[1] == 0xFF) i = 2; + j = 2; + for(; i+1 < len; i+=j) { + out[k++] = String.fromCharCode((data[i]<<8) + data[i+1]); + } + break; + case "utf32le": + if(len >= 4 && data[0] == 0xFF) if(data[1] == 0xFE && data[2] === 0 && data[3] === 0) i = 4; + j = 4; + for(; i < len; i+=j) { + w = (data[i+3]<<24) + (data[i+2]<<16) + (data[i+1]<<8) + (data[i]); + if(w > 0xFFFF) { + w -= 0x10000; + out[k++] = String.fromCharCode(0xD800 + ((w >> 10) & 0x3FF)); + out[k++] = String.fromCharCode(0xDC00 + (w & 0x3FF)); + } + else out[k++] = String.fromCharCode(w); + } + break; + case "utf32be": + if(len >= 4 && data[3] == 0xFF) if(data[2] == 0xFE && data[1] === 0 && data[0] === 0) i = 4; + j = 4; + for(; i < len; i+=j) { + w = (data[i]<<24) + (data[i+1]<<16) + (data[i+2]<<8) + (data[i+3]); + if(w > 0xFFFF) { + w -= 0x10000; + out[k++] = String.fromCharCode(0xD800 + ((w >> 10) & 0x3FF)); + out[k++] = String.fromCharCode(0xDC00 + (w & 0x3FF)); + } + else out[k++] = String.fromCharCode(w); + } + break; + case "utf7": + if(len >= 4 && data[0] == 0x2B && data[1] == 0x2F && data[2] == 0x76) { + if(len >= 5 && data[3] == 0x38 && data[4] == 0x2D) i = 5; + else if(data[3] == 0x38 || data[3] == 0x39 || data[3] == 0x2B || data[3] == 0x2F) i = 4; + } + for(; i < len; i+=j) { + if(data[i] !== 0x2b) { j=1; out[k++] = String.fromCharCode(data[i]); continue; } + j=1; + if(data[i+1] === 0x2d) { j = 2; out[k++] = "+"; continue; } + // eslint-disable-next-line no-useless-escape + while(String.fromCharCode(data[i+j]).match(/[A-Za-z0-9+\/]/)) j++; + var dash = 0; + if(data[i+j] === 0x2d) { ++j; dash=1; } + var tt = []; + var o64 = ""; + var c1=0, c2=0, c3=0; + var e1=0, e2=0, e3=0, e4=0; + for(var l = 1; l < j - dash;) { + e1 = BM.indexOf(String.fromCharCode(data[i+l++])); + e2 = BM.indexOf(String.fromCharCode(data[i+l++])); + c1 = e1 << 2 | e2 >> 4; + tt.push(c1); + e3 = BM.indexOf(String.fromCharCode(data[i+l++])); + if(e3 === -1) break; + c2 = (e2 & 15) << 4 | e3 >> 2; + tt.push(c2); + e4 = BM.indexOf(String.fromCharCode(data[i+l++])); + if(e4 === -1) break; + c3 = (e3 & 3) << 6 | e4; + if(e4 < 64) tt.push(c3); + } + o64 = decode(1201, tt); + for(l = 0; l < o64.length; ++l) out[k++] = o64.charAt(l); + } + break; + default: throw new Error("Unsupported magic: " + cp + " " + magic[cp]); + } + else throw new Error("Unrecognized CP: " + cp); + return out.slice(0,k).join(""); + }; + var hascp = function hascp(cp/*:number*/)/*:boolean*/ { return !!(cpt[cp] || magic[cp]); }; + const utils = { decode: decode, encode: encode, hascp: hascp, magic: magic, cache:cache }; + export { utils }; diff --git a/docbits/10_install.md b/docbits/10_install.md index 53ebf20..e29ad4d 100644 --- a/docbits/10_install.md +++ b/docbits/10_install.md @@ -2,6 +2,8 @@ ### Installation +**Standalone Browser Scripts** + The complete browser standalone build is saved to `dist/xlsx.full.min.js` and can be directly added to a page with a `script` tag: @@ -51,18 +53,50 @@ be configured to remove support with `resolve.alias`: +With [bower](https://bower.io/search/?q=js-xlsx): + +```bash +$ bower install js-xlsx +``` + +**Deno** + +The [`sheetjs`](https://deno.land/x/sheetjs) package is available on deno: + +```ts +import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs' +``` + +**NodeJS** + With [npm](https://www.npmjs.org/package/xlsx): ```bash $ npm install xlsx ``` -With [bower](https://bower.io/search/?q=js-xlsx): +By default, the module supports `require`: -```bash -$ bower install js-xlsx +```js +var XLSX = require("xlsx"); ``` +The module also ships with `xlsx.mjs` for use with `import`: + +```js +import * as XLSX from 'xlsx/xlsx.mjs'; + +/* load 'fs' for readFile and writeFile support */ +import * as fs from 'fs'; +XLSX.set_fs(fs); + +/* load the codepage support library for extended support with older formats */ +import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cpexcel); +``` + +**PhotoShop and InDesign** + `dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign that is included in the `npm` package. It can be directly referenced with a `#include` directive: diff --git a/misc/02_codepage.js b/misc/02_codepage.js index 55ef79c..151f985 100644 --- a/misc/02_codepage.js +++ b/misc/02_codepage.js @@ -1,6 +1,6 @@ var current_codepage = 1200, current_ansi = 1252; -var VALID_ANSI = [ 874, 932, 936, 949, 950 ]; +var VALID_ANSI = [ 874, 932, 936, 949, 950, 10000 ]; for(var i = 0; i <= 8; ++i) VALID_ANSI.push(1250 + i); /* ECMA-376 Part I 18.4.1 charset to codepage mapping */ var CS2CP = ({ @@ -55,3 +55,21 @@ var debom = function(data/*:string*/)/*:string*/ { var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; + +var cptable; +function set_cptable(_cptable) { + cptable = _cptable; + set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); }; + debom = function(data/*:string*/) { + if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return cptable.utils.decode(1200, char_codes(data.slice(2))); } + return data; + }; + _getchar = function _gc2(x/*:number*/)/*:string*/ { + if(current_codepage === 1200) return String.fromCharCode(x); + return cptable.utils.decode(current_codepage, [x&255,x>>8])[0]; + }; + _getansi = function _ga2(x/*:number*/)/*:string*/ { + return cptable.utils.decode(current_ansi, [x])[0]; + }; +} +export { set_cptable }; diff --git a/misc/19_esmfs.js b/misc/19_esmfs.js deleted file mode 100644 index c2dba60..0000000 --- a/misc/19_esmfs.js +++ /dev/null @@ -1,60 +0,0 @@ -import * as _fs from 'fs'; - -/* normalize data for blob ctor */ -function blobify(data) { - if(typeof data === "string") return s2ab(data); - if(Array.isArray(data)) return a2u(data); - return data; -} -/* write or download file */ -function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { - /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ - if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); - var data = (enc == "utf8") ? utf8write(payload) : payload; - /*:: declare var IE_SaveFile: any; */ - if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); - if(typeof Blob !== 'undefined') { - var blob = new Blob([blobify(data)], {type:"application/octet-stream"}); - /*:: declare var navigator: any; */ - if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname); - /*:: declare var saveAs: any; */ - if(typeof saveAs !== 'undefined') return saveAs(blob, fname); - if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) { - var url = URL.createObjectURL(blob); - /*:: declare var chrome: any; */ - if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") { - if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); - return chrome.downloads.download({ url: url, filename: fname, saveAs: true}); - } - var a = document.createElement("a"); - if(a.download != null) { - /*:: if(document.body == null) throw new Error("unreachable"); */ - a.download = fname; a.href = url; document.body.appendChild(a); a.click(); - /*:: if(document.body == null) throw new Error("unreachable"); */ document.body.removeChild(a); - if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); - return url; - } - } - } - // $FlowIgnore - if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript - // $FlowIgnore - var out = File(fname); out.open("w"); out.encoding = "binary"; - if(Array.isArray(payload)) payload = a2s(payload); - out.write(payload); out.close(); return payload; - } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } - throw new Error("cannot save file " + fname); -} - -/* read binary data from file */ -function read_binary(path/*:string*/) { - if(typeof _fs !== 'undefined') return _fs.readFileSync(path); - // $FlowIgnore - if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript - // $FlowIgnore - var infile = File(path); infile.open("r"); infile.encoding = "binary"; - var data = infile.read(); infile.close(); - return data; - } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } - throw new Error("Cannot access file " + path); -} diff --git a/misc/19_mjsfs.js b/misc/19_mjsfs.js index 528be8d..2ee7bca 100644 --- a/misc/19_mjsfs.js +++ b/misc/19_mjsfs.js @@ -1,4 +1,6 @@ -const _fs = void 0; +let _fs = void 0; +function set_fs(fs) { _fs = fs; } +export { set_fs }; /* normalize data for blob ctor */ function blobify(data) { @@ -10,6 +12,16 @@ function blobify(data) { function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); + if(typeof Deno !== 'undefined') { + /* in this spot, it's safe to assume typed arrays and TextEncoder/TextDecoder exist */ + if(enc) switch(enc) { + case "utf8": payload = new TextEncoder(enc).encode(payload); break; + case "binary": payload = s2ab(payload); break; + /* TODO: binary equivalent */ + default: throw new Error("Unsupported encoding " + enc); + } + return Deno.writeFileSync(fname, payload); + } var data = (enc == "utf8") ? utf8write(payload) : payload; /*:: declare var IE_SaveFile: any; */ if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); @@ -49,6 +61,7 @@ function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { /* read binary data from file */ function read_binary(path/*:string*/) { if(typeof _fs !== 'undefined') return _fs.readFileSync(path); + if(typeof Deno !== 'undefined') return Deno.readFileSync(path); // $FlowIgnore if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript // $FlowIgnore diff --git a/misc/docs/README.md b/misc/docs/README.md index 04465ba..d91e03f 100644 --- a/misc/docs/README.md +++ b/misc/docs/README.md @@ -113,6 +113,8 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! ### Installation +**Standalone Browser Scripts** + The complete browser standalone build is saved to `dist/xlsx.full.min.js` and can be directly added to a page with a `script` tag: @@ -156,18 +158,50 @@ be configured to remove support with `resolve.alias`: +With [bower](https://bower.io/search/?q=js-xlsx): + +```bash +$ bower install js-xlsx +``` + +**Deno** + +The [`sheetjs`](https://deno.land/x/sheetjs) package is available on deno: + +```ts +import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs' +``` + +**NodeJS** + With [npm](https://www.npmjs.org/package/xlsx): ```bash $ npm install xlsx ``` -With [bower](https://bower.io/search/?q=js-xlsx): +By default, the module supports `require`: -```bash -$ bower install js-xlsx +```js +var XLSX = require("xlsx"); ``` +The module also ships with `xlsx.mjs` for use with `import`: + +```js +import * as XLSX from 'xlsx/xlsx.mjs'; + +/* load 'fs' for readFile and writeFile support */ +import * as fs from 'fs'; +XLSX.set_fs(fs); + +/* load the codepage support library for extended support with older formats */ +import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cpexcel); +``` + +**PhotoShop and InDesign** + `dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign that is included in the `npm` package. It can be directly referenced with a `#include` directive: @@ -1541,7 +1575,9 @@ data grid for previewing and modifying structured data in the web browser. The [`react-data-grid`](https://npm.im/react-data-grid) is a data grid tailored for react. It expects two properties: `rows` of data objects and `columns` which describe the columns. For the purposes of massaging the data to fit the react -data grid API it is easiest to start from an array of arrays: +data grid API it is easiest to start from an array of arrays. + +This demo starts by fetching a remote file and using `XLSX.read` to extract: ```js import { useEffect, useState } from "react"; diff --git a/misc/esm.lst b/misc/esm.lst deleted file mode 100644 index 5c3b0a6..0000000 --- a/misc/esm.lst +++ /dev/null @@ -1,79 +0,0 @@ -misc/00_esmheader.js -bits/01_version.js -misc/02_codepage.js -bits/03_consts.js -bits/04_base64.js -bits/05_buf.js -bits/09_types.js -bits/10_ssf.js -bits/11_ssfutils.js -misc/18_esmcfb.js -misc/19_esmfs.js -bits/20_jsutils.js -misc/21_ziputils.js -bits/22_xmlutils.js -bits/23_binutils.js -bits/24_hoppers.js -bits/25_cellutils.js -bits/27_csfutils.js -bits/28_binstructs.js -bits/29_xlsenum.js -bits/30_ctype.js -bits/31_rels.js -bits/32_odmanrdf.js -bits/33_coreprops.js -bits/34_extprops.js -bits/35_custprops.js -bits/36_xlsprops.js -bits/38_xlstypes.js -bits/39_xlsbiff.js -bits/40_harb.js -bits/41_lotus.js -bits/42_sstxml.js -bits/43_sstbin.js -bits/44_offcrypto.js -bits/45_rtf.js -bits/46_stycommon.js -bits/47_styxml.js -bits/48_stybin.js -bits/49_theme.js -bits/50_styxls.js -bits/52_calcchain.js -bits/53_externlink.js -bits/54_drawing.js -bits/55_vml.js -bits/56_cmntcommon.js -bits/57_cmntxml.js -bits/58_cmntbin.js -bits/59_vba.js -bits/60_macrovba.js -bits/61_fcommon.js -bits/62_fxls.js -bits/63_fbin.js -bits/64_ftab.js -bits/65_fods.js -bits/66_wscommon.js -bits/67_wsxml.js -bits/68_wsbin.js -bits/69_chartxml.js -bits/70_csheet.js -bits/71_wbcommon.js -bits/72_wbxml.js -bits/73_wbbin.js -bits/74_xmlbin.js -bits/75_xlml.js -bits/76_xls.js -bits/77_parsetab.js -bits/78_writebiff.js -bits/79_html.js -bits/80_parseods.js -bits/81_writeods.js -bits/83_numbers.js -bits/84_defaults.js -bits/85_parsezip.js -bits/86_writezip.js -bits/87_read.js -bits/88_write.js -bits/90_utils.js -bits/95_api.js -misc/98_esmxport.js diff --git a/types/index.d.ts b/types/index.d.ts index d2801b4..209be29 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,16 +1,23 @@ /* index.d.ts (C) 2015-present SheetJS and contributors */ // TypeScript Version: 2.2 -import * as CFB from "cfb"; -import * as SSF from "ssf"; +// import * as CFB from "cfb"; +// import * as SSF from "ssf"; /** Version string */ export const version: string; /** SSF Formatter Library */ -export { SSF }; +// export { SSF }; +export const SSF: any; /** CFB Library */ -export { CFB }; +// export { CFB }; +export const CFB: any; + +/** ESM ONLY! Set internal `fs` instance */ +export function set_fs(fs: any): void; +/** ESM ONLY! Set internal codepage tables */ +export function set_cptable(cptable: any): void; /** NODE ONLY! Attempts to read filename and parse */ export function readFile(filename: string, opts?: ParsingOptions): WorkBook; diff --git a/types/xlsx-tests.ts b/types/xlsx-tests.ts index 5afa63f..3af6c37 100644 --- a/types/xlsx-tests.ts +++ b/types/xlsx-tests.ts @@ -75,5 +75,5 @@ const headers: string[] = get_header_row(aoa2); const CFB = XLSX.CFB; const vbawb = XLSX.readFile("test.xlsm", {bookVBA:true}); if(vbawb.vbaraw) { - const cfb: XLSX.CFB.CFB$Container = CFB.read(vbawb.vbaraw, {type: "buffer"}); + const cfb: any /* XLSX.CFB.CFB$Container */ = CFB.read(vbawb.vbaraw, {type: "buffer"}); } diff --git a/xlsx.esm.mjs b/xlsx.esm.mjs deleted file mode 100644 index 29a56ef..0000000 --- a/xlsx.esm.mjs +++ /dev/null @@ -1,23215 +0,0 @@ -/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ -/* vim: set ts=2: */ -/*exported XLSX */ -/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */ -var XLSX = {}; -XLSX.version = '0.18.0'; -var current_codepage = 1200, current_ansi = 1252; - -var VALID_ANSI = [ 874, 932, 936, 949, 950 ]; -for(var i = 0; i <= 8; ++i) VALID_ANSI.push(1250 + i); -/* ECMA-376 Part I 18.4.1 charset to codepage mapping */ -var CS2CP = ({ - /*::[*/0/*::]*/: 1252, /* ANSI */ - /*::[*/1/*::]*/: 65001, /* DEFAULT */ - /*::[*/2/*::]*/: 65001, /* SYMBOL */ - /*::[*/77/*::]*/: 10000, /* MAC */ - /*::[*/128/*::]*/: 932, /* SHIFTJIS */ - /*::[*/129/*::]*/: 949, /* HANGUL */ - /*::[*/130/*::]*/: 1361, /* JOHAB */ - /*::[*/134/*::]*/: 936, /* GB2312 */ - /*::[*/136/*::]*/: 950, /* CHINESEBIG5 */ - /*::[*/161/*::]*/: 1253, /* GREEK */ - /*::[*/162/*::]*/: 1254, /* TURKISH */ - /*::[*/163/*::]*/: 1258, /* VIETNAMESE */ - /*::[*/177/*::]*/: 1255, /* HEBREW */ - /*::[*/178/*::]*/: 1256, /* ARABIC */ - /*::[*/186/*::]*/: 1257, /* BALTIC */ - /*::[*/204/*::]*/: 1251, /* RUSSIAN */ - /*::[*/222/*::]*/: 874, /* THAI */ - /*::[*/238/*::]*/: 1250, /* EASTEUROPE */ - /*::[*/255/*::]*/: 1252, /* OEM */ - /*::[*/69/*::]*/: 6969 /* MISC */ -}/*:any*/); - -var set_ansi = function(cp/*:number*/) { if(VALID_ANSI.indexOf(cp) == -1) return; current_ansi = CS2CP[0] = cp; }; -function reset_ansi() { set_ansi(1252); } - -var set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); }; -function reset_cp() { set_cp(1200); reset_ansi(); } - -function char_codes(data/*:string*/)/*:Array*/ { var o/*:Array*/ = []; for(var i = 0, len = data.length; i < len; ++i) o[i] = data.charCodeAt(i); return o; } - -function utf16leread(data/*:string*/)/*:string*/ { - var o/*:Array*/ = []; - for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i) + (data.charCodeAt(2*i+1)<<8)); - return o.join(""); -} -function utf16beread(data/*:string*/)/*:string*/ { - var o/*:Array*/ = []; - for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i+1) + (data.charCodeAt(2*i)<<8)); - return o.join(""); -} - -var debom = function(data/*:string*/)/*:string*/ { - var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1); - if(c1 == 0xFF && c2 == 0xFE) return utf16leread(data.slice(2)); - if(c1 == 0xFE && c2 == 0xFF) return utf16beread(data.slice(2)); - if(c1 == 0xFEFF) return data.slice(1); - return data; -}; - -var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; -var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; -var DENSE = null; -var DIF_XL = true; -var Base64 = function() { - var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - return { - encode: function(input) { - var o = ""; - var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; - for (var i = 0; i < input.length; ) { - c1 = input.charCodeAt(i++); - e1 = c1 >> 2; - c2 = input.charCodeAt(i++); - e2 = (c1 & 3) << 4 | c2 >> 4; - c3 = input.charCodeAt(i++); - e3 = (c2 & 15) << 2 | c3 >> 6; - e4 = c3 & 63; - if (isNaN(c2)) { - e3 = e4 = 64; - } else if (isNaN(c3)) { - e4 = 64; - } - o += map.charAt(e1) + map.charAt(e2) + map.charAt(e3) + map.charAt(e4); - } - return o; - }, - decode: function(input) { - var o = ""; - var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; - input = input.replace(/[^\w\+\/\=]/g, ""); - for (var i = 0; i < input.length; ) { - e1 = map.indexOf(input.charAt(i++)); - e2 = map.indexOf(input.charAt(i++)); - c1 = e1 << 2 | e2 >> 4; - o += String.fromCharCode(c1); - e3 = map.indexOf(input.charAt(i++)); - c2 = (e2 & 15) << 4 | e3 >> 2; - if (e3 !== 64) { - o += String.fromCharCode(c2); - } - e4 = map.indexOf(input.charAt(i++)); - c3 = (e3 & 3) << 6 | e4; - if (e4 !== 64) { - o += String.fromCharCode(c3); - } - } - return o; - } - }; -}(); -var has_buf = (typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && !!process.versions.node); - -var Buffer_from = /*::(*/function(){}/*:: :any)*/; - -if(typeof Buffer !== 'undefined') { - var nbfs = !Buffer.from; - if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; } - Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer); - // $FlowIgnore - if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); }; - // $FlowIgnore - if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); }; -} - -function new_raw_buf(len/*:number*/) { - /* jshint -W056 */ - return has_buf ? Buffer.alloc(len) : typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len); - /* jshint +W056 */ -} - -function new_unsafe_buf(len/*:number*/) { - /* jshint -W056 */ - return has_buf ? Buffer.allocUnsafe(len) : typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len); - /* jshint +W056 */ -} - -var s2a = function s2a(s/*:string*/)/*:any*/ { - if(has_buf) return Buffer_from(s, "binary"); - return s.split("").map(function(x/*:string*/)/*:number*/{ return x.charCodeAt(0) & 0xff; }); -}; - -function s2ab(s/*:string*/)/*:any*/ { - if(typeof ArrayBuffer === 'undefined') return s2a(s); - var buf = new ArrayBuffer(s.length), view = new Uint8Array(buf); - for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; - return buf; -} - -function a2s(data/*:any*/)/*:string*/ { - if(Array.isArray(data)) return data.map(function(c) { return String.fromCharCode(c); }).join(""); - var o/*:Array*/ = []; for(var i = 0; i < data.length; ++i) o[i] = String.fromCharCode(data[i]); return o.join(""); -} - -function a2u(data/*:Array*/)/*:Uint8Array*/ { - if(typeof Uint8Array === 'undefined') throw new Error("Unsupported"); - return new Uint8Array(data); -} - -function ab2a(data/*:ArrayBuffer|Uint8Array*/)/*:Array*/ { - if(typeof ArrayBuffer == 'undefined') throw new Error("Unsupported"); - if(data instanceof ArrayBuffer) return ab2a(new Uint8Array(data)); - /*:: if(data instanceof ArrayBuffer) throw new Error("unreachable"); */ - var o = new Array(data.length); - for(var i = 0; i < data.length; ++i) o[i] = data[i]; - return o; -} - -function utf8decode(content/*:string*/) { - var out = [], widx = 0; - var o = new_raw_buf(content.length + 255); - for(var ridx = 0; ridx < content.length; ++ridx) { - var c = content.charCodeAt(ridx); - if(c < 0x80) o[widx++] = c; - else if(c < 0x800) { - o[widx++] = (192|((c>>6)&31)); - o[widx++] = (128|(c&63)); - } else if(c >= 0xD800 && c < 0xE000) { - c = (c&1023)+64; - var d = str.charCodeAt(++ridx)&1023; - o[widx++] = (240|((c>>8)&7)); - o[widx++] = (128|((c>>2)&63)); - o[widx++] = (128|((d>>6)&15)|((c&3)<<4)); - o[widx++] = (128|(d&63)); - } else { - o[widx++] = (224|((c>>12)&15)); - o[widx++] = (128|((c>>6)&63)); - o[widx++] = (128|(c&63)); - } - if(widx > 65530) { - out.push(o.slice(0, widx)); - widx = 0; - o = new_raw_buf(65535); - } - } - out.push(o.slice(0, widx)); - return bconcat(out); -} - -var bconcat = function(bufs) { - if(typeof Uint8Array !== "undefined") { - var i = 0, maxlen = 0; - for(i = 0; i < bufs.length; ++i) maxlen += bufs[i].length; - var o = new Uint8Array(maxlen); - var len = 0; - for(i = 0, maxlen = 0; i < bufs.length; maxlen += len, ++i) { - len = bufs[i].length; - if(bufs[i] instanceof Uint8Array) o.set(bufs[i], maxlen); - else if(typeof bufs[i] == "string") { throw "wtf"; } - else o.set(new Uint8Array(bufs[i]), maxlen); - } - return o; - } - return [].concat.apply([], bufs.map(function(buf) { return Array.isArray(buf) ? buf : [].slice.call(buf); })); -}; - -var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g; -/*:: -declare type Block = any; -declare type BufArray = { - newblk(sz:number):Block; - next(sz:number):Block; - end():any; - push(buf:Block):void; -}; - -type RecordHopperCB = {(d:any, Rn:string, RT:number):?boolean;}; - -type EvertType = {[string]:string}; -type EvertNumType = {[string]:number}; -type EvertArrType = {[string]:Array}; - -type StringConv = {(string):string}; - -type WriteObjStrFactory = {from_sheet(ws:Worksheet, o:any, wb:?Workbook):string}; -*/ -/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */ -/*jshint -W041 */ -var SSF/*:SSFModule*/ = ({}/*:any*/); -var make_ssf = function make_ssf(SSF/*:SSFModule*/){ -SSF.version = '0.11.2'; -function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; } -function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; } -function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} -function pad_(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v;return t.length>=d?t:fill(' ',d-t.length)+t;} -function rpad_(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:t+fill(' ',d-t.length);} -function pad0r1(v/*:any*/,d/*:number*/)/*:string*/{var t=""+Math.round(v); return t.length>=d?t:fill('0',d-t.length)+t;} -function pad0r2(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} -var p2_32 = Math.pow(2,32); -function pad0r(v/*:any*/,d/*:number*/)/*:string*/{if(v>p2_32||v<-p2_32) return pad0r1(v,d); var i = Math.round(v); return pad0r2(i,d); } -function isgeneral(s/*:string*/, i/*:?number*/)/*:boolean*/ { i = i || 0; return s.length >= 7 + i && (s.charCodeAt(i)|32) === 103 && (s.charCodeAt(i+1)|32) === 101 && (s.charCodeAt(i+2)|32) === 110 && (s.charCodeAt(i+3)|32) === 101 && (s.charCodeAt(i+4)|32) === 114 && (s.charCodeAt(i+5)|32) === 97 && (s.charCodeAt(i+6)|32) === 108; } -/*:: -type SSF_write_num = {(type:string, fmt:string, val:number):string}; -*/ -var days/*:Array >*/ = [ - ['Sun', 'Sunday'], - ['Mon', 'Monday'], - ['Tue', 'Tuesday'], - ['Wed', 'Wednesday'], - ['Thu', 'Thursday'], - ['Fri', 'Friday'], - ['Sat', 'Saturday'] -]; -var months/*:Array >*/ = [ - ['J', 'Jan', 'January'], - ['F', 'Feb', 'February'], - ['M', 'Mar', 'March'], - ['A', 'Apr', 'April'], - ['M', 'May', 'May'], - ['J', 'Jun', 'June'], - ['J', 'Jul', 'July'], - ['A', 'Aug', 'August'], - ['S', 'Sep', 'September'], - ['O', 'Oct', 'October'], - ['N', 'Nov', 'November'], - ['D', 'Dec', 'December'] -]; -function init_table(t/*:any*/) { - t[0]= 'General'; - t[1]= '0'; - t[2]= '0.00'; - t[3]= '#,##0'; - t[4]= '#,##0.00'; - t[9]= '0%'; - t[10]= '0.00%'; - t[11]= '0.00E+00'; - t[12]= '# ?/?'; - t[13]= '# ??/??'; - t[14]= 'm/d/yy'; - t[15]= 'd-mmm-yy'; - t[16]= 'd-mmm'; - t[17]= 'mmm-yy'; - t[18]= 'h:mm AM/PM'; - t[19]= 'h:mm:ss AM/PM'; - t[20]= 'h:mm'; - t[21]= 'h:mm:ss'; - t[22]= 'm/d/yy h:mm'; - t[37]= '#,##0 ;(#,##0)'; - t[38]= '#,##0 ;[Red](#,##0)'; - t[39]= '#,##0.00;(#,##0.00)'; - t[40]= '#,##0.00;[Red](#,##0.00)'; - t[45]= 'mm:ss'; - t[46]= '[h]:mm:ss'; - t[47]= 'mmss.0'; - t[48]= '##0.0E+0'; - t[49]= '@'; - t[56]= '"上午/下午 "hh"時"mm"分"ss"秒 "'; -} - -var table_fmt = {}; -init_table(table_fmt); -/* Defaults determined by systematically testing in Excel 2019 */ - -/* These formats appear to default to other formats in the table */ -var default_map/*:Array*/ = []; -var defi = 0; - -// 5 -> 37 ... 8 -> 40 -for(defi = 5; defi <= 8; ++defi) default_map[defi] = 32 + defi; - -// 23 -> 0 ... 26 -> 0 -for(defi = 23; defi <= 26; ++defi) default_map[defi] = 0; - -// 27 -> 14 ... 31 -> 14 -for(defi = 27; defi <= 31; ++defi) default_map[defi] = 14; -// 50 -> 14 ... 58 -> 14 -for(defi = 50; defi <= 58; ++defi) default_map[defi] = 14; - -// 59 -> 1 ... 62 -> 4 -for(defi = 59; defi <= 62; ++defi) default_map[defi] = defi - 58; -// 67 -> 9 ... 68 -> 10 -for(defi = 67; defi <= 68; ++defi) default_map[defi] = defi - 58; -// 72 -> 14 ... 75 -> 17 -for(defi = 72; defi <= 75; ++defi) default_map[defi] = defi - 58; - -// 69 -> 12 ... 71 -> 14 -for(defi = 67; defi <= 68; ++defi) default_map[defi] = defi - 57; - -// 76 -> 20 ... 78 -> 22 -for(defi = 76; defi <= 78; ++defi) default_map[defi] = defi - 56; - -// 79 -> 45 ... 81 -> 47 -for(defi = 79; defi <= 81; ++defi) default_map[defi] = defi - 34; - -// 82 -> 0 ... 65536 -> 0 (omitted) - -/* These formats technically refer to Accounting formats with no equivalent */ -var default_str/*:Array*/ = []; - -// 5 -- Currency, 0 decimal, black negative -default_str[5] = default_str[63] = '"$"#,##0_);\\("$"#,##0\\)'; -// 6 -- Currency, 0 decimal, red negative -default_str[6] = default_str[64] = '"$"#,##0_);[Red]\\("$"#,##0\\)'; -// 7 -- Currency, 2 decimal, black negative -default_str[7] = default_str[65] = '"$"#,##0.00_);\\("$"#,##0.00\\)'; -// 8 -- Currency, 2 decimal, red negative -default_str[8] = default_str[66] = '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)'; - -// 41 -- Accounting, 0 decimal, No Symbol -default_str[41] = '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)'; -// 42 -- Accounting, 0 decimal, $ Symbol -default_str[42] = '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)'; -// 43 -- Accounting, 2 decimal, No Symbol -default_str[43] = '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)'; -// 44 -- Accounting, 2 decimal, $ Symbol -default_str[44] = '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'; -function frac(x/*:number*/, D/*:number*/, mixed/*:?boolean*/)/*:Array*/ { - var sgn = x < 0 ? -1 : 1; - var B = x * sgn; - var P_2 = 0, P_1 = 1, P = 0; - var Q_2 = 1, Q_1 = 0, Q = 0; - var A = Math.floor(B); - while(Q_1 < D) { - A = Math.floor(B); - P = A * P_1 + P_2; - Q = A * Q_1 + Q_2; - if((B - A) < 0.00000005) break; - B = 1 / (B - A); - P_2 = P_1; P_1 = P; - Q_2 = Q_1; Q_1 = Q; - } - if(Q > D) { if(Q_1 > D) { Q = Q_2; P = P_2; } else { Q = Q_1; P = P_1; } } - if(!mixed) return [0, sgn * P, Q]; - var q = Math.floor(sgn * P/Q); - return [q, sgn*P - q*Q, Q]; -} -function parse_date_code(v/*:number*/,opts/*:?any*/,b2/*:?boolean*/) { - if(v > 2958465 || v < 0) return null; - var date = (v|0), time = Math.floor(86400 * (v - date)), dow=0; - var dout=[]; - var out={D:date, T:time, u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0}; - if(Math.abs(out.u) < 1e-6) out.u = 0; - if(opts && opts.date1904) date += 1462; - if(out.u > 0.9999) { - out.u = 0; - if(++time == 86400) { out.T = time = 0; ++date; ++out.D; } - } - if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;} - else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;} - else { - if(date > 60) --date; - /* 1 = Jan 1 1900 in Gregorian */ - var d = new Date(1900, 0, 1); - d.setDate(d.getDate() + date - 1); - dout = [d.getFullYear(), d.getMonth()+1,d.getDate()]; - dow = d.getDay(); - if(date < 60) dow = (dow + 6) % 7; - if(b2) dow = fix_hijri(d, dout); - } - out.y = dout[0]; out.m = dout[1]; out.d = dout[2]; - out.S = time % 60; time = Math.floor(time / 60); - out.M = time % 60; time = Math.floor(time / 60); - out.H = time; - out.q = dow; - return out; -} -SSF.parse_date_code = parse_date_code; -var basedate = new Date(1899, 11, 31, 0, 0, 0); -var dnthresh = basedate.getTime(); -var base1904 = new Date(1900, 2, 1, 0, 0, 0); -function datenum_local(v/*:Date*/, date1904/*:?boolean*/)/*:number*/ { - var epoch = v.getTime(); - if(date1904) epoch -= 1461*24*60*60*1000; - else if(v >= base1904) epoch += 24*60*60*1000; - return (epoch - (dnthresh + (v.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000)) / (24 * 60 * 60 * 1000); -} -/* The longest 32-bit integer text is "-4294967296", exactly 11 chars */ -function general_fmt_int(v/*:number*/)/*:string*/ { return v.toString(10); } -SSF._general_int = general_fmt_int; - -/* ECMA-376 18.8.30 numFmt*/ -/* Note: `toPrecision` uses standard form when prec > E and E >= -6 */ -var general_fmt_num = (function make_general_fmt_num() { - var trailing_zeroes_and_decimal = /(?:\.0*|(\.\d*[1-9])0+)$/; - function strip_decimal(o/*:string*/)/*:string*/ { - return (o.indexOf(".") == -1) ? o : o.replace(trailing_zeroes_and_decimal, "$1"); - } - - /* General Exponential always shows 2 digits exp and trims the mantissa */ - var mantissa_zeroes_and_decimal = /(?:\.0*|(\.\d*[1-9])0+)[Ee]/; - var exp_with_single_digit = /(E[+-])(\d)$/; - function normalize_exp(o/*:string*/)/*:string*/ { - if(o.indexOf("E") == -1) return o; - return o.replace(mantissa_zeroes_and_decimal,"$1E").replace(exp_with_single_digit,"$10$2"); - } - - /* exponent >= -9 and <= 9 */ - function small_exp(v/*:number*/)/*:string*/ { - var w = (v<0?12:11); - var o = strip_decimal(v.toFixed(12)); if(o.length <= w) return o; - o = v.toPrecision(10); if(o.length <= w) return o; - return v.toExponential(5); - } - - /* exponent >= 11 or <= -10 likely exponential */ - function large_exp(v/*:number*/)/*:string*/ { - var o = strip_decimal(v.toFixed(11)); - return (o.length > (v<0?12:11) || o === "0" || o === "-0") ? v.toPrecision(6) : o; - } - - function general_fmt_num_base(v/*:number*/)/*:string*/ { - var V = Math.floor(Math.log(Math.abs(v))*Math.LOG10E), o; - - if(V >= -4 && V <= -1) o = v.toPrecision(10+V); - else if(Math.abs(V) <= 9) o = small_exp(v); - else if(V === 10) o = v.toFixed(10).substr(0,12); - else o = large_exp(v); - - return strip_decimal(normalize_exp(o.toUpperCase())); - } - - return general_fmt_num_base; -})(); -SSF._general_num = general_fmt_num; - -/* - "General" rules: - - text is passed through ("@") - - booleans are rendered as TRUE/FALSE - - "up to 11 characters" displayed for numbers - - Default date format (code 14) used for Dates - - TODO: technically the display depends on the width of the cell -*/ -function general_fmt(v/*:any*/, opts/*:any*/) { - switch(typeof v) { - case 'string': return v; - case 'boolean': return v ? "TRUE" : "FALSE"; - case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v); - case 'undefined': return ""; - case 'object': - if(v == null) return ""; - if(v instanceof Date) return format(14, datenum_local(v, opts && opts.date1904), opts); - } - throw new Error("unsupported value in General format: " + v); -} -SSF._general = general_fmt; -function fix_hijri(date/*:Date*/, o/*:[number, number, number]*/) { - /* TODO: properly adjust y/m/d and */ - o[0] -= 581; - var dow = date.getDay(); - if(date < 60) dow = (dow + 6) % 7; - return dow; -} -//var THAI_DIGITS = "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59".split(""); -/*jshint -W086 */ -function write_date(type/*:number*/, fmt/*:string*/, val, ss0/*:?number*/)/*:string*/ { - var o="", ss=0, tt=0, y = val.y, out, outl = 0; - switch(type) { - case 98: /* 'b' buddhist year */ - y = val.y + 543; - /* falls through */ - case 121: /* 'y' year */ - switch(fmt.length) { - case 1: case 2: out = y % 100; outl = 2; break; - default: out = y % 10000; outl = 4; break; - } break; - case 109: /* 'm' month */ - switch(fmt.length) { - case 1: case 2: out = val.m; outl = fmt.length; break; - case 3: return months[val.m-1][1]; - case 5: return months[val.m-1][0]; - default: return months[val.m-1][2]; - } break; - case 100: /* 'd' day */ - switch(fmt.length) { - case 1: case 2: out = val.d; outl = fmt.length; break; - case 3: return days[val.q][0]; - default: return days[val.q][1]; - } break; - case 104: /* 'h' 12-hour */ - switch(fmt.length) { - case 1: case 2: out = 1+(val.H+11)%12; outl = fmt.length; break; - default: throw 'bad hour format: ' + fmt; - } break; - case 72: /* 'H' 24-hour */ - switch(fmt.length) { - case 1: case 2: out = val.H; outl = fmt.length; break; - default: throw 'bad hour format: ' + fmt; - } break; - case 77: /* 'M' minutes */ - switch(fmt.length) { - case 1: case 2: out = val.M; outl = fmt.length; break; - default: throw 'bad minute format: ' + fmt; - } break; - case 115: /* 's' seconds */ - if(fmt != 's' && fmt != 'ss' && fmt != '.0' && fmt != '.00' && fmt != '.000') throw 'bad second format: ' + fmt; - if(val.u === 0 && (fmt == "s" || fmt == "ss")) return pad0(val.S, fmt.length); - /*::if(!ss0) ss0 = 0; */ - if(ss0 >= 2) tt = ss0 === 3 ? 1000 : 100; - else tt = ss0 === 1 ? 10 : 1; - ss = Math.round((tt)*(val.S + val.u)); - if(ss >= 60*tt) ss = 0; - if(fmt === 's') return ss === 0 ? "0" : ""+ss/tt; - o = pad0(ss,2 + ss0); - if(fmt === 'ss') return o.substr(0,2); - return "." + o.substr(2,fmt.length-1); - case 90: /* 'Z' absolute time */ - switch(fmt) { - case '[h]': case '[hh]': out = val.D*24+val.H; break; - case '[m]': case '[mm]': out = (val.D*24+val.H)*60+val.M; break; - case '[s]': case '[ss]': out = ((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u); break; - default: throw 'bad abstime format: ' + fmt; - } outl = fmt.length === 3 ? 1 : 2; break; - case 101: /* 'e' era */ - out = y; outl = 1; break; - } - var outstr = outl > 0 ? pad0(out, outl) : ""; - return outstr; -} -/*jshint +W086 */ -function commaify(s/*:string*/)/*:string*/ { - var w = 3; - if(s.length <= w) return s; - var j = (s.length % w), o = s.substr(0,j); - for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w); - return o; -} -var write_num/*:SSF_write_num*/ = (function make_write_num(){ -var pct1 = /%/g; -function write_num_pct(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{ - var sfmt = fmt.replace(pct1,""), mul = fmt.length - sfmt.length; - return write_num(type, sfmt, val * Math.pow(10,2*mul)) + fill("%",mul); -} -function write_num_cm(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{ - var idx = fmt.length - 1; - while(fmt.charCodeAt(idx-1) === 44) --idx; - return write_num(type, fmt.substr(0,idx), val / Math.pow(10,3*(fmt.length-idx))); -} -function write_num_exp(fmt/*:string*/, val/*:number*/)/*:string*/{ - var o/*:string*/; - var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1; - if(fmt.match(/^#+0.0E\+0$/)) { - if(val == 0) return "0.0E+0"; - else if(val < 0) return "-" + write_num_exp(fmt, -val); - var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E'); - var ee = Math.floor(Math.log(val)*Math.LOG10E)%period; - if(ee < 0) ee += period; - o = (val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period); - if(o.indexOf("e") === -1) { - var fakee = Math.floor(Math.log(val)*Math.LOG10E); - if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee); - else o += "E+" + (fakee - ee); - while(o.substr(0,2) === "0.") { - o = o.charAt(0) + o.substr(2,period) + "." + o.substr(2+period); - o = o.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0."); - } - o = o.replace(/\+-/,"-"); - } - o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3) { return $1 + $2 + $3.substr(0,(period+ee)%period) + "." + $3.substr(ee) + "E"; }); - } else o = val.toExponential(idx); - if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.length-1); - if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e"); - return o.replace("e","E"); -} -var frac1 = /# (\?+)( ?)\/( ?)(\d+)/; -function write_num_f1(r/*:Array*/, aval/*:number*/, sign/*:string*/)/*:string*/ { - var den = parseInt(r[4],10), rr = Math.round(aval * den), base = Math.floor(rr/den); - var myn = (rr - base*den), myd = den; - return sign + (base === 0 ? "" : ""+base) + " " + (myn === 0 ? fill(" ", r[1].length + 1 + r[4].length) : pad_(myn,r[1].length) + r[2] + "/" + r[3] + pad0(myd,r[4].length)); -} -function write_num_f2(r/*:Array*/, aval/*:number*/, sign/*:string*/)/*:string*/ { - return sign + (aval === 0 ? "" : ""+aval) + fill(" ", r[1].length + 2 + r[4].length); -} -var dec1 = /^#*0*\.([0#]+)/; -var closeparen = /\).*[0#]/; -var phone = /\(###\) ###\\?-####/; -function hashq(str/*:string*/)/*:string*/ { - var o = "", cc; - for(var i = 0; i != str.length; ++i) switch((cc=str.charCodeAt(i))) { - case 35: break; - case 63: o+= " "; break; - case 48: o+= "0"; break; - default: o+= String.fromCharCode(cc); - } - return o; -} -function rnd(val/*:number*/, d/*:number*/)/*:string*/ { var dd = Math.pow(10,d); return ""+(Math.round(val * dd)/dd); } -function dec(val/*:number*/, d/*:number*/)/*:number*/ { - var _frac = val - Math.floor(val), dd = Math.pow(10,d); - if (d < ('' + Math.round(_frac * dd)).length) return 0; - return Math.round(_frac * dd); -} -function carry(val/*:number*/, d/*:number*/)/*:number*/ { - if (d < ('' + Math.round((val-Math.floor(val))*Math.pow(10,d))).length) { - return 1; - } - return 0; -} -function flr(val/*:number*/)/*:string*/ { - if(val < 2147483647 && val > -2147483648) return ""+(val >= 0 ? (val|0) : (val-1|0)); - return ""+Math.floor(val); -} -function write_num_flt(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/ { - if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) { - var ffmt = fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,""); - if(val >= 0) return write_num_flt('n', ffmt, val); - return '(' + write_num_flt('n', ffmt, -val) + ')'; - } - if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val); - if(fmt.indexOf('%') !== -1) return write_num_pct(type, fmt, val); - if(fmt.indexOf('E') !== -1) return write_num_exp(fmt, val); - if(fmt.charCodeAt(0) === 36) return "$"+write_num_flt(type,fmt.substr(fmt.charAt(1)==' '?2:1),val); - var o; - var r/*:?Array*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; - if(fmt.match(/^00+$/)) return sign + pad0r(aval,fmt.length); - if(fmt.match(/^[#?]+$/)) { - o = pad0r(val,0); if(o === "0") o = ""; - return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o; - } - if((r = fmt.match(frac1))) return write_num_f1(r, aval, sign); - if(fmt.match(/^#+0+$/)) return sign + pad0r(aval,fmt.length - fmt.indexOf("0")); - if((r = fmt.match(dec1))) { - o = rnd(val, r[1].length).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])).replace(/\.(\d*)$/,function($$, $1) { return "." + $1 + fill("0", hashq(/*::(*/r/*::||[""])*/[1]).length-$1.length); }); - return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,"."); - } - fmt = fmt.replace(/^#+([0.])/, "$1"); - if((r = fmt.match(/^(0*)\.(#*)$/))) { - return sign + rnd(aval, r[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":"."); - } - if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify(pad0r(aval,0)); - if((r = fmt.match(/^#,##0\.([#0]*0)$/))) { - return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(""+(Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length),r[1].length); - } - if((r = fmt.match(/^#,#*,#0/))) return write_num_flt(type,fmt.replace(/^#,#*,/,""),val); - if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { - o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g,""), val)); - ri = 0; - return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri= 0) return write_num_int('n', ffmt, val); - return '(' + write_num_int('n', ffmt, -val) + ')'; - } - if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val); - if(fmt.indexOf('%') !== -1) return write_num_pct2(type, fmt, val); - if(fmt.indexOf('E') !== -1) return write_num_exp2(fmt, val); - if(fmt.charCodeAt(0) === 36) return "$"+write_num_int(type,fmt.substr(fmt.charAt(1)==' '?2:1),val); - var o; - var r/*:?Array*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; - if(fmt.match(/^00+$/)) return sign + pad0(aval,fmt.length); - if(fmt.match(/^[#?]+$/)) { - o = (""+val); if(val === 0) o = ""; - return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o; - } - if((r = fmt.match(frac1))) return write_num_f2(r, aval, sign); - if(fmt.match(/^#+0+$/)) return sign + pad0(aval,fmt.length - fmt.indexOf("0")); - if((r = fmt.match(dec1))) { - /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */ - o = (""+val).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])); - o = o.replace(/\.(\d*)$/,function($$, $1) { - /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */ - return "." + $1 + fill("0", hashq(r[1]).length-$1.length); }); - return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,"."); - } - fmt = fmt.replace(/^#+([0.])/, "$1"); - if((r = fmt.match(/^(0*)\.(#*)$/))) { - return sign + (""+aval).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":"."); - } - if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify((""+aval)); - if((r = fmt.match(/^#,##0\.([#0]*0)$/))) { - return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify((""+val)) + "." + fill('0',r[1].length); - } - if((r = fmt.match(/^#,#*,#0/))) return write_num_int(type,fmt.replace(/^#,#*,/,""),val); - if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { - o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g,""), val)); - ri = 0; - return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri*/ { - var out/*:Array*/ = []; - var in_str = false/*, cc*/; - for(var i = 0, j = 0; i < fmt.length; ++i) switch((/*cc=*/fmt.charCodeAt(i))) { - case 34: /* '"' */ - in_str = !in_str; break; - case 95: case 42: case 92: /* '_' '*' '\\' */ - ++i; break; - case 59: /* ';' */ - out[out.length] = fmt.substr(j,i-j); - j = i+1; - } - out[out.length] = fmt.substr(j); - if(in_str === true) throw new Error("Format |" + fmt + "| unterminated string "); - return out; -} -SSF._split = split_fmt; -var abstime = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/; -function fmt_is_date(fmt/*:string*/)/*:boolean*/ { - var i = 0, /*cc = 0,*/ c = "", o = ""; - while(i < fmt.length) { - switch((c = fmt.charAt(i))) { - case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break; - case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break; - case '\\': i+=2; break; - case '_': i+=2; break; - case '@': ++i; break; - case 'B': case 'b': - if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") return true; - /* falls through */ - case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E': - /* falls through */ - case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g': return true; - case 'A': case 'a': case '上': - if(fmt.substr(i, 3).toUpperCase() === "A/P") return true; - if(fmt.substr(i, 5).toUpperCase() === "AM/PM") return true; - if(fmt.substr(i, 5).toUpperCase() === "上午/下午") return true; - ++i; break; - case '[': - o = c; - while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i); - if(o.match(abstime)) return true; - break; - case '.': - /* falls through */ - case '0': case '#': - while(i < fmt.length && ("0#?.,E+-%".indexOf(c=fmt.charAt(++i)) > -1 || (c=='\\' && fmt.charAt(i+1) == "-" && "0#".indexOf(fmt.charAt(i+2))>-1))){/* empty */} - break; - case '?': while(fmt.charAt(++i) === c){/* empty */} break; - case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; - case '(': case ')': ++i; break; - case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1){/* empty */} break; - case ' ': ++i; break; - default: ++i; break; - } - } - return false; -} -SSF.is_date = fmt_is_date; -function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) { - var out = [], o = "", i = 0, c = "", lst='t', dt, j, cc; - var hr='H'; - /* Tokenize */ - while(i < fmt.length) { - switch((c = fmt.charAt(i))) { - case 'G': /* General */ - if(!isgeneral(fmt, i)) throw new Error('unrecognized character ' + c + ' in ' +fmt); - out[out.length] = {t:'G', v:'General'}; i+=7; break; - case '"': /* Literal text */ - for(o="";(cc=fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) o += String.fromCharCode(cc); - out[out.length] = {t:'t', v:o}; ++i; break; - case '\\': var w = fmt.charAt(++i), t = (w === "(" || w === ")") ? w : 't'; - out[out.length] = {t:t, v:w}; ++i; break; - case '_': out[out.length] = {t:'t', v:" "}; i+=2; break; - case '@': /* Text Placeholder */ - out[out.length] = {t:'T', v:v}; ++i; break; - case 'B': case 'b': - if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") { - if(dt==null) { dt=parse_date_code(v, opts, fmt.charAt(i+1) === "2"); if(dt==null) return ""; } - out[out.length] = {t:'X', v:fmt.substr(i,2)}; lst = c; i+=2; break; - } - /* falls through */ - case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E': - c = c.toLowerCase(); - /* falls through */ - case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g': - if(v < 0) return ""; - if(dt==null) { dt=parse_date_code(v, opts); if(dt==null) return ""; } - o = c; while(++i < fmt.length && fmt.charAt(i).toLowerCase() === c) o+=c; - if(c === 'm' && lst.toLowerCase() === 'h') c = 'M'; - if(c === 'h') c = hr; - out[out.length] = {t:c, v:o}; lst = c; break; - case 'A': case 'a': case '上': - var q={t:c, v:c}; - if(dt==null) dt=parse_date_code(v, opts); - if(fmt.substr(i, 3).toUpperCase() === "A/P") { if(dt!=null) q.v = dt.H >= 12 ? "P" : "A"; q.t = 'T'; hr='h';i+=3;} - else if(fmt.substr(i,5).toUpperCase() === "AM/PM") { if(dt!=null) q.v = dt.H >= 12 ? "PM" : "AM"; q.t = 'T'; i+=5; hr='h'; } - else if(fmt.substr(i,5).toUpperCase() === "上午/下午") { if(dt!=null) q.v = dt.H >= 12 ? "下午" : "上午"; q.t = 'T'; i+=5; hr='h'; } - else { q.t = "t"; ++i; } - if(dt==null && q.t === 'T') return ""; - out[out.length] = q; lst = c; break; - case '[': - o = c; - while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i); - if(o.slice(-1) !== ']') throw 'unterminated "[" block: |' + o + '|'; - if(o.match(abstime)) { - if(dt==null) { dt=parse_date_code(v, opts); if(dt==null) return ""; } - out[out.length] = {t:'Z', v:o.toLowerCase()}; - lst = o.charAt(1); - } else if(o.indexOf("$") > -1) { - o = (o.match(/\$([^-\[\]]*)/)||[])[1]||"$"; - if(!fmt_is_date(fmt)) out[out.length] = {t:'t',v:o}; - } - break; - /* Numbers */ - case '.': - if(dt != null) { - o = c; while(++i < fmt.length && (c=fmt.charAt(i)) === "0") o += c; - out[out.length] = {t:'s', v:o}; break; - } - /* falls through */ - case '0': case '#': - o = c; while(++i < fmt.length && "0#?.,E+-%".indexOf(c=fmt.charAt(i)) > -1) o += c; - out[out.length] = {t:'n', v:o}; break; - case '?': - o = c; while(fmt.charAt(++i) === c) o+=c; - out[out.length] = {t:c, v:o}; lst = c; break; - case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; // ** - case '(': case ')': out[out.length] = {t:(flen===1?'t':c), v:c}; ++i; break; - case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i); - out[out.length] = {t:'D', v:o}; break; - case ' ': out[out.length] = {t:c, v:c}; ++i; break; - case '$': out[out.length] = {t:'t', v:'$'}; ++i; break; - default: - if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt); - out[out.length] = {t:'t', v:c}; ++i; break; - } - } - - /* Scan for date/time parts */ - var bt = 0, ss0 = 0, ssm; - for(i=out.length-1, lst='t'; i >= 0; --i) { - switch(out[i].t) { - case 'h': case 'H': out[i].t = hr; lst='h'; if(bt < 1) bt = 1; break; - case 's': - if((ssm=out[i].v.match(/\.0+$/))) ss0=Math.max(ss0,ssm[0].length-1); - if(bt < 3) bt = 3; - /* falls through */ - case 'd': case 'y': case 'M': case 'e': lst=out[i].t; break; - case 'm': if(lst === 's') { out[i].t = 'M'; if(bt < 2) bt = 2; } break; - case 'X': /*if(out[i].v === "B2");*/ - break; - case 'Z': - if(bt < 1 && out[i].v.match(/[Hh]/)) bt = 1; - if(bt < 2 && out[i].v.match(/[Mm]/)) bt = 2; - if(bt < 3 && out[i].v.match(/[Ss]/)) bt = 3; - } - } - /* time rounding depends on presence of minute / second / usec fields */ - switch(bt) { - case 0: break; - case 1: - /*::if(!dt) break;*/ - if(dt.u >= 0.5) { dt.u = 0; ++dt.S; } - if(dt.S >= 60) { dt.S = 0; ++dt.M; } - if(dt.M >= 60) { dt.M = 0; ++dt.H; } - break; - case 2: - /*::if(!dt) break;*/ - if(dt.u >= 0.5) { dt.u = 0; ++dt.S; } - if(dt.S >= 60) { dt.S = 0; ++dt.M; } - break; - } - - /* replace fields */ - var nstr = "", jj; - for(i=0; i < out.length; ++i) { - switch(out[i].t) { - case 't': case 'T': case ' ': case 'D': break; - case 'X': out[i].v = ""; out[i].t = ";"; break; - case 'd': case 'm': case 'y': case 'h': case 'H': case 'M': case 's': case 'e': case 'b': case 'Z': - /*::if(!dt) throw "unreachable"; */ - out[i].v = write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0); - out[i].t = 't'; break; - case 'n': case '?': - jj = i+1; - while(out[jj] != null && ( - (c=out[jj].t) === "?" || c === "D" || - ((c === " " || c === "t") && out[jj+1] != null && (out[jj+1].t === '?' || out[jj+1].t === "t" && out[jj+1].v === '/')) || - (out[i].t === '(' && (c === ' ' || c === 'n' || c === ')')) || - (c === 't' && (out[jj].v === '/' || out[jj].v === ' ' && out[jj+1] != null && out[jj+1].t == '?')) - )) { - out[i].v += out[jj].v; - out[jj] = {v:"", t:";"}; ++jj; - } - nstr += out[i].v; - i = jj-1; break; - case 'G': out[i].t = 't'; out[i].v = general_fmt(v,opts); break; - } - } - var vv = "", myv, ostr; - if(nstr.length > 0) { - if(nstr.charCodeAt(0) == 40) /* '(' */ { - myv = (v<0&&nstr.charCodeAt(0) === 45 ? -v : v); - ostr = write_num('n', nstr, myv); - } else { - myv = (v<0 && flen > 1 ? -v : v); - ostr = write_num('n', nstr, myv); - if(myv < 0 && out[0] && out[0].t == 't') { - ostr = ostr.substr(1); - out[0].v = "-" + out[0].v; - } - } - jj=ostr.length-1; - var decpt = out.length; - for(i=0; i < out.length; ++i) if(out[i] != null && out[i].t != 't' && out[i].v.indexOf(".") > -1) { decpt = i; break; } - var lasti=out.length; - if(decpt === out.length && ostr.indexOf("E") === -1) { - for(i=out.length-1; i>= 0;--i) { - if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue; - if(jj>=out[i].v.length-1) { jj -= out[i].v.length; out[i].v = ostr.substr(jj+1, out[i].v.length); } - else if(jj < 0) out[i].v = ""; - else { out[i].v = ostr.substr(0, jj+1); jj = -1; } - out[i].t = 't'; - lasti = i; - } - if(jj>=0 && lasti= 0; --i) { - if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue; - j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")-1:out[i].v.length-1; - vv = out[i].v.substr(j+1); - for(; j>=0; --j) { - if(jj>=0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) vv = ostr.charAt(jj--) + vv; - } - out[i].v = vv; - out[i].t = 't'; - lasti = i; - } - if(jj>=0 && lasti-1&&i===decpt?out[i].v.indexOf(".")+1:0; - vv = out[i].v.substr(0,j); - for(; j-1) { - myv = (flen >1 && v < 0 && i>0 && out[i-1].v === "-" ? -v:v); - out[i].v = write_num(out[i].t, out[i].v, myv); - out[i].t = 't'; - } - var retval = ""; - for(i=0; i !== out.length; ++i) if(out[i] != null) retval += out[i].v; - return retval; -} -SSF._eval = eval_fmt; -var cfregex = /\[[=<>]/; -var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/; -function chkcond(v, rr) { - if(rr == null) return false; - var thresh = parseFloat(rr[2]); - switch(rr[1]) { - case "=": if(v == thresh) return true; break; - case ">": if(v > thresh) return true; break; - case "<": if(v < thresh) return true; break; - case "<>": if(v != thresh) return true; break; - case ">=": if(v >= thresh) return true; break; - case "<=": if(v <= thresh) return true; break; - } - return false; -} -function choose_fmt(f/*:string*/, v/*:any*/) { - var fmt = split_fmt(f); - var l = fmt.length, lat = fmt[l-1].indexOf("@"); - if(l<4 && lat>-1) --l; - if(fmt.length > 4) throw new Error("cannot find right format for |" + fmt.join("|") + "|"); - if(typeof v !== "number") return [4, fmt.length === 4 || lat>-1?fmt[fmt.length-1]:"@"]; - switch(fmt.length) { - case 1: fmt = lat>-1 ? ["General", "General", "General", fmt[0]] : [fmt[0], fmt[0], fmt[0], "@"]; break; - case 2: fmt = lat>-1 ? [fmt[0], fmt[0], fmt[0], fmt[1]] : [fmt[0], fmt[1], fmt[0], "@"]; break; - case 3: fmt = lat>-1 ? [fmt[0], fmt[1], fmt[0], fmt[2]] : [fmt[0], fmt[1], fmt[2], "@"]; break; - case 4: break; - } - var ff = v > 0 ? fmt[0] : v < 0 ? fmt[1] : fmt[2]; - if(fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) return [l, ff]; - if(fmt[0].match(cfregex) != null || fmt[1].match(cfregex) != null) { - var m1 = fmt[0].match(cfregex2); - var m2 = fmt[1].match(cfregex2); - return chkcond(v, m1) ? [l, fmt[0]] : chkcond(v, m2) ? [l, fmt[1]] : [l, fmt[m1 != null && m2 != null ? 2 : 1]]; - } - return [l, ff]; -} -function format(fmt/*:string|number*/,v/*:any*/,o/*:?any*/) { - if(o == null) o = {}; - var sfmt = ""; - switch(typeof fmt) { - case "string": - if(fmt == "m/d/yy" && o.dateNF) sfmt = o.dateNF; - else sfmt = fmt; - break; - case "number": - if(fmt == 14 && o.dateNF) sfmt = o.dateNF; - else sfmt = (o.table != null ? (o.table/*:any*/) : table_fmt)[fmt]; - if(sfmt == null) sfmt = (o.table && o.table[default_map[fmt]]) || table_fmt[default_map[fmt]]; - if(sfmt == null) sfmt = default_str[fmt] || "General"; - break; - } - if(isgeneral(sfmt,0)) return general_fmt(v, o); - if(v instanceof Date) v = datenum_local(v, o.date1904); - var f = choose_fmt(sfmt, v); - if(isgeneral(f[1])) return general_fmt(v, o); - if(v === true) v = "TRUE"; else if(v === false) v = "FALSE"; - else if(v === "" || v == null) return ""; - return eval_fmt(f[1], v, o, f[0]); -} -function load_entry(fmt/*:string*/, idx/*:?number*/)/*:number*/ { - if(typeof idx != 'number') { - idx = +idx || -1; -/*::if(typeof idx != 'number') return 0x188; */ - for(var i = 0; i < 0x0188; ++i) { -/*::if(typeof idx != 'number') return 0x188; */ - if(table_fmt[i] == undefined) { if(idx < 0) idx = i; continue; } - if(table_fmt[i] == fmt) { idx = i; break; } - } -/*::if(typeof idx != 'number') return 0x188; */ - if(idx < 0) idx = 0x187; - } -/*::if(typeof idx != 'number') return 0x188; */ - table_fmt[idx] = fmt; - return idx; -} -SSF.load = load_entry; -SSF._table = table_fmt; -SSF.get_table = function get_table()/*:SSFTable*/ { return table_fmt; }; -SSF.load_table = function load_table(tbl/*:SSFTable*/)/*:void*/ { - for(var i=0; i!=0x0188; ++i) - if(tbl[i] !== undefined) load_entry(tbl[i], i); -}; -SSF.init_table = init_table; -SSF.format = format; -}; -make_ssf(SSF); -/* map from xlml named formats to SSF TODO: localize */ -var XLMLFormatMap/*{[string]:string}*/ = ({ - "General Number": "General", - "General Date": SSF._table[22], - "Long Date": "dddd, mmmm dd, yyyy", - "Medium Date": SSF._table[15], - "Short Date": SSF._table[14], - "Long Time": SSF._table[19], - "Medium Time": SSF._table[18], - "Short Time": SSF._table[20], - "Currency": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', - "Fixed": SSF._table[2], - "Standard": SSF._table[4], - "Percent": SSF._table[10], - "Scientific": SSF._table[11], - "Yes/No": '"Yes";"Yes";"No";@', - "True/False": '"True";"True";"False";@', - "On/Off": '"Yes";"Yes";"No";@' -}/*:any*/); - -var SSFImplicit/*{[number]:string}*/ = ({ - "5": '"$"#,##0_);\\("$"#,##0\\)', - "6": '"$"#,##0_);[Red]\\("$"#,##0\\)', - "7": '"$"#,##0.00_);\\("$"#,##0.00\\)', - "8": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', - "23": 'General', "24": 'General', "25": 'General', "26": 'General', - "27": 'm/d/yy', "28": 'm/d/yy', "29": 'm/d/yy', "30": 'm/d/yy', "31": 'm/d/yy', - "32": 'h:mm:ss', "33": 'h:mm:ss', "34": 'h:mm:ss', "35": 'h:mm:ss', - "36": 'm/d/yy', - "41": '_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)', - "42": '_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)', - "43": '_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)', - "44": '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)', - "50": 'm/d/yy', "51": 'm/d/yy', "52": 'm/d/yy', "53": 'm/d/yy', "54": 'm/d/yy', - "55": 'm/d/yy', "56": 'm/d/yy', "57": 'm/d/yy', "58": 'm/d/yy', - "59": '0', - "60": '0.00', - "61": '#,##0', - "62": '#,##0.00', - "63": '"$"#,##0_);\\("$"#,##0\\)', - "64": '"$"#,##0_);[Red]\\("$"#,##0\\)', - "65": '"$"#,##0.00_);\\("$"#,##0.00\\)', - "66": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', - "67": '0%', - "68": '0.00%', - "69": '# ?/?', - "70": '# ??/??', - "71": 'm/d/yy', - "72": 'm/d/yy', - "73": 'd-mmm-yy', - "74": 'd-mmm', - "75": 'mmm-yy', - "76": 'h:mm', - "77": 'h:mm:ss', - "78": 'm/d/yy h:mm', - "79": 'mm:ss', - "80": '[h]:mm:ss', - "81": 'mmss.0' -}/*:any*/); - -/* dateNF parse TODO: move to SSF */ -var dateNFregex = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g; -function dateNF_regex(dateNF/*:string|number*/)/*:RegExp*/ { - var fmt = typeof dateNF == "number" ? SSF._table[dateNF] : dateNF; - fmt = fmt.replace(dateNFregex, "(\\d+)"); - return new RegExp("^" + fmt + "$"); -} -function dateNF_fix(str/*:string*/, dateNF/*:string*/, match/*:Array*/)/*:string*/ { - var Y = -1, m = -1, d = -1, H = -1, M = -1, S = -1; - (dateNF.match(dateNFregex)||[]).forEach(function(n, i) { - var v = parseInt(match[i+1], 10); - switch(n.toLowerCase().charAt(0)) { - case 'y': Y = v; break; case 'd': d = v; break; - case 'h': H = v; break; case 's': S = v; break; - case 'm': if(H >= 0) M = v; else m = v; break; - } - }); - if(S >= 0 && M == -1 && m >= 0) { M = m; m = -1; } - var datestr = (("" + (Y>=0?Y: new Date().getFullYear())).slice(-4) + "-" + ("00" + (m>=1?m:1)).slice(-2) + "-" + ("00" + (d>=1?d:1)).slice(-2)); - if(datestr.length == 7) datestr = "0" + datestr; - if(datestr.length == 8) datestr = "20" + datestr; - var timestr = (("00" + (H>=0?H:0)).slice(-2) + ":" + ("00" + (M>=0?M:0)).slice(-2) + ":" + ("00" + (S>=0?S:0)).slice(-2)); - if(H == -1 && M == -1 && S == -1) return datestr; - if(Y == -1 && m == -1 && d == -1) return timestr; - return datestr + "T" + timestr; -} - -var DO_NOT_EXPORT_CFB = true; -/*:: -declare var Base64:any; -declare var ReadShift:any; -declare var CheckField:any; -declare var prep_blob:any; -declare var __readUInt32LE:any; -declare var __readInt32LE:any; -declare var __toBuffer:any; -declare var __utf16le:any; -declare var bconcat:any; -declare var s2a:any; -declare var chr0:any; -declare var chr1:any; -declare var has_buf:boolean; -declare var new_buf:any; -declare var new_raw_buf:any; -declare var new_unsafe_buf:any; -*/ -/* cfb.js (C) 2013-present SheetJS -- http://sheetjs.com */ -/* vim: set ts=2: */ -/*jshint eqnull:true */ -/*exported CFB */ -/*global Uint8Array:false, Uint16Array:false */ - -/*:: -declare var DO_NOT_EXPORT_CFB:?boolean; -type SectorEntry = { - name?:string; - nodes?:Array; - data:RawBytes; -}; -type SectorList = { - [k:string|number]:SectorEntry; - name:?string; - fat_addrs:Array; - ssz:number; -} -type CFBFiles = {[n:string]:CFBEntry}; -*/ -/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */ -/* vim: set ts=2: */ -/*exported CRC32 */ -var CRC32; -(function (factory) { - /*jshint ignore:start */ - /*eslint-disable */ - factory(CRC32 = {}); - /*eslint-enable */ - /*jshint ignore:end */ -}(function(CRC32) { -CRC32.version = '1.2.0'; -/* see perf/crc32table.js */ -/*global Int32Array */ -function signed_crc_table()/*:any*/ { - var c = 0, table/*:Array*/ = new Array(256); - - for(var n =0; n != 256; ++n){ - c = n; - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); - table[n] = c; - } - - return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table; -} - -var T = signed_crc_table(); -function crc32_bstr(bstr/*:string*/, seed/*:number*/)/*:number*/ { - var C = seed ^ -1, L = bstr.length - 1; - for(var i = 0; i < L;) { - C = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF]; - C = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF]; - } - if(i === L) C = (C>>>8) ^ T[(C ^ bstr.charCodeAt(i))&0xFF]; - return C ^ -1; -} - -function crc32_buf(buf/*:Uint8Array|Array*/, seed/*:number*/)/*:number*/ { - if(buf.length > 10000) return crc32_buf_8(buf, seed); - var C = seed ^ -1, L = buf.length - 3; - for(var i = 0; i < L;) { - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - } - while(i < L+3) C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - return C ^ -1; -} - -function crc32_buf_8(buf/*:Uint8Array|Array*/, seed/*:number*/)/*:number*/ { - var C = seed ^ -1, L = buf.length - 7; - for(var i = 0; i < L;) { - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - } - while(i < L+7) C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; - return C ^ -1; -} - -function crc32_str(str/*:string*/, seed/*:number*/)/*:number*/ { - var C = seed ^ -1; - for(var i = 0, L=str.length, c, d; i < L;) { - c = str.charCodeAt(i++); - if(c < 0x80) { - C = (C>>>8) ^ T[(C ^ c)&0xFF]; - } else if(c < 0x800) { - C = (C>>>8) ^ T[(C ^ (192|((c>>6)&31)))&0xFF]; - C = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF]; - } else if(c >= 0xD800 && c < 0xE000) { - c = (c&1023)+64; d = str.charCodeAt(i++)&1023; - C = (C>>>8) ^ T[(C ^ (240|((c>>8)&7)))&0xFF]; - C = (C>>>8) ^ T[(C ^ (128|((c>>2)&63)))&0xFF]; - C = (C>>>8) ^ T[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF]; - C = (C>>>8) ^ T[(C ^ (128|(d&63)))&0xFF]; - } else { - C = (C>>>8) ^ T[(C ^ (224|((c>>12)&15)))&0xFF]; - C = (C>>>8) ^ T[(C ^ (128|((c>>6)&63)))&0xFF]; - C = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF]; - } - } - return C ^ -1; -} -CRC32.table = T; -CRC32.bstr = crc32_bstr; -CRC32.buf = crc32_buf; -CRC32.str = crc32_str; -})); -/* [MS-CFB] v20171201 */ -var CFB = (function _CFB(){ -var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/; -exports.version = '1.1.4'; -/* [MS-CFB] 2.6.4 */ -function namecmp(l/*:string*/, r/*:string*/)/*:number*/ { - var L = l.split("/"), R = r.split("/"); - for(var i = 0, c = 0, Z = Math.min(L.length, R.length); i < Z; ++i) { - if((c = L[i].length - R[i].length)) return c; - if(L[i] != R[i]) return L[i] < R[i] ? -1 : 1; - } - return L.length - R.length; -} -function dirname(p/*:string*/)/*:string*/ { - if(p.charAt(p.length - 1) == "/") return (p.slice(0,-1).indexOf("/") === -1) ? p : dirname(p.slice(0, -1)); - var c = p.lastIndexOf("/"); - return (c === -1) ? p : p.slice(0, c+1); -} - -function filename(p/*:string*/)/*:string*/ { - if(p.charAt(p.length - 1) == "/") return filename(p.slice(0, -1)); - var c = p.lastIndexOf("/"); - return (c === -1) ? p : p.slice(c+1); -} -/* -------------------------------------------------------------------------- */ -/* DOS Date format: - high|YYYYYYYm.mmmddddd.HHHHHMMM.MMMSSSSS|low - add 1980 to stored year - stored second should be doubled -*/ - -/* write JS date to buf as a DOS date */ -function write_dos_date(buf/*:CFBlob*/, date/*:Date|string*/) { - if(typeof date === "string") date = new Date(date); - var hms/*:number*/ = date.getHours(); - hms = hms << 6 | date.getMinutes(); - hms = hms << 5 | (date.getSeconds()>>>1); - buf.write_shift(2, hms); - var ymd/*:number*/ = (date.getFullYear() - 1980); - ymd = ymd << 4 | (date.getMonth()+1); - ymd = ymd << 5 | date.getDate(); - buf.write_shift(2, ymd); -} - -/* read four bytes from buf and interpret as a DOS date */ -function parse_dos_date(buf/*:CFBlob*/)/*:Date*/ { - var hms = buf.read_shift(2) & 0xFFFF; - var ymd = buf.read_shift(2) & 0xFFFF; - var val = new Date(); - var d = ymd & 0x1F; ymd >>>= 5; - var m = ymd & 0x0F; ymd >>>= 4; - val.setMilliseconds(0); - val.setFullYear(ymd + 1980); - val.setMonth(m-1); - val.setDate(d); - var S = hms & 0x1F; hms >>>= 5; - var M = hms & 0x3F; hms >>>= 6; - val.setHours(hms); - val.setMinutes(M); - val.setSeconds(S<<1); - return val; -} -function parse_extra_field(blob/*:CFBlob*/)/*:any*/ { - prep_blob(blob, 0); - var o = /*::(*/{}/*:: :any)*/; - var flags = 0; - while(blob.l <= blob.length - 4) { - var type = blob.read_shift(2); - var sz = blob.read_shift(2), tgt = blob.l + sz; - var p = {}; - switch(type) { - /* UNIX-style Timestamps */ - case 0x5455: { - flags = blob.read_shift(1); - if(flags & 1) p.mtime = blob.read_shift(4); - /* for some reason, CD flag corresponds to LFH */ - if(sz > 5) { - if(flags & 2) p.atime = blob.read_shift(4); - if(flags & 4) p.ctime = blob.read_shift(4); - } - if(p.mtime) p.mt = new Date(p.mtime*1000); - } - break; - } - blob.l = tgt; - o[type] = p; - } - return o; -} -var fs/*:: = require('fs'); */; -function get_fs() { return fs || (fs = {}); } -function parse(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ { -if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options); -if(file.length < 512) throw new Error("CFB file size " + file.length + " < 512"); -var mver = 3; -var ssz = 512; -var nmfs = 0; // number of mini FAT sectors -var difat_sec_cnt = 0; -var dir_start = 0; -var minifat_start = 0; -var difat_start = 0; - -var fat_addrs/*:Array*/ = []; // locations of FAT sectors - -/* [MS-CFB] 2.2 Compound File Header */ -var blob/*:CFBlob*/ = /*::(*/file.slice(0,512)/*:: :any)*/; -prep_blob(blob, 0); - -/* major version */ -var mv = check_get_mver(blob); -mver = mv[0]; -switch(mver) { - case 3: ssz = 512; break; case 4: ssz = 4096; break; - case 0: if(mv[1] == 0) return parse_zip(file, options); - /* falls through */ - default: throw new Error("Major Version: Expected 3 or 4 saw " + mver); -} - -/* reprocess header */ -if(ssz !== 512) { blob = /*::(*/file.slice(0,ssz)/*:: :any)*/; prep_blob(blob, 28 /* blob.l */); } -/* Save header for final object */ -var header/*:RawBytes*/ = file.slice(0,ssz); - -check_shifts(blob, mver); - -// Number of Directory Sectors -var dir_cnt/*:number*/ = blob.read_shift(4, 'i'); -if(mver === 3 && dir_cnt !== 0) throw new Error('# Directory Sectors: Expected 0 saw ' + dir_cnt); - -// Number of FAT Sectors -blob.l += 4; - -// First Directory Sector Location -dir_start = blob.read_shift(4, 'i'); - -// Transaction Signature -blob.l += 4; - -// Mini Stream Cutoff Size -blob.chk('00100000', 'Mini Stream Cutoff Size: '); - -// First Mini FAT Sector Location -minifat_start = blob.read_shift(4, 'i'); - -// Number of Mini FAT Sectors -nmfs = blob.read_shift(4, 'i'); - -// First DIFAT sector location -difat_start = blob.read_shift(4, 'i'); - -// Number of DIFAT Sectors -difat_sec_cnt = blob.read_shift(4, 'i'); - -// Grab FAT Sector Locations -for(var q = -1, j = 0; j < 109; ++j) { /* 109 = (512 - blob.l)>>>2; */ - q = blob.read_shift(4, 'i'); - if(q<0) break; - fat_addrs[j] = q; -} - -/** Break the file up into sectors */ -var sectors/*:Array*/ = sectorify(file, ssz); - -sleuth_fat(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs); - -/** Chains */ -var sector_list/*:SectorList*/ = make_sector_list(sectors, dir_start, fat_addrs, ssz); - -sector_list[dir_start].name = "!Directory"; -if(nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT"; -sector_list[fat_addrs[0]].name = "!FAT"; -sector_list.fat_addrs = fat_addrs; -sector_list.ssz = ssz; - -/* [MS-CFB] 2.6.1 Compound File Directory Entry */ -var files/*:CFBFiles*/ = {}, Paths/*:Array*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array*/ = []; -read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start); - -build_full_paths(FileIndex, FullPaths, Paths); -Paths.shift(); - -var o = { - FileIndex: FileIndex, - FullPaths: FullPaths -}; - -// $FlowIgnore -if(options && options.raw) o.raw = {header: header, sectors: sectors}; -return o; -} // parse - -/* [MS-CFB] 2.2 Compound File Header -- read up to major version */ -function check_get_mver(blob/*:CFBlob*/)/*:[number, number]*/ { - if(blob[blob.l] == 0x50 && blob[blob.l + 1] == 0x4b) return [0, 0]; - // header signature 8 - blob.chk(HEADER_SIGNATURE, 'Header Signature: '); - - // clsid 16 - //blob.chk(HEADER_CLSID, 'CLSID: '); - blob.l += 16; - - // minor version 2 - var mver/*:number*/ = blob.read_shift(2, 'u'); - - return [blob.read_shift(2,'u'), mver]; -} -function check_shifts(blob/*:CFBlob*/, mver/*:number*/)/*:void*/ { - var shift = 0x09; - - // Byte Order - //blob.chk('feff', 'Byte Order: '); // note: some writers put 0xffff - blob.l += 2; - - // Sector Shift - switch((shift = blob.read_shift(2))) { - case 0x09: if(mver != 3) throw new Error('Sector Shift: Expected 9 saw ' + shift); break; - case 0x0c: if(mver != 4) throw new Error('Sector Shift: Expected 12 saw ' + shift); break; - default: throw new Error('Sector Shift: Expected 9 or 12 saw ' + shift); - } - - // Mini Sector Shift - blob.chk('0600', 'Mini Sector Shift: '); - - // Reserved - blob.chk('000000000000', 'Reserved: '); -} - -/** Break the file up into sectors */ -function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array*/ { - var nsectors = Math.ceil(file.length/ssz)-1; - var sectors/*:Array*/ = []; - for(var i=1; i < nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz); - sectors[nsectors-1] = file.slice(nsectors*ssz); - return sectors; -} - -/* [MS-CFB] 2.6.4 Red-Black Tree */ -function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array*/, Paths/*:Array*/)/*:void*/ { - var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length; - var dad/*:Array*/ = [], q/*:Array*/ = []; - - for(; i < pl; ++i) { dad[i]=q[i]=i; FP[i]=Paths[i]; } - - for(; j < q.length; ++j) { - i = q[j]; - L = FI[i].L; R = FI[i].R; C = FI[i].C; - if(dad[i] === i) { - if(L !== -1 /*NOSTREAM*/ && dad[L] !== L) dad[i] = dad[L]; - if(R !== -1 && dad[R] !== R) dad[i] = dad[R]; - } - if(C !== -1 /*NOSTREAM*/) dad[C] = i; - if(L !== -1 && i != dad[i]) { dad[L] = dad[i]; if(q.lastIndexOf(L) < j) q.push(L); } - if(R !== -1 && i != dad[i]) { dad[R] = dad[i]; if(q.lastIndexOf(R) < j) q.push(R); } - } - for(i=1; i < pl; ++i) if(dad[i] === i) { - if(R !== -1 /*NOSTREAM*/ && dad[R] !== R) dad[i] = dad[R]; - else if(L !== -1 && dad[L] !== L) dad[i] = dad[L]; - } - - for(i=1; i < pl; ++i) { - if(FI[i].type === 0 /* unknown */) continue; - j = i; - if(j != dad[j]) do { - j = dad[j]; - FP[i] = FP[j] + "/" + FP[i]; - } while (j !== 0 && -1 !== dad[j] && j != dad[j]); - dad[i] = -1; - } - - FP[0] += "/"; - for(i=1; i < pl; ++i) { - if(FI[i].type !== 2 /* stream */) FP[i] += "/"; - } -} - -function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ { - var start = entry.start, size = entry.size; - //return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/); - var o = []; - var idx = start; - while(mini && size > 0 && idx >= 0) { - o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ)); - size -= MSSZ; - idx = __readInt32LE(mini, idx * 4); - } - if(o.length === 0) return (new_buf(0)/*:any*/); - return (bconcat(o).slice(0, entry.size)/*:any*/); -} - -/** Chase down the rest of the DIFAT chain to build a comprehensive list - DIFAT chains by storing the next sector number as the last 32 bits */ -function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array*/, ssz/*:number*/, fat_addrs)/*:void*/ { - var q/*:number*/ = ENDOFCHAIN; - if(idx === ENDOFCHAIN) { - if(cnt !== 0) throw new Error("DIFAT chain shorter than expected"); - } else if(idx !== -1 /*FREESECT*/) { - var sector = sectors[idx], m = (ssz>>>2)-1; - if(!sector) return; - for(var i = 0; i < m; ++i) { - if((q = __readInt32LE(sector,i*4)) === ENDOFCHAIN) break; - fat_addrs.push(q); - } - sleuth_fat(__readInt32LE(sector,ssz-4),cnt - 1, sectors, ssz, fat_addrs); - } -} - -/** Follow the linked list of sectors for a given starting point */ -function get_sector_list(sectors/*:Array*/, start/*:number*/, fat_addrs/*:Array*/, ssz/*:number*/, chkd/*:?Array*/)/*:SectorEntry*/ { - var buf/*:Array*/ = [], buf_chain/*:Array*/ = []; - if(!chkd) chkd = []; - var modulus = ssz - 1, j = 0, jj = 0; - for(j=start; j>=0;) { - chkd[j] = true; - buf[buf.length] = j; - buf_chain.push(sectors[j]); - var addr = fat_addrs[Math.floor(j*4/ssz)]; - jj = ((j*4) & modulus); - if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz); - if(!sectors[addr]) break; - j = __readInt32LE(sectors[addr], jj); - } - return {nodes: buf, data:__toBuffer([buf_chain])}; -} - -/** Chase down the sector linked lists */ -function make_sector_list(sectors/*:Array*/, dir_start/*:number*/, fat_addrs/*:Array*/, ssz/*:number*/)/*:SectorList*/ { - var sl = sectors.length, sector_list/*:SectorList*/ = ([]/*:any*/); - var chkd/*:Array*/ = [], buf/*:Array*/ = [], buf_chain/*:Array*/ = []; - var modulus = ssz - 1, i=0, j=0, k=0, jj=0; - for(i=0; i < sl; ++i) { - buf = ([]/*:Array*/); - k = (i + dir_start); if(k >= sl) k-=sl; - if(chkd[k]) continue; - buf_chain = []; - var seen = []; - for(j=k; j>=0;) { - seen[j] = true; - chkd[j] = true; - buf[buf.length] = j; - buf_chain.push(sectors[j]); - var addr/*:number*/ = fat_addrs[Math.floor(j*4/ssz)]; - jj = ((j*4) & modulus); - if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz); - if(!sectors[addr]) break; - j = __readInt32LE(sectors[addr], jj); - if(seen[j]) break; - } - sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])}/*:SectorEntry*/); - } - return sector_list; -} - -/* [MS-CFB] 2.6.1 Compound File Directory Entry */ -function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array*/, Paths/*:Array*/, nmfs, files, FileIndex, mini) { - var minifat_store = 0, pl = (Paths.length?2:0); - var sector = sector_list[dir_start].data; - var i = 0, namelen = 0, name; - for(; i < sector.length; i+= 128) { - var blob/*:CFBlob*/ = /*::(*/sector.slice(i, i+128)/*:: :any)*/; - prep_blob(blob, 64); - namelen = blob.read_shift(2); - name = __utf16le(blob,0,namelen-pl); - Paths.push(name); - var o/*:CFBEntry*/ = ({ - name: name, - type: blob.read_shift(1), - color: blob.read_shift(1), - L: blob.read_shift(4, 'i'), - R: blob.read_shift(4, 'i'), - C: blob.read_shift(4, 'i'), - clsid: blob.read_shift(16), - state: blob.read_shift(4, 'i'), - start: 0, - size: 0 - }); - var ctime/*:number*/ = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); - if(ctime !== 0) o.ct = read_date(blob, blob.l-8); - var mtime/*:number*/ = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); - if(mtime !== 0) o.mt = read_date(blob, blob.l-8); - o.start = blob.read_shift(4, 'i'); - o.size = blob.read_shift(4, 'i'); - if(o.size < 0 && o.start < 0) { o.size = o.type = 0; o.start = ENDOFCHAIN; o.name = ""; } - if(o.type === 5) { /* root */ - minifat_store = o.start; - if(nmfs > 0 && minifat_store !== ENDOFCHAIN) sector_list[minifat_store].name = "!StreamData"; - /*minifat_size = o.size;*/ - } else if(o.size >= 4096 /* MSCSZ */) { - o.storage = 'fat'; - if(sector_list[o.start] === undefined) sector_list[o.start] = get_sector_list(sectors, o.start, sector_list.fat_addrs, sector_list.ssz); - sector_list[o.start].name = o.name; - o.content = (sector_list[o.start].data.slice(0,o.size)/*:any*/); - } else { - o.storage = 'minifat'; - if(o.size < 0) o.size = 0; - else if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) { - o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data); - } - } - if(o.content) prep_blob(o.content, 0); - files[name] = o; - FileIndex.push(o); - } -} - -function read_date(blob/*:RawBytes|CFBlob*/, offset/*:number*/)/*:Date*/ { - return new Date(( ( (__readUInt32LE(blob,offset+4)/1e7)*Math.pow(2,32)+__readUInt32LE(blob,offset)/1e7 ) - 11644473600)*1000); -} - -function read_file(filename/*:string*/, options/*:CFBReadOpts*/) { - get_fs(); - return parse(fs.readFileSync(filename), options); -} - -function read(blob/*:RawBytes|string*/, options/*:CFBReadOpts*/) { - switch(options && options.type || "base64") { - case "file": /*:: if(typeof blob !== 'string') throw "Must pass a filename when type='file'"; */return read_file(blob, options); - case "base64": /*:: if(typeof blob !== 'string') throw "Must pass a base64-encoded binary string when type='file'"; */return parse(s2a(Base64.decode(blob)), options); - case "binary": /*:: if(typeof blob !== 'string') throw "Must pass a binary string when type='file'"; */return parse(s2a(blob), options); - } - return parse(/*::typeof blob == 'string' ? new Buffer(blob, 'utf-8') : */blob, options); -} - -function init_cfb(cfb/*:CFBContainer*/, opts/*:?any*/)/*:void*/ { - var o = opts || {}, root = o.root || "Root Entry"; - if(!cfb.FullPaths) cfb.FullPaths = []; - if(!cfb.FileIndex) cfb.FileIndex = []; - if(cfb.FullPaths.length !== cfb.FileIndex.length) throw new Error("inconsistent CFB structure"); - if(cfb.FullPaths.length === 0) { - cfb.FullPaths[0] = root + "/"; - cfb.FileIndex[0] = ({ name: root, type: 5 }/*:any*/); - } - if(o.CLSID) cfb.FileIndex[0].clsid = o.CLSID; - seed_cfb(cfb); -} -function seed_cfb(cfb/*:CFBContainer*/)/*:void*/ { - var nm = "\u0001Sh33tJ5"; - if(CFB.find(cfb, "/" + nm)) return; - var p = new_buf(4); p[0] = 55; p[1] = p[3] = 50; p[2] = 54; - cfb.FileIndex.push(({ name: nm, type: 2, content:p, size:4, L:69, R:69, C:69 }/*:any*/)); - cfb.FullPaths.push(cfb.FullPaths[0] + nm); - rebuild_cfb(cfb); -} -function rebuild_cfb(cfb/*:CFBContainer*/, f/*:?boolean*/)/*:void*/ { - init_cfb(cfb); - var gc = false, s = false; - for(var i = cfb.FullPaths.length - 1; i >= 0; --i) { - var _file = cfb.FileIndex[i]; - switch(_file.type) { - case 0: - if(s) gc = true; - else { cfb.FileIndex.pop(); cfb.FullPaths.pop(); } - break; - case 1: case 2: case 5: - s = true; - if(isNaN(_file.R * _file.L * _file.C)) gc = true; - if(_file.R > -1 && _file.L > -1 && _file.R == _file.L) gc = true; - break; - default: gc = true; break; - } - } - if(!gc && !f) return; - - var now = new Date(1987, 1, 19), j = 0; - var data/*:Array<[string, CFBEntry]>*/ = []; - for(i = 0; i < cfb.FullPaths.length; ++i) { - if(cfb.FileIndex[i].type === 0) continue; - data.push([cfb.FullPaths[i], cfb.FileIndex[i]]); - } - for(i = 0; i < data.length; ++i) { - var dad = dirname(data[i][0]); - s = false; - for(j = 0; j < data.length; ++j) if(data[j][0] === dad) s = true; - if(!s) data.push([dad, ({ - name: filename(dad).replace("/",""), - type: 1, - clsid: HEADER_CLSID, - ct: now, mt: now, - content: null - }/*:any*/)]); - } - - data.sort(function(x,y) { return namecmp(x[0], y[0]); }); - cfb.FullPaths = []; cfb.FileIndex = []; - for(i = 0; i < data.length; ++i) { cfb.FullPaths[i] = data[i][0]; cfb.FileIndex[i] = data[i][1]; } - for(i = 0; i < data.length; ++i) { - var elt = cfb.FileIndex[i]; - var nm = cfb.FullPaths[i]; - - elt.name = filename(nm).replace("/",""); - elt.L = elt.R = elt.C = -(elt.color = 1); - elt.size = elt.content ? elt.content.length : 0; - elt.start = 0; - elt.clsid = (elt.clsid || HEADER_CLSID); - if(i === 0) { - elt.C = data.length > 1 ? 1 : -1; - elt.size = 0; - elt.type = 5; - } else if(nm.slice(-1) == "/") { - for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==nm) break; - elt.C = j >= data.length ? -1 : j; - for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==dirname(nm)) break; - elt.R = j >= data.length ? -1 : j; - elt.type = 1; - } else { - if(dirname(cfb.FullPaths[i+1]||"") == dirname(nm)) elt.R = i + 1; - elt.type = 2; - } - } - -} - -function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes*/ { - var _opts = options || {}; - rebuild_cfb(cfb); - if(_opts.fileType == 'zip') return write_zip(cfb, _opts); - var L = (function(cfb/*:CFBContainer*/)/*:Array*/{ - var mini_size = 0, fat_size = 0; - for(var i = 0; i < cfb.FileIndex.length; ++i) { - var file = cfb.FileIndex[i]; - if(!file.content) continue; - /*:: if(file.content == null) throw new Error("unreachable"); */ - var flen = file.content.length; - if(flen > 0){ - if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6; - else fat_size += (flen + 0x01FF) >> 9; - } - } - var dir_cnt = (cfb.FullPaths.length +3) >> 2; - var mini_cnt = (mini_size + 7) >> 3; - var mfat_cnt = (mini_size + 0x7F) >> 7; - var fat_base = mini_cnt + fat_size + dir_cnt + mfat_cnt; - var fat_cnt = (fat_base + 0x7F) >> 7; - var difat_cnt = fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt-109)/0x7F); - while(((fat_base + fat_cnt + difat_cnt + 0x7F) >> 7) > fat_cnt) difat_cnt = ++fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt-109)/0x7F); - var L = [1, difat_cnt, fat_cnt, mfat_cnt, dir_cnt, fat_size, mini_size, 0]; - cfb.FileIndex[0].size = mini_size << 6; - L[7] = (cfb.FileIndex[0].start=L[0]+L[1]+L[2]+L[3]+L[4]+L[5])+((L[6]+7) >> 3); - return L; - })(cfb); - var o = new_buf(L[7] << 9); - var i = 0, T = 0; - { - for(i = 0; i < 8; ++i) o.write_shift(1, HEADER_SIG[i]); - for(i = 0; i < 8; ++i) o.write_shift(2, 0); - o.write_shift(2, 0x003E); - o.write_shift(2, 0x0003); - o.write_shift(2, 0xFFFE); - o.write_shift(2, 0x0009); - o.write_shift(2, 0x0006); - for(i = 0; i < 3; ++i) o.write_shift(2, 0); - o.write_shift(4, 0); - o.write_shift(4, L[2]); - o.write_shift(4, L[0] + L[1] + L[2] + L[3] - 1); - o.write_shift(4, 0); - o.write_shift(4, 1<<12); - o.write_shift(4, L[3] ? L[0] + L[1] + L[2] - 1: ENDOFCHAIN); - o.write_shift(4, L[3]); - o.write_shift(-4, L[1] ? L[0] - 1: ENDOFCHAIN); - o.write_shift(4, L[1]); - for(i = 0; i < 109; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1); - } - if(L[1]) { - for(T = 0; T < L[1]; ++T) { - for(; i < 236 + T * 127; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1); - o.write_shift(-4, T === L[1] - 1 ? ENDOFCHAIN : T + 1); - } - } - var chainit = function(w/*:number*/)/*:void*/ { - for(T += w; i> 9); - } - chainit((L[6] + 7) >> 3); - while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); - T = i = 0; - for(j = 0; j < cfb.FileIndex.length; ++j) { - file = cfb.FileIndex[j]; - if(!file.content) continue; - /*:: if(file.content == null) throw new Error("unreachable"); */ - flen = file.content.length; - if(!flen || flen >= 0x1000) continue; - file.start = T; - chainit((flen + 0x3F) >> 6); - } - while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); - for(i = 0; i < L[4]<<2; ++i) { - var nm = cfb.FullPaths[i]; - if(!nm || nm.length === 0) { - for(j = 0; j < 17; ++j) o.write_shift(4, 0); - for(j = 0; j < 3; ++j) o.write_shift(4, -1); - for(j = 0; j < 12; ++j) o.write_shift(4, 0); - continue; - } - file = cfb.FileIndex[i]; - if(i === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN; - var _nm/*:string*/ = (i === 0 && _opts.root) || file.name; - flen = 2*(_nm.length+1); - o.write_shift(64, _nm, "utf16le"); - o.write_shift(2, flen); - o.write_shift(1, file.type); - o.write_shift(1, file.color); - o.write_shift(-4, file.L); - o.write_shift(-4, file.R); - o.write_shift(-4, file.C); - if(!file.clsid) for(j = 0; j < 4; ++j) o.write_shift(4, 0); - else o.write_shift(16, file.clsid, "hex"); - o.write_shift(4, file.state || 0); - o.write_shift(4, 0); o.write_shift(4, 0); - o.write_shift(4, 0); o.write_shift(4, 0); - o.write_shift(4, file.start); - o.write_shift(4, file.size); o.write_shift(4, 0); - } - for(i = 1; i < cfb.FileIndex.length; ++i) { - file = cfb.FileIndex[i]; - /*:: if(!file.content) throw new Error("unreachable"); */ - if(file.size >= 0x1000) { - o.l = (file.start+1) << 9; - for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]); - for(; j & 0x1FF; ++j) o.write_shift(1, 0); - } - } - for(i = 1; i < cfb.FileIndex.length; ++i) { - file = cfb.FileIndex[i]; - /*:: if(!file.content) throw new Error("unreachable"); */ - if(file.size > 0 && file.size < 0x1000) { - for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]); - for(; j & 0x3F; ++j) o.write_shift(1, 0); - } - } - while(o.l < o.length) o.write_shift(1, 0); - return o; -} -/* [MS-CFB] 2.6.4 (Unicode 3.0.1 case conversion) */ -function find(cfb/*:CFBContainer*/, path/*:string*/)/*:?CFBEntry*/ { - var UCFullPaths/*:Array*/ = cfb.FullPaths.map(function(x) { return x.toUpperCase(); }); - var UCPaths/*:Array*/ = UCFullPaths.map(function(x) { var y = x.split("/"); return y[y.length - (x.slice(-1) == "/" ? 2 : 1)]; }); - var k/*:boolean*/ = false; - if(path.charCodeAt(0) === 47 /* "/" */) { k = true; path = UCFullPaths[0].slice(0, -1) + path; } - else k = path.indexOf("/") !== -1; - var UCPath/*:string*/ = path.toUpperCase(); - var w/*:number*/ = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath); - if(w !== -1) return cfb.FileIndex[w]; - - var m = !UCPath.match(chr1); - UCPath = UCPath.replace(chr0,''); - if(m) UCPath = UCPath.replace(chr1,'!'); - for(w = 0; w < UCFullPaths.length; ++w) { - if((m ? UCFullPaths[w].replace(chr1,'!') : UCFullPaths[w]).replace(chr0,'') == UCPath) return cfb.FileIndex[w]; - if((m ? UCPaths[w].replace(chr1,'!') : UCPaths[w]).replace(chr0,'') == UCPath) return cfb.FileIndex[w]; - } - return null; -} -/** CFB Constants */ -var MSSZ = 64; /* Mini Sector Size = 1<<6 */ -//var MSCSZ = 4096; /* Mini Stream Cutoff Size */ -/* 2.1 Compound File Sector Numbers and Types */ -var ENDOFCHAIN = -2; -/* 2.2 Compound File Header */ -var HEADER_SIGNATURE = 'd0cf11e0a1b11ae1'; -var HEADER_SIG = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]; -var HEADER_CLSID = '00000000000000000000000000000000'; -var consts = { - /* 2.1 Compund File Sector Numbers and Types */ - MAXREGSECT: -6, - DIFSECT: -4, - FATSECT: -3, - ENDOFCHAIN: ENDOFCHAIN, - FREESECT: -1, - /* 2.2 Compound File Header */ - HEADER_SIGNATURE: HEADER_SIGNATURE, - HEADER_MINOR_VERSION: '3e00', - MAXREGSID: -6, - NOSTREAM: -1, - HEADER_CLSID: HEADER_CLSID, - /* 2.6.1 Compound File Directory Entry */ - EntryTypes: ['unknown','storage','stream','lockbytes','property','root'] -}; - -function write_file(cfb/*:CFBContainer*/, filename/*:string*/, options/*:CFBWriteOpts*/)/*:void*/ { - get_fs(); - var o = _write(cfb, options); - /*:: if(typeof Buffer == 'undefined' || !Buffer.isBuffer(o) || !(o instanceof Buffer)) throw new Error("unreachable"); */ - fs.writeFileSync(filename, o); -} - -function a2s(o/*:RawBytes*/)/*:string*/ { - var out = new Array(o.length); - for(var i = 0; i < o.length; ++i) out[i] = String.fromCharCode(o[i]); - return out.join(""); -} - -function write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes|string*/ { - var o = _write(cfb, options); - switch(options && options.type) { - case "file": get_fs(); fs.writeFileSync(options.filename, (o/*:any*/)); return o; - case "binary": return a2s(o); - case "base64": return Base64.encode(a2s(o)); - } - return o; -} -/* node < 8.1 zlib does not expose bytesRead, so default to pure JS */ -var _zlib; -function use_zlib(zlib) { try { - var InflateRaw = zlib.InflateRaw; - var InflRaw = new InflateRaw(); - InflRaw._processChunk(new Uint8Array([3, 0]), InflRaw._finishFlushFlag); - if(InflRaw.bytesRead) _zlib = zlib; - else throw new Error("zlib does not expose bytesRead"); -} catch(e) {console.error("cannot use native zlib: " + (e.message || e)); } } - -function _inflateRawSync(payload, usz) { - if(!_zlib) return _inflate(payload, usz); - var InflateRaw = _zlib.InflateRaw; - var InflRaw = new InflateRaw(); - var out = InflRaw._processChunk(payload.slice(payload.l), InflRaw._finishFlushFlag); - payload.l += InflRaw.bytesRead; - return out; -} - -function _deflateRawSync(payload) { - return _zlib ? _zlib.deflateRawSync(payload) : _deflate(payload); -} -var CLEN_ORDER = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - -/* LEN_ID = [ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285 ]; */ -var LEN_LN = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13 , 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 ]; - -/* DST_ID = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ]; */ -var DST_LN = [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 ]; - -function bit_swap_8(n) { var t = (((((n<<1)|(n<<11)) & 0x22110) | (((n<<5)|(n<<15)) & 0x88440))); return ((t>>16) | (t>>8) |t)&0xFF; } - -var use_typed_arrays = typeof Uint8Array !== 'undefined'; - -var bitswap8 = use_typed_arrays ? new Uint8Array(1<<8) : []; -for(var q = 0; q < (1<<8); ++q) bitswap8[q] = bit_swap_8(q); - -function bit_swap_n(n, b) { - var rev = bitswap8[n & 0xFF]; - if(b <= 8) return rev >>> (8-b); - rev = (rev << 8) | bitswap8[(n>>8)&0xFF]; - if(b <= 16) return rev >>> (16-b); - rev = (rev << 8) | bitswap8[(n>>16)&0xFF]; - return rev >>> (24-b); -} - -/* helpers for unaligned bit reads */ -function read_bits_2(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 6 ? 0 : buf[h+1]<<8))>>>w)& 0x03; } -function read_bits_3(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 5 ? 0 : buf[h+1]<<8))>>>w)& 0x07; } -function read_bits_4(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 4 ? 0 : buf[h+1]<<8))>>>w)& 0x0F; } -function read_bits_5(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 3 ? 0 : buf[h+1]<<8))>>>w)& 0x1F; } -function read_bits_7(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 1 ? 0 : buf[h+1]<<8))>>>w)& 0x7F; } - -/* works up to n = 3 * 8 + 1 = 25 */ -function read_bits_n(buf, bl, n) { - var w = (bl&7), h = (bl>>>3), f = ((1<>> w; - if(n < 8 - w) return v & f; - v |= buf[h+1]<<(8-w); - if(n < 16 - w) return v & f; - v |= buf[h+2]<<(16-w); - if(n < 24 - w) return v & f; - v |= buf[h+3]<<(24-w); - return v & f; -} - -/* until ArrayBuffer#realloc is a thing, fake a realloc */ -function realloc(b, sz/*:number*/) { - var L = b.length, M = 2*L > sz ? 2*L : sz + 5, i = 0; - if(L >= sz) return b; - if(has_buf) { - var o = new_unsafe_buf(M); - // $FlowIgnore - if(b.copy) b.copy(o); - else for(; i < b.length; ++i) o[i] = b[i]; - return o; - } else if(use_typed_arrays) { - var a = new Uint8Array(M); - if(a.set) a.set(b); - else for(; i < b.length; ++i) a[i] = b[i]; - return a; - } - b.length = M; - return b; -} - -/* zero-filled arrays for older browsers */ -function zero_fill_array(n) { - var o = new Array(n); - for(var i = 0; i < n; ++i) o[i] = 0; - return o; -}var _deflate = (function() { -var _deflateRaw = (function() { - return function deflateRaw(data, out) { - var boff = 0; - while(boff < data.length) { - var L = Math.min(0xFFFF, data.length - boff); - var h = boff + L == data.length; - /* TODO: this is only type 0 stored */ - out.write_shift(1, +h); - out.write_shift(2, L); - out.write_shift(2, (~L) & 0xFFFF); - while(L-- > 0) out[out.l++] = data[boff++]; - } - return out.l; - }; -})(); - -return function(data) { - var buf = new_buf(50+Math.floor(data.length*1.1)); - var off = _deflateRaw(data, buf); - return buf.slice(0, off); -}; -})(); -/* modified inflate function also moves original read head */ - -/* build tree (used for literals and lengths) */ -function build_tree(clens, cmap, MAX/*:number*/)/*:number*/ { - var maxlen = 1, w = 0, i = 0, j = 0, ccode = 0, L = clens.length; - - var bl_count = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32); - for(i = 0; i < 32; ++i) bl_count[i] = 0; - - for(i = L; i < MAX; ++i) clens[i] = 0; - L = clens.length; - - var ctree = use_typed_arrays ? new Uint16Array(L) : zero_fill_array(L); // [] - - /* build code tree */ - for(i = 0; i < L; ++i) { - bl_count[(w = clens[i])]++; - if(maxlen < w) maxlen = w; - ctree[i] = 0; - } - bl_count[0] = 0; - for(i = 1; i <= maxlen; ++i) bl_count[i+16] = (ccode = (ccode + bl_count[i-1])<<1); - for(i = 0; i < L; ++i) { - ccode = clens[i]; - if(ccode != 0) ctree[i] = bl_count[ccode+16]++; - } - - /* cmap[maxlen + 4 bits] = (off&15) + (lit<<4) reverse mapping */ - var cleni = 0; - for(i = 0; i < L; ++i) { - cleni = clens[i]; - if(cleni != 0) { - ccode = bit_swap_n(ctree[i], maxlen)>>(maxlen-cleni); - for(j = (1<<(maxlen + 4 - cleni)) - 1; j>=0; --j) - cmap[ccode|(j<*/ = []; - var i = 0; - for(;i<32; i++) dlens.push(5); - build_tree(dlens, fix_dmap, 32); - - var clens/*:Array*/ = []; - i = 0; - for(; i<=143; i++) clens.push(8); - for(; i<=255; i++) clens.push(9); - for(; i<=279; i++) clens.push(7); - for(; i<=287; i++) clens.push(8); - build_tree(clens, fix_lmap, 288); -})(); - -var dyn_lmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768); -var dyn_dmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768); -var dyn_cmap = use_typed_arrays ? new Uint16Array(128) : zero_fill_array(128); -var dyn_len_1 = 1, dyn_len_2 = 1; - -/* 5.5.3 Expanding Huffman Codes */ -function dyn(data, boff/*:number*/) { - /* nomenclature from RFC1951 refers to bit values; these are offset by the implicit constant */ - var _HLIT = read_bits_5(data, boff) + 257; boff += 5; - var _HDIST = read_bits_5(data, boff) + 1; boff += 5; - var _HCLEN = read_bits_4(data, boff) + 4; boff += 4; - var w = 0; - - /* grab and store code lengths */ - var clens = use_typed_arrays ? new Uint8Array(19) : zero_fill_array(19); - var ctree = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - var maxlen = 1; - var bl_count = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8); - var next_code = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8); - var L = clens.length; /* 19 */ - for(var i = 0; i < _HCLEN; ++i) { - clens[CLEN_ORDER[i]] = w = read_bits_3(data, boff); - if(maxlen < w) maxlen = w; - bl_count[w]++; - boff += 3; - } - - /* build code tree */ - var ccode = 0; - bl_count[0] = 0; - for(i = 1; i <= maxlen; ++i) next_code[i] = ccode = (ccode + bl_count[i-1])<<1; - for(i = 0; i < L; ++i) if((ccode = clens[i]) != 0) ctree[i] = next_code[ccode]++; - /* cmap[7 bits from stream] = (off&7) + (lit<<3) */ - var cleni = 0; - for(i = 0; i < L; ++i) { - cleni = clens[i]; - if(cleni != 0) { - ccode = bitswap8[ctree[i]]>>(8-cleni); - for(var j = (1<<(7-cleni))-1; j>=0; --j) dyn_cmap[ccode|(j<*/ = []; - maxlen = 1; - for(; hcodes.length < _HLIT + _HDIST;) { - ccode = dyn_cmap[read_bits_7(data, boff)]; - boff += ccode & 7; - switch((ccode >>>= 3)) { - case 16: - w = 3 + read_bits_2(data, boff); boff += 2; - ccode = hcodes[hcodes.length - 1]; - while(w-- > 0) hcodes.push(ccode); - break; - case 17: - w = 3 + read_bits_3(data, boff); boff += 3; - while(w-- > 0) hcodes.push(0); - break; - case 18: - w = 11 + read_bits_7(data, boff); boff += 7; - while(w -- > 0) hcodes.push(0); - break; - default: - hcodes.push(ccode); - if(maxlen < ccode) maxlen = ccode; - break; - } - } - - /* build literal / length trees */ - var h1 = hcodes.slice(0, _HLIT), h2 = hcodes.slice(_HLIT); - for(i = _HLIT; i < 286; ++i) h1[i] = 0; - for(i = _HDIST; i < 30; ++i) h2[i] = 0; - dyn_len_1 = build_tree(h1, dyn_lmap, 286); - dyn_len_2 = build_tree(h2, dyn_dmap, 30); - return boff; -} - -/* return [ data, bytesRead ] */ -function inflate(data, usz/*:number*/) { - /* shortcircuit for empty buffer [0x03, 0x00] */ - if(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; } - - /* bit offset */ - var boff = 0; - - /* header includes final bit and type bits */ - var header = 0; - - var outbuf = new_unsafe_buf(usz ? usz : (1<<18)); - var woff = 0; - var OL = outbuf.length>>>0; - var max_len_1 = 0, max_len_2 = 0; - - while((header&1) == 0) { - header = read_bits_3(data, boff); boff += 3; - if((header >>> 1) == 0) { - /* Stored block */ - if(boff & 7) boff += 8 - (boff&7); - /* 2 bytes sz, 2 bytes bit inverse */ - var sz = data[boff>>>3] | data[(boff>>>3)+1]<<8; - boff += 32; - /* push sz bytes */ - if(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; } - if(typeof data.copy === 'function') { - // $FlowIgnore - data.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz); - woff += sz; boff += 8*sz; - } else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; } - continue; - } else if((header >>> 1) == 1) { - /* Fixed Huffman */ - max_len_1 = 9; max_len_2 = 5; - } else { - /* Dynamic Huffman */ - boff = dyn(data, boff); - max_len_1 = dyn_len_1; max_len_2 = dyn_len_2; - } - if(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; } - for(;;) { // while(true) is apparently out of vogue in modern JS circles - /* ingest code and move read head */ - var bits = read_bits_n(data, boff, max_len_1); - var code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits]; - boff += code & 15; code >>>= 4; - /* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */ - if(((code>>>8)&0xFF) === 0) outbuf[woff++] = code; - else if(code == 256) break; - else { - code -= 257; - var len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0; - var tgt = woff + LEN_LN[code]; - /* length extra bits */ - if(len_eb > 0) { - tgt += read_bits_n(data, boff, len_eb); - boff += len_eb; - } - - /* dist code */ - bits = read_bits_n(data, boff, max_len_2); - code = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits]; - boff += code & 15; code >>>= 4; - var dst_eb = (code < 4 ? 0 : (code-2)>>1); - var dst = DST_LN[code]; - /* dist extra bits */ - if(dst_eb > 0) { - dst += read_bits_n(data, boff, dst_eb); - boff += dst_eb; - } - - /* in the common case, manual byte copy is faster than TA set / Buffer copy */ - if(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; } - while(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; } - } - } - } - return [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3]; -} - -function _inflate(payload, usz) { - var data = payload.slice(payload.l||0); - var out = inflate(data, usz); - payload.l += out[1]; - return out[0]; -} - -function warn_or_throw(wrn, msg) { - if(wrn) { if(typeof console !== 'undefined') console.error(msg); } - else throw new Error(msg); -} - -function parse_zip(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ { - var blob/*:CFBlob*/ = /*::(*/file/*:: :any)*/; - prep_blob(blob, 0); - - var FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array*/ = []; - var o = { - FileIndex: FileIndex, - FullPaths: FullPaths - }; - init_cfb(o, { root: options.root }); - - /* find end of central directory, start just after signature */ - var i = blob.length - 4; - while((blob[i] != 0x50 || blob[i+1] != 0x4b || blob[i+2] != 0x05 || blob[i+3] != 0x06) && i >= 0) --i; - blob.l = i + 4; - - /* parse end of central directory */ - blob.l += 4; - var fcnt = blob.read_shift(2); - blob.l += 6; - var start_cd = blob.read_shift(4); - - /* parse central directory */ - blob.l = start_cd; - - for(i = 0; i < fcnt; ++i) { - /* trust local file header instead of CD entry */ - blob.l += 20; - var csz = blob.read_shift(4); - var usz = blob.read_shift(4); - var namelen = blob.read_shift(2); - var efsz = blob.read_shift(2); - var fcsz = blob.read_shift(2); - blob.l += 8; - var offset = blob.read_shift(4); - var EF = parse_extra_field(/*::(*/blob.slice(blob.l+namelen, blob.l+namelen+efsz)/*:: :any)*/); - blob.l += namelen + efsz + fcsz; - - var L = blob.l; - blob.l = offset + 4; - parse_local_file(blob, csz, usz, o, EF); - blob.l = L; - } - - return o; -} - - -/* head starts just after local file header signature */ -function parse_local_file(blob/*:CFBlob*/, csz/*:number*/, usz/*:number*/, o/*:CFBContainer*/, EF) { - /* [local file header] */ - blob.l += 2; - var flags = blob.read_shift(2); - var meth = blob.read_shift(2); - var date = parse_dos_date(blob); - - if(flags & 0x2041) throw new Error("Unsupported ZIP encryption"); - var crc32 = blob.read_shift(4); - var _csz = blob.read_shift(4); - var _usz = blob.read_shift(4); - - var namelen = blob.read_shift(2); - var efsz = blob.read_shift(2); - - // TODO: flags & (1<<11) // UTF8 - var name = ""; for(var i = 0; i < namelen; ++i) name += String.fromCharCode(blob[blob.l++]); - if(efsz) { - var ef = parse_extra_field(/*::(*/blob.slice(blob.l, blob.l + efsz)/*:: :any)*/); - if((ef[0x5455]||{}).mt) date = ef[0x5455].mt; - if(((EF||{})[0x5455]||{}).mt) date = EF[0x5455].mt; - } - blob.l += efsz; - - /* [encryption header] */ - - /* [file data] */ - var data = blob.slice(blob.l, blob.l + _csz); - switch(meth) { - case 8: data = _inflateRawSync(blob, _usz); break; - case 0: break; - default: throw new Error("Unsupported ZIP Compression method " + meth); - } - - /* [data descriptor] */ - var wrn = false; - if(flags & 8) { - crc32 = blob.read_shift(4); - if(crc32 == 0x08074b50) { crc32 = blob.read_shift(4); wrn = true; } - _csz = blob.read_shift(4); - _usz = blob.read_shift(4); - } - - if(_csz != csz) warn_or_throw(wrn, "Bad compressed size: " + csz + " != " + _csz); - if(_usz != usz) warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz); - var _crc32 = CRC32.buf(data, 0); - if((crc32>>0) != (_crc32>>0)) warn_or_throw(wrn, "Bad CRC32 checksum: " + crc32 + " != " + _crc32); - cfb_add(o, name, data, {unsafe: true, mt: date}); -} -function write_zip(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes*/ { - var _opts = options || {}; - var out = [], cdirs = []; - var o/*:CFBlob*/ = new_buf(1); - var method = (_opts.compression ? 8 : 0), flags = 0; - var desc = false; - if(desc) flags |= 8; - var i = 0, j = 0; - - var start_cd = 0, fcnt = 0; - var root = cfb.FullPaths[0], fp = root, fi = cfb.FileIndex[0]; - var crcs = []; - var sz_cd = 0; - - for(i = 1; i < cfb.FullPaths.length; ++i) { - fp = cfb.FullPaths[i].slice(root.length); fi = cfb.FileIndex[i]; - if(!fi.size || !fi.content || fp == "\u0001Sh33tJ5") continue; - var start = start_cd; - - /* TODO: CP437 filename */ - var namebuf = new_buf(fp.length); - for(j = 0; j < fp.length; ++j) namebuf.write_shift(1, fp.charCodeAt(j) & 0x7F); - namebuf = namebuf.slice(0, namebuf.l); - crcs[fcnt] = CRC32.buf(/*::((*/fi.content/*::||[]):any)*/, 0); - - var outbuf = fi.content/*::||[]*/; - if(method == 8) outbuf = _deflateRawSync(outbuf); - - /* local file header */ - o = new_buf(30); - o.write_shift(4, 0x04034b50); - o.write_shift(2, 20); - o.write_shift(2, flags); - o.write_shift(2, method); - /* TODO: last mod file time/date */ - if(fi.mt) write_dos_date(o, fi.mt); - else o.write_shift(4, 0); - o.write_shift(-4, (flags & 8) ? 0 : crcs[fcnt]); - o.write_shift(4, (flags & 8) ? 0 : outbuf.length); - o.write_shift(4, (flags & 8) ? 0 : /*::(*/fi.content/*::||[])*/.length); - o.write_shift(2, namebuf.length); - o.write_shift(2, 0); - - start_cd += o.length; - out.push(o); - start_cd += namebuf.length; - out.push(namebuf); - - /* TODO: encryption header ? */ - start_cd += outbuf.length; - out.push(outbuf); - - /* data descriptor */ - if(flags & 8) { - o = new_buf(12); - o.write_shift(-4, crcs[fcnt]); - o.write_shift(4, outbuf.length); - o.write_shift(4, /*::(*/fi.content/*::||[])*/.length); - start_cd += o.l; - out.push(o); - } - - /* central directory */ - o = new_buf(46); - o.write_shift(4, 0x02014b50); - o.write_shift(2, 0); - o.write_shift(2, 20); - o.write_shift(2, flags); - o.write_shift(2, method); - o.write_shift(4, 0); /* TODO: last mod file time/date */ - o.write_shift(-4, crcs[fcnt]); - - o.write_shift(4, outbuf.length); - o.write_shift(4, /*::(*/fi.content/*::||[])*/.length); - o.write_shift(2, namebuf.length); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(4, 0); - o.write_shift(4, start); - - sz_cd += o.l; - cdirs.push(o); - sz_cd += namebuf.length; - cdirs.push(namebuf); - ++fcnt; - } - - /* end of central directory */ - o = new_buf(22); - o.write_shift(4, 0x06054b50); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, fcnt); - o.write_shift(2, fcnt); - o.write_shift(4, sz_cd); - o.write_shift(4, start_cd); - o.write_shift(2, 0); - - return bconcat(([bconcat((out/*:any*/)), bconcat(cdirs), o]/*:any*/)); -} -function cfb_new(opts/*:?any*/)/*:CFBContainer*/ { - var o/*:CFBContainer*/ = ({}/*:any*/); - init_cfb(o, opts); - return o; -} - -function cfb_add(cfb/*:CFBContainer*/, name/*:string*/, content/*:?RawBytes*/, opts/*:?any*/)/*:CFBEntry*/ { - var unsafe = opts && opts.unsafe; - if(!unsafe) init_cfb(cfb); - var file = !unsafe && CFB.find(cfb, name); - if(!file) { - var fpath/*:string*/ = cfb.FullPaths[0]; - if(name.slice(0, fpath.length) == fpath) fpath = name; - else { - if(fpath.slice(-1) != "/") fpath += "/"; - fpath = (fpath + name).replace("//","/"); - } - file = ({name: filename(name), type: 2}/*:any*/); - cfb.FileIndex.push(file); - cfb.FullPaths.push(fpath); - if(!unsafe) CFB.utils.cfb_gc(cfb); - } - /*:: if(!file) throw new Error("unreachable"); */ - file.content = (content/*:any*/); - file.size = content ? content.length : 0; - if(opts) { - if(opts.CLSID) file.clsid = opts.CLSID; - if(opts.mt) file.mt = opts.mt; - if(opts.ct) file.ct = opts.ct; - } - return file; -} - -function cfb_del(cfb/*:CFBContainer*/, name/*:string*/)/*:boolean*/ { - init_cfb(cfb); - var file = CFB.find(cfb, name); - if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) { - cfb.FileIndex.splice(j, 1); - cfb.FullPaths.splice(j, 1); - return true; - } - return false; -} - -function cfb_mov(cfb/*:CFBContainer*/, old_name/*:string*/, new_name/*:string*/)/*:boolean*/ { - init_cfb(cfb); - var file = CFB.find(cfb, old_name); - if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) { - cfb.FileIndex[j].name = filename(new_name); - cfb.FullPaths[j] = new_name; - return true; - } - return false; -} - -function cfb_gc(cfb/*:CFBContainer*/)/*:void*/ { rebuild_cfb(cfb, true); } - -exports.find = find; -exports.read = read; -exports.parse = parse; -exports.write = write; -exports.writeFile = write_file; -exports.utils = { - cfb_new: cfb_new, - cfb_add: cfb_add, - cfb_del: cfb_del, - cfb_mov: cfb_mov, - cfb_gc: cfb_gc, - ReadShift: ReadShift, - CheckField: CheckField, - prep_blob: prep_blob, - bconcat: bconcat, - use_zlib: use_zlib, - _deflateRaw: _deflate, - _inflateRaw: _inflate, - consts: consts -}; - -return exports; -})(); - -if(typeof require !== 'undefined' && typeof module !== 'undefined' && typeof DO_NOT_EXPORT_CFB === 'undefined') { module.exports = CFB; } -import * as _fs from 'fs'; - -/* normalize data for blob ctor */ -function blobify(data) { - if(typeof data === "string") return s2ab(data); - if(Array.isArray(data)) return a2u(data); - return data; -} -/* write or download file */ -function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { - /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ - if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); - var data = (enc == "utf8") ? utf8write(payload) : payload; - /*:: declare var IE_SaveFile: any; */ - if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); - if(typeof Blob !== 'undefined') { - var blob = new Blob([blobify(data)], {type:"application/octet-stream"}); - /*:: declare var navigator: any; */ - if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname); - /*:: declare var saveAs: any; */ - if(typeof saveAs !== 'undefined') return saveAs(blob, fname); - if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) { - var url = URL.createObjectURL(blob); - /*:: declare var chrome: any; */ - if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") { - if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); - return chrome.downloads.download({ url: url, filename: fname, saveAs: true}); - } - var a = document.createElement("a"); - if(a.download != null) { - /*:: if(document.body == null) throw new Error("unreachable"); */ - a.download = fname; a.href = url; document.body.appendChild(a); a.click(); - /*:: if(document.body == null) throw new Error("unreachable"); */ document.body.removeChild(a); - if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); - return url; - } - } - } - // $FlowIgnore - if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript - // $FlowIgnore - var out = File(fname); out.open("w"); out.encoding = "binary"; - if(Array.isArray(payload)) payload = a2s(payload); - out.write(payload); out.close(); return payload; - } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } - throw new Error("cannot save file " + fname); -} - -/* read binary data from file */ -function read_binary(path/*:string*/) { - if(typeof _fs !== 'undefined') return _fs.readFileSync(path); - // $FlowIgnore - if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript - // $FlowIgnore - var infile = File(path); infile.open("r"); infile.encoding = "binary"; - var data = infile.read(); infile.close(); - return data; - } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } - throw new Error("Cannot access file " + path); -} -function keys(o/*:any*/)/*:Array*/ { - var ks = Object.keys(o), o2 = []; - for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]); - return o2; -} - -function evert_key(obj/*:any*/, key/*:string*/)/*:EvertType*/ { - var o = ([]/*:any*/), K = keys(obj); - for(var i = 0; i !== K.length; ++i) if(o[obj[K[i]][key]] == null) o[obj[K[i]][key]] = K[i]; - return o; -} - -function evert(obj/*:any*/)/*:EvertType*/ { - var o = ([]/*:any*/), K = keys(obj); - for(var i = 0; i !== K.length; ++i) o[obj[K[i]]] = K[i]; - return o; -} - -function evert_num(obj/*:any*/)/*:EvertNumType*/ { - var o = ([]/*:any*/), K = keys(obj); - for(var i = 0; i !== K.length; ++i) o[obj[K[i]]] = parseInt(K[i],10); - return o; -} - -function evert_arr(obj/*:any*/)/*:EvertArrType*/ { - var o/*:EvertArrType*/ = ([]/*:any*/), K = keys(obj); - for(var i = 0; i !== K.length; ++i) { - if(o[obj[K[i]]] == null) o[obj[K[i]]] = []; - o[obj[K[i]]].push(K[i]); - } - return o; -} - -var basedate = new Date(1899, 11, 30, 0, 0, 0); // 2209161600000 -function datenum(v/*:Date*/, date1904/*:?boolean*/)/*:number*/ { - var epoch = v.getTime(); - if(date1904) epoch -= 1462*24*60*60*1000; - var dnthresh = basedate.getTime() + (v.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000; - return (epoch - dnthresh) / (24 * 60 * 60 * 1000); -} -var refdate = new Date(); -var dnthresh = basedate.getTime() + (refdate.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000; -var refoffset = refdate.getTimezoneOffset(); -function numdate(v/*:number*/)/*:Date*/ { - var out = new Date(); - out.setTime(v * 24 * 60 * 60 * 1000 + dnthresh); - if (out.getTimezoneOffset() !== refoffset) { - out.setTime(out.getTime() + (out.getTimezoneOffset() - refoffset) * 60000); - } - return out; -} - -/* ISO 8601 Duration */ -function parse_isodur(s) { - var sec = 0, mt = 0, time = false; - var m = s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/); - if(!m) throw new Error("|" + s + "| is not an ISO8601 Duration"); - for(var i = 1; i != m.length; ++i) { - if(!m[i]) continue; - mt = 1; - if(i > 3) time = true; - switch(m[i].slice(m[i].length-1)) { - case 'Y': - throw new Error("Unsupported ISO Duration Field: " + m[i].slice(m[i].length-1)); - case 'D': mt *= 24; - /* falls through */ - case 'H': mt *= 60; - /* falls through */ - case 'M': - if(!time) throw new Error("Unsupported ISO Duration Field: M"); - else mt *= 60; - /* falls through */ - case 'S': break; - } - sec += mt * parseInt(m[i], 10); - } - return sec; -} - -var good_pd_date = new Date('2017-02-19T19:06:09.000Z'); -if(isNaN(good_pd_date.getFullYear())) good_pd_date = new Date('2/19/17'); -var good_pd = good_pd_date.getFullYear() == 2017; -/* parses a date as a local date */ -function parseDate(str/*:string|Date*/, fixdate/*:?number*/)/*:Date*/ { - var d = new Date(str); - if(good_pd) { - /*:: if(fixdate == null) fixdate = 0; */ - if(fixdate > 0) d.setTime(d.getTime() + d.getTimezoneOffset() * 60 * 1000); - else if(fixdate < 0) d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1000); - return d; - } - if(str instanceof Date) return str; - if(good_pd_date.getFullYear() == 1917 && !isNaN(d.getFullYear())) { - var s = d.getFullYear(); - if(str.indexOf("" + s) > -1) return d; - d.setFullYear(d.getFullYear() + 100); return d; - } - var n = str.match(/\d+/g)||["2017","2","19","0","0","0"]; - var out = new Date(+n[0], +n[1] - 1, +n[2], (+n[3]||0), (+n[4]||0), (+n[5]||0)); - if(str.indexOf("Z") > -1) out = new Date(out.getTime() - out.getTimezoneOffset() * 60 * 1000); - return out; -} - -function cc2str(arr/*:Array*/, debomit)/*:string*/ { - if(has_buf && Buffer.isBuffer(arr)) { - if(debomit) { - if(arr[0] == 0xFF && arr[1] == 0xFE) return arr.slice(2).toString("utf16le"); - if(arr[1] == 0xFE && arr[2] == 0xFF) return utf16beread(arr.slice(2).toString("binary")); - } - return arr.toString("binary"); - } - /* TODO: investigate performance degradation of TextEncoder in Edge 13 */ - var o = []; - for(var i = 0; i != arr.length; ++i) o.push(String.fromCharCode(arr[i])); - return o.join(""); -} - -function dup(o/*:any*/)/*:any*/ { - if(typeof JSON != 'undefined' && !Array.isArray(o)) return JSON.parse(JSON.stringify(o)); - if(typeof o != 'object' || o == null) return o; - if(o instanceof Date) return new Date(o.getTime()); - var out = {}; - for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]); - return out; -} - -function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; } - -/* TODO: stress test */ -function fuzzynum(s/*:string*/)/*:number*/ { - var v/*:number*/ = Number(s); - if(isFinite(v)) return v; - if(!isNaN(v)) return NaN; - if(!/\d/.test(s)) return v; - var wt = 1; - var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";}); - if(!isNaN(v = Number(ss))) return v / wt; - ss = ss.replace(/[(](.*)[)]/,function($$, $1) { wt = -wt; return $1;}); - if(!isNaN(v = Number(ss))) return v / wt; - return v; -} -function fuzzydate(s/*:string*/)/*:Date*/ { - var o = new Date(s), n = new Date(NaN); - var y = o.getYear(), m = o.getMonth(), d = o.getDate(); - if(isNaN(d)) return n; - if(y < 0 || y > 8099) return n; - if((m > 0 || d > 1) && y != 101) return o; - if(s.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) return o; - if(s.match(/[^-0-9:,\/\\]/)) return n; - return o; -} - -var safe_split_regex = "abacaba".split(/(:?b)/i).length == 5; -function split_regex(str/*:string*/, re, def/*:string*/)/*:Array*/ { - if(safe_split_regex || typeof re == "string") return str.split(re); - var p = str.split(re), o = [p[0]]; - for(var i = 1; i < p.length; ++i) { o.push(def); o.push(p[i]); } - return o; -} -function getdatastr(data)/*:?string*/ { - if(!data) return null; - if(data.data) return debom(data.data); - if(data.asNodeBuffer && has_buf) return debom(data.asNodeBuffer().toString('binary')); - if(data.asBinary) return debom(data.asBinary()); - if(data._data && data._data.getContent) return debom(cc2str(Array.prototype.slice.call(data._data.getContent(),0))); - if(data.content && data.type) return debom(cc2str(data.content)); - return null; -} - -function getdatabin(data) { - if(!data) return null; - if(data.data) return char_codes(data.data); - if(data.asNodeBuffer && has_buf) return data.asNodeBuffer(); - if(data._data && data._data.getContent) { - var o = data._data.getContent(); - if(typeof o == "string") return char_codes(o); - return Array.prototype.slice.call(o); - } - if(data.content && data.type) return data.content; - return null; -} - -function getdata(data) { return (data && data.name.slice(-4) === ".bin") ? getdatabin(data) : getdatastr(data); } - -/* Part 2 Section 10.1.2 "Mapping Content Types" Names are case-insensitive */ -/* OASIS does not comment on filename case sensitivity */ -function safegetzipfile(zip, file/*:string*/) { - var k = zip.FullPaths || keys(zip.files); - var f = file.toLowerCase().replace(/[\/]/g, '\\'), g = f.replace(/\\/g,'\/'); - for(var i=0; i\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g; -var tagregex=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg; - -if(!(XML_HEADER.match(tagregex))) tagregex = /<[^>]*>/g; -var nsregex=/<\w*:/, nsregex2 = /<(\/?)\w+:/; -function parsexmltag(tag/*:string*/, skip_root/*:?boolean*/, skip_LC/*:?boolean*/)/*:any*/ { - var z = ({}/*:any*/); - var eq = 0, c = 0; - for(; eq !== tag.length; ++eq) if((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) break; - if(!skip_root) z[0] = tag.slice(0, eq); - if(eq === tag.length) return z; - var m = tag.match(attregexg), j=0, v="", i=0, q="", cc="", quot = 1; - if(m) for(i = 0; i != m.length; ++i) { - cc = m[i]; - for(c=0; c != cc.length; ++c) if(cc.charCodeAt(c) === 61) break; - q = cc.slice(0,c).trim(); - while(cc.charCodeAt(c+1) == 32) ++c; - quot = ((eq=cc.charCodeAt(c+1)) == 34 || eq == 39) ? 1 : 0; - v = cc.slice(c+1+quot, cc.length-quot); - for(j=0;j!=q.length;++j) if(q.charCodeAt(j) === 58) break; - if(j===q.length) { - if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods - z[q] = v; - if(!skip_LC) z[q.toLowerCase()] = v; - } - else { - 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 - z[k] = v; - if(!skip_LC) z[k.toLowerCase()] = v; - } - } - return z; -} -function strip_ns(x/*:string*/)/*:string*/ { return x.replace(nsregex2, "<$1"); } - -var encodings = { - '"': '"', - ''': "'", - '>': '>', - '<': '<', - '&': '&' -}; -var rencoding = evert(encodings); -//var rencstr = "&<>'\"".split(""); - -// TODO: CP remap (need to read file version to determine OS) -var unescapexml/*:StringConv*/ = (function() { - /* 22.4.2.4 bstr (Basic String) */ - var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig; - return function unescapexml(text/*:string*/)/*:string*/ { - var s = text + '', i = s.indexOf("-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));}); - var j = s.indexOf("]]>"); - return unescapexml(s.slice(0, i)) + s.slice(i+9,j) + unescapexml(s.slice(j+3)); - }; -})(); - -var decregex=/[&<>'"]/g, charegex = /[\u0000-\u0008\u000b-\u001f]/g; -function escapexml(text/*:string*/)/*:string*/{ - var s = text + ''; - return s.replace(decregex, function(y) { return rencoding[y]; }).replace(charegex,function(s) { return "_x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + "_";}); -} -function escapexmltag(text/*:string*/)/*:string*/{ return escapexml(text).replace(/ /g,"_x0020_"); } - -var htmlcharegex = /[\u0000-\u001f]/g; -function escapehtml(text/*:string*/)/*:string*/{ - var s = text + ''; - return s.replace(decregex, function(y) { return rencoding[y]; }).replace(/\n/g, "
").replace(htmlcharegex,function(s) { return "&#x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + ";"; }); -} - -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() + ";"; }); -} - -/* TODO: handle codepages */ -var xlml_fixstr/*:StringConv*/ = (function() { - var entregex = /&#(\d+);/g; - function entrepl($$/*:string*/,$1/*:string*/)/*:string*/ { return String.fromCharCode(parseInt($1,10)); } - return function xlml_fixstr(str/*:string*/)/*:string*/ { return str.replace(entregex,entrepl); }; -})(); -var xlml_unfixstr/*:StringConv*/ = (function() { - return function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); }; -})(); - -function parsexmlbool(value/*:any*/)/*:boolean*/ { - switch(value) { - case 1: case true: case '1': case 'true': case 'TRUE': return true; - /* case '0': case 'false': case 'FALSE':*/ - default: return false; - } -} - -var utf8read/*:StringConv*/ = function utf8reada(orig/*:string*/)/*:string*/ { - var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0; - while (i < orig.length) { - c = orig.charCodeAt(i++); - if (c < 128) { out += String.fromCharCode(c); continue; } - d = orig.charCodeAt(i++); - if (c>191 && c<224) { f = ((c & 31) << 6); f |= (d & 63); out += String.fromCharCode(f); continue; } - 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)); - } - return out; -}; - -var utf8write/*:StringConv*/ = function(orig/*:string*/)/*:string*/ { - var out/*:Array*/ = [], i = 0, c = 0, d = 0; - 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(""); -}; - -if(has_buf) { - var utf8readb = function utf8readb(data) { - var out = Buffer.alloc(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'); - }; - var corpus = "foo bar baz\u00e2\u0098\u0083\u00f0\u009f\u008d\u00a3"; - if(utf8read(corpus) == utf8readb(corpus)) utf8read = utf8readb; - var utf8readc = function utf8readc(data) { return Buffer_from(data, 'binary').toString('utf8'); }; - if(utf8read(corpus) == utf8readc(corpus)) utf8read = utf8readc; - - utf8write = function(data) { return Buffer_from(data, 'utf8').toString("binary"); }; -} - -// matches ... extracts content -var matchtag = (function() { - var mtcache/*:{[k:string]:RegExp}*/ = ({}/*:any*/); - return function matchtag(f/*:string*/,g/*:?string*/)/*:RegExp*/ { - var t = f+"|"+(g||""); - if(mtcache[t]) return mtcache[t]; - return (mtcache[t] = new RegExp('<(?:\\w+:)?'+f+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)',((g||"")/*:any*/))); - }; -})(); - -var htmldecode/*:{(s:string):string}*/ = (function() { - var entities/*:Array<[RegExp, string]>*/ = [ - ['nbsp', ' '], ['middot', '·'], - ['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&'] - ].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; }); - return function htmldecode(str/*:string*/)/*:string*/ { - 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+ tags with new lines - .replace(/<\s*[bB][rR]\s*\/?>/g,"\n") - // Strip HTML elements - .replace(/<[^>]*>/g,""); - for(var i = 0; i < entities.length; ++i) o = o.replace(entities[i][0], entities[i][1]); - return o; - }; -})(); - -var vtregex = (function(){ var vt_cache = {}; - return function vt_regex(bt) { - if(vt_cache[bt] !== undefined) return vt_cache[bt]; - return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g') ); -};})(); -var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)*/ { - var h = parsexmltag(data); - - var matches/*:Array*/ = data.match(vtregex(h.baseType))||[]; - var res/*:Array*/ = []; - if(matches.length != h.size) { - if(opts.WTF) throw new Error("unexpected vector length " + matches.length + " != " + h.size); - return res; - } - matches.forEach(function(x/*:string*/) { - var v = x.replace(vtvregex,"").match(vtmregex); - if(v) res.push({v:utf8read(v[2]), t:v[1]}); - }); - return res; -} - -var wtregex = /(^\s|\s$|\n)/; -function writetag(f/*:string*/,g/*:string*/)/*:string*/ { return '<' + f + (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + ''; } - -function wxt_helper(h)/*:string*/ { return keys(h).map(function(k) { return " " + k + '="' + h[k] + '"';}).join(""); } -function writextag(f/*:string*/,g/*:?string*/,h) { return '<' + f + ((h != null) ? wxt_helper(h) : "") + ((g != null) ? (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + '';} - -function write_w3cdtf(d/*:Date*/, t/*:?boolean*/)/*:string*/ { try { return d.toISOString().replace(/\.\d*/,""); } catch(e) { if(t) throw e; } return ""; } - -function write_vt(s, xlsx/*:?boolean*/)/*:string*/ { - switch(typeof s) { - case 'string': - var o = writextag('vt:lpwstr', escapexml(s)); - if(xlsx) o = o.replace(/"/g, "_x0022_"); - return o; - case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s))); - case 'boolean': return writextag('vt:bool',s?'true':'false'); - } - if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s)); - throw new Error("Unable to serialize " + s); -} - -var XMLNS = ({ - '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' -}/*:any*/); - -XMLNS.main = [ - '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' -]; - -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', - 'mv': 'http://macVmlSchemaUri', - 'v': 'urn:schemas-microsoft-com:vml', - 'html': 'http://www.w3.org/TR/REC-html40' -}/*:any*/); -function read_double_le(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { - var s = 1 - 2 * (b[idx + 7] >>> 7); - var e = ((b[idx + 7] & 0x7f) << 4) + ((b[idx + 6] >>> 4) & 0x0f); - var m = (b[idx+6]&0x0f); - for(var i = 5; i >= 0; --i) m = m * 256 + b[idx + i]; - if(e == 0x7ff) return m == 0 ? (s * Infinity) : NaN; - if(e == 0) e = -1022; - else { e -= 1023; m += Math.pow(2,52); } - return s * Math.pow(2, e - 52) * m; -} - -function write_double_le(b/*:RawBytes|CFBlob*/, v/*:number*/, idx/*:number*/) { - var bs = ((((v < 0) || (1/v == -Infinity)) ? 1 : 0) << 7), e = 0, m = 0; - var av = bs ? (-v) : v; - if(!isFinite(av)) { e = 0x7ff; m = isNaN(v) ? 0x6969 : 0; } - else if(av == 0) e = m = 0; - else { - e = Math.floor(Math.log(av) / Math.LN2); - m = av * Math.pow(2, 52 - e); - if((e <= -1023) && (!isFinite(m) || (m < Math.pow(2,52)))) { e = -1022; } - else { m -= Math.pow(2,52); e+=1023; } - } - for(var i = 0; i <= 5; ++i, m/=256) b[idx + i] = m & 0xff; - b[idx + 6] = ((e & 0x0f) << 4) | (m & 0xf); - b[idx + 7] = (e >> 4) | bs; -} - -var __toBuffer = function(bufs/*:Array >*/)/*:RawBytes*/ { var x=[],w=10240; for(var i=0;i*/=[]; for(var i=s; i*/=[]; for(var i=s; i 0 ? __utf8(b, i+4,i+4+len-1) : "";}; -var ___lpstr = __lpstr; -var __cpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";}; -var ___cpstr = __cpstr; -var __lpwstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = 2*__readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";}; -var ___lpwstr = __lpwstr; -var __lpp4, ___lpp4; -__lpp4 = ___lpp4 = function lpp4_(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf16le(b, i+4,i+4+len) : "";}; -var __8lpp4 = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len) : "";}; -var ___8lpp4 = __8lpp4; -var __double, ___double; -__double = ___double = function(b/*:RawBytes|CFBlob*/, idx/*:number*/) { return read_double_le(b, idx);}; -var is_buf = function is_buf_a(a) { return Array.isArray(a) || (typeof Uint8Array !== "undefined" && a instanceof Uint8Array); }; - -if(has_buf/*:: && typeof Buffer !== 'undefined'*/) { - __utf16le = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/)/*:string*/ { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___utf16le(b,s,e); return b.toString('utf16le',s,e).replace(chr0,'')/*.replace(chr1,'!')*/; }; - __hexlify = function(b/*:RawBytes|CFBlob*/,s/*:number*/,l/*:number*/)/*:string*/ { return Buffer.isBuffer(b)/*:: && b instanceof Buffer*/ ? b.toString('hex',s,s+l) : ___hexlify(b,s,l); }; - __lpstr = function lpstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___lpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8',i+4,i+4+len-1) : "";}; - __cpstr = function cpstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___cpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8',i+4,i+4+len-1) : "";}; - __lpwstr = function lpwstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___lpwstr(b, i); var len = 2*b.readUInt32LE(i); return b.toString('utf16le',i+4,i+4+len-1);}; - __lpp4 = function lpp4_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf16le',i+4,i+4+len);}; - __8lpp4 = function lpp4_8b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___8lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf8',i+4,i+4+len);}; - __utf8 = function utf8_b(b/*:RawBytes|CFBlob*/, s/*:number*/, e/*:number*/) { return (Buffer.isBuffer(b)/*:: && (b instanceof Buffer)*/) ? b.toString('utf8',s,e) : ___utf8(b,s,e); }; - __toBuffer = function(bufs) { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat(bufs[0].map(function(x) { return Buffer.isBuffer(x) ? x : Buffer_from(x); })) : ___toBuffer(bufs);}; - bconcat = function(bufs) { return Buffer.concat(bufs.map(function(buf) { return Buffer.isBuffer(buf) ? buf : Buffer_from(buf); })); }; - __double = function double_(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(Buffer.isBuffer(b)/*::&& b instanceof Buffer*/) return b.readDoubleLE(i); return ___double(b,i); }; - is_buf = function is_buf_b(a) { return Buffer.isBuffer(a) || Array.isArray(a) || (typeof Uint8Array !== "undefined" && a instanceof Uint8Array); }; -} - -/* from js-xls */ -if(typeof cptable !== 'undefined') { - __utf16le = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/) { return cptable.utils.decode(1200, b.slice(s,e)).replace(chr0, ''); }; - __utf8 = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/) { return cptable.utils.decode(65001, b.slice(s,e)); }; - __lpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(current_ansi, b.slice(i+4, i+4+len-1)) : "";}; - __cpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(current_codepage, b.slice(i+4, i+4+len-1)) : "";}; - __lpwstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = 2*__readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(1200, b.slice(i+4,i+4+len-1)) : "";}; - __lpp4 = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(1200, b.slice(i+4,i+4+len)) : "";}; - __8lpp4 = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(65001, b.slice(i+4,i+4+len)) : "";}; -} - -var __readUInt8 = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return b[idx]; }; -var __readUInt16LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx+1]*(1<<8))+b[idx]; }; -var __readInt16LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { var u = (b[idx+1]*(1<<8))+b[idx]; return (u < 0x8000) ? u : ((0xffff - u + 1) * -1); }; -var __readUInt32LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return b[idx+3]*(1<<24)+(b[idx+2]<<16)+(b[idx+1]<<8)+b[idx]; }; -var __readInt32LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx+3]<<24)|(b[idx+2]<<16)|(b[idx+1]<<8)|b[idx]; }; -var __readInt32BE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx]<<24)|(b[idx+1]<<16)|(b[idx+2]<<8)|b[idx+3]; }; - -function ReadShift(size/*:number*/, t/*:?string*/)/*:number|string*/ { - var o="", oI/*:: :number = 0*/, oR, oo=[], w, vv, i, loc; - switch(t) { - case 'dbcs': - loc = this.l; - if(has_buf && Buffer.isBuffer(this)) o = this.slice(this.l, this.l+2*size).toString("utf16le"); - else for(i = 0; i < size; ++i) { o+=String.fromCharCode(__readUInt16LE(this, loc)); loc+=2; } - size *= 2; - break; - - case 'utf8': o = __utf8(this, this.l, this.l + size); break; - case 'utf16le': size *= 2; o = __utf16le(this, this.l, this.l + size); break; - - case 'wstr': - if(typeof cptable !== 'undefined') o = cptable.utils.decode(current_codepage, this.slice(this.l, this.l+2*size)); - else return ReadShift.call(this, size, 'dbcs'); - size = 2 * size; break; - - /* [MS-OLEDS] 2.1.4 LengthPrefixedAnsiString */ - case 'lpstr-ansi': o = __lpstr(this, this.l); size = 4 + __readUInt32LE(this, this.l); break; - case 'lpstr-cp': o = __cpstr(this, this.l); size = 4 + __readUInt32LE(this, this.l); break; - /* [MS-OLEDS] 2.1.5 LengthPrefixedUnicodeString */ - case 'lpwstr': o = __lpwstr(this, this.l); size = 4 + 2 * __readUInt32LE(this, this.l); break; - /* [MS-OFFCRYPTO] 2.1.2 Length-Prefixed Padded Unicode String (UNICODE-LP-P4) */ - case 'lpp4': size = 4 + __readUInt32LE(this, this.l); o = __lpp4(this, this.l); if(size & 0x02) size += 2; break; - /* [MS-OFFCRYPTO] 2.1.3 Length-Prefixed UTF-8 String (UTF-8-LP-P4) */ - case '8lpp4': size = 4 + __readUInt32LE(this, this.l); o = __8lpp4(this, this.l); if(size & 0x03) size += 4 - (size & 0x03); break; - - case 'cstr': size = 0; o = ""; - while((w=__readUInt8(this, this.l + size++))!==0) oo.push(_getchar(w)); - o = oo.join(""); break; - case '_wstr': size = 0; o = ""; - while((w=__readUInt16LE(this,this.l +size))!==0){oo.push(_getchar(w));size+=2;} - size+=2; o = oo.join(""); break; - - /* sbcs and dbcs support continue records in the SST way TODO codepages */ - case 'dbcs-cont': o = ""; loc = this.l; - for(i = 0; i < size; ++i) { - if(this.lens && this.lens.indexOf(loc) !== -1) { - w = __readUInt8(this, loc); - this.l = loc + 1; - vv = ReadShift.call(this, size-i, w ? 'dbcs-cont' : 'sbcs-cont'); - return oo.join("") + vv; - } - oo.push(_getchar(__readUInt16LE(this, loc))); - loc+=2; - } o = oo.join(""); size *= 2; break; - - case 'cpstr': - if(typeof cptable !== 'undefined') { - o = cptable.utils.decode(current_codepage, this.slice(this.l, this.l + size)); - break; - } - /* falls through */ - case 'sbcs-cont': o = ""; loc = this.l; - for(i = 0; i != size; ++i) { - if(this.lens && this.lens.indexOf(loc) !== -1) { - w = __readUInt8(this, loc); - this.l = loc + 1; - vv = ReadShift.call(this, size-i, w ? 'dbcs-cont' : 'sbcs-cont'); - return oo.join("") + vv; - } - oo.push(_getchar(__readUInt8(this, loc))); - loc+=1; - } o = oo.join(""); break; - - default: - switch(size) { - case 1: oI = __readUInt8(this, this.l); this.l++; return oI; - case 2: oI = (t === 'i' ? __readInt16LE : __readUInt16LE)(this, this.l); this.l += 2; return oI; - case 4: case -4: - if(t === 'i' || ((this[this.l+3] & 0x80)===0)) { oI = ((size > 0) ? __readInt32LE : __readInt32BE)(this, this.l); this.l += 4; return oI; } - else { oR = __readUInt32LE(this, this.l); this.l += 4; } return oR; - case 8: case -8: - if(t === 'f') { - if(size == 8) oR = __double(this, this.l); - else oR = __double([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]], 0); - this.l += 8; return oR; - } else size = 8; - /* falls through */ - case 16: o = __hexlify(this, this.l, size); break; - }} - this.l+=size; return o; -} - -var __writeUInt32LE = function(b/*:RawBytes|CFBlob*/, val/*:number*/, idx/*:number*/)/*:void*/ { b[idx] = (val & 0xFF); b[idx+1] = ((val >>> 8) & 0xFF); b[idx+2] = ((val >>> 16) & 0xFF); b[idx+3] = ((val >>> 24) & 0xFF); }; -var __writeInt32LE = function(b/*:RawBytes|CFBlob*/, val/*:number*/, idx/*:number*/)/*:void*/ { b[idx] = (val & 0xFF); b[idx+1] = ((val >> 8) & 0xFF); b[idx+2] = ((val >> 16) & 0xFF); b[idx+3] = ((val >> 24) & 0xFF); }; -var __writeUInt16LE = function(b/*:RawBytes|CFBlob*/, val/*:number*/, idx/*:number*/)/*:void*/ { b[idx] = (val & 0xFF); b[idx+1] = ((val >>> 8) & 0xFF); }; - -function WriteShift(t/*:number*/, val/*:string|number*/, f/*:?string*/)/*:any*/ { - var size = 0, i = 0; - if(f === 'dbcs') { - /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ - for(i = 0; i != val.length; ++i) __writeUInt16LE(this, val.charCodeAt(i), this.l + 2 * i); - size = 2 * val.length; - } else if(f === 'sbcs') { - if(typeof cptable !== 'undefined' && current_ansi == 874) { - /* TODO: use tables directly, don't encode */ - /*:: if(typeof val !== "string") throw new Error("unreachable"); */ - for(i = 0; i != val.length; ++i) { - var cppayload = cptable.utils.encode(current_ansi, val.charAt(i)); - this[this.l + i] = cppayload[0]; - } - } else { - /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ - val = val.replace(/[^\x00-\x7F]/g, "_"); - /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ - for(i = 0; i != val.length; ++i) this[this.l + i] = (val.charCodeAt(i) & 0xFF); - } - size = val.length; - } else if(f === 'hex') { - for(; i < t; ++i) { - /*:: if(typeof val !== "string") throw new Error("unreachable"); */ - this[this.l++] = (parseInt(val.slice(2*i, 2*i+2), 16)||0); - } return this; - } else if(f === 'utf16le') { - /*:: if(typeof val !== "string") throw new Error("unreachable"); */ - var end/*:number*/ = Math.min(this.l + t, this.length); - for(i = 0; i < Math.min(val.length, t); ++i) { - var cc = val.charCodeAt(i); - this[this.l++] = (cc & 0xff); - this[this.l++] = (cc >> 8); - } - while(this.l < end) this[this.l++] = 0; - return this; - } else /*:: if(typeof val === 'number') */ switch(t) { - case 1: size = 1; this[this.l] = val&0xFF; break; - case 2: size = 2; this[this.l] = val&0xFF; val >>>= 8; this[this.l+1] = val&0xFF; break; - case 3: size = 3; this[this.l] = val&0xFF; val >>>= 8; this[this.l+1] = val&0xFF; val >>>= 8; this[this.l+2] = val&0xFF; break; - case 4: size = 4; __writeUInt32LE(this, val, this.l); break; - case 8: size = 8; if(f === 'f') { write_double_le(this, val, this.l); break; } - /* falls through */ - case 16: break; - case -4: size = 4; __writeInt32LE(this, val, this.l); break; - } - this.l += size; return this; -} - -function CheckField(hexstr/*:string*/, fld/*:string*/)/*:void*/ { - var m = __hexlify(this,this.l,hexstr.length>>1); - if(m !== hexstr) throw new Error(fld + 'Expected ' + hexstr + ' saw ' + m); - this.l += hexstr.length>>1; -} - -function prep_blob(blob, pos/*:number*/)/*:void*/ { - blob.l = pos; - blob.read_shift = /*::(*/ReadShift/*:: :any)*/; - blob.chk = CheckField; - blob.write_shift = WriteShift; -} - -function parsenoop(blob, length/*:: :number, opts?:any */) { blob.l += length; } - -function new_buf(sz/*:number*/)/*:Block*/ { - var o = new_raw_buf(sz); - prep_blob(o, 0); - return o; -} - -/* [MS-XLSB] 2.1.4 Record */ -function recordhopper(data, cb/*:RecordHopperCB*/, opts/*:?any*/) { - if(!data) return; - var tmpbyte, cntbyte, length; - prep_blob(data, data.l || 0); - var L = data.length, RT = 0, tgt = 0; - while(data.l < L) { - RT = data.read_shift(1); - if(RT & 0x80) RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F)<<7); - var R = XLSBRecordEnum[RT] || XLSBRecordEnum[0xFFFF]; - tmpbyte = data.read_shift(1); - length = tmpbyte & 0x7F; - for(cntbyte = 1; cntbyte <4 && (tmpbyte & 0x80); ++cntbyte) length += ((tmpbyte = data.read_shift(1)) & 0x7F)<<(7*cntbyte); - tgt = data.l + length; - var d = R.f && R.f(data, length, opts); - data.l = tgt; - if(cb(d, R.n, RT)) return; - } -} - -/* control buffer usage for fixed-length buffers */ -function buf_array()/*:BufArray*/ { - var bufs/*:Array*/ = [], blksz = has_buf ? 256 : 2048; - var newblk = function ba_newblk(sz/*:number*/)/*:Block*/ { - var o/*:Block*/ = (new_buf(sz)/*:any*/); - prep_blob(o, 0); - return o; - }; - - var curbuf/*:Block*/ = newblk(blksz); - - var endbuf = function ba_endbuf() { - if(!curbuf) return; - if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; } - if(curbuf.length > 0) bufs.push(curbuf); - curbuf = null; - }; - - var next = function ba_next(sz/*:number*/)/*:Block*/ { - if(curbuf && (sz < (curbuf.length - curbuf.l))) return curbuf; - endbuf(); - return (curbuf = newblk(Math.max(sz+1, blksz))); - }; - - var end = function ba_end() { - endbuf(); - return bconcat(bufs); - }; - - var push = function ba_push(buf) { endbuf(); curbuf = buf; if(curbuf.l == null) curbuf.l = curbuf.length; next(blksz); }; - - return ({ next:next, push:push, end:end, _bufs:bufs }/*:any*/); -} - -function write_record(ba/*:BufArray*/, type/*:string*/, payload, length/*:?number*/) { - var t/*:number*/ = +XLSBRE[type], l; - if(isNaN(t)) return; // TODO: throw something here? - if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0; - l = 1 + (t >= 0x80 ? 1 : 0) + 1/* + length*/; - if(length >= 0x80) ++l; if(length >= 0x4000) ++l; if(length >= 0x200000) ++l; - var o = ba.next(l); - if(t <= 0x7F) o.write_shift(1, t); - else { - o.write_shift(1, (t & 0x7F) + 0x80); - o.write_shift(1, (t >> 7)); - } - for(var i = 0; i != 4; ++i) { - if(length >= 0x80) { o.write_shift(1, (length & 0x7F)+0x80); length >>= 7; } - else { o.write_shift(1, length); break; } - } - if(/*:: length != null &&*/length > 0 && is_buf(payload)) ba.push(payload); -} -/* XLS ranges enforced */ -function shift_cell_xls(cell/*:CellAddress*/, tgt/*:any*/, opts/*:?any*/)/*:CellAddress*/ { - var out = dup(cell); - if(tgt.s) { - if(out.cRel) out.c += tgt.s.c; - if(out.rRel) out.r += tgt.s.r; - } else { - if(out.cRel) out.c += tgt.c; - if(out.rRel) out.r += tgt.r; - } - if(!opts || opts.biff < 12) { - while(out.c >= 0x100) out.c -= 0x100; - while(out.r >= 0x10000) out.r -= 0x10000; - } - return out; -} - -function shift_range_xls(cell, range, opts) { - var out = dup(cell); - out.s = shift_cell_xls(out.s, range.s, opts); - out.e = shift_cell_xls(out.e, range.s, opts); - return out; -} - -function encode_cell_xls(c/*:CellAddress*/, biff/*:number*/)/*:string*/ { - if(c.cRel && c.c < 0) { c = dup(c); while(c.c < 0) c.c += (biff > 8) ? 0x4000 : 0x100; } - if(c.rRel && c.r < 0) { c = dup(c); while(c.r < 0) c.r += (biff > 8) ? 0x100000 : ((biff > 5) ? 0x10000 : 0x4000); } - var s = encode_cell(c); - if(!c.cRel && c.cRel != null) s = fix_col(s); - if(!c.rRel && c.rRel != null) s = fix_row(s); - return s; -} - -function encode_range_xls(r, opts)/*:string*/ { - if(r.s.r == 0 && !r.s.rRel) { - if(r.e.r == (opts.biff >= 12 ? 0xFFFFF : (opts.biff >= 8 ? 0x10000 : 0x4000)) && !r.e.rRel) { - return (r.s.cRel ? "" : "$") + encode_col(r.s.c) + ":" + (r.e.cRel ? "" : "$") + encode_col(r.e.c); - } - } - if(r.s.c == 0 && !r.s.cRel) { - if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) { - return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r); - } - } - return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff); -} -function decode_row(rowstr/*:string*/)/*:number*/ { return parseInt(unfix_row(rowstr),10) - 1; } -function encode_row(row/*:number*/)/*:string*/ { return "" + (row + 1); } -function fix_row(cstr/*:string*/)/*:string*/ { return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2"); } -function unfix_row(cstr/*:string*/)/*:string*/ { return cstr.replace(/\$(\d+)$/,"$1"); } - -function decode_col(colstr/*:string*/)/*:number*/ { var c = unfix_col(colstr), d = 0, i = 0; for(; i !== c.length; ++i) d = 26*d + c.charCodeAt(i) - 64; return d - 1; } -function encode_col(col/*:number*/)/*:string*/ { if(col < 0) throw new Error("invalid column " + col); var s=""; for(++col; col; col=Math.floor((col-1)/26)) s = String.fromCharCode(((col-1)%26) + 65) + s; return s; } -function fix_col(cstr/*:string*/)/*:string*/ { return cstr.replace(/^([A-Z])/,"$$$1"); } -function unfix_col(cstr/*:string*/)/*:string*/ { return cstr.replace(/^\$([A-Z])/,"$1"); } - -function split_cell(cstr/*:string*/)/*:Array*/ { return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(","); } -//function decode_cell(cstr/*:string*/)/*:CellAddress*/ { var splt = split_cell(cstr); return { c:decode_col(splt[0]), r:decode_row(splt[1]) }; } -function decode_cell(cstr/*:string*/)/*:CellAddress*/ { - var R = 0, C = 0; - for(var i = 0; i < cstr.length; ++i) { - var cc = cstr.charCodeAt(i); - if(cc >= 48 && cc <= 57) R = 10 * R + (cc - 48); - else if(cc >= 65 && cc <= 90) C = 26 * C + (cc - 64); - } - return { c: C - 1, r:R - 1 }; -} -//function encode_cell(cell/*:CellAddress*/)/*:string*/ { return encode_col(cell.c) + encode_row(cell.r); } -function encode_cell(cell/*:CellAddress*/)/*:string*/ { - var col = cell.c + 1; - var s=""; - for(; col; col=((col-1)/26)|0) s = String.fromCharCode(((col-1)%26) + 65) + s; - return s + (cell.r + 1); -} -function decode_range(range/*:string*/)/*:Range*/ { - var idx = range.indexOf(":"); - if(idx == -1) return { s: decode_cell(range), e: decode_cell(range) }; - return { s: decode_cell(range.slice(0, idx)), e: decode_cell(range.slice(idx + 1)) }; -} -/*# if only one arg, it is assumed to be a Range. If 2 args, both are cell addresses */ -function encode_range(cs/*:CellAddrSpec|Range*/,ce/*:?CellAddrSpec*/)/*:string*/ { - if(typeof ce === 'undefined' || typeof ce === 'number') { -/*:: if(!(cs instanceof Range)) throw "unreachable"; */ - return encode_range(cs.s, cs.e); - } -/*:: if((cs instanceof Range)) throw "unreachable"; */ - if(typeof cs !== 'string') cs = encode_cell((cs/*:any*/)); - if(typeof ce !== 'string') ce = encode_cell((ce/*:any*/)); -/*:: if(typeof cs !== 'string') throw "unreachable"; */ -/*:: if(typeof ce !== 'string') throw "unreachable"; */ - return cs == ce ? cs : cs + ":" + ce; -} - -function safe_decode_range(range/*:string*/)/*:Range*/ { - var o = {s:{c:0,r:0},e:{c:0,r:0}}; - var idx = 0, i = 0, cc = 0; - var len = range.length; - for(idx = 0; i < len; ++i) { - if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break; - idx = 26*idx + cc; - } - o.s.c = --idx; - - for(idx = 0; i < len; ++i) { - if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break; - idx = 10*idx + cc; - } - o.s.r = --idx; - - if(i === len || cc != 10) { o.e.c=o.s.c; o.e.r=o.s.r; return o; } - ++i; - - for(idx = 0; i != len; ++i) { - if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break; - idx = 26*idx + cc; - } - o.e.c = --idx; - - for(idx = 0; i != len; ++i) { - if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break; - idx = 10*idx + cc; - } - o.e.r = --idx; - return o; -} - -function safe_format_cell(cell/*:Cell*/, v/*:any*/) { - var q = (cell.t == 'd' && v instanceof Date); - if(cell.z != null) try { return (cell.w = SSF.format(cell.z, q ? datenum(v) : v)); } catch(e) { } - try { return (cell.w = SSF.format((cell.XF||{}).numFmtId||(q ? 14 : 0), q ? datenum(v) : v)); } catch(e) { return ''+v; } -} - -function format_cell(cell/*:Cell*/, v/*:any*/, o/*:any*/) { - if(cell == null || cell.t == null || cell.t == 'z') return ""; - if(cell.w !== undefined) return cell.w; - if(cell.t == 'd' && !cell.z && o && o.dateNF) cell.z = o.dateNF; - if(cell.t == "e") return BErr[cell.v] || cell.v; - if(v == undefined) return safe_format_cell(cell, cell.v); - return safe_format_cell(cell, v); -} - -function sheet_to_workbook(sheet/*:Worksheet*/, opts)/*:Workbook*/ { - var n = opts && opts.sheet ? opts.sheet : "Sheet1"; - var sheets = {}; sheets[n] = sheet; - return { SheetNames: [n], Sheets: sheets }; -} - -function sheet_add_aoa(_ws/*:?Worksheet*/, data/*:AOA*/, opts/*:?any*/)/*:Worksheet*/ { - var o = opts || {}; - var dense = _ws ? Array.isArray(_ws) : o.dense; - if(DENSE != null && dense == null) dense = DENSE; - var ws/*:Worksheet*/ = _ws || (dense ? ([]/*:any*/) : ({}/*:any*/)); - var _R = 0, _C = 0; - if(ws && o.origin != null) { - if(typeof o.origin == 'number') _R = o.origin; - else { - var _origin/*:CellAddress*/ = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; - _R = _origin.r; _C = _origin.c; - } - if(!ws["!ref"]) ws["!ref"] = "A1:A1"; - } - var range/*:Range*/ = ({s: {c:10000000, r:10000000}, e: {c:0, r:0}}/*:any*/); - if(ws['!ref']) { - var _range = safe_decode_range(ws['!ref']); - range.s.c = _range.s.c; - range.s.r = _range.s.r; - range.e.c = Math.max(range.e.c, _range.e.c); - range.e.r = Math.max(range.e.r, _range.e.r); - if(_R == -1) range.e.r = _R = _range.e.r + 1; - } - for(var R = 0; R != data.length; ++R) { - if(!data[R]) continue; - if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays"); - for(var C = 0; C != data[R].length; ++C) { - if(typeof data[R][C] === 'undefined') continue; - var cell/*:Cell*/ = ({v: data[R][C] }/*:any*/); - var __R = _R + R, __C = _C + C; - if(range.s.r > __R) range.s.r = __R; - if(range.s.c > __C) range.s.c = __C; - if(range.e.r < __R) range.e.r = __R; - if(range.e.c < __C) range.e.c = __C; - if(data[R][C] && typeof data[R][C] === 'object' && !Array.isArray(data[R][C]) && !(data[R][C] instanceof Date)) cell = data[R][C]; - else { - if(Array.isArray(cell.v)) { cell.f = data[R][C][1]; cell.v = cell.v[0]; } - if(cell.v === null) { - if(cell.f) cell.t = 'n'; - else if(o.nullError) { cell.t = 'e'; cell.v = 0; } - else if(!o.sheetStubs) continue; - else cell.t = 'z'; - } - else if(typeof cell.v === 'number') cell.t = 'n'; - else if(typeof cell.v === 'boolean') cell.t = 'b'; - else if(cell.v instanceof Date) { - cell.z = o.dateNF || SSF._table[14]; - if(o.cellDates) { cell.t = 'd'; cell.w = SSF.format(cell.z, datenum(cell.v)); } - else { cell.t = 'n'; cell.v = datenum(cell.v); cell.w = SSF.format(cell.z, cell.v); } - } - else cell.t = 's'; - } - if(dense) { - if(!ws[__R]) ws[__R] = []; - if(ws[__R][__C] && ws[__R][__C].z) cell.z = ws[__R][__C].z; - ws[__R][__C] = cell; - } else { - var cell_ref = encode_cell(({c:__C,r:__R}/*:any*/)); - if(ws[cell_ref] && ws[cell_ref].z) cell.z = ws[cell_ref].z; - ws[cell_ref] = cell; - } - } - } - if(range.s.c < 10000000) ws['!ref'] = encode_range(range); - return ws; -} -function aoa_to_sheet(data/*:AOA*/, opts/*:?any*/)/*:Worksheet*/ { return sheet_add_aoa(null, data, opts); } - -function write_UInt32LE(x/*:number*/, o) { - if (!o) o = new_buf(4); - o.write_shift(4, x); - return o; -} - -/* [MS-XLSB] 2.5.168 */ -function parse_XLWideString(data/*::, length*/)/*:string*/ { - var cchCharacters = data.read_shift(4); - return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, 'dbcs'); -} -function write_XLWideString(data/*:string*/, o) { - var _null = false; if (o == null) { _null = true; o = new_buf(4 + 2 * data.length); } - o.write_shift(4, data.length); - if (data.length > 0) o.write_shift(0, data, 'dbcs'); - return _null ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.5.91 */ -//function parse_LPWideString(data/*::, length*/)/*:string*/ { -// var cchCharacters = data.read_shift(2); -// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le"); -//} - -/* [MS-XLSB] 2.5.143 */ -function parse_StrRun(data) { - return { ich: data.read_shift(2), ifnt: data.read_shift(2) }; -} -function write_StrRun(run, o) { - if (!o) o = new_buf(4); - o.write_shift(2, run.ich || 0); - o.write_shift(2, run.ifnt || 0); - return o; -} - -/* [MS-XLSB] 2.5.121 */ -function parse_RichStr(data, length/*:number*/)/*:XLString*/ { - var start = data.l; - var flags = data.read_shift(1); - var str = parse_XLWideString(data); - var rgsStrRun = []; - var z = ({ t: str, h: str }/*:any*/); - if ((flags & 1) !== 0) { /* fRichStr */ - /* TODO: formatted string */ - var dwSizeStrRun = data.read_shift(4); - for (var i = 0; i != dwSizeStrRun; ++i) rgsStrRun.push(parse_StrRun(data)); - z.r = rgsStrRun; - } - else z.r = [{ ich: 0, ifnt: 0 }]; - //if((flags & 2) !== 0) { /* fExtStr */ - // /* TODO: phonetic string */ - //} - data.l = start + length; - return z; -} -function write_RichStr(str/*:XLString*/, o/*:?Block*/)/*:Block*/ { - /* TODO: formatted string */ - var _null = false; if (o == null) { _null = true; o = new_buf(15 + 4 * str.t.length); } - o.write_shift(1, 0); - write_XLWideString(str.t, o); - return _null ? o.slice(0, o.l) : o; -} -/* [MS-XLSB] 2.4.328 BrtCommentText (RichStr w/1 run) */ -var parse_BrtCommentText = parse_RichStr; -function write_BrtCommentText(str/*:XLString*/, o/*:?Block*/)/*:Block*/ { - /* TODO: formatted string */ - var _null = false; if (o == null) { _null = true; o = new_buf(23 + 4 * str.t.length); } - o.write_shift(1, 1); - write_XLWideString(str.t, o); - o.write_shift(4, 1); - write_StrRun({ ich: 0, ifnt: 0 }, o); - return _null ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.5.9 */ -function parse_XLSBCell(data)/*:any*/ { - var col = data.read_shift(4); - var iStyleRef = data.read_shift(2); - iStyleRef += data.read_shift(1) << 16; - data.l++; //var fPhShow = data.read_shift(1); - return { c: col, iStyleRef: iStyleRef }; -} -function write_XLSBCell(cell/*:any*/, o/*:?Block*/) { - if (o == null) o = new_buf(8); - o.write_shift(-4, cell.c); - o.write_shift(3, cell.iStyleRef || cell.s); - o.write_shift(1, 0); /* fPhShow */ - return o; -} - -/* Short XLSB Cell does not include column */ -function parse_XLSBShortCell(data)/*:any*/ { - var iStyleRef = data.read_shift(2); - iStyleRef += data.read_shift(1) <<16; - data.l++; //var fPhShow = data.read_shift(1); - return { c:-1, iStyleRef: iStyleRef }; -} -function write_XLSBShortCell(cell/*:any*/, o/*:?Block*/) { - if(o == null) o = new_buf(4); - o.write_shift(3, cell.iStyleRef || cell.s); - o.write_shift(1, 0); /* fPhShow */ - return o; -} - -/* [MS-XLSB] 2.5.21 */ -var parse_XLSBCodeName = parse_XLWideString; -var write_XLSBCodeName = write_XLWideString; - -/* [MS-XLSB] 2.5.166 */ -function parse_XLNullableWideString(data/*::, length*/)/*:string*/ { - var cchCharacters = data.read_shift(4); - return cchCharacters === 0 || cchCharacters === 0xFFFFFFFF ? "" : data.read_shift(cchCharacters, 'dbcs'); -} -function write_XLNullableWideString(data/*:string*/, o) { - var _null = false; if (o == null) { _null = true; o = new_buf(127); } - o.write_shift(4, data.length > 0 ? data.length : 0xFFFFFFFF); - if (data.length > 0) o.write_shift(0, data, 'dbcs'); - return _null ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.5.165 */ -var parse_XLNameWideString = parse_XLWideString; -//var write_XLNameWideString = write_XLWideString; - -/* [MS-XLSB] 2.5.114 */ -var parse_RelID = parse_XLNullableWideString; -var write_RelID = write_XLNullableWideString; - - -/* [MS-XLS] 2.5.217 ; [MS-XLSB] 2.5.122 */ -function parse_RkNumber(data)/*:number*/ { - var b = data.slice(data.l, data.l + 4); - var fX100 = (b[0] & 1), fInt = (b[0] & 2); - data.l += 4; - var RK = fInt === 0 ? __double([0, 0, 0, 0, (b[0] & 0xFC), b[1], b[2], b[3]], 0) : __readInt32LE(b, 0) >> 2; - return fX100 ? (RK / 100) : RK; -} -function write_RkNumber(data/*:number*/, o) { - if (o == null) o = new_buf(4); - var fX100 = 0, fInt = 0, d100 = data * 100; - if ((data == (data | 0)) && (data >= -(1 << 29)) && (data < (1 << 29))) { fInt = 1; } - else if ((d100 == (d100 | 0)) && (d100 >= -(1 << 29)) && (d100 < (1 << 29))) { fInt = 1; fX100 = 1; } - if (fInt) o.write_shift(-4, ((fX100 ? d100 : data) << 2) + (fX100 + 2)); - else throw new Error("unsupported RkNumber " + data); // TODO -} - - -/* [MS-XLSB] 2.5.117 RfX */ -function parse_RfX(data /*::, length*/)/*:Range*/ { - var cell/*:Range*/ = ({ s: {}, e: {} }/*:any*/); - cell.s.r = data.read_shift(4); - cell.e.r = data.read_shift(4); - cell.s.c = data.read_shift(4); - cell.e.c = data.read_shift(4); - return cell; -} -function write_RfX(r/*:Range*/, o) { - if (!o) o = new_buf(16); - o.write_shift(4, r.s.r); - o.write_shift(4, r.e.r); - o.write_shift(4, r.s.c); - o.write_shift(4, r.e.c); - return o; -} - -/* [MS-XLSB] 2.5.153 UncheckedRfX */ -var parse_UncheckedRfX = parse_RfX; -var write_UncheckedRfX = write_RfX; - -/* [MS-XLSB] 2.5.155 UncheckedSqRfX */ -//function parse_UncheckedSqRfX(data) { -// var cnt = data.read_shift(4); -// var out = []; -// for(var i = 0; i < cnt; ++i) { -// var rng = parse_UncheckedRfX(data); -// out.push(encode_range(rng)); -// } -// return out.join(","); -//} -//function write_UncheckedSqRfX(sqrfx/*:string*/) { -// var parts = sqrfx.split(/\s*,\s*/); -// var o = new_buf(4); o.write_shift(4, parts.length); -// var out = [o]; -// parts.forEach(function(rng) { -// out.push(write_UncheckedRfX(safe_decode_range(rng))); -// }); -// return bconcat(out); -//} - -/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */ -/* TODO: error checking, NaN and Infinity values are not valid Xnum */ -function parse_Xnum(data/*::, length*/) { - if(data.length - data.l < 8) throw "XLS Xnum Buffer underflow"; - return data.read_shift(8, 'f'); -} -function write_Xnum(data, o) { return (o || new_buf(8)).write_shift(8, data, 'f'); } - -/* [MS-XLSB] 2.4.324 BrtColor */ -function parse_BrtColor(data/*::, length*/) { - var out = {}; - var d = data.read_shift(1); - - //var fValidRGB = d & 1; - var xColorType = d >>> 1; - - var index = data.read_shift(1); - var nTS = data.read_shift(2, 'i'); - var bR = data.read_shift(1); - var bG = data.read_shift(1); - var bB = data.read_shift(1); - data.l++; //var bAlpha = data.read_shift(1); - - switch (xColorType) { - case 0: out.auto = 1; break; - case 1: - out.index = index; - var icv = XLSIcv[index]; - /* automatic pseudo index 81 */ - if (icv) out.rgb = rgb2Hex(icv); - break; - case 2: - /* if(!fValidRGB) throw new Error("invalid"); */ - out.rgb = rgb2Hex([bR, bG, bB]); - break; - case 3: out.theme = index; break; - } - if (nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768; - - return out; -} -function write_BrtColor(color, o) { - if (!o) o = new_buf(8); - if (!color || color.auto) { o.write_shift(4, 0); o.write_shift(4, 0); return o; } - if (color.index != null) { - o.write_shift(1, 0x02); - o.write_shift(1, color.index); - } else if (color.theme != null) { - o.write_shift(1, 0x06); - o.write_shift(1, color.theme); - } else { - o.write_shift(1, 0x05); - o.write_shift(1, 0); - } - var nTS = color.tint || 0; - if (nTS > 0) nTS *= 32767; - else if (nTS < 0) nTS *= 32768; - o.write_shift(2, nTS); - if (!color.rgb || color.theme != null) { - o.write_shift(2, 0); - o.write_shift(1, 0); - o.write_shift(1, 0); - } else { - var rgb = (color.rgb || 'FFFFFF'); - if (typeof rgb == 'number') rgb = ("000000" + rgb.toString(16)).slice(-6); - o.write_shift(1, parseInt(rgb.slice(0, 2), 16)); - o.write_shift(1, parseInt(rgb.slice(2, 4), 16)); - o.write_shift(1, parseInt(rgb.slice(4, 6), 16)); - o.write_shift(1, 0xFF); - } - return o; -} - -/* [MS-XLSB] 2.5.52 */ -function parse_FontFlags(data/*::, length, opts*/) { - var d = data.read_shift(1); - data.l++; - var out = { - fBold: d & 0x01, - fItalic: d & 0x02, - fUnderline: d & 0x04, - fStrikeout: d & 0x08, - fOutline: d & 0x10, - fShadow: d & 0x20, - fCondense: d & 0x40, - fExtend: d & 0x80 - }; - return out; -} -function write_FontFlags(font, o) { - if (!o) o = new_buf(2); - var grbit = - (font.italic ? 0x02 : 0) | - (font.strike ? 0x08 : 0) | - (font.outline ? 0x10 : 0) | - (font.shadow ? 0x20 : 0) | - (font.condense ? 0x40 : 0) | - (font.extend ? 0x80 : 0); - o.write_shift(1, grbit); - o.write_shift(1, 0); - return o; -} - -/* [MS-OLEDS] 2.3.1 and 2.3.2 */ -function parse_ClipboardFormatOrString(o, w/*:number*/)/*:string*/ { - // $FlowIgnore - var ClipFmt = { 2: "BITMAP", 3: "METAFILEPICT", 8: "DIB", 14: "ENHMETAFILE" }; - var m/*:number*/ = o.read_shift(4); - switch (m) { - case 0x00000000: return ""; - case 0xffffffff: case 0xfffffffe: return ClipFmt[o.read_shift(4)] || ""; - } - if (m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16)); - o.l -= 4; - return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr"); -} -function parse_ClipboardFormatOrAnsiString(o) { return parse_ClipboardFormatOrString(o, 1); } -function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatOrString(o, 2); } - -/* [MS-OLEPS] 2.2 PropertyType */ -//var VT_EMPTY = 0x0000; -//var VT_NULL = 0x0001; -var VT_I2 = 0x0002; -var VT_I4 = 0x0003; -//var VT_R4 = 0x0004; -//var VT_R8 = 0x0005; -//var VT_CY = 0x0006; -//var VT_DATE = 0x0007; -//var VT_BSTR = 0x0008; -//var VT_ERROR = 0x000A; -var VT_BOOL = 0x000B; -var VT_VARIANT = 0x000C; -//var VT_DECIMAL = 0x000E; -//var VT_I1 = 0x0010; -//var VT_UI1 = 0x0011; -//var VT_UI2 = 0x0012; -var VT_UI4 = 0x0013; -//var VT_I8 = 0x0014; -//var VT_UI8 = 0x0015; -//var VT_INT = 0x0016; -//var VT_UINT = 0x0017; -var VT_LPSTR = 0x001E; -//var VT_LPWSTR = 0x001F; -var VT_FILETIME = 0x0040; -var VT_BLOB = 0x0041; -//var VT_STREAM = 0x0042; -//var VT_STORAGE = 0x0043; -//var VT_STREAMED_Object = 0x0044; -//var VT_STORED_Object = 0x0045; -//var VT_BLOB_Object = 0x0046; -var VT_CF = 0x0047; -//var VT_CLSID = 0x0048; -//var VT_VERSIONED_STREAM = 0x0049; -var VT_VECTOR = 0x1000; -//var VT_ARRAY = 0x2000; - -var VT_STRING = 0x0050; // 2.3.3.1.11 VtString -var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString -var VT_CUSTOM = [VT_STRING, VT_USTR]; - -/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */ -var DocSummaryPIDDSI = { - /*::[*/0x01/*::]*/: { n: 'CodePage', t: VT_I2 }, - /*::[*/0x02/*::]*/: { n: 'Category', t: VT_STRING }, - /*::[*/0x03/*::]*/: { n: 'PresentationFormat', t: VT_STRING }, - /*::[*/0x04/*::]*/: { n: 'ByteCount', t: VT_I4 }, - /*::[*/0x05/*::]*/: { n: 'LineCount', t: VT_I4 }, - /*::[*/0x06/*::]*/: { n: 'ParagraphCount', t: VT_I4 }, - /*::[*/0x07/*::]*/: { n: 'SlideCount', t: VT_I4 }, - /*::[*/0x08/*::]*/: { n: 'NoteCount', t: VT_I4 }, - /*::[*/0x09/*::]*/: { n: 'HiddenCount', t: VT_I4 }, - /*::[*/0x0a/*::]*/: { n: 'MultimediaClipCount', t: VT_I4 }, - /*::[*/0x0b/*::]*/: { n: 'ScaleCrop', t: VT_BOOL }, - /*::[*/0x0c/*::]*/: { n: 'HeadingPairs', t: VT_VECTOR | VT_VARIANT }, - /*::[*/0x0d/*::]*/: { n: 'TitlesOfParts', t: VT_VECTOR | VT_LPSTR }, - /*::[*/0x0e/*::]*/: { n: 'Manager', t: VT_STRING }, - /*::[*/0x0f/*::]*/: { n: 'Company', t: VT_STRING }, - /*::[*/0x10/*::]*/: { n: 'LinksUpToDate', t: VT_BOOL }, - /*::[*/0x11/*::]*/: { n: 'CharacterCount', t: VT_I4 }, - /*::[*/0x13/*::]*/: { n: 'SharedDoc', t: VT_BOOL }, - /*::[*/0x16/*::]*/: { n: 'HyperlinksChanged', t: VT_BOOL }, - /*::[*/0x17/*::]*/: { n: 'AppVersion', t: VT_I4, p: 'version' }, - /*::[*/0x18/*::]*/: { n: 'DigSig', t: VT_BLOB }, - /*::[*/0x1A/*::]*/: { n: 'ContentType', t: VT_STRING }, - /*::[*/0x1B/*::]*/: { n: 'ContentStatus', t: VT_STRING }, - /*::[*/0x1C/*::]*/: { n: 'Language', t: VT_STRING }, - /*::[*/0x1D/*::]*/: { n: 'Version', t: VT_STRING }, - /*::[*/0xFF/*::]*/: {}, - /* [MS-OLEPS] 2.18 */ - /*::[*/0x80000000/*::]*/: { n: 'Locale', t: VT_UI4 }, - /*::[*/0x80000003/*::]*/: { n: 'Behavior', t: VT_UI4 }, - /*::[*/0x72627262/*::]*/: {} -}; - -/* [MS-OSHARED] 2.3.3.2.1.1 Summary Information Property Set PIDSI */ -var SummaryPIDSI = { - /*::[*/0x01/*::]*/: { n: 'CodePage', t: VT_I2 }, - /*::[*/0x02/*::]*/: { n: 'Title', t: VT_STRING }, - /*::[*/0x03/*::]*/: { n: 'Subject', t: VT_STRING }, - /*::[*/0x04/*::]*/: { n: 'Author', t: VT_STRING }, - /*::[*/0x05/*::]*/: { n: 'Keywords', t: VT_STRING }, - /*::[*/0x06/*::]*/: { n: 'Comments', t: VT_STRING }, - /*::[*/0x07/*::]*/: { n: 'Template', t: VT_STRING }, - /*::[*/0x08/*::]*/: { n: 'LastAuthor', t: VT_STRING }, - /*::[*/0x09/*::]*/: { n: 'RevNumber', t: VT_STRING }, - /*::[*/0x0A/*::]*/: { n: 'EditTime', t: VT_FILETIME }, - /*::[*/0x0B/*::]*/: { n: 'LastPrinted', t: VT_FILETIME }, - /*::[*/0x0C/*::]*/: { n: 'CreatedDate', t: VT_FILETIME }, - /*::[*/0x0D/*::]*/: { n: 'ModifiedDate', t: VT_FILETIME }, - /*::[*/0x0E/*::]*/: { n: 'PageCount', t: VT_I4 }, - /*::[*/0x0F/*::]*/: { n: 'WordCount', t: VT_I4 }, - /*::[*/0x10/*::]*/: { n: 'CharCount', t: VT_I4 }, - /*::[*/0x11/*::]*/: { n: 'Thumbnail', t: VT_CF }, - /*::[*/0x12/*::]*/: { n: 'Application', t: VT_STRING }, - /*::[*/0x13/*::]*/: { n: 'DocSecurity', t: VT_I4 }, - /*::[*/0xFF/*::]*/: {}, - /* [MS-OLEPS] 2.18 */ - /*::[*/0x80000000/*::]*/: { n: 'Locale', t: VT_UI4 }, - /*::[*/0x80000003/*::]*/: { n: 'Behavior', t: VT_UI4 }, - /*::[*/0x72627262/*::]*/: {} -}; - -var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n"); -var SummaryRE/*:{[key:string]:string}*/ = evert_key(SummaryPIDSI, "n"); - -/* [MS-XLS] 2.4.63 Country/Region codes */ -var CountryEnum = { - /*::[*/0x0001/*::]*/: "US", // United States - /*::[*/0x0002/*::]*/: "CA", // Canada - /*::[*/0x0003/*::]*/: "", // Latin America (except Brazil) - /*::[*/0x0007/*::]*/: "RU", // Russia - /*::[*/0x0014/*::]*/: "EG", // Egypt - /*::[*/0x001E/*::]*/: "GR", // Greece - /*::[*/0x001F/*::]*/: "NL", // Netherlands - /*::[*/0x0020/*::]*/: "BE", // Belgium - /*::[*/0x0021/*::]*/: "FR", // France - /*::[*/0x0022/*::]*/: "ES", // Spain - /*::[*/0x0024/*::]*/: "HU", // Hungary - /*::[*/0x0027/*::]*/: "IT", // Italy - /*::[*/0x0029/*::]*/: "CH", // Switzerland - /*::[*/0x002B/*::]*/: "AT", // Austria - /*::[*/0x002C/*::]*/: "GB", // United Kingdom - /*::[*/0x002D/*::]*/: "DK", // Denmark - /*::[*/0x002E/*::]*/: "SE", // Sweden - /*::[*/0x002F/*::]*/: "NO", // Norway - /*::[*/0x0030/*::]*/: "PL", // Poland - /*::[*/0x0031/*::]*/: "DE", // Germany - /*::[*/0x0034/*::]*/: "MX", // Mexico - /*::[*/0x0037/*::]*/: "BR", // Brazil - /*::[*/0x003d/*::]*/: "AU", // Australia - /*::[*/0x0040/*::]*/: "NZ", // New Zealand - /*::[*/0x0042/*::]*/: "TH", // Thailand - /*::[*/0x0051/*::]*/: "JP", // Japan - /*::[*/0x0052/*::]*/: "KR", // Korea - /*::[*/0x0054/*::]*/: "VN", // Viet Nam - /*::[*/0x0056/*::]*/: "CN", // China - /*::[*/0x005A/*::]*/: "TR", // Turkey - /*::[*/0x0069/*::]*/: "JS", // Ramastan - /*::[*/0x00D5/*::]*/: "DZ", // Algeria - /*::[*/0x00D8/*::]*/: "MA", // Morocco - /*::[*/0x00DA/*::]*/: "LY", // Libya - /*::[*/0x015F/*::]*/: "PT", // Portugal - /*::[*/0x0162/*::]*/: "IS", // Iceland - /*::[*/0x0166/*::]*/: "FI", // Finland - /*::[*/0x01A4/*::]*/: "CZ", // Czech Republic - /*::[*/0x0376/*::]*/: "TW", // Taiwan - /*::[*/0x03C1/*::]*/: "LB", // Lebanon - /*::[*/0x03C2/*::]*/: "JO", // Jordan - /*::[*/0x03C3/*::]*/: "SY", // Syria - /*::[*/0x03C4/*::]*/: "IQ", // Iraq - /*::[*/0x03C5/*::]*/: "KW", // Kuwait - /*::[*/0x03C6/*::]*/: "SA", // Saudi Arabia - /*::[*/0x03CB/*::]*/: "AE", // United Arab Emirates - /*::[*/0x03CC/*::]*/: "IL", // Israel - /*::[*/0x03CE/*::]*/: "QA", // Qatar - /*::[*/0x03D5/*::]*/: "IR", // Iran - /*::[*/0xFFFF/*::]*/: "US" // United States -}; - -/* [MS-XLS] 2.5.127 */ -var XLSFillPattern = [ - null, - 'solid', - 'mediumGray', - 'darkGray', - 'lightGray', - 'darkHorizontal', - 'darkVertical', - 'darkDown', - 'darkUp', - 'darkGrid', - 'darkTrellis', - 'lightHorizontal', - 'lightVertical', - 'lightDown', - 'lightUp', - 'lightGrid', - 'lightTrellis', - 'gray125', - 'gray0625' -]; - -function rgbify(arr/*:Array*/)/*:Array<[number, number, number]>*/ { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); } - -/* [MS-XLS] 2.5.161 */ -/* [MS-XLSB] 2.5.75 Icv */ -var _XLSIcv = rgbify([ - /* Color Constants */ - 0x000000, - 0xFFFFFF, - 0xFF0000, - 0x00FF00, - 0x0000FF, - 0xFFFF00, - 0xFF00FF, - 0x00FFFF, - - /* Overridable Defaults */ - 0x000000, - 0xFFFFFF, - 0xFF0000, - 0x00FF00, - 0x0000FF, - 0xFFFF00, - 0xFF00FF, - 0x00FFFF, - - 0x800000, - 0x008000, - 0x000080, - 0x808000, - 0x800080, - 0x008080, - 0xC0C0C0, - 0x808080, - 0x9999FF, - 0x993366, - 0xFFFFCC, - 0xCCFFFF, - 0x660066, - 0xFF8080, - 0x0066CC, - 0xCCCCFF, - - 0x000080, - 0xFF00FF, - 0xFFFF00, - 0x00FFFF, - 0x800080, - 0x800000, - 0x008080, - 0x0000FF, - 0x00CCFF, - 0xCCFFFF, - 0xCCFFCC, - 0xFFFF99, - 0x99CCFF, - 0xFF99CC, - 0xCC99FF, - 0xFFCC99, - - 0x3366FF, - 0x33CCCC, - 0x99CC00, - 0xFFCC00, - 0xFF9900, - 0xFF6600, - 0x666699, - 0x969696, - 0x003366, - 0x339966, - 0x003300, - 0x333300, - 0x993300, - 0x993366, - 0x333399, - 0x333333, - - /* Other entries to appease BIFF8/12 */ - 0xFFFFFF, /* 0x40 icvForeground ?? */ - 0x000000, /* 0x41 icvBackground ?? */ - 0x000000, /* 0x42 icvFrame ?? */ - 0x000000, /* 0x43 icv3D ?? */ - 0x000000, /* 0x44 icv3DText ?? */ - 0x000000, /* 0x45 icv3DHilite ?? */ - 0x000000, /* 0x46 icv3DShadow ?? */ - 0x000000, /* 0x47 icvHilite ?? */ - 0x000000, /* 0x48 icvCtlText ?? */ - 0x000000, /* 0x49 icvCtlScrl ?? */ - 0x000000, /* 0x4A icvCtlInv ?? */ - 0x000000, /* 0x4B icvCtlBody ?? */ - 0x000000, /* 0x4C icvCtlFrame ?? */ - 0x000000, /* 0x4D icvCtlFore ?? */ - 0x000000, /* 0x4E icvCtlBack ?? */ - 0x000000, /* 0x4F icvCtlNeutral */ - 0x000000, /* 0x50 icvInfoBk ?? */ - 0x000000 /* 0x51 icvInfoText ?? */ -]); -var XLSIcv = dup(_XLSIcv); - -/* [MS-XLSB] 2.5.97.2 */ -var BErr = { - /*::[*/0x00/*::]*/: "#NULL!", - /*::[*/0x07/*::]*/: "#DIV/0!", - /*::[*/0x0F/*::]*/: "#VALUE!", - /*::[*/0x17/*::]*/: "#REF!", - /*::[*/0x1D/*::]*/: "#NAME?", - /*::[*/0x24/*::]*/: "#NUM!", - /*::[*/0x2A/*::]*/: "#N/A", - /*::[*/0x2B/*::]*/: "#GETTING_DATA", - /*::[*/0xFF/*::]*/: "#WTF?" -}; -var RBErr = evert_num(BErr); -/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */ -/* 12.3 Part Summary */ -/* 14.2 Part Summary */ -/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */ -var ct2type/*{[string]:string}*/ = ({ - /* Workbook */ - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks", - - /* Worksheet */ - "application/vnd.ms-excel.binIndexWs": "TODO", /* Binary Index */ - - /* Macrosheet */ - "application/vnd.ms-excel.intlmacrosheet": "TODO", - "application/vnd.ms-excel.binIndexMs": "TODO", /* Binary Index */ - - /* File Properties */ - "application/vnd.openxmlformats-package.core-properties+xml": "coreprops", - "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops", - "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops", - - /* Custom Data Properties */ - "application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO", - - /* PivotTable */ - "application/vnd.ms-excel.pivotTable": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO", - - /* Chart Objects */ - "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": "TODO", - - /* Chart Colors */ - "application/vnd.ms-office.chartcolorstyle+xml": "TODO", - - /* Chart Style */ - "application/vnd.ms-office.chartstyle+xml": "TODO", - - /* Chart Advanced */ - "application/vnd.ms-office.chartex+xml": "TODO", - - /* Calculation Chain */ - "application/vnd.ms-excel.calcChain": "calcchains", - "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains", - - /* Printer Settings */ - "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings": "TODO", - - /* ActiveX */ - "application/vnd.ms-office.activeX": "TODO", - "application/vnd.ms-office.activeX+xml": "TODO", - - /* Custom Toolbars */ - "application/vnd.ms-excel.attachedToolbars": "TODO", - - /* External Data Connections */ - "application/vnd.ms-excel.connections": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": "TODO", - - /* External Links */ - "application/vnd.ms-excel.externalLink": "links", - "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links", - - /* Metadata */ - "application/vnd.ms-excel.sheetMetadata": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "TODO", - - /* PivotCache */ - "application/vnd.ms-excel.pivotCacheDefinition": "TODO", - "application/vnd.ms-excel.pivotCacheRecords": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml": "TODO", - - /* Query Table */ - "application/vnd.ms-excel.queryTable": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml": "TODO", - - /* Shared Workbook */ - "application/vnd.ms-excel.userNames": "TODO", - "application/vnd.ms-excel.revisionHeaders": "TODO", - "application/vnd.ms-excel.revisionLog": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml": "TODO", - - /* Single Cell Table */ - "application/vnd.ms-excel.tableSingleCells": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml": "TODO", - - /* Slicer */ - "application/vnd.ms-excel.slicer": "TODO", - "application/vnd.ms-excel.slicerCache": "TODO", - "application/vnd.ms-excel.slicer+xml": "TODO", - "application/vnd.ms-excel.slicerCache+xml": "TODO", - - /* Sort Map */ - "application/vnd.ms-excel.wsSortMap": "TODO", - - /* Table */ - "application/vnd.ms-excel.table": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": "TODO", - - /* Themes */ - "application/vnd.openxmlformats-officedocument.theme+xml": "themes", - - /* Theme Override */ - "application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO", - - /* Timeline */ - "application/vnd.ms-excel.Timeline+xml": "TODO", /* verify */ - "application/vnd.ms-excel.TimelineCache+xml": "TODO", /* verify */ - - /* VBA */ - "application/vnd.ms-office.vbaProject": "vba", - "application/vnd.ms-office.vbaProjectSignature": "TODO", - - /* Volatile Dependencies */ - "application/vnd.ms-office.volatileDependencies": "TODO", - "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml": "TODO", - - /* Control Properties */ - "application/vnd.ms-excel.controlproperties+xml": "TODO", - - /* Data Model */ - "application/vnd.openxmlformats-officedocument.model+data": "TODO", - - /* Survey */ - "application/vnd.ms-excel.Survey+xml": "TODO", - - /* Drawing */ - "application/vnd.openxmlformats-officedocument.drawing+xml": "drawings", - "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": "TODO", - "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml": "TODO", - "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml": "TODO", - "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml": "TODO", - "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml": "TODO", - - /* VML */ - "application/vnd.openxmlformats-officedocument.vmlDrawing": "TODO", - - "application/vnd.openxmlformats-package.relationships+xml": "rels", - "application/vnd.openxmlformats-officedocument.oleObject": "TODO", - - /* Image */ - "image/png": "TODO", - - "sheet": "js" -}/*:any*/); - -var CT_LIST = (function(){ - var o = { - workbooks: { - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", - xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml", - xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main", - xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml", - xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" - }, - strs: { /* Shared Strings */ - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", - xlsb: "application/vnd.ms-excel.sharedStrings" - }, - comments: { /* Comments */ - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", - xlsb: "application/vnd.ms-excel.comments" - }, - sheets: { /* Worksheet */ - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", - xlsb: "application/vnd.ms-excel.worksheet" - }, - charts: { /* Chartsheet */ - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", - xlsb: "application/vnd.ms-excel.chartsheet" - }, - dialogs: { /* Dialogsheet */ - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml", - xlsb: "application/vnd.ms-excel.dialogsheet" - }, - macros: { /* Macrosheet (Excel 4.0 Macros) */ - xlsx: "application/vnd.ms-excel.macrosheet+xml", - xlsb: "application/vnd.ms-excel.macrosheet" - }, - styles: { /* Styles */ - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", - xlsb: "application/vnd.ms-excel.styles" - } - }; - keys(o).forEach(function(k) { ["xlsm", "xlam"].forEach(function(v) { if(!o[k][v]) o[k][v] = o[k].xlsx; }); }); - keys(o).forEach(function(k){ keys(o[k]).forEach(function(v) { ct2type[o[k][v]] = k; }); }); - return o; -})(); - -var type2ct/*{[string]:Array}*/ = evert_arr(ct2type); - -XMLNS.CT = 'http://schemas.openxmlformats.org/package/2006/content-types'; - -function new_ct()/*:any*/ { - return ({ - workbooks:[], sheets:[], charts:[], dialogs:[], macros:[], - rels:[], strs:[], comments:[], links:[], - coreprops:[], extprops:[], custprops:[], themes:[], styles:[], - calcchains:[], vba: [], drawings: [], - TODO:[], xmlns: "" }/*:any*/); -} - -function parse_ct(data/*:?string*/) { - var ct = new_ct(); - if(!data || !data.match) return ct; - var ctext = {}; - (data.match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - switch(y[0].replace(nsregex,"<")) { - case ' 0 ? ct.calcchains[0] : ""; - ct.sst = ct.strs.length > 0 ? ct.strs[0] : ""; - ct.style = ct.styles.length > 0 ? ct.styles[0] : ""; - ct.defaults = ctext; - delete ct.calcchains; - return ct; -} - -var CTYPE_XML_ROOT = writextag('Types', null, { - 'xmlns': XMLNS.CT, - 'xmlns:xsd': XMLNS.xsd, - 'xmlns:xsi': XMLNS.xsi -}); - -var CTYPE_DEFAULTS = [ - ['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'], - /* from test files */ - ['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', type2ct.rels[0]] -].map(function(x) { - return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]}); -}); - -function write_ct(ct, opts)/*:string*/ { - var o/*:Array*/ = [], v; - o[o.length] = (XML_HEADER); - o[o.length] = (CTYPE_XML_ROOT); - o = o.concat(CTYPE_DEFAULTS); - - /* only write first instance */ - var f1 = function(w) { - if(ct[w] && ct[w].length > 0) { - v = ct[w][0]; - o[o.length] = (writextag('Override', null, { - 'PartName': (v[0] == '/' ? "":"/") + v, - 'ContentType': CT_LIST[w][opts.bookType || 'xlsx'] - })); - } - }; - - /* book type-specific */ - var f2 = function(w) { - (ct[w]||[]).forEach(function(v) { - o[o.length] = (writextag('Override', null, { - 'PartName': (v[0] == '/' ? "":"/") + v, - 'ContentType': CT_LIST[w][opts.bookType || 'xlsx'] - })); - }); - }; - - /* standard type */ - var f3 = function(t) { - (ct[t]||[]).forEach(function(v) { - o[o.length] = (writextag('Override', null, { - 'PartName': (v[0] == '/' ? "":"/") + v, - 'ContentType': type2ct[t][0] - })); - }); - }; - - f1('workbooks'); - f2('sheets'); - f2('charts'); - f3('themes'); - ['strs', 'styles'].forEach(f1); - ['coreprops', 'extprops', 'custprops'].forEach(f3); - f3('vba'); - f3('comments'); - f3('drawings'); - if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* 9.3 Relationships */ -var RELS = ({ - 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.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath", - XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing", - XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink", - CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", - CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", - VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject" -}/*:any*/); - -/* 9.3.3 Representing Relationships */ -function get_rels_path(file/*:string*/)/*:string*/ { - var n = file.lastIndexOf("/"); - return file.slice(0,n+1) + '_rels/' + file.slice(n+1) + ".rels"; -} - -function parse_rels(data/*:?string*/, currentFilePath/*:string*/) { - var rels = {"!id":{}}; - if (!data) return rels; - if (currentFilePath.charAt(0) !== '/') { - currentFilePath = '/'+currentFilePath; - } - var hash = {}; - - (data.match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - /* 9.3.2.2 OPC_Relationships */ - if (y[0] === '2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} - -var RELS_EXTERN = [RELS.HLINK, RELS.XPATH, RELS.XMISS]; -function add_rels(rels, rId/*:number*/, f, type, relobj, targetmode/*:?string*/)/*:number*/ { - if(!relobj) relobj = {}; - if(!rels['!id']) rels['!id'] = {}; - if(rId < 0) for(rId = 1; rels['!id']['rId' + rId]; ++rId){/* empty */} - relobj.Id = 'rId' + rId; - relobj.Type = type; - relobj.Target = f; - if(targetmode) relobj.TargetMode = targetmode; - else if(RELS_EXTERN.indexOf(relobj.Type) > -1) relobj.TargetMode = "External"; - if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId); - rels['!id'][relobj.Id] = relobj; - rels[('/' + relobj.Target).replace("//","/")] = relobj; - return rId; -} -/* Open Document Format for Office Applications (OpenDocument) Version 1.2 */ -/* Part 3 Section 4 Manifest File */ -var CT_ODS = "application/vnd.oasis.opendocument.spreadsheet"; -function parse_manifest(d, opts) { - var str = xlml_normalize(d); - var Rn; - var FEtag; - while((Rn = xlmlregex.exec(str))) switch(Rn[3]) { - case 'manifest': break; // 4.2 - case 'file-entry': // 4.3 - FEtag = parsexmltag(Rn[0], false); - if(FEtag.path == '/' && FEtag.type !== CT_ODS) throw new Error("This OpenDocument is not a spreadsheet"); - break; - case 'encryption-data': // 4.4 - case 'algorithm': // 4.5 - case 'start-key-generation': // 4.6 - case 'key-derivation': // 4.7 - throw new Error("Unsupported ODS Encryption"); - default: if(opts && opts.WTF) throw Rn; - } -} - -function write_manifest(manifest/*:Array >*/)/*:string*/ { - var o = [XML_HEADER]; - o.push('\n'); - o.push(' \n'); - for(var i = 0; i < manifest.length; ++i) o.push(' \n'); - o.push(''); - return o.join(""); -} - -/* Part 3 Section 6 Metadata Manifest File */ -function write_rdf_type(file/*:string*/, res/*:string*/, tag/*:?string*/) { - return [ - ' \n', - ' \n', - ' \n' - ].join(""); -} -function write_rdf_has(base/*:string*/, file/*:string*/) { - return [ - ' \n', - ' \n', - ' \n' - ].join(""); -} -function write_rdf(rdf) { - var o = [XML_HEADER]; - o.push('\n'); - for(var i = 0; i != rdf.length; ++i) { - o.push(write_rdf_type(rdf[i][0], rdf[i][1])); - o.push(write_rdf_has("",rdf[i][0])); - } - o.push(write_rdf_type("","Document", "pkg")); - o.push(''); - return o.join(""); -} -/* TODO: pull properties */ -var write_meta_ods/*:{(wb:Workbook, opts:any):string}*/ = (function() { - var payload = 'Sheet' + 'JS ' + XLSX.version + ''; - return function wmo(/*:: wb: Workbook, opts: any*/)/*:string*/ { - return payload; - }; -})(); - -/* ECMA-376 Part II 11.1 Core Properties Part */ -/* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ -var CORE_PROPS/*:Array >*/ = [ - ["cp:category", "Category"], - ["cp:contentStatus", "ContentStatus"], - ["cp:keywords", "Keywords"], - ["cp:lastModifiedBy", "LastAuthor"], - ["cp:lastPrinted", "LastPrinted"], - ["cp:revision", "RevNumber"], - ["cp:version", "Version"], - ["dc:creator", "Author"], - ["dc:description", "Comments"], - ["dc:identifier", "Identifier"], - ["dc:language", "Language"], - ["dc:subject", "Subject"], - ["dc:title", "Title"], - ["dcterms:created", "CreatedDate", 'date'], - ["dcterms:modified", "ModifiedDate", 'date'] -]; - -XMLNS.CORE_PROPS = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"; -RELS.CORE_PROPS = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties'; - -var CORE_PROPS_REGEX/*:Array*/ = (function() { - var r = new Array(CORE_PROPS.length); - for(var i = 0; i < CORE_PROPS.length; ++i) { - var f = CORE_PROPS[i]; - var g = "(?:"+ f[0].slice(0,f[0].indexOf(":")) +":)"+ f[0].slice(f[0].indexOf(":")+1); - r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)<\/" + g + ">"); - } - return r; -})(); - -function parse_core_props(data) { - var p = {}; - data = utf8read(data); - - for(var i = 0; i < CORE_PROPS.length; ++i) { - var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]); - if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]); - if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]); - } - - return p; -} - -var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, { - //'xmlns': XMLNS.CORE_PROPS, - 'xmlns:cp': XMLNS.CORE_PROPS, - 'xmlns:dc': XMLNS.dc, - 'xmlns:dcterms': XMLNS.dcterms, - 'xmlns:dcmitype': XMLNS.dcmitype, - 'xmlns:xsi': XMLNS.xsi -}); - -function cp_doit(f, g, h, o, p) { - if(p[f] != null || g == null || g === "") return; - p[f] = g; - g = escapexml(g); - o[o.length] = (h ? writextag(f,g,h) : writetag(f,g)); -} - -function write_core_props(cp, _opts) { - var opts = _opts || {}; - var o = [XML_HEADER, CORE_PROPS_XML_ROOT], p = {}; - if(!cp && !opts.Props) return o.join(""); - - if(cp) { - if(cp.CreatedDate != null) cp_doit("dcterms:created", typeof cp.CreatedDate === "string" ? cp.CreatedDate : write_w3cdtf(cp.CreatedDate, opts.WTF), {"xsi:type":"dcterms:W3CDTF"}, o, p); - if(cp.ModifiedDate != null) cp_doit("dcterms:modified", typeof cp.ModifiedDate === "string" ? cp.ModifiedDate : write_w3cdtf(cp.ModifiedDate, opts.WTF), {"xsi:type":"dcterms:W3CDTF"}, o, p); - } - - for(var i = 0; i != CORE_PROPS.length; ++i) { - var f = CORE_PROPS[i]; - var v = opts.Props && opts.Props[f[1]] != null ? opts.Props[f[1]] : cp ? cp[f[1]] : null; - if(v === true) v = "1"; - else if(v === false) v = "0"; - else if(typeof v == "number") v = String(v); - if(v != null) cp_doit(f[0], v, null, o, p); - } - if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* 15.2.12.3 Extended File Properties Part */ -/* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ -var EXT_PROPS/*:Array >*/ = [ - ["Application", "Application", "string"], - ["AppVersion", "AppVersion", "string"], - ["Company", "Company", "string"], - ["DocSecurity", "DocSecurity", "string"], - ["Manager", "Manager", "string"], - ["HyperlinksChanged", "HyperlinksChanged", "bool"], - ["SharedDoc", "SharedDoc", "bool"], - ["LinksUpToDate", "LinksUpToDate", "bool"], - ["ScaleCrop", "ScaleCrop", "bool"], - ["HeadingPairs", "HeadingPairs", "raw"], - ["TitlesOfParts", "TitlesOfParts", "raw"] -]; - -XMLNS.EXT_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"; -RELS.EXT_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'; - -var PseudoPropsPairs = [ - "Worksheets", "SheetNames", - "NamedRanges", "DefinedNames", - "Chartsheets", "ChartNames" -]; -function load_props_pairs(HP/*:string|Array>*/, TOP, props, opts) { - var v = []; - if(typeof HP == "string") v = parseVector(HP, opts); - else for(var j = 0; j < HP.length; ++j) v = v.concat(HP[j].map(function(hp) { return {v:hp}; })); - var parts = (typeof TOP == "string") ? parseVector(TOP, opts).map(function (x) { return x.v; }) : TOP; - var idx = 0, len = 0; - if(parts.length > 0) for(var i = 0; i !== v.length; i += 2) { - len = +(v[i+1].v); - switch(v[i].v) { - case "Worksheets": - case "工作表": - case "Листы": - case "أوراق العمل": - case "ワークシート": - case "גליונות עבודה": - case "Arbeitsblätter": - case "Çalışma Sayfaları": - case "Feuilles de calcul": - case "Fogli di lavoro": - case "Folhas de cálculo": - case "Planilhas": - case "Regneark": - case "Hojas de cálculo": - case "Werkbladen": - props.Worksheets = len; - props.SheetNames = parts.slice(idx, idx + len); - break; - - case "Named Ranges": - case "Rangos con nombre": - case "名前付き一覧": - case "Benannte Bereiche": - case "Navngivne områder": - props.NamedRanges = len; - props.DefinedNames = parts.slice(idx, idx + len); - break; - - case "Charts": - case "Diagramme": - props.Chartsheets = len; - props.ChartNames = parts.slice(idx, idx + len); - break; - } - idx += len; - } -} - -function parse_ext_props(data, p, opts) { - var q = {}; if(!p) p = {}; - data = utf8read(data); - - EXT_PROPS.forEach(function(f) { - var xml = (data.match(matchtag(f[0]))||[])[1]; - switch(f[2]) { - case "string": if(xml) p[f[1]] = unescapexml(xml); break; - case "bool": p[f[1]] = xml === "true"; break; - case "raw": - var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">")); - if(cur && cur.length > 0) q[f[1]] = cur[1]; - break; - } - }); - - if(q.HeadingPairs && q.TitlesOfParts) load_props_pairs(q.HeadingPairs, q.TitlesOfParts, p, opts); - - return p; -} - -var EXT_PROPS_XML_ROOT = writextag('Properties', null, { - 'xmlns': XMLNS.EXT_PROPS, - 'xmlns:vt': XMLNS.vt -}); - -function write_ext_props(cp/*::, opts*/)/*:string*/ { - var o/*:Array*/ = [], W = writextag; - if(!cp) cp = {}; - cp.Application = "SheetJS"; - o[o.length] = (XML_HEADER); - o[o.length] = (EXT_PROPS_XML_ROOT); - - EXT_PROPS.forEach(function(f) { - if(cp[f[1]] === undefined) return; - var v; - switch(f[2]) { - case 'string': v = escapexml(String(cp[f[1]])); break; - case 'bool': v = cp[f[1]] ? 'true' : 'false'; break; - } - if(v !== undefined) o[o.length] = (W(f[0], v)); - }); - - /* TODO: HeadingPairs, TitlesOfParts */ - o[o.length] = (W('HeadingPairs', W('vt:vector', W('vt:variant', 'Worksheets')+W('vt:variant', W('vt:i4', String(cp.Worksheets))), {size:2, baseType:"variant"}))); - o[o.length] = (W('TitlesOfParts', W('vt:vector', cp.SheetNames.map(function(s) { return "" + escapexml(s) + ""; }).join(""), {size: cp.Worksheets, baseType:"lpstr"}))); - if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* 15.2.12.2 Custom File Properties Part */ -XMLNS.CUST_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"; -RELS.CUST_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties'; - -var custregex = /<[^>]+>[^<]*/g; -function parse_cust_props(data/*:string*/, opts) { - var p = {}, name = ""; - var m = data.match(custregex); - if(m) for(var i = 0; i != m.length; ++i) { - var x = m[i], y = parsexmltag(x); - switch(y[0]) { - case '': name = null; break; - default: if (x.indexOf(''); - var type = toks[0].slice(4), text = toks[1]; - /* 22.4.2.32 (CT_Variant). Omit the binary types from 22.4 (Variant Types) */ - switch(type) { - case 'lpstr': case 'bstr': case 'lpwstr': - p[name] = unescapexml(text); - break; - case 'bool': - p[name] = parsexmlbool(text); - break; - case 'i1': case 'i2': case 'i4': case 'i8': case 'int': case 'uint': - p[name] = parseInt(text, 10); - break; - case 'r4': case 'r8': case 'decimal': - p[name] = parseFloat(text); - break; - case 'filetime': case 'date': - p[name] = parseDate(text); - break; - case 'cy': case 'error': - p[name] = unescapexml(text); - break; - default: - if(type.slice(-1) == '/') break; - if(opts.WTF && typeof console !== 'undefined') console.warn('Unexpected', x, type, toks); - } - } else if(x.slice(0,2) === "2){ o[o.length] = ''; o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* Common Name -> XLML Name */ -var XLMLDocPropsMap = { - Title: 'Title', - Subject: 'Subject', - Author: 'Author', - Keywords: 'Keywords', - Comments: 'Description', - LastAuthor: 'LastAuthor', - RevNumber: 'Revision', - Application: 'AppName', - /* TotalTime: 'TotalTime', */ - LastPrinted: 'LastPrinted', - CreatedDate: 'Created', - ModifiedDate: 'LastSaved', - /* Pages */ - /* Words */ - /* Characters */ - Category: 'Category', - /* PresentationFormat */ - Manager: 'Manager', - Company: 'Company', - /* Guid */ - /* HyperlinkBase */ - /* Bytes */ - /* Lines */ - /* Paragraphs */ - /* CharactersWithSpaces */ - AppVersion: 'Version', - - ContentStatus: 'ContentStatus', /* NOTE: missing from schema */ - Identifier: 'Identifier', /* NOTE: missing from schema */ - Language: 'Language' /* NOTE: missing from schema */ -}; -var evert_XLMLDPM = evert(XLMLDocPropsMap); - -function xlml_set_prop(Props, tag/*:string*/, val) { - tag = evert_XLMLDPM[tag] || tag; - Props[tag] = val; -} - -function xlml_write_docprops(Props, opts) { - var o/*:Array*/ = []; - keys(XLMLDocPropsMap).map(function(m) { - for(var i = 0; i < CORE_PROPS.length; ++i) if(CORE_PROPS[i][1] == m) return CORE_PROPS[i]; - for(i = 0; i < EXT_PROPS.length; ++i) if(EXT_PROPS[i][1] == m) return EXT_PROPS[i]; - throw m; - }).forEach(function(p) { - if(Props[p[1]] == null) return; - var m = opts && opts.Props && opts.Props[p[1]] != null ? opts.Props[p[1]] : Props[p[1]]; - switch(p[2]) { - case 'date': m = new Date(m).toISOString().replace(/\.\d*Z/,"Z"); break; - } - if(typeof m == 'number') m = String(m); - else if(m === true || m === false) { m = m ? "1" : "0"; } - else if(m instanceof Date) m = new Date(m).toISOString().replace(/\.\d*Z/,""); - o.push(writetag(XLMLDocPropsMap[p[1]] || p[1], m)); - }); - return writextag('DocumentProperties', o.join(""), {xmlns:XLMLNS.o }); -} -function xlml_write_custprops(Props, Custprops/*::, opts*/) { - var BLACKLIST = ["Worksheets","SheetNames"]; - var T = 'CustomDocumentProperties'; - var o/*:Array*/ = []; - if(Props) keys(Props).forEach(function(k) { - /*:: if(!Props) return; */ - if(!Object.prototype.hasOwnProperty.call(Props, k)) return; - for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return; - for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return; - for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return; - - var m = Props[k]; - var t = "string"; - if(typeof m == 'number') { t = "float"; m = String(m); } - else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; } - else m = String(m); - o.push(writextag(escapexmltag(k), m, {"dt:dt":t})); - }); - if(Custprops) keys(Custprops).forEach(function(k) { - /*:: if(!Custprops) return; */ - if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return; - if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return; - var m = Custprops[k]; - var t = "string"; - if(typeof m == 'number') { t = "float"; m = String(m); } - else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; } - else if(m instanceof Date) { t = "dateTime.tz"; m = m.toISOString(); } - else m = String(m); - o.push(writextag(escapexmltag(k), m, {"dt:dt":t})); - }); - return '<' + T + ' xmlns="' + XLMLNS.o + '">' + o.join("") + ''; -} -/* [MS-DTYP] 2.3.3 FILETIME */ -/* [MS-OLEDS] 2.1.3 FILETIME (Packet Version) */ -/* [MS-OLEPS] 2.8 FILETIME (Packet Version) */ -function parse_FILETIME(blob) { - var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4); - return new Date(((dwHighDateTime/1e7*Math.pow(2,32) + dwLowDateTime/1e7) - 11644473600)*1000).toISOString().replace(/\.000/,""); -} -function write_FILETIME(time/*:string|Date*/) { - var date = (typeof time == "string") ? new Date(Date.parse(time)) : time; - var t = date.getTime() / 1000 + 11644473600; - var l = t % Math.pow(2,32), h = (t - l) / Math.pow(2,32); - l *= 1e7; h *= 1e7; - var w = (l / Math.pow(2,32)) | 0; - if(w > 0) { l = l % Math.pow(2,32); h += w; } - var o = new_buf(8); o.write_shift(4, l); o.write_shift(4, h); return o; -} - -/* [MS-OSHARED] 2.3.3.1.4 Lpstr */ -function parse_lpstr(blob, type, pad/*:?number*/) { - var start = blob.l; - var str = blob.read_shift(0, 'lpstr-cp'); - if(pad) while((blob.l - start) & 3) ++blob.l; - return str; -} - -/* [MS-OSHARED] 2.3.3.1.6 Lpwstr */ -function parse_lpwstr(blob, type, pad) { - var str = blob.read_shift(0, 'lpwstr'); - if(pad) blob.l += (4 - ((str.length+1) & 3)) & 3; - return str; -} - - -/* [MS-OSHARED] 2.3.3.1.11 VtString */ -/* [MS-OSHARED] 2.3.3.1.12 VtUnalignedString */ -function parse_VtStringBase(blob, stringType, pad) { - if(stringType === 0x1F /*VT_LPWSTR*/) return parse_lpwstr(blob); - return parse_lpstr(blob, stringType, pad); -} - -function parse_VtString(blob, t/*:number*/, pad/*:?boolean*/) { return parse_VtStringBase(blob, t, pad === false ? 0: 4); } -function parse_VtUnalignedString(blob, t/*:number*/) { if(!t) throw new Error("VtUnalignedString must have positive length"); return parse_VtStringBase(blob, t, 0); } - -/* [MS-OSHARED] 2.3.3.1.7 VtVecLpwstrValue */ -function parse_VtVecLpwstrValue(blob)/*:Array*/ { - var length = blob.read_shift(4); - var ret/*:Array*/ = []; - for(var i = 0; i != length; ++i) { - var start = blob.l; - ret[i] = blob.read_shift(0, 'lpwstr').replace(chr0,''); - if((blob.l - start) & 0x02) blob.l += 2; - } - return ret; -} - -/* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue */ -function parse_VtVecUnalignedLpstrValue(blob)/*:Array*/ { - var length = blob.read_shift(4); - var ret/*:Array*/ = []; - for(var i = 0; i != length; ++i) ret[i] = blob.read_shift(0, 'lpstr-cp').replace(chr0,''); - return ret; -} - - -/* [MS-OSHARED] 2.3.3.1.13 VtHeadingPair */ -function parse_VtHeadingPair(blob) { - var start = blob.l; - var headingString = parse_TypedPropertyValue(blob, VT_USTR); - if(blob[blob.l] == 0x00 && blob[blob.l+1] == 0x00 && ((blob.l - start) & 0x02)) blob.l += 2; - var headerParts = parse_TypedPropertyValue(blob, VT_I4); - return [headingString, headerParts]; -} - -/* [MS-OSHARED] 2.3.3.1.14 VtVecHeadingPairValue */ -function parse_VtVecHeadingPairValue(blob) { - var cElements = blob.read_shift(4); - var out = []; - for(var i = 0; i < cElements / 2; ++i) out.push(parse_VtHeadingPair(blob)); - return out; -} - -/* [MS-OLEPS] 2.18.1 Dictionary (uses 2.17, 2.16) */ -function parse_dictionary(blob,CodePage) { - var cnt = blob.read_shift(4); - var dict/*:{[number]:string}*/ = ({}/*:any*/); - for(var j = 0; j != cnt; ++j) { - var pid = blob.read_shift(4); - var len = blob.read_shift(4); - dict[pid] = blob.read_shift(len, (CodePage === 0x4B0 ?'utf16le':'utf8')).replace(chr0,'').replace(chr1,'!'); - if(CodePage === 0x4B0 && (len % 2)) blob.l += 2; - } - if(blob.l & 3) blob.l = (blob.l>>2+1)<<2; - return dict; -} - -/* [MS-OLEPS] 2.9 BLOB */ -function parse_BLOB(blob) { - var size = blob.read_shift(4); - var bytes = blob.slice(blob.l,blob.l+size); - blob.l += size; - if((size & 3) > 0) blob.l += (4 - (size & 3)) & 3; - return bytes; -} - -/* [MS-OLEPS] 2.11 ClipboardData */ -function parse_ClipboardData(blob) { - // TODO - var o = {}; - o.Size = blob.read_shift(4); - //o.Format = blob.read_shift(4); - blob.l += o.Size + 3 - (o.Size - 1) % 4; - return o; -} - -/* [MS-OLEPS] 2.15 TypedPropertyValue */ -function parse_TypedPropertyValue(blob, type/*:number*/, _opts)/*:any*/ { - var t = blob.read_shift(2), ret, opts = _opts||{}; - blob.l += 2; - if(type !== VT_VARIANT) - if(t !== type && VT_CUSTOM.indexOf(type)===-1 && !((type & 0xFFFE) == 0x101E && (t & 0xFFFE) == 0x101E)) throw new Error('Expected type ' + type + ' saw ' + t); - switch(type === VT_VARIANT ? t : type) { - case 0x02 /*VT_I2*/: ret = blob.read_shift(2, 'i'); if(!opts.raw) blob.l += 2; return ret; - case 0x03 /*VT_I4*/: ret = blob.read_shift(4, 'i'); return ret; - case 0x0B /*VT_BOOL*/: return blob.read_shift(4) !== 0x0; - case 0x13 /*VT_UI4*/: ret = blob.read_shift(4); return ret; - case 0x1E /*VT_LPSTR*/: return parse_lpstr(blob, t, 4).replace(chr0,''); - case 0x1F /*VT_LPWSTR*/: return parse_lpwstr(blob); - case 0x40 /*VT_FILETIME*/: return parse_FILETIME(blob); - case 0x41 /*VT_BLOB*/: return parse_BLOB(blob); - case 0x47 /*VT_CF*/: return parse_ClipboardData(blob); - case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw).replace(chr0,''); - case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,''); - case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPairValue(blob); - case 0x101E /*VT_VECTOR|VT_LPSTR*/: - case 0x101F /*VT_VECTOR|VT_LPWSTR*/: - return t == 0x101F ? parse_VtVecLpwstrValue(blob) : parse_VtVecUnalignedLpstrValue(blob); - default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t); - } -} -function write_TypedPropertyValue(type/*:number*/, value) { - var o = new_buf(4), p = new_buf(4); - o.write_shift(4, type == 0x50 ? 0x1F : type); - switch(type) { - case 0x03 /*VT_I4*/: p.write_shift(-4, value); break; - case 0x05 /*VT_I4*/: p = new_buf(8); p.write_shift(8, value, 'f'); break; - case 0x0B /*VT_BOOL*/: p.write_shift(4, value ? 0x01 : 0x00); break; - case 0x40 /*VT_FILETIME*/: /*:: if(typeof value !== "string" && !(value instanceof Date)) throw "unreachable"; */ p = write_FILETIME(value); break; - case 0x1F /*VT_LPWSTR*/: - case 0x50 /*VT_STRING*/: - /*:: if(typeof value !== "string") throw "unreachable"; */ - p = new_buf(4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); - p.write_shift(4, value.length + 1); - p.write_shift(0, value, "dbcs"); - while(p.l != p.length) p.write_shift(1, 0); - break; - default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + value); - } - return bconcat([o, p]); -} - -/* [MS-OLEPS] 2.20 PropertySet */ -function parse_PropertySet(blob, PIDSI) { - var start_addr = blob.l; - var size = blob.read_shift(4); - var NumProps = blob.read_shift(4); - var Props = [], i = 0; - var CodePage = 0; - var Dictionary = -1, DictObj/*:{[number]:string}*/ = ({}/*:any*/); - for(i = 0; i != NumProps; ++i) { - var PropID = blob.read_shift(4); - var Offset = blob.read_shift(4); - Props[i] = [PropID, Offset + start_addr]; - } - Props.sort(function(x,y) { return x[1] - y[1]; }); - var PropH = {}; - for(i = 0; i != NumProps; ++i) { - if(blob.l !== Props[i][1]) { - var fail = true; - if(i>0 && PIDSI) switch(PIDSI[Props[i-1][0]].t) { - case 0x02 /*VT_I2*/: if(blob.l+2 === Props[i][1]) { blob.l+=2; fail = false; } break; - case 0x50 /*VT_STRING*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break; - case 0x100C /*VT_VECTOR|VT_VARIANT*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break; - } - if((!PIDSI||i==0) && blob.l <= Props[i][1]) { fail=false; blob.l = Props[i][1]; } - if(fail) throw new Error("Read Error: Expected address " + Props[i][1] + ' at ' + blob.l + ' :' + i); - } - if(PIDSI) { - var piddsi = PIDSI[Props[i][0]]; - PropH[piddsi.n] = parse_TypedPropertyValue(blob, piddsi.t, {raw:true}); - if(piddsi.p === 'version') PropH[piddsi.n] = String(PropH[piddsi.n] >> 16) + "." + ("0000" + String(PropH[piddsi.n] & 0xFFFF)).slice(-4); - if(piddsi.n == "CodePage") switch(PropH[piddsi.n]) { - case 0: PropH[piddsi.n] = 1252; - /* falls through */ - case 874: - case 932: - case 936: - case 949: - case 950: - case 1250: - case 1251: - case 1253: - case 1254: - case 1255: - case 1256: - case 1257: - case 1258: - case 10000: - case 1200: - case 1201: - case 1252: - case 65000: case -536: - case 65001: case -535: - set_cp(CodePage = (PropH[piddsi.n]>>>0) & 0xFFFF); break; - default: throw new Error("Unsupported CodePage: " + PropH[piddsi.n]); - } - } else { - if(Props[i][0] === 0x1) { - CodePage = PropH.CodePage = (parse_TypedPropertyValue(blob, VT_I2)/*:number*/); - set_cp(CodePage); - if(Dictionary !== -1) { - var oldpos = blob.l; - blob.l = Props[Dictionary][1]; - DictObj = parse_dictionary(blob,CodePage); - blob.l = oldpos; - } - } else if(Props[i][0] === 0) { - if(CodePage === 0) { Dictionary = i; blob.l = Props[i+1][1]; continue; } - DictObj = parse_dictionary(blob,CodePage); - } else { - var name = DictObj[Props[i][0]]; - var val; - /* [MS-OSHARED] 2.3.3.2.3.1.2 + PROPVARIANT */ - switch(blob[blob.l]) { - case 0x41 /*VT_BLOB*/: blob.l += 4; val = parse_BLOB(blob); break; - case 0x1E /*VT_LPSTR*/: blob.l += 4; val = parse_VtString(blob, blob[blob.l-4]).replace(/\u0000+$/,""); break; - case 0x1F /*VT_LPWSTR*/: blob.l += 4; val = parse_VtString(blob, blob[blob.l-4]).replace(/\u0000+$/,""); break; - case 0x03 /*VT_I4*/: blob.l += 4; val = blob.read_shift(4, 'i'); break; - case 0x13 /*VT_UI4*/: blob.l += 4; val = blob.read_shift(4); break; - case 0x05 /*VT_R8*/: blob.l += 4; val = blob.read_shift(8, 'f'); break; - case 0x0B /*VT_BOOL*/: blob.l += 4; val = parsebool(blob, 4); break; - case 0x40 /*VT_FILETIME*/: blob.l += 4; val = parseDate(parse_FILETIME(blob)); break; - default: throw new Error("unparsed value: " + blob[blob.l]); - } - PropH[name] = val; - } - } - } - blob.l = start_addr + size; /* step ahead to skip padding */ - return PropH; -} -var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ].concat(PseudoPropsPairs); -function guess_property_type(val/*:any*/)/*:number*/ { - switch(typeof val) { - case "boolean": return 0x0B; - case "number": return ((val|0)==val) ? 0x03 : 0x05; - case "string": return 0x1F; - case "object": if(val instanceof Date) return 0x40; break; - } - return -1; -} -function write_PropertySet(entries, RE, PIDSI) { - var hdr = new_buf(8), piao = [], prop = []; - var sz = 8, i = 0; - - var pr = new_buf(8), pio = new_buf(8); - pr.write_shift(4, 0x0002); - pr.write_shift(4, 0x04B0); - pio.write_shift(4, 0x0001); - prop.push(pr); piao.push(pio); - sz += 8 + pr.length; - - if(!RE) { - pio = new_buf(8); - pio.write_shift(4, 0); - piao.unshift(pio); - - var bufs = [new_buf(4)]; - bufs[0].write_shift(4, entries.length); - for(i = 0; i < entries.length; ++i) { - var value = entries[i][0]; - pr = new_buf(4 + 4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); - pr.write_shift(4, i+2); - pr.write_shift(4, value.length + 1); - pr.write_shift(0, value, "dbcs"); - while(pr.l != pr.length) pr.write_shift(1, 0); - bufs.push(pr); - } - pr = bconcat(bufs); - prop.unshift(pr); - sz += 8 + pr.length; - } - - for(i = 0; i < entries.length; ++i) { - if(RE && !RE[entries[i][0]]) continue; - if(XLSPSSkip.indexOf(entries[i][0]) > -1) continue; - if(entries[i][1] == null) continue; - - var val = entries[i][1], idx = 0; - if(RE) { - idx = +RE[entries[i][0]]; - var pinfo = (PIDSI/*:: || {}*/)[idx]/*:: || {} */; - if(pinfo.p == "version" && typeof val == "string") { - /*:: if(typeof val !== "string") throw "unreachable"; */ - var arr = val.split("."); - val = ((+arr[0])<<16) + ((+arr[1])||0); - } - pr = write_TypedPropertyValue(pinfo.t, val); - } else { - var T = guess_property_type(val); - if(T == -1) { T = 0x1F; val = String(val); } - pr = write_TypedPropertyValue(T, val); - } - prop.push(pr); - - pio = new_buf(8); - pio.write_shift(4, !RE ? 2+i : idx); - piao.push(pio); - - sz += 8 + pr.length; - } - - var w = 8 * (prop.length + 1); - for(i = 0; i < prop.length; ++i) { piao[i].write_shift(4, w); w += prop[i].length; } - hdr.write_shift(4, sz); - hdr.write_shift(4, prop.length); - return bconcat([hdr].concat(piao).concat(prop)); -} - -/* [MS-OLEPS] 2.21 PropertySetStream */ -function parse_PropertySetStream(file, PIDSI, clsid) { - var blob = file.content; - if(!blob) return ({}/*:any*/); - prep_blob(blob, 0); - - var NumSets, FMTID0, FMTID1, Offset0, Offset1 = 0; - blob.chk('feff', 'Byte Order: '); - - /*var vers = */blob.read_shift(2); // TODO: check version - var SystemIdentifier = blob.read_shift(4); - var CLSID = blob.read_shift(16); - if(CLSID !== CFB.utils.consts.HEADER_CLSID && CLSID !== clsid) throw new Error("Bad PropertySet CLSID " + CLSID); - NumSets = blob.read_shift(4); - if(NumSets !== 1 && NumSets !== 2) throw new Error("Unrecognized #Sets: " + NumSets); - FMTID0 = blob.read_shift(16); Offset0 = blob.read_shift(4); - - if(NumSets === 1 && Offset0 !== blob.l) throw new Error("Length mismatch: " + Offset0 + " !== " + blob.l); - else if(NumSets === 2) { FMTID1 = blob.read_shift(16); Offset1 = blob.read_shift(4); } - var PSet0 = parse_PropertySet(blob, PIDSI); - - var rval = ({ SystemIdentifier: SystemIdentifier }/*:any*/); - for(var y in PSet0) rval[y] = PSet0[y]; - //rval.blob = blob; - rval.FMTID = FMTID0; - //rval.PSet0 = PSet0; - if(NumSets === 1) return rval; - if(Offset1 - blob.l == 2) blob.l += 2; - if(blob.l !== Offset1) throw new Error("Length mismatch 2: " + blob.l + " !== " + Offset1); - var PSet1; - try { PSet1 = parse_PropertySet(blob, null); } catch(e) {/* empty */} - for(y in PSet1) rval[y] = PSet1[y]; - rval.FMTID = [FMTID0, FMTID1]; // TODO: verify FMTID0/1 - return rval; -} -function write_PropertySetStream(entries, clsid, RE, PIDSI/*:{[key:string|number]:any}*/, entries2/*:?any*/, clsid2/*:?any*/) { - var hdr = new_buf(entries2 ? 68 : 48); - var bufs = [hdr]; - hdr.write_shift(2, 0xFFFE); - hdr.write_shift(2, 0x0000); /* TODO: type 1 props */ - hdr.write_shift(4, 0x32363237); - hdr.write_shift(16, CFB.utils.consts.HEADER_CLSID, "hex"); - hdr.write_shift(4, (entries2 ? 2 : 1)); - hdr.write_shift(16, clsid, "hex"); - hdr.write_shift(4, (entries2 ? 68 : 48)); - var ps0 = write_PropertySet(entries, RE, PIDSI); - bufs.push(ps0); - - if(entries2) { - var ps1 = write_PropertySet(entries2, null, null); - hdr.write_shift(16, clsid2, "hex"); - hdr.write_shift(4, 68 + ps0.length); - bufs.push(ps1); - } - return bconcat(bufs); -} - -function parsenoop2(blob, length) { blob.read_shift(length); return null; } -function writezeroes(n, o) { if(!o) o=new_buf(n); for(var j=0; j= 12 ? 2 : 1); - var encoding = 'sbcs-cont'; - var cp = current_codepage; - if(opts && opts.biff >= 8) current_codepage = 1200; - if(!opts || opts.biff == 8 ) { - var fHighByte = blob.read_shift(1); - if(fHighByte) { encoding = 'dbcs-cont'; } - } else if(opts.biff == 12) { - encoding = 'wstr'; - } - if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr'; - var o = cch ? blob.read_shift(cch, encoding) : ""; - current_codepage = cp; - return o; -} - -/* 2.5.293 XLUnicodeRichExtendedString */ -function parse_XLUnicodeRichExtendedString(blob) { - var cp = current_codepage; - current_codepage = 1200; - var cch = blob.read_shift(2), flags = blob.read_shift(1); - var /*fHighByte = flags & 0x1,*/ fExtSt = flags & 0x4, fRichSt = flags & 0x8; - var width = 1 + (flags & 0x1); // 0x0 -> utf8, 0x1 -> dbcs - var cRun = 0, cbExtRst; - var z = {}; - if(fRichSt) cRun = blob.read_shift(2); - if(fExtSt) cbExtRst = blob.read_shift(4); - var encoding = width == 2 ? 'dbcs-cont' : 'sbcs-cont'; - var msg = cch === 0 ? "" : blob.read_shift(cch, encoding); - if(fRichSt) blob.l += 4 * cRun; //TODO: parse this - if(fExtSt) blob.l += cbExtRst; //TODO: parse this - z.t = msg; - if(!fRichSt) { z.raw = "" + z.t + ""; z.r = z.t; } - current_codepage = cp; - return z; -} -function write_XLUnicodeRichExtendedString(xlstr/*:: :XLString, opts*/) { - var str = (xlstr.t||""), nfmts = 1; - - var hdr = new_buf(3 + (nfmts > 1 ? 2 : 0)); - hdr.write_shift(2, str.length); - hdr.write_shift(1, (nfmts > 1 ? 0x08 : 0x00) | 0x01); - if(nfmts > 1) hdr.write_shift(2, nfmts); - - var otext = new_buf(2 * str.length); - otext.write_shift(2 * str.length, str, 'utf16le'); - - var out = [hdr, otext]; - - return bconcat(out); -} - -/* 2.5.296 XLUnicodeStringNoCch */ -function parse_XLUnicodeStringNoCch(blob, cch, opts) { - var retval; - if(opts) { - if(opts.biff >= 2 && opts.biff <= 5) return blob.read_shift(cch, 'cpstr'); - if(opts.biff >= 12) return blob.read_shift(cch, 'dbcs-cont'); - } - var fHighByte = blob.read_shift(1); - if(fHighByte===0) { retval = blob.read_shift(cch, 'sbcs-cont'); } - else { retval = blob.read_shift(cch, 'dbcs-cont'); } - return retval; -} - -/* 2.5.294 XLUnicodeString */ -function parse_XLUnicodeString(blob, length, opts) { - var cch = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); - if(cch === 0) { blob.l++; return ""; } - return parse_XLUnicodeStringNoCch(blob, cch, opts); -} -/* BIFF5 override */ -function parse_XLUnicodeString2(blob, length, opts) { - if(opts.biff > 5) return parse_XLUnicodeString(blob, length, opts); - var cch = blob.read_shift(1); - if(cch === 0) { blob.l++; return ""; } - return blob.read_shift(cch, (opts.biff <= 4 || !blob.lens ) ? 'cpstr' : 'sbcs-cont'); -} -/* TODO: BIFF5 and lower, codepage awareness */ -function write_XLUnicodeString(str, opts, o) { - if(!o) o = new_buf(3 + 2 * str.length); - o.write_shift(2, str.length); - o.write_shift(1, 1); - o.write_shift(31, str, 'utf16le'); - return o; -} - -/* [MS-XLS] 2.5.61 ControlInfo */ -function parse_ControlInfo(blob/*::, length, opts*/) { - var flags = blob.read_shift(1); - blob.l++; - var accel = blob.read_shift(2); - blob.l += 2; - return [flags, accel]; -} - -/* [MS-OSHARED] 2.3.7.6 URLMoniker TODO: flags */ -function parse_URLMoniker(blob/*::, length, opts*/) { - var len = blob.read_shift(4), start = blob.l; - var extra = false; - if(len > 24) { - /* look ahead */ - blob.l += len - 24; - if(blob.read_shift(16) === "795881f43b1d7f48af2c825dc4852763") extra = true; - blob.l = start; - } - var url = blob.read_shift((extra?len-24:len)>>1, 'utf16le').replace(chr0,""); - if(extra) blob.l += 24; - return url; -} - -/* [MS-OSHARED] 2.3.7.8 FileMoniker TODO: all fields */ -function parse_FileMoniker(blob/*::, length*/) { - var cAnti = blob.read_shift(2); - var preamble = ""; while(cAnti-- > 0) preamble += "../"; - var ansiPath = blob.read_shift(0, 'lpstr-ansi'); - blob.l += 2; //var endServer = blob.read_shift(2); - if(blob.read_shift(2) != 0xDEAD) throw new Error("Bad FileMoniker"); - var sz = blob.read_shift(4); - if(sz === 0) return preamble + ansiPath.replace(/\\/g,"/"); - var bytes = blob.read_shift(4); - if(blob.read_shift(2) != 3) throw new Error("Bad FileMoniker"); - var unicodePath = blob.read_shift(bytes>>1, 'utf16le').replace(chr0,""); - return preamble + unicodePath; -} - -/* [MS-OSHARED] 2.3.7.2 HyperlinkMoniker TODO: all the monikers */ -function parse_HyperlinkMoniker(blob, length) { - var clsid = blob.read_shift(16); length -= 16; - switch(clsid) { - case "e0c9ea79f9bace118c8200aa004ba90b": return parse_URLMoniker(blob, length); - case "0303000000000000c000000000000046": return parse_FileMoniker(blob, length); - default: throw new Error("Unsupported Moniker " + clsid); - } -} - -/* [MS-OSHARED] 2.3.7.9 HyperlinkString */ -function parse_HyperlinkString(blob/*::, length*/) { - var len = blob.read_shift(4); - var o = len > 0 ? blob.read_shift(len, 'utf16le').replace(chr0, "") : ""; - return o; -} -function write_HyperlinkString(str/*:string*/, o) { - if(!o) o = new_buf(6 + str.length * 2); - o.write_shift(4, 1 + str.length); - for(var i = 0; i < str.length; ++i) o.write_shift(2, str.charCodeAt(i)); - o.write_shift(2, 0); - return o; -} - -/* [MS-OSHARED] 2.3.7.1 Hyperlink Object */ -function parse_Hyperlink(blob, length)/*:Hyperlink*/ { - var end = blob.l + length; - var sVer = blob.read_shift(4); - if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer); - var flags = blob.read_shift(2); - blob.l += 2; - var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime; - if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l); - if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l); - if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l); - if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l); - if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l); - if(flags & 0x0020) guid = blob.read_shift(16); - if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/); - blob.l = end; - var target = targetFrameName||moniker||oleMoniker||""; - if(target && Loc) target+="#"+Loc; - if(!target) target = "#" + Loc; - if((flags & 0x0002) && target.charAt(0) == "/" && target.charAt(1) != "/") target = "file://" + target; - var out = ({Target:target}/*:any*/); - if(guid) out.guid = guid; - if(fileTime) out.time = fileTime; - if(displayName) out.Tooltip = displayName; - return out; -} -function write_Hyperlink(hl) { - var out = new_buf(512), i = 0; - var Target = hl.Target; - if(Target.slice(0,7) == "file://") Target = Target.slice(7); - var hashidx = Target.indexOf("#"); - var F = hashidx > -1 ? 0x1f : 0x17; - switch(Target.charAt(0)) { case "#": F=0x1c; break; case ".": F&=~2; break; } - out.write_shift(4,2); out.write_shift(4, F); - var data = [8,6815827,6619237,4849780,83]; for(i = 0; i < data.length; ++i) out.write_shift(4, data[i]); - if(F == 0x1C) { - Target = Target.slice(1); - write_HyperlinkString(Target, out); - } else if(F & 0x02) { - data = "e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); - for(i = 0; i < data.length; ++i) out.write_shift(1, parseInt(data[i], 16)); - var Pretarget = hashidx > -1 ? Target.slice(0, hashidx) : Target; - out.write_shift(4, 2*(Pretarget.length + 1)); - for(i = 0; i < Pretarget.length; ++i) out.write_shift(2, Pretarget.charCodeAt(i)); - out.write_shift(2, 0); - if(F & 0x08) write_HyperlinkString(hashidx > -1 ? Target.slice(hashidx+1): "", out); - } else { - data = "03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "); - for(i = 0; i < data.length; ++i) out.write_shift(1, parseInt(data[i], 16)); - var P = 0; - while(Target.slice(P*3,P*3+3)=="../"||Target.slice(P*3,P*3+3)=="..\\") ++P; - out.write_shift(2, P); - out.write_shift(4, Target.length - 3 * P + 1); - for(i = 0; i < Target.length - 3 * P; ++i) out.write_shift(1, Target.charCodeAt(i + 3 * P) & 0xFF); - out.write_shift(1, 0); - out.write_shift(2, 0xFFFF); - out.write_shift(2, 0xDEAD); - for(i = 0; i < 6; ++i) out.write_shift(4, 0); - } - return out.slice(0, out.l); -} - -/* 2.5.178 LongRGBA */ -function parse_LongRGBA(blob/*::, length*/) { var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1); return [r,g,b,a]; } - -/* 2.5.177 LongRGB */ -function parse_LongRGB(blob, length) { var x = parse_LongRGBA(blob, length); x[3] = 0; return x; } - - -/* [MS-XLS] 2.5.19 */ -function parse_XLSCell(blob/*::, length*/)/*:Cell*/ { - var rw = blob.read_shift(2); // 0-indexed - var col = blob.read_shift(2); - var ixfe = blob.read_shift(2); - return ({r:rw, c:col, ixfe:ixfe}/*:any*/); -} -function write_XLSCell(R/*:number*/, C/*:number*/, ixfe/*:?number*/, o) { - if(!o) o = new_buf(6); - o.write_shift(2, R); - o.write_shift(2, C); - o.write_shift(2, ixfe||0); - return o; -} - -/* [MS-XLS] 2.5.134 */ -function parse_frtHeader(blob) { - var rt = blob.read_shift(2); - var flags = blob.read_shift(2); // TODO: parse these flags - blob.l += 8; - return {type: rt, flags: flags}; -} - - - -function parse_OptXLUnicodeString(blob, length, opts) { return length === 0 ? "" : parse_XLUnicodeString2(blob, length, opts); } - -/* [MS-XLS] 2.5.344 */ -function parse_XTI(blob, length, opts) { - var w = opts.biff > 8 ? 4 : 2; - var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w,'i'), itabLast = blob.read_shift(w,'i'); - return [iSupBook, itabFirst, itabLast]; -} - -/* [MS-XLS] 2.5.218 */ -function parse_RkRec(blob) { - var ixfe = blob.read_shift(2); - var RK = parse_RkNumber(blob); - return [ixfe, RK]; -} - -/* [MS-XLS] 2.5.1 */ -function parse_AddinUdf(blob, length, opts) { - blob.l += 4; length -= 4; - var l = blob.l + length; - var udfName = parse_ShortXLUnicodeString(blob, length, opts); - var cb = blob.read_shift(2); - l -= blob.l; - if(cb !== l) throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb); - blob.l += cb; - return udfName; -} - -/* [MS-XLS] 2.5.209 TODO: Check sizes */ -function parse_Ref8U(blob/*::, length*/) { - var rwFirst = blob.read_shift(2); - var rwLast = blob.read_shift(2); - var colFirst = blob.read_shift(2); - var colLast = blob.read_shift(2); - return {s:{c:colFirst, r:rwFirst}, e:{c:colLast,r:rwLast}}; -} -function write_Ref8U(r/*:Range*/, o) { - if(!o) o = new_buf(8); - o.write_shift(2, r.s.r); - o.write_shift(2, r.e.r); - o.write_shift(2, r.s.c); - o.write_shift(2, r.e.c); - return o; -} - -/* [MS-XLS] 2.5.211 */ -function parse_RefU(blob/*::, length*/) { - var rwFirst = blob.read_shift(2); - var rwLast = blob.read_shift(2); - var colFirst = blob.read_shift(1); - var colLast = blob.read_shift(1); - return {s:{c:colFirst, r:rwFirst}, e:{c:colLast,r:rwLast}}; -} - -/* [MS-XLS] 2.5.207 */ -var parse_Ref = parse_RefU; - -/* [MS-XLS] 2.5.143 */ -function parse_FtCmo(blob/*::, length*/) { - blob.l += 4; - var ot = blob.read_shift(2); - var id = blob.read_shift(2); - var flags = blob.read_shift(2); - blob.l+=12; - return [id, ot, flags]; -} - -/* [MS-XLS] 2.5.149 */ -function parse_FtNts(blob) { - var out = {}; - blob.l += 4; - blob.l += 16; // GUID TODO - out.fSharedNote = blob.read_shift(2); - blob.l += 4; - return out; -} - -/* [MS-XLS] 2.5.142 */ -function parse_FtCf(blob) { - var out = {}; - blob.l += 4; - blob.cf = blob.read_shift(2); - return out; -} - -/* [MS-XLS] 2.5.140 - 2.5.154 and friends */ -function parse_FtSkip(blob) { blob.l += 2; blob.l += blob.read_shift(2); } -var FtTab = { - /*::[*/0x00/*::]*/: parse_FtSkip, /* FtEnd */ - /*::[*/0x04/*::]*/: parse_FtSkip, /* FtMacro */ - /*::[*/0x05/*::]*/: parse_FtSkip, /* FtButton */ - /*::[*/0x06/*::]*/: parse_FtSkip, /* FtGmo */ - /*::[*/0x07/*::]*/: parse_FtCf, /* FtCf */ - /*::[*/0x08/*::]*/: parse_FtSkip, /* FtPioGrbit */ - /*::[*/0x09/*::]*/: parse_FtSkip, /* FtPictFmla */ - /*::[*/0x0A/*::]*/: parse_FtSkip, /* FtCbls */ - /*::[*/0x0B/*::]*/: parse_FtSkip, /* FtRbo */ - /*::[*/0x0C/*::]*/: parse_FtSkip, /* FtSbs */ - /*::[*/0x0D/*::]*/: parse_FtNts, /* FtNts */ - /*::[*/0x0E/*::]*/: parse_FtSkip, /* FtSbsFmla */ - /*::[*/0x0F/*::]*/: parse_FtSkip, /* FtGboData */ - /*::[*/0x10/*::]*/: parse_FtSkip, /* FtEdoData */ - /*::[*/0x11/*::]*/: parse_FtSkip, /* FtRboData */ - /*::[*/0x12/*::]*/: parse_FtSkip, /* FtCblsData */ - /*::[*/0x13/*::]*/: parse_FtSkip, /* FtLbsData */ - /*::[*/0x14/*::]*/: parse_FtSkip, /* FtCblsFmla */ - /*::[*/0x15/*::]*/: parse_FtCmo -}; -function parse_FtArray(blob, length/*::, ot*/) { - var tgt = blob.l + length; - var fts = []; - while(blob.l < tgt) { - var ft = blob.read_shift(2); - blob.l-=2; - try { - fts.push(FtTab[ft](blob, tgt - blob.l)); - } catch(e) { blob.l = tgt; return fts; } - } - if(blob.l != tgt) blob.l = tgt; //throw new Error("bad Object Ft-sequence"); - return fts; -} - -/* --- 2.4 Records --- */ - -/* [MS-XLS] 2.4.21 */ -function parse_BOF(blob, length) { - var o = {BIFFVer:0, dt:0}; - o.BIFFVer = blob.read_shift(2); length -= 2; - if(length >= 2) { o.dt = blob.read_shift(2); blob.l -= 2; } - switch(o.BIFFVer) { - case 0x0600: /* BIFF8 */ - case 0x0500: /* BIFF5 */ - case 0x0400: /* BIFF4 */ - case 0x0300: /* BIFF3 */ - case 0x0200: /* BIFF2 */ - case 0x0002: case 0x0007: /* BIFF2 */ - break; - default: if(length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer); - } - - blob.read_shift(length); - return o; -} -function write_BOF(wb/*:Workbook*/, t/*:number*/, o) { - var h = 0x0600, w = 16; - switch(o.bookType) { - case 'biff8': break; - case 'biff5': h = 0x0500; w = 8; break; - case 'biff4': h = 0x0004; w = 6; break; - case 'biff3': h = 0x0003; w = 6; break; - case 'biff2': h = 0x0002; w = 4; break; - case 'xla': break; - default: throw new Error("unsupported BIFF version"); - } - var out = new_buf(w); - out.write_shift(2, h); - out.write_shift(2, t); - if(w > 4) out.write_shift(2, 0x7262); - if(w > 6) out.write_shift(2, 0x07CD); - if(w > 8) { - out.write_shift(2, 0xC009); - out.write_shift(2, 0x0001); - out.write_shift(2, 0x0706); - out.write_shift(2, 0x0000); - } - return out; -} - - -/* [MS-XLS] 2.4.146 */ -function parse_InterfaceHdr(blob, length) { - if(length === 0) return 0x04b0; - if((blob.read_shift(2))!==0x04b0){/* empty */} - return 0x04b0; -} - - -/* [MS-XLS] 2.4.349 */ -function parse_WriteAccess(blob, length, opts) { - if(opts.enc) { blob.l += length; return ""; } - var l = blob.l; - // TODO: make sure XLUnicodeString doesnt overrun - var UserName = parse_XLUnicodeString2(blob, 0, opts); - blob.read_shift(length + l - blob.l); - return UserName; -} -function write_WriteAccess(s/*:string*/, opts) { - var b8 = !opts || opts.biff == 8; - var o = new_buf(b8 ? 112 : 54); - o.write_shift(opts.biff == 8 ? 2 : 1, 7); - if(b8) o.write_shift(1, 0); - o.write_shift(4, 0x33336853); - o.write_shift(4, (0x00534A74 | (b8 ? 0 : 0x20000000))); - while(o.l < o.length) o.write_shift(1, (b8 ? 0 : 32)); - return o; -} - -/* [MS-XLS] 2.4.351 */ -function parse_WsBool(blob, length, opts) { - var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0); - return { fDialog: flags & 0x10, fBelow: flags & 0x40, fRight: flags & 0x80 }; -} - -/* [MS-XLS] 2.4.28 */ -function parse_BoundSheet8(blob, length, opts) { - var pos = blob.read_shift(4); - var hidden = blob.read_shift(1) & 0x03; - var dt = blob.read_shift(1); - switch(dt) { - case 0: dt = 'Worksheet'; break; - case 1: dt = 'Macrosheet'; break; - case 2: dt = 'Chartsheet'; break; - case 6: dt = 'VBAModule'; break; - } - var name = parse_ShortXLUnicodeString(blob, 0, opts); - if(name.length === 0) name = "Sheet1"; - return { pos:pos, hs:hidden, dt:dt, name:name }; -} -function write_BoundSheet8(data, opts) { - var w = (!opts || opts.biff >= 8 ? 2 : 1); - var o = new_buf(8 + w * data.name.length); - o.write_shift(4, data.pos); - o.write_shift(1, data.hs || 0); - o.write_shift(1, data.dt); - o.write_shift(1, data.name.length); - if(opts.biff >= 8) o.write_shift(1, 1); - o.write_shift(w * data.name.length, data.name, opts.biff < 8 ? 'sbcs' : 'utf16le'); - var out = o.slice(0, o.l); - out.l = o.l; return out; -} - -/* [MS-XLS] 2.4.265 TODO */ -function parse_SST(blob, length)/*:SST*/ { - var end = blob.l + length; - var cnt = blob.read_shift(4); - var ucnt = blob.read_shift(4); - var strs/*:SST*/ = ([]/*:any*/); - for(var i = 0; i != ucnt && blob.l < end; ++i) { - strs.push(parse_XLUnicodeRichExtendedString(blob)); - } - strs.Count = cnt; strs.Unique = ucnt; - return strs; -} -function write_SST(sst, opts) { - var header = new_buf(8); - header.write_shift(4, sst.Count); - header.write_shift(4, sst.Unique); - var strs = []; - for(var j = 0; j < sst.length; ++j) strs[j] = write_XLUnicodeRichExtendedString(sst[j], opts); - var o = bconcat([header].concat(strs)); - /*::(*/o/*:: :any)*/.parts = [header.length].concat(strs.map(function(str) { return str.length; })); - return o; -} - -/* [MS-XLS] 2.4.107 */ -function parse_ExtSST(blob, length) { - var extsst = {}; - extsst.dsst = blob.read_shift(2); - blob.l += length-2; - return extsst; -} - - -/* [MS-XLS] 2.4.221 TODO: check BIFF2-4 */ -function parse_Row(blob) { - var z = ({}/*:any*/); - z.r = blob.read_shift(2); - z.c = blob.read_shift(2); - z.cnt = blob.read_shift(2) - z.c; - var miyRw = blob.read_shift(2); - blob.l += 4; // reserved(2), unused(2) - var flags = blob.read_shift(1); // various flags - blob.l += 3; // reserved(8), ixfe(12), flags(4) - if(flags & 0x07) z.level = flags & 0x07; - // collapsed: flags & 0x10 - if(flags & 0x20) z.hidden = true; - if(flags & 0x40) z.hpt = miyRw / 20; - return z; -} - - -/* [MS-XLS] 2.4.125 */ -function parse_ForceFullCalculation(blob) { - var header = parse_frtHeader(blob); - if(header.type != 0x08A3) throw new Error("Invalid Future Record " + header.type); - var fullcalc = blob.read_shift(4); - return fullcalc !== 0x0; -} - - - - - -/* [MS-XLS] 2.4.215 rt */ -function parse_RecalcId(blob) { - blob.read_shift(2); - return blob.read_shift(4); -} - -/* [MS-XLS] 2.4.87 */ -function parse_DefaultRowHeight(blob, length, opts) { - var f = 0; - if(!(opts && opts.biff == 2)) { - f = blob.read_shift(2); - } - var miyRw = blob.read_shift(2); - if((opts && opts.biff == 2)) { - f = 1 - (miyRw >> 15); miyRw &= 0x7fff; - } - var fl = {Unsynced:f&1,DyZero:(f&2)>>1,ExAsc:(f&4)>>2,ExDsc:(f&8)>>3}; - return [fl, miyRw]; -} - -/* [MS-XLS] 2.4.345 TODO */ -function parse_Window1(blob) { - var xWn = blob.read_shift(2), yWn = blob.read_shift(2), dxWn = blob.read_shift(2), dyWn = blob.read_shift(2); - var flags = blob.read_shift(2), iTabCur = blob.read_shift(2), iTabFirst = blob.read_shift(2); - var ctabSel = blob.read_shift(2), wTabRatio = blob.read_shift(2); - return { Pos: [xWn, yWn], Dim: [dxWn, dyWn], Flags: flags, CurTab: iTabCur, - FirstTab: iTabFirst, Selected: ctabSel, TabRatio: wTabRatio }; -} -function write_Window1(/*::opts*/) { - var o = new_buf(18); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, 0x7260); - o.write_shift(2, 0x44c0); - o.write_shift(2, 0x38); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, 1); - o.write_shift(2, 0x01f4); - return o; -} -/* [MS-XLS] 2.4.346 TODO */ -function parse_Window2(blob, length, opts) { - if(opts && opts.biff >= 2 && opts.biff < 5) return {}; - var f = blob.read_shift(2); - return { RTL: f & 0x40 }; -} -function write_Window2(view) { - var o = new_buf(18), f = 0x6b6; - if(view && view.RTL) f |= 0x40; - o.write_shift(2, f); - o.write_shift(4, 0); - o.write_shift(4, 64); - o.write_shift(4, 0); - o.write_shift(4, 0); - return o; -} - -/* [MS-XLS] 2.4.189 TODO */ -function parse_Pane(/*blob, length, opts*/) { -} - -/* [MS-XLS] 2.4.122 TODO */ -function parse_Font(blob, length, opts) { - var o/*:any*/ = { - dyHeight: blob.read_shift(2), - fl: blob.read_shift(2) - }; - switch((opts && opts.biff) || 8) { - case 2: break; - case 3: case 4: blob.l += 2; break; - default: blob.l += 10; break; - } - o.name = parse_ShortXLUnicodeString(blob, 0, opts); - return o; -} -function write_Font(data, opts) { - var name = data.name || "Arial"; - var b5 = (opts && (opts.biff == 5)), w = (b5 ? (15 + name.length) : (16 + 2 * name.length)); - var o = new_buf(w); - o.write_shift(2, (data.sz || 12) * 20); - o.write_shift(4, 0); - o.write_shift(2, 400); - o.write_shift(4, 0); - o.write_shift(2, 0); - o.write_shift(1, name.length); - if(!b5) o.write_shift(1, 1); - o.write_shift((b5 ? 1 : 2) * name.length, name, (b5 ? "sbcs" : "utf16le")); - return o; -} - -/* [MS-XLS] 2.4.149 */ -function parse_LabelSst(blob) { - var cell = parse_XLSCell(blob); - cell.isst = blob.read_shift(4); - return cell; -} -function write_LabelSst(R/*:number*/, C/*:number*/, v/*:number*/, os/*:number*/ /*::, opts*/) { - var o = new_buf(10); - write_XLSCell(R, C, os, o); - o.write_shift(4, v); - return o; -} - -/* [MS-XLS] 2.4.148 */ -function parse_Label(blob, length, opts) { - if(opts.biffguess && opts.biff == 2) opts.biff = 5; - var target = blob.l + length; - var cell = parse_XLSCell(blob, 6); - if(opts.biff == 2) blob.l++; - var str = parse_XLUnicodeString(blob, target - blob.l, opts); - cell.val = str; - return cell; -} -function write_Label(R/*:number*/, C/*:number*/, v/*:string*/, os/*:number*/, opts) { - var b8 = !opts || opts.biff == 8; - var o = new_buf(6 + 2 + (+b8) + (1 + b8) * v.length); - write_XLSCell(R, C, os, o); - o.write_shift(2, v.length); - if(b8) o.write_shift(1, 1); - o.write_shift((1 + b8) * v.length, v, b8 ? 'utf16le' : 'sbcs'); - return o; -} - - -/* [MS-XLS] 2.4.126 Number Formats */ -function parse_Format(blob, length, opts) { - var numFmtId = blob.read_shift(2); - var fmtstr = parse_XLUnicodeString2(blob, 0, opts); - return [numFmtId, fmtstr]; -} -function write_Format(i/*:number*/, f/*:string*/, opts, o) { - var b5 = (opts && (opts.biff == 5)); - if(!o) o = new_buf(b5 ? (3 + f.length) : (5 + 2 * f.length)); - o.write_shift(2, i); - o.write_shift((b5 ? 1 : 2), f.length); - if(!b5) o.write_shift(1, 1); - o.write_shift((b5 ? 1 : 2) * f.length, f, (b5 ? 'sbcs' : 'utf16le')); - var out = (o.length > o.l) ? o.slice(0, o.l) : o; - if(out.l == null) out.l = out.length; - return out; -} -var parse_BIFF2Format = parse_XLUnicodeString2; - -/* [MS-XLS] 2.4.90 */ -function parse_Dimensions(blob, length, opts) { - var end = blob.l + length; - var w = opts.biff == 8 || !opts.biff ? 4 : 2; - var r = blob.read_shift(w), R = blob.read_shift(w); - var c = blob.read_shift(2), C = blob.read_shift(2); - blob.l = end; - return {s: {r:r, c:c}, e: {r:R, c:C}}; -} -function write_Dimensions(range, opts) { - var w = opts.biff == 8 || !opts.biff ? 4 : 2; - var o = new_buf(2*w + 6); - o.write_shift(w, range.s.r); - o.write_shift(w, range.e.r + 1); - o.write_shift(2, range.s.c); - o.write_shift(2, range.e.c + 1); - o.write_shift(2, 0); - return o; -} - -/* [MS-XLS] 2.4.220 */ -function parse_RK(blob) { - var rw = blob.read_shift(2), col = blob.read_shift(2); - var rkrec = parse_RkRec(blob); - return {r:rw, c:col, ixfe:rkrec[0], rknum:rkrec[1]}; -} - -/* [MS-XLS] 2.4.175 */ -function parse_MulRk(blob, length) { - var target = blob.l + length - 2; - var rw = blob.read_shift(2), col = blob.read_shift(2); - var rkrecs = []; - while(blob.l < target) rkrecs.push(parse_RkRec(blob)); - if(blob.l !== target) throw new Error("MulRK read error"); - var lastcol = blob.read_shift(2); - if(rkrecs.length != lastcol - col + 1) throw new Error("MulRK length mismatch"); - return {r:rw, c:col, C:lastcol, rkrec:rkrecs}; -} -/* [MS-XLS] 2.4.174 */ -function parse_MulBlank(blob, length) { - var target = blob.l + length - 2; - var rw = blob.read_shift(2), col = blob.read_shift(2); - var ixfes = []; - while(blob.l < target) ixfes.push(blob.read_shift(2)); - if(blob.l !== target) throw new Error("MulBlank read error"); - var lastcol = blob.read_shift(2); - if(ixfes.length != lastcol - col + 1) throw new Error("MulBlank length mismatch"); - return {r:rw, c:col, C:lastcol, ixfe:ixfes}; -} - -/* [MS-XLS] 2.5.20 2.5.249 TODO: interpret values here */ -function parse_CellStyleXF(blob, length, style, opts) { - var o = {}; - var a = blob.read_shift(4), b = blob.read_shift(4); - var c = blob.read_shift(4), d = blob.read_shift(2); - o.patternType = XLSFillPattern[c >> 26]; - - if(!opts.cellStyles) return o; - o.alc = a & 0x07; - o.fWrap = (a >> 3) & 0x01; - o.alcV = (a >> 4) & 0x07; - o.fJustLast = (a >> 7) & 0x01; - o.trot = (a >> 8) & 0xFF; - o.cIndent = (a >> 16) & 0x0F; - o.fShrinkToFit = (a >> 20) & 0x01; - o.iReadOrder = (a >> 22) & 0x02; - o.fAtrNum = (a >> 26) & 0x01; - o.fAtrFnt = (a >> 27) & 0x01; - o.fAtrAlc = (a >> 28) & 0x01; - o.fAtrBdr = (a >> 29) & 0x01; - o.fAtrPat = (a >> 30) & 0x01; - o.fAtrProt = (a >> 31) & 0x01; - - o.dgLeft = b & 0x0F; - o.dgRight = (b >> 4) & 0x0F; - o.dgTop = (b >> 8) & 0x0F; - o.dgBottom = (b >> 12) & 0x0F; - o.icvLeft = (b >> 16) & 0x7F; - o.icvRight = (b >> 23) & 0x7F; - o.grbitDiag = (b >> 30) & 0x03; - - o.icvTop = c & 0x7F; - o.icvBottom = (c >> 7) & 0x7F; - o.icvDiag = (c >> 14) & 0x7F; - o.dgDiag = (c >> 21) & 0x0F; - - o.icvFore = d & 0x7F; - o.icvBack = (d >> 7) & 0x7F; - o.fsxButton = (d >> 14) & 0x01; - return o; -} -//function parse_CellXF(blob, length, opts) {return parse_CellStyleXF(blob,length,0, opts);} -//function parse_StyleXF(blob, length, opts) {return parse_CellStyleXF(blob,length,1, opts);} - -/* [MS-XLS] 2.4.353 TODO: actually do this right */ -function parse_XF(blob, length, opts) { - var o = {}; - o.ifnt = blob.read_shift(2); o.numFmtId = blob.read_shift(2); o.flags = blob.read_shift(2); - o.fStyle = (o.flags >> 2) & 0x01; - length -= 6; - o.data = parse_CellStyleXF(blob, length, o.fStyle, opts); - return o; -} -function write_XF(data, ixfeP, opts, o) { - var b5 = (opts && (opts.biff == 5)); - if(!o) o = new_buf(b5 ? 16 : 20); - o.write_shift(2, 0); - if(data.style) { - o.write_shift(2, (data.numFmtId||0)); - o.write_shift(2, 0xFFF4); - } else { - o.write_shift(2, (data.numFmtId||0)); - o.write_shift(2, (ixfeP<<4)); - } - var f = 0; - if(data.numFmtId > 0 && b5) f |= 0x0400; - o.write_shift(4, f); - o.write_shift(4, 0); - if(!b5) o.write_shift(4, 0); - o.write_shift(2, 0); - return o; -} - -/* [MS-XLS] 2.4.134 */ -function parse_Guts(blob) { - blob.l += 4; - var out = [blob.read_shift(2), blob.read_shift(2)]; - if(out[0] !== 0) out[0]--; - if(out[1] !== 0) out[1]--; - if(out[0] > 7 || out[1] > 7) throw new Error("Bad Gutters: " + out.join("|")); - return out; -} -function write_Guts(guts/*:Array*/) { - var o = new_buf(8); - o.write_shift(4, 0); - o.write_shift(2, guts[0] ? guts[0] + 1 : 0); - o.write_shift(2, guts[1] ? guts[1] + 1 : 0); - return o; -} - -/* [MS-XLS] 2.4.24 */ -function parse_BoolErr(blob, length, opts) { - var cell = parse_XLSCell(blob, 6); - if(opts.biff == 2 || length == 9) ++blob.l; - var val = parse_Bes(blob, 2); - cell.val = val; - cell.t = (val === true || val === false) ? 'b' : 'e'; - return cell; -} -function write_BoolErr(R/*:number*/, C/*:number*/, v, os/*:number*/, opts, t/*:string*/) { - var o = new_buf(8); - write_XLSCell(R, C, os, o); - write_Bes(v, t, o); - return o; -} - -/* [MS-XLS] 2.4.180 Number */ -function parse_Number(blob, length, opts) { - if(opts.biffguess && opts.biff == 2) opts.biff = 5; - var cell = parse_XLSCell(blob, 6); - var xnum = parse_Xnum(blob, 8); - cell.val = xnum; - return cell; -} -function write_Number(R/*:number*/, C/*:number*/, v, os/*:: :number, opts*/) { - var o = new_buf(14); - write_XLSCell(R, C, os, o); - write_Xnum(v, o); - return o; -} - -var parse_XLHeaderFooter = parse_OptXLUnicodeString; // TODO: parse 2.4.136 - -/* [MS-XLS] 2.4.271 */ -function parse_SupBook(blob, length, opts) { - var end = blob.l + length; - var ctab = blob.read_shift(2); - var cch = blob.read_shift(2); - opts.sbcch = cch; - if(cch == 0x0401 || cch == 0x3A01) return [cch, ctab]; - if(cch < 0x01 || cch >0xff) throw new Error("Unexpected SupBook type: "+cch); - var virtPath = parse_XLUnicodeStringNoCch(blob, cch); - /* TODO: 2.5.277 Virtual Path */ - var rgst = []; - while(end > blob.l) rgst.push(parse_XLUnicodeString(blob)); - return [cch, ctab, virtPath, rgst]; -} - -/* [MS-XLS] 2.4.105 TODO */ -function parse_ExternName(blob, length, opts) { - var flags = blob.read_shift(2); - var body; - var o = ({ - fBuiltIn: flags & 0x01, - fWantAdvise: (flags >>> 1) & 0x01, - fWantPict: (flags >>> 2) & 0x01, - fOle: (flags >>> 3) & 0x01, - fOleLink: (flags >>> 4) & 0x01, - cf: (flags >>> 5) & 0x3FF, - fIcon: flags >>> 15 & 0x01 - }/*:any*/); - if(opts.sbcch === 0x3A01) body = parse_AddinUdf(blob, length-2, opts); - //else throw new Error("unsupported SupBook cch: " + opts.sbcch); - o.body = body || blob.read_shift(length-2); - if(typeof body === "string") o.Name = body; - return o; -} - -/* [MS-XLS] 2.4.150 TODO */ -var XLSLblBuiltIn = [ - "_xlnm.Consolidate_Area", - "_xlnm.Auto_Open", - "_xlnm.Auto_Close", - "_xlnm.Extract", - "_xlnm.Database", - "_xlnm.Criteria", - "_xlnm.Print_Area", - "_xlnm.Print_Titles", - "_xlnm.Recorder", - "_xlnm.Data_Form", - "_xlnm.Auto_Activate", - "_xlnm.Auto_Deactivate", - "_xlnm.Sheet_Title", - "_xlnm._FilterDatabase" -]; -function parse_Lbl(blob, length, opts) { - var target = blob.l + length; - var flags = blob.read_shift(2); - var chKey = blob.read_shift(1); - var cch = blob.read_shift(1); - var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); - var itab = 0; - if(!opts || opts.biff >= 5) { - if(opts.biff != 5) blob.l += 2; - itab = blob.read_shift(2); - if(opts.biff == 5) blob.l += 2; - blob.l += 4; - } - var name = parse_XLUnicodeStringNoCch(blob, cch, opts); - if(flags & 0x20) name = XLSLblBuiltIn[name.charCodeAt(0)]; - var npflen = target - blob.l; if(opts && opts.biff == 2) --npflen; - /*jshint -W018 */ - var rgce = (target == blob.l || cce === 0 || !(npflen > 0)) ? [] : parse_NameParsedFormula(blob, npflen, opts, cce); - /*jshint +W018 */ - return { - chKey: chKey, - Name: name, - itab: itab, - rgce: rgce - }; -} - -/* [MS-XLS] 2.4.106 TODO: verify filename encoding */ -function parse_ExternSheet(blob, length, opts) { - if(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts); - var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2); - while(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts)); - // [iSupBook, itabFirst, itabLast]; - if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target); - return o; -} -function parse_BIFF5ExternSheet(blob, length, opts) { - if(blob[blob.l + 1] == 0x03) blob[blob.l]++; - var o = parse_ShortXLUnicodeString(blob, length, opts); - return o.charCodeAt(0) == 0x03 ? o.slice(1) : o; -} - -/* [MS-XLS] 2.4.176 TODO: check older biff */ -function parse_NameCmt(blob, length, opts) { - if(opts.biff < 8) { blob.l += length; return; } - var cchName = blob.read_shift(2); - var cchComment = blob.read_shift(2); - var name = parse_XLUnicodeStringNoCch(blob, cchName, opts); - var comment = parse_XLUnicodeStringNoCch(blob, cchComment, opts); - return [name, comment]; -} - -/* [MS-XLS] 2.4.260 */ -function parse_ShrFmla(blob, length, opts) { - var ref = parse_RefU(blob, 6); - blob.l++; - var cUse = blob.read_shift(1); - length -= 8; - return [parse_SharedParsedFormula(blob, length, opts), cUse, ref]; -} - -/* [MS-XLS] 2.4.4 TODO */ -function parse_Array(blob, length, opts) { - var ref = parse_Ref(blob, 6); - /* TODO: fAlwaysCalc */ - switch(opts.biff) { - case 2: blob.l ++; length -= 7; break; - case 3: case 4: blob.l += 2; length -= 8; break; - default: blob.l += 6; length -= 12; - } - return [ref, parse_ArrayParsedFormula(blob, length, opts, ref)]; -} - -/* [MS-XLS] 2.4.173 */ -function parse_MTRSettings(blob) { - var fMTREnabled = blob.read_shift(4) !== 0x00; - var fUserSetThreadCount = blob.read_shift(4) !== 0x00; - var cUserThreadCount = blob.read_shift(4); - return [fMTREnabled, fUserSetThreadCount, cUserThreadCount]; -} - -/* [MS-XLS] 2.5.186 TODO: BIFF5 */ -function parse_NoteSh(blob, length, opts) { - if(opts.biff < 8) return; - var row = blob.read_shift(2), col = blob.read_shift(2); - var flags = blob.read_shift(2), idObj = blob.read_shift(2); - var stAuthor = parse_XLUnicodeString2(blob, 0, opts); - if(opts.biff < 8) blob.read_shift(1); - return [{r:row,c:col}, stAuthor, idObj, flags]; -} - -/* [MS-XLS] 2.4.179 */ -function parse_Note(blob, length, opts) { - /* TODO: Support revisions */ - return parse_NoteSh(blob, length, opts); -} - -/* [MS-XLS] 2.4.168 */ -function parse_MergeCells(blob, length)/*:Array*/ { - var merges/*:Array*/ = []; - var cmcs = blob.read_shift(2); - while (cmcs--) merges.push(parse_Ref8U(blob,length)); - return merges; -} -function write_MergeCells(merges/*:Array*/) { - var o = new_buf(2 + merges.length * 8); - o.write_shift(2, merges.length); - for(var i = 0; i < merges.length; ++i) write_Ref8U(merges[i], o); - return o; -} - -/* [MS-XLS] 2.4.181 TODO: parse all the things! */ -function parse_Obj(blob, length, opts) { - if(opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts); - var cmo = parse_FtCmo(blob, 22); // id, ot, flags - var fts = parse_FtArray(blob, length-22, cmo[1]); - return { cmo: cmo, ft:fts }; -} -/* from older spec */ -var parse_BIFF5OT = []; -parse_BIFF5OT[0x08] = function(blob, length) { - var tgt = blob.l + length; - blob.l += 10; // todo - var cf = blob.read_shift(2); - blob.l += 4; - blob.l += 2; //var cbPictFmla = blob.read_shift(2); - blob.l += 2; - blob.l += 2; //var grbit = blob.read_shift(2); - blob.l += 4; - var cchName = blob.read_shift(1); - blob.l += cchName; // TODO: stName - blob.l = tgt; // TODO: fmla - return { fmt:cf }; -}; - -function parse_BIFF5Obj(blob, length, opts) { - blob.l += 4; //var cnt = blob.read_shift(4); - var ot = blob.read_shift(2); - var id = blob.read_shift(2); - var grbit = blob.read_shift(2); - blob.l += 2; //var colL = blob.read_shift(2); - blob.l += 2; //var dxL = blob.read_shift(2); - blob.l += 2; //var rwT = blob.read_shift(2); - blob.l += 2; //var dyT = blob.read_shift(2); - blob.l += 2; //var colR = blob.read_shift(2); - blob.l += 2; //var dxR = blob.read_shift(2); - blob.l += 2; //var rwB = blob.read_shift(2); - blob.l += 2; //var dyB = blob.read_shift(2); - blob.l += 2; //var cbMacro = blob.read_shift(2); - blob.l += 6; - length -= 36; - var fts = []; - fts.push((parse_BIFF5OT[ot]||parsenoop)(blob, length, opts)); - return { cmo: [id, ot, grbit], ft:fts }; -} - -/* [MS-XLS] 2.4.329 TODO: parse properly */ -function parse_TxO(blob, length, opts) { - var s = blob.l; - var texts = ""; -try { - blob.l += 4; - var ot = (opts.lastobj||{cmo:[0,0]}).cmo[1]; - var controlInfo; // eslint-disable-line no-unused-vars - if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6; - else controlInfo = parse_ControlInfo(blob, 6, opts); - var cchText = blob.read_shift(2); - /*var cbRuns = */blob.read_shift(2); - /*var ifntEmpty = */parseuint16(blob, 2); - var len = blob.read_shift(2); - blob.l += len; - //var fmla = parse_ObjFmla(blob, s + length - blob.l); - - for(var i = 1; i < blob.lens.length-1; ++i) { - if(blob.l-s != blob.lens[i]) throw new Error("TxO: bad continue record"); - var hdr = blob[blob.l]; - var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i+1]-blob.lens[i]-1); - texts += t; - if(texts.length >= (hdr ? cchText : 2*cchText)) break; - } - if(texts.length !== cchText && texts.length !== cchText*2) { - throw new Error("cchText: " + cchText + " != " + texts.length); - } - - blob.l = s + length; - /* [MS-XLS] 2.5.272 TxORuns */ -// var rgTxoRuns = []; -// for(var j = 0; j != cbRuns/8-1; ++j) blob.l += 8; -// var cchText2 = blob.read_shift(2); -// if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText); -// blob.l += 6; -// if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l); - return { t: texts }; -} catch(e) { blob.l = s + length; return { t: texts }; } -} - -/* [MS-XLS] 2.4.140 */ -function parse_HLink(blob, length) { - var ref = parse_Ref8U(blob, 8); - blob.l += 16; /* CLSID */ - var hlink = parse_Hyperlink(blob, length-24); - return [ref, hlink]; -} -function write_HLink(hl) { - var O = new_buf(24); - var ref = decode_cell(hl[0]); - O.write_shift(2, ref.r); O.write_shift(2, ref.r); - O.write_shift(2, ref.c); O.write_shift(2, ref.c); - var clsid = "d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); - for(var i = 0; i < 16; ++i) O.write_shift(1, parseInt(clsid[i], 16)); - return bconcat([O, write_Hyperlink(hl[1])]); -} - - -/* [MS-XLS] 2.4.141 */ -function parse_HLinkTooltip(blob, length) { - blob.read_shift(2); - var ref = parse_Ref8U(blob, 8); - var wzTooltip = blob.read_shift((length-10)/2, 'dbcs-cont'); - wzTooltip = wzTooltip.replace(chr0,""); - return [ref, wzTooltip]; -} -function write_HLinkTooltip(hl) { - var TT = hl[1].Tooltip; - var O = new_buf(10 + 2 * (TT.length + 1)); - O.write_shift(2, 0x0800); - var ref = decode_cell(hl[0]); - O.write_shift(2, ref.r); O.write_shift(2, ref.r); - O.write_shift(2, ref.c); O.write_shift(2, ref.c); - for(var i = 0; i < TT.length; ++i) O.write_shift(2, TT.charCodeAt(i)); - O.write_shift(2, 0); - return O; -} - -/* [MS-XLS] 2.4.63 */ -function parse_Country(blob)/*:[string|number, string|number]*/ { - var o = [0,0], d; - d = blob.read_shift(2); o[0] = CountryEnum[d] || d; - d = blob.read_shift(2); o[1] = CountryEnum[d] || d; - return o; -} -function write_Country(o) { - if(!o) o = new_buf(4); - o.write_shift(2, 0x01); - o.write_shift(2, 0x01); - return o; -} - -/* [MS-XLS] 2.4.50 ClrtClient */ -function parse_ClrtClient(blob) { - var ccv = blob.read_shift(2); - var o = []; - while(ccv-->0) o.push(parse_LongRGB(blob, 8)); - return o; -} - -/* [MS-XLS] 2.4.188 */ -function parse_Palette(blob) { - var ccv = blob.read_shift(2); - var o = []; - while(ccv-->0) o.push(parse_LongRGB(blob, 8)); - return o; -} - -/* [MS-XLS] 2.4.354 */ -function parse_XFCRC(blob) { - blob.l += 2; - var o = {cxfs:0, crc:0}; - o.cxfs = blob.read_shift(2); - o.crc = blob.read_shift(4); - return o; -} - -/* [MS-XLS] 2.4.53 TODO: parse flags */ -/* [MS-XLSB] 2.4.323 TODO: parse flags */ -function parse_ColInfo(blob, length, opts) { - if(!opts.cellStyles) return parsenoop(blob, length); - var w = opts && opts.biff >= 12 ? 4 : 2; - var colFirst = blob.read_shift(w); - var colLast = blob.read_shift(w); - var coldx = blob.read_shift(w); - var ixfe = blob.read_shift(w); - var flags = blob.read_shift(2); - if(w == 2) blob.l += 2; - var o = ({s:colFirst, e:colLast, w:coldx, ixfe:ixfe, flags:flags}/*:any*/); - if(opts.biff >= 5 || !opts.biff) o.level = (flags >> 8) & 0x7; - return o; -} -function write_ColInfo(col, idx) { - var o = new_buf(12); - o.write_shift(2, idx); - o.write_shift(2, idx); - o.write_shift(2, col.width * 256); - o.write_shift(2, 0); - var f = 0; - if(col.hidden) f |= 1; - o.write_shift(1, f); - f = col.level || 0; - o.write_shift(1, f); - o.write_shift(2, 0); - return o; -} - -/* [MS-XLS] 2.4.257 */ -function parse_Setup(blob, length) { - var o = {}; - if(length < 32) return o; - blob.l += 16; - o.header = parse_Xnum(blob, 8); - o.footer = parse_Xnum(blob, 8); - blob.l += 2; - return o; -} - -/* [MS-XLS] 2.4.261 */ -function parse_ShtProps(blob, length, opts) { - var def = {area:false}; - if(opts.biff != 5) { blob.l += length; return def; } - var d = blob.read_shift(1); blob.l += 3; - if((d & 0x10)) def.area = true; - return def; -} - -/* [MS-XLS] 2.4.241 */ -function write_RRTabId(n/*:number*/) { - var out = new_buf(2 * n); - for(var i = 0; i < n; ++i) out.write_shift(2, i+1); - return out; -} - -var parse_Blank = parse_XLSCell; /* [MS-XLS] 2.4.20 Just the cell */ -var parse_Scl = parseuint16a; /* [MS-XLS] 2.4.247 num, den */ -var parse_String = parse_XLUnicodeString; /* [MS-XLS] 2.4.268 */ - -/* --- Specific to versions before BIFF8 --- */ -function parse_ImData(blob) { - var cf = blob.read_shift(2); - var env = blob.read_shift(2); - var lcb = blob.read_shift(4); - var o = {fmt:cf, env:env, len:lcb, data:blob.slice(blob.l,blob.l+lcb)}; - blob.l += lcb; - return o; -} - -/* BIFF2_??? where ??? is the name from [XLS] */ -function parse_BIFF2STR(blob, length, opts) { - if(opts.biffguess && opts.biff == 5) opts.biff = 2; - var cell = parse_XLSCell(blob, 6); - ++blob.l; - var str = parse_XLUnicodeString2(blob, length-7, opts); - cell.t = 'str'; - cell.val = str; - return cell; -} - -function parse_BIFF2NUM(blob/*::, length*/) { - var cell = parse_XLSCell(blob, 6); - ++blob.l; - var num = parse_Xnum(blob, 8); - cell.t = 'n'; - cell.val = num; - return cell; -} -function write_BIFF2NUM(r/*:number*/, c/*:number*/, val/*:number*/) { - var out = new_buf(15); - write_BIFF2Cell(out, r, c); - out.write_shift(8, val, 'f'); - return out; -} - -function parse_BIFF2INT(blob) { - var cell = parse_XLSCell(blob, 6); - ++blob.l; - var num = blob.read_shift(2); - cell.t = 'n'; - cell.val = num; - return cell; -} -function write_BIFF2INT(r/*:number*/, c/*:number*/, val/*:number*/) { - var out = new_buf(9); - write_BIFF2Cell(out, r, c); - out.write_shift(2, val); - return out; -} - -function parse_BIFF2STRING(blob) { - var cch = blob.read_shift(1); - if(cch === 0) { blob.l++; return ""; } - return blob.read_shift(cch, 'sbcs-cont'); -} - -/* TODO: convert to BIFF8 font struct */ -function parse_BIFF2FONTXTRA(blob, length) { - blob.l += 6; // unknown - blob.l += 2; // font weight "bls" - blob.l += 1; // charset - blob.l += 3; // unknown - blob.l += 1; // font family - blob.l += length - 13; -} - -/* TODO: parse rich text runs */ -function parse_RString(blob, length, opts) { - var end = blob.l + length; - var cell = parse_XLSCell(blob, 6); - var cch = blob.read_shift(2); - var str = parse_XLUnicodeStringNoCch(blob, cch, opts); - blob.l = end; - cell.t = 'str'; - cell.val = str; - return cell; -} -/* from js-harb (C) 2014-present SheetJS */ -var DBF = (function() { -var dbf_codepage_map = { - /* Code Pages Supported by Visual FoxPro */ - /*::[*/0x01/*::]*/: 437, /*::[*/0x02/*::]*/: 850, - /*::[*/0x03/*::]*/: 1252, /*::[*/0x04/*::]*/: 10000, - /*::[*/0x64/*::]*/: 852, /*::[*/0x65/*::]*/: 866, - /*::[*/0x66/*::]*/: 865, /*::[*/0x67/*::]*/: 861, - /*::[*/0x68/*::]*/: 895, /*::[*/0x69/*::]*/: 620, - /*::[*/0x6A/*::]*/: 737, /*::[*/0x6B/*::]*/: 857, - /*::[*/0x78/*::]*/: 950, /*::[*/0x79/*::]*/: 949, - /*::[*/0x7A/*::]*/: 936, /*::[*/0x7B/*::]*/: 932, - /*::[*/0x7C/*::]*/: 874, /*::[*/0x7D/*::]*/: 1255, - /*::[*/0x7E/*::]*/: 1256, /*::[*/0x96/*::]*/: 10007, - /*::[*/0x97/*::]*/: 10029, /*::[*/0x98/*::]*/: 10006, - /*::[*/0xC8/*::]*/: 1250, /*::[*/0xC9/*::]*/: 1251, - /*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253, - - /* shapefile DBF extension */ - /*::[*/0x00/*::]*/: 20127, /*::[*/0x08/*::]*/: 865, - /*::[*/0x09/*::]*/: 437, /*::[*/0x0A/*::]*/: 850, - /*::[*/0x0B/*::]*/: 437, /*::[*/0x0D/*::]*/: 437, - /*::[*/0x0E/*::]*/: 850, /*::[*/0x0F/*::]*/: 437, - /*::[*/0x10/*::]*/: 850, /*::[*/0x11/*::]*/: 437, - /*::[*/0x12/*::]*/: 850, /*::[*/0x13/*::]*/: 932, - /*::[*/0x14/*::]*/: 850, /*::[*/0x15/*::]*/: 437, - /*::[*/0x16/*::]*/: 850, /*::[*/0x17/*::]*/: 865, - /*::[*/0x18/*::]*/: 437, /*::[*/0x19/*::]*/: 437, - /*::[*/0x1A/*::]*/: 850, /*::[*/0x1B/*::]*/: 437, - /*::[*/0x1C/*::]*/: 863, /*::[*/0x1D/*::]*/: 850, - /*::[*/0x1F/*::]*/: 852, /*::[*/0x22/*::]*/: 852, - /*::[*/0x23/*::]*/: 852, /*::[*/0x24/*::]*/: 860, - /*::[*/0x25/*::]*/: 850, /*::[*/0x26/*::]*/: 866, - /*::[*/0x37/*::]*/: 850, /*::[*/0x40/*::]*/: 852, - /*::[*/0x4D/*::]*/: 936, /*::[*/0x4E/*::]*/: 949, - /*::[*/0x4F/*::]*/: 950, /*::[*/0x50/*::]*/: 874, - /*::[*/0x57/*::]*/: 1252, /*::[*/0x58/*::]*/: 1252, - /*::[*/0x59/*::]*/: 1252, /*::[*/0x6C/*::]*/: 863, - /*::[*/0x86/*::]*/: 737, /*::[*/0x87/*::]*/: 852, - /*::[*/0x88/*::]*/: 857, /*::[*/0xCC/*::]*/: 1257, - - /*::[*/0xFF/*::]*/: 16969 -}; -var dbf_reverse_map = evert({ - /*::[*/0x01/*::]*/: 437, /*::[*/0x02/*::]*/: 850, - /*::[*/0x03/*::]*/: 1252, /*::[*/0x04/*::]*/: 10000, - /*::[*/0x64/*::]*/: 852, /*::[*/0x65/*::]*/: 866, - /*::[*/0x66/*::]*/: 865, /*::[*/0x67/*::]*/: 861, - /*::[*/0x68/*::]*/: 895, /*::[*/0x69/*::]*/: 620, - /*::[*/0x6A/*::]*/: 737, /*::[*/0x6B/*::]*/: 857, - /*::[*/0x78/*::]*/: 950, /*::[*/0x79/*::]*/: 949, - /*::[*/0x7A/*::]*/: 936, /*::[*/0x7B/*::]*/: 932, - /*::[*/0x7C/*::]*/: 874, /*::[*/0x7D/*::]*/: 1255, - /*::[*/0x7E/*::]*/: 1256, /*::[*/0x96/*::]*/: 10007, - /*::[*/0x97/*::]*/: 10029, /*::[*/0x98/*::]*/: 10006, - /*::[*/0xC8/*::]*/: 1250, /*::[*/0xC9/*::]*/: 1251, - /*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253, - /*::[*/0x00/*::]*/: 20127 -}); -var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5]; -/* TODO: find an actual specification */ -function dbf_to_aoa(buf, opts)/*:AOA*/ { - var out/*:AOA*/ = []; - var d/*:Block*/ = (new_raw_buf(1)/*:any*/); - switch(opts.type) { - case 'base64': d = s2a(Base64.decode(buf)); break; - case 'binary': d = s2a(buf); break; - case 'buffer': - case 'array': d = buf; break; - } - prep_blob(d, 0); - - /* header */ - var ft = d.read_shift(1); - var memo = !!(ft & 0x88); - var vfp = false, l7 = false; - switch(ft) { - case 0x02: break; // dBASE II - case 0x03: break; // dBASE III - case 0x30: vfp = true; memo = true; break; // VFP - case 0x31: vfp = true; memo = true; break; // VFP with autoincrement - // 0x43 dBASE IV SQL table files - // 0x63 dBASE IV SQL system files - case 0x83: break; // dBASE III with memo - case 0x8B: break; // dBASE IV with memo - case 0x8C: l7 = true; break; // dBASE Level 7 with memo - // case 0xCB dBASE IV SQL table files with memo - case 0xF5: break; // FoxPro 2.x with memo - // case 0xFB FoxBASE - default: throw new Error("DBF Unsupported Version: " + ft.toString(16)); - } - - var nrow = 0, fpos = 0x0209; - if(ft == 0x02) nrow = d.read_shift(2); - d.l += 3; // dBASE II stores DDMMYY date, others use YYMMDD - if(ft != 0x02) nrow = d.read_shift(4); - if(nrow > 1048576) nrow = 1e6; - - if(ft != 0x02) fpos = d.read_shift(2); // header length - var rlen = d.read_shift(2); // record length - - var /*flags = 0,*/ current_cp = opts.codepage || 1252; - if(ft != 0x02) { // 20 reserved bytes - d.l+=16; - /*flags = */d.read_shift(1); - //if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16)); - - /* codepage present in FoxPro and dBASE Level 7 */ - if(d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]]; - d.l+=1; - - d.l+=2; - } - if(l7) d.l += 36; // Level 7: 32 byte "Language driver name", 4 byte reserved - -/*:: type DBFField = { name:string; len:number; type:string; } */ - var fields/*:Array*/ = [], field/*:DBFField*/ = ({}/*:any*/); - var hend = Math.min(d.length, (ft == 0x02 ? 0x209 : (fpos - 10 - (vfp ? 264 : 0)))); - var ww = l7 ? 32 : 11; - while(d.l < hend && d[d.l] != 0x0d) { - field = ({}/*:any*/); - field.name = cptable.utils.decode(current_cp, d.slice(d.l, d.l+ww)).replace(/[\u0000\r\n].*$/g,""); - d.l += ww; - field.type = String.fromCharCode(d.read_shift(1)); - if(ft != 0x02 && !l7) field.offset = d.read_shift(4); - field.len = d.read_shift(1); - if(ft == 0x02) field.offset = d.read_shift(2); - field.dec = d.read_shift(1); - if(field.name.length) fields.push(field); - if(ft != 0x02) d.l += l7 ? 13 : 14; - switch(field.type) { - case 'B': // Double (VFP) / Binary (dBASE L7) - if((!vfp || field.len != 8) && opts.WTF) console.log('Skipping ' + field.name + ':' + field.type); - break; - case 'G': // General (FoxPro and dBASE L7) - case 'P': // Picture (FoxPro and dBASE L7) - if(opts.WTF) console.log('Skipping ' + field.name + ':' + field.type); - break; - case '+': // Autoincrement (dBASE L7 only) - case '0': // _NullFlags (VFP only) - case '@': // Timestamp (dBASE L7 only) - case 'C': // Character (dBASE II) - case 'D': // Date (dBASE III) - case 'F': // Float (dBASE IV) - case 'I': // Long (VFP and dBASE L7) - case 'L': // Logical (dBASE II) - case 'M': // Memo (dBASE III) - case 'N': // Number (dBASE II) - case 'O': // Double (dBASE L7 only) - case 'T': // Datetime (VFP only) - case 'Y': // Currency (VFP only) - break; - default: throw new Error('Unknown Field Type: ' + field.type); - } - } - - if(d[d.l] !== 0x0D) d.l = fpos-1; - if(d.read_shift(1) !== 0x0D) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]); - d.l = fpos; - - /* data */ - var R = 0, C = 0; - out[0] = []; - for(C = 0; C != fields.length; ++C) out[0][C] = fields[C].name; - while(nrow-- > 0) { - if(d[d.l] === 0x2A) { - // TODO: record marked as deleted -- create a hidden row? - d.l+=rlen; - continue; - } - ++d.l; - out[++R] = []; C = 0; - for(C = 0; C != fields.length; ++C) { - var dd = d.slice(d.l, d.l+fields[C].len); d.l+=fields[C].len; - prep_blob(dd, 0); - var s = cptable.utils.decode(current_cp, dd); - switch(fields[C].type) { - case 'C': - // NOTE: it is conventional to write ' / / ' for empty dates - if(s.trim().length) out[R][C] = s.replace(/\s+$/,""); - break; - case 'D': - if(s.length === 8) out[R][C] = new Date(+s.slice(0,4), +s.slice(4,6)-1, +s.slice(6,8)); - else out[R][C] = s; - break; - case 'F': out[R][C] = parseFloat(s.trim()); break; - case '+': case 'I': out[R][C] = l7 ? dd.read_shift(-4, 'i') ^ 0x80000000 : dd.read_shift(4, 'i'); break; - case 'L': switch(s.trim().toUpperCase()) { - case 'Y': case 'T': out[R][C] = true; break; - case 'N': case 'F': out[R][C] = false; break; - case '': case '?': break; - default: throw new Error("DBF Unrecognized L:|" + s + "|"); - } break; - case 'M': /* TODO: handle memo files */ - if(!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16)); - out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10): dd.read_shift(4)); - break; - case 'N': - s = s.replace(/\u0000/g,"").trim(); - // NOTE: dBASE II interprets " . " as 0 - if(s && s != ".") out[R][C] = +s || 0; break; - case '@': - // NOTE: dBASE specs appear to be incorrect - out[R][C] = new Date(dd.read_shift(-8, 'f') - 0x388317533400); - break; - case 'T': out[R][C] = new Date((dd.read_shift(4) - 0x253D8C) * 0x5265C00 + dd.read_shift(4)); break; - case 'Y': out[R][C] = dd.read_shift(4,'i')/1e4; break; - case 'O': out[R][C] = -dd.read_shift(-8, 'f'); break; - case 'B': if(vfp && fields[C].len == 8) { out[R][C] = dd.read_shift(8,'f'); break; } - /* falls through */ - case 'G': case 'P': dd.l += fields[C].len; break; - case '0': - if(fields[C].name === '_NullFlags') break; - /* falls through */ - default: throw new Error("DBF Unsupported data type " + fields[C].type); - } - } - } - if(ft != 0x02) if(d.l < d.length && d[d.l++] != 0x1A) throw new Error("DBF EOF Marker missing " + (d.l-1) + " of " + d.length + " " + d[d.l-1].toString(16)); - if(opts && opts.sheetRows) out = out.slice(0, opts.sheetRows); - return out; -} - -function dbf_to_sheet(buf, opts)/*:Worksheet*/ { - var o = opts || {}; - if(!o.dateNF) o.dateNF = "yyyymmdd"; - return aoa_to_sheet(dbf_to_aoa(buf, o), o); -} - -function dbf_to_workbook(buf, opts)/*:Workbook*/ { - try { return sheet_to_workbook(dbf_to_sheet(buf, opts), opts); } - catch(e) { if(opts && opts.WTF) throw e; } - return ({SheetNames:[],Sheets:{}}); -} - -var _RLEN = { 'B': 8, 'C': 250, 'L': 1, 'D': 8, '?': 0, '': 0 }; -function sheet_to_dbf(ws/*:Worksheet*/, opts/*:WriteOpts*/) { - var o = opts || {}; - if(+o.codepage >= 0) set_cp(+o.codepage); - if(o.type == "string") throw new Error("Cannot write DBF to JS string"); - var ba = buf_array(); - var aoa/*:AOA*/ = sheet_to_json(ws, {header:1, raw:true, cellDates:true}); - var headers = aoa[0], data = aoa.slice(1); - var i = 0, j = 0, hcnt = 0, rlen = 1; - for(i = 0; i < headers.length; ++i) { - if(i == null) continue; - ++hcnt; - if(typeof headers[i] === 'number') headers[i] = headers[i].toString(10); - if(typeof headers[i] !== 'string') throw new Error("DBF Invalid column name " + headers[i] + " |" + (typeof headers[i]) + "|"); - if(headers.indexOf(headers[i]) !== i) for(j=0; j<1024;++j) - if(headers.indexOf(headers[i] + "_" + j) == -1) { headers[i] += "_" + j; break; } - } - var range = safe_decode_range(ws['!ref']); - var coltypes/*:Array*/ = []; - for(i = 0; i <= range.e.c - range.s.c; ++i) { - var col/*:Array*/ = []; - for(j=0; j < data.length; ++j) { - if(data[j][i] != null) col.push(data[j][i]); - } - if(col.length == 0 || headers[i] == null) { coltypes[i] = '?'; continue; } - var guess = '', _guess = ''; - for(j = 0; j < col.length; ++j) { - switch(typeof col[j]) { - /* TODO: check if L2 compat is desired */ - case 'number': _guess = 'B'; break; - case 'string': _guess = 'C'; break; - case 'boolean': _guess = 'L'; break; - case 'object': _guess = col[j] instanceof Date ? 'D' : 'C'; break; - default: _guess = 'C'; - } - guess = guess && guess != _guess ? 'C' : _guess; - if(guess == 'C') break; - } - rlen += _RLEN[guess] || 0; - coltypes[i] = guess; - } - - var h = ba.next(32); - h.write_shift(4, 0x13021130); - h.write_shift(4, data.length); - h.write_shift(2, 296 + 32 * hcnt); - h.write_shift(2, rlen); - for(i=0; i < 4; ++i) h.write_shift(4, 0); - h.write_shift(4, 0x00000000 | ((+dbf_reverse_map[/*::String(*/current_ansi/*::)*/] || 0x03)<<8)); - - for(i = 0, j = 0; i < headers.length; ++i) { - if(headers[i] == null) continue; - var hf = ba.next(32); - var _f = (headers[i].slice(-10) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00").slice(0, 11); - hf.write_shift(1, _f, "sbcs"); - hf.write_shift(1, coltypes[i] == '?' ? 'C' : coltypes[i], "sbcs"); - hf.write_shift(4, j); - hf.write_shift(1, _RLEN[coltypes[i]] || 0); - hf.write_shift(1, 0); - hf.write_shift(1, 0x02); - hf.write_shift(4, 0); - hf.write_shift(1, 0); - hf.write_shift(4, 0); - hf.write_shift(4, 0); - j += _RLEN[coltypes[i]] || 0; - } - - var hb = ba.next(264); - hb.write_shift(4, 0x0000000D); - for(i=0; i < 65;++i) hb.write_shift(4, 0x00000000); - for(i=0; i < data.length; ++i) { - var rout = ba.next(rlen); - rout.write_shift(1, 0); - for(j=0; j":190, "?":191, "{":223 - }/*:any*/); - var sylk_char_regex = new RegExp("\u001BN(" + keys(sylk_escapes).join("|").replace(/\|\|\|/, "|\\||").replace(/([?()+])/g,"\\$1") + "|\\|)", "gm"); - var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; }; - var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); }; - sylk_escapes["|"] = 254; - /* TODO: find an actual specification */ - function sylk_to_aoa(d/*:RawData*/, opts)/*:[AOA, Worksheet]*/ { - switch(opts.type) { - case 'base64': return sylk_to_aoa_str(Base64.decode(d), opts); - case 'binary': return sylk_to_aoa_str(d, opts); - case 'buffer': return sylk_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); - case 'array': return sylk_to_aoa_str(cc2str(d), opts); - } - throw new Error("Unrecognized type " + opts.type); - } - function sylk_to_aoa_str(str/*:string*/, opts)/*:[AOA, Worksheet]*/ { - var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr/*:AOA*/ = []; - var formats/*:Array*/ = []; - var next_cell_format/*:string|null*/ = null; - var sht = {}, rowinfo/*:Array*/ = [], colinfo/*:Array*/ = [], cw/*:Array*/ = []; - var Mval = 0, j; - if(+opts.codepage >= 0) set_cp(+opts.codepage); - for (; ri !== records.length; ++ri) { - Mval = 0; - var rstr=records[ri].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g, decode_sylk_char).replace(sylk_char_regex, sylk_char_fn); - var record=rstr.replace(/;;/g, "\u0000").split(";").map(function(x) { return x.replace(/\u0000/g, ";"); }); - var RT=record[0], val; - if(rstr.length > 0) switch(RT) { - case 'ID': break; /* header */ - case 'E': break; /* EOF */ - case 'B': break; /* dimensions */ - case 'O': break; /* options? */ - case 'W': break; /* window? */ - case 'P': - if(record[1].charAt(0) == 'P') - formats.push(rstr.slice(3).replace(/;;/g, ";")); - break; - case 'C': - var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1; - for(rj=1; rj -1 && arr[_R][_C]; - if(!shrbase || !shrbase[1]) throw new Error("SYLK shared formula cannot find base"); - arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C}); - } - break; - case 'F': - var F_seen = 0; - for(rj=1; rj 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); } - else if(Mval === 0) rowinfo[R].hidden = true; - break; - default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr); - } - if(F_seen < 1) next_cell_format = null; break; - default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr); - } - } - if(rowinfo.length > 0) sht['!rows'] = rowinfo; - if(colinfo.length > 0) sht['!cols'] = colinfo; - if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); - return [arr, sht]; - } - - function sylk_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ { - var aoasht = sylk_to_aoa(d, opts); - var aoa = aoasht[0], ws = aoasht[1]; - var o = aoa_to_sheet(aoa, opts); - keys(ws).forEach(function(k) { o[k] = ws[k]; }); - return o; - } - - function sylk_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(sylk_to_sheet(d, opts), opts); } - - function write_ws_cell_sylk(cell/*:Cell*/, ws/*:Worksheet*/, R/*:number*/, C/*:number*//*::, opts*/)/*:string*/ { - var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K"; - switch(cell.t) { - case 'n': - o += (cell.v||0); - if(cell.f && !cell.F) o += ";E" + a1_to_rc(cell.f, {r:R, c:C}); break; - case 'b': o += cell.v ? "TRUE" : "FALSE"; break; - case 'e': o += cell.w || cell.v; break; - case 'd': o += '"' + (cell.w || cell.v) + '"'; break; - case 's': o += '"' + cell.v.replace(/"/g,"") + '"'; break; - } - return o; - } - - function write_ws_cols_sylk(out, cols) { - cols.forEach(function(col, i) { - var rec = "F;W" + (i+1) + " " + (i+1) + " "; - if(col.hidden) rec += "0"; - else { - if(typeof col.width == 'number' && !col.wpx) col.wpx = width2px(col.width); - if(typeof col.wpx == 'number' && !col.wch) col.wch = px2char(col.wpx); - if(typeof col.wch == 'number') rec += Math.round(col.wch); - } - if(rec.charAt(rec.length - 1) != " ") out.push(rec); - }); - } - - function write_ws_rows_sylk(out/*:Array*/, rows/*:Array*/) { - rows.forEach(function(row, i) { - var rec = "F;"; - if(row.hidden) rec += "M0;"; - else if(row.hpt) rec += "M" + 20 * row.hpt + ";"; - else if(row.hpx) rec += "M" + 20 * px2pt(row.hpx) + ";"; - if(rec.length > 2) out.push(rec + "R" + (i+1)); - }); - } - - function sheet_to_sylk(ws/*:Worksheet*/, opts/*:?any*/)/*:string*/ { - var preamble/*:Array*/ = ["ID;PWXL;N;E"], o/*:Array*/ = []; - var r = safe_decode_range(ws['!ref']), cell/*:Cell*/; - var dense = Array.isArray(ws); - var RS = "\r\n"; - - preamble.push("P;PGeneral"); - preamble.push("F;P0;DG0G8;M255"); - if(ws['!cols']) write_ws_cols_sylk(preamble, ws['!cols']); - if(ws['!rows']) write_ws_rows_sylk(preamble, ws['!rows']); - - preamble.push("B;Y" + (r.e.r - r.s.r + 1) + ";X" + (r.e.c - r.s.c + 1) + ";D" + [r.s.c,r.s.r,r.e.c,r.e.r].join(" ")); - for(var R = r.s.r; R <= r.e.r; ++R) { - for(var C = r.s.c; C <= r.e.c; ++C) { - var coord = encode_cell({r:R,c:C}); - cell = dense ? (ws[R]||[])[C]: ws[coord]; - if(!cell || (cell.v == null && (!cell.f || cell.F))) continue; - o.push(write_ws_cell_sylk(cell, ws, R, C, opts)); - } - } - return preamble.join(RS) + RS + o.join(RS) + RS + "E" + RS; - } - - return { - to_workbook: sylk_to_workbook, - to_sheet: sylk_to_sheet, - from_sheet: sheet_to_sylk - }; -})(); - -var DIF = (function() { - function dif_to_aoa(d/*:RawData*/, opts)/*:AOA*/ { - switch(opts.type) { - case 'base64': return dif_to_aoa_str(Base64.decode(d), opts); - case 'binary': return dif_to_aoa_str(d, opts); - case 'buffer': return dif_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); - case 'array': return dif_to_aoa_str(cc2str(d), opts); - } - throw new Error("Unrecognized type " + opts.type); - } - function dif_to_aoa_str(str/*:string*/, opts)/*:AOA*/ { - var records = str.split('\n'), R = -1, C = -1, ri = 0, arr/*:AOA*/ = []; - for (; ri !== records.length; ++ri) { - if (records[ri].trim() === 'BOT') { arr[++R] = []; C = 0; continue; } - if (R < 0) continue; - var metadata = records[ri].trim().split(","); - var type = metadata[0], value = metadata[1]; - ++ri; - var data = records[ri] || ""; - while(((data.match(/["]/g)||[]).length & 1) && ri < records.length - 1) data += "\n" + records[++ri]; - data = data.trim(); - switch (+type) { - case -1: - if (data === 'BOT') { arr[++R] = []; C = 0; continue; } - else if (data !== 'EOD') throw new Error("Unrecognized DIF special command " + data); - break; - case 0: - if(data === 'TRUE') arr[R][C] = true; - else if(data === 'FALSE') arr[R][C] = false; - else if(!isNaN(fuzzynum(value))) arr[R][C] = fuzzynum(value); - else if(!isNaN(fuzzydate(value).getDate())) arr[R][C] = parseDate(value); - else arr[R][C] = value; - ++C; break; - case 1: - data = data.slice(1,data.length-1); - data = data.replace(/""/g, '"'); - if(DIF_XL && data && data.match(/^=".*"$/)) data = data.slice(2, -1); - arr[R][C++] = data !== '' ? data : null; - break; - } - if (data === 'EOD') break; - } - if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); - return arr; - } - - function dif_to_sheet(str/*:string*/, opts)/*:Worksheet*/ { return aoa_to_sheet(dif_to_aoa(str, opts), opts); } - function dif_to_workbook(str/*:string*/, opts)/*:Workbook*/ { return sheet_to_workbook(dif_to_sheet(str, opts), opts); } - - var sheet_to_dif = (function() { - var push_field = function pf(o/*:Array*/, topic/*:string*/, v/*:number*/, n/*:number*/, s/*:string*/) { - o.push(topic); - o.push(v + "," + n); - o.push('"' + s.replace(/"/g,'""') + '"'); - }; - var push_value = function po(o/*:Array*/, type/*:number*/, v/*:any*/, s/*:string*/) { - o.push(type + "," + v); - o.push(type == 1 ? '"' + s.replace(/"/g,'""') + '"' : s); - }; - return function sheet_to_dif(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ { - var o/*:Array*/ = []; - var r = safe_decode_range(ws['!ref']), cell/*:Cell*/; - var dense = Array.isArray(ws); - push_field(o, "TABLE", 0, 1, "sheetjs"); - push_field(o, "VECTORS", 0, r.e.r - r.s.r + 1,""); - push_field(o, "TUPLES", 0, r.e.c - r.s.c + 1,""); - push_field(o, "DATA", 0, 0,""); - for(var R = r.s.r; R <= r.e.r; ++R) { - push_value(o, -1, 0, "BOT"); - for(var C = r.s.c; C <= r.e.c; ++C) { - var coord = encode_cell({r:R,c:C}); - cell = dense ? (ws[R]||[])[C] : ws[coord]; - if(!cell) { push_value(o, 1, 0, ""); continue;} - switch(cell.t) { - case 'n': - var val = DIF_XL ? cell.w : cell.v; - if(!val && cell.v != null) val = cell.v; - if(val == null) { - if(DIF_XL && cell.f && !cell.F) push_value(o, 1, 0, "=" + cell.f); - else push_value(o, 1, 0, ""); - } - else push_value(o, 0, val, "V"); - break; - case 'b': - push_value(o, 0, cell.v ? 1 : 0, cell.v ? "TRUE" : "FALSE"); - break; - case 's': - push_value(o, 1, 0, (!DIF_XL || isNaN(cell.v)) ? cell.v : '="' + cell.v + '"'); - break; - case 'd': - if(!cell.w) cell.w = SSF.format(cell.z || SSF._table[14], datenum(parseDate(cell.v))); - if(DIF_XL) push_value(o, 0, cell.w, "V"); - else push_value(o, 1, 0, cell.w); - break; - default: push_value(o, 1, 0, ""); - } - } - } - push_value(o, -1, 0, "EOD"); - var RS = "\r\n"; - var oo = o.join(RS); - //while((oo.length & 0x7F) != 0) oo += "\0"; - return oo; - }; - })(); - return { - to_workbook: dif_to_workbook, - to_sheet: dif_to_sheet, - from_sheet: sheet_to_dif - }; -})(); - -var ETH = (function() { - function decode(s/*:string*/)/*:string*/ { return s.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,"\n"); } - function encode(s/*:string*/)/*:string*/ { return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g,"\\n"); } - - function eth_to_aoa(str/*:string*/, opts)/*:AOA*/ { - var records = str.split('\n'), R = -1, C = -1, ri = 0, arr/*:AOA*/ = []; - for (; ri !== records.length; ++ri) { - var record = records[ri].trim().split(":"); - if(record[0] !== 'cell') continue; - var addr = decode_cell(record[1]); - if(arr.length <= addr.r) for(R = arr.length; R <= addr.r; ++R) if(!arr[R]) arr[R] = []; - R = addr.r; C = addr.c; - switch(record[2]) { - case 't': arr[R][C] = decode(record[3]); break; - case 'v': arr[R][C] = +record[3]; break; - case 'vtf': var _f = record[record.length - 1]; - /* falls through */ - case 'vtc': - switch(record[3]) { - case 'nl': arr[R][C] = +record[4] ? true : false; break; - default: arr[R][C] = +record[4]; break; - } - if(record[2] == 'vtf') arr[R][C] = [arr[R][C], _f]; - } - } - if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); - return arr; - } - - function eth_to_sheet(d/*:string*/, opts)/*:Worksheet*/ { return aoa_to_sheet(eth_to_aoa(d, opts), opts); } - function eth_to_workbook(d/*:string*/, opts)/*:Workbook*/ { return sheet_to_workbook(eth_to_sheet(d, opts), opts); } - - var header = [ - "socialcalc:version:1.5", - "MIME-Version: 1.0", - "Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave" - ].join("\n"); - - var sep = [ - "--SocialCalcSpreadsheetControlSave", - "Content-type: text/plain; charset=UTF-8" - ].join("\n") + "\n"; - - /* TODO: the other parts */ - var meta = [ - "# SocialCalc Spreadsheet Control Save", - "part:sheet" - ].join("\n"); - - var end = "--SocialCalcSpreadsheetControlSave--"; - - function sheet_to_eth_data(ws/*:Worksheet*/)/*:string*/ { - if(!ws || !ws['!ref']) return ""; - var o/*:Array*/ = [], oo/*:Array*/ = [], cell, coord = ""; - var r = decode_range(ws['!ref']); - var dense = Array.isArray(ws); - for(var R = r.s.r; R <= r.e.r; ++R) { - for(var C = r.s.c; C <= r.e.c; ++C) { - coord = encode_cell({r:R,c:C}); - cell = dense ? (ws[R]||[])[C] : ws[coord]; - if(!cell || cell.v == null || cell.t === 'z') continue; - oo = ["cell", coord, 't']; - switch(cell.t) { - case 's': case 'str': oo.push(encode(cell.v)); break; - case 'n': - if(!cell.f) { oo[2]='v'; oo[3]=cell.v; } - else { oo[2]='vtf'; oo[3]='n'; oo[4]=cell.v; oo[5]=encode(cell.f); } - break; - case 'b': - oo[2] = 'vt'+(cell.f?'f':'c'); oo[3]='nl'; oo[4]=cell.v?"1":"0"; - oo[5] = encode(cell.f||(cell.v?'TRUE':'FALSE')); - break; - case 'd': - var t = datenum(parseDate(cell.v)); - oo[2] = 'vtc'; oo[3] = 'nd'; oo[4] = ""+t; - oo[5] = cell.w || SSF.format(cell.z || SSF._table[14], t); - break; - case 'e': continue; - } - o.push(oo.join(":")); - } - } - o.push("sheet:c:" + (r.e.c-r.s.c+1) + ":r:" + (r.e.r-r.s.r+1) + ":tvf:1"); - o.push("valueformat:1:text-wiki"); - //o.push("copiedfrom:" + ws['!ref']); // clipboard only - return o.join("\n"); - } - - function sheet_to_eth(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ { - return [header, sep, meta, sep, sheet_to_eth_data(ws), end].join("\n"); - // return ["version:1.5", sheet_to_eth_data(ws)].join("\n"); // clipboard form - } - - return { - to_workbook: eth_to_workbook, - to_sheet: eth_to_sheet, - from_sheet: sheet_to_eth - }; -})(); - -var PRN = (function() { - function set_text_arr(data/*:string*/, arr/*:AOA*/, R/*:number*/, C/*:number*/, o/*:any*/) { - if(o.raw) arr[R][C] = data; - else if(data === ""){/* empty */} - else if(data === 'TRUE') arr[R][C] = true; - else if(data === 'FALSE') arr[R][C] = false; - else if(!isNaN(fuzzynum(data))) arr[R][C] = fuzzynum(data); - else if(!isNaN(fuzzydate(data).getDate())) arr[R][C] = parseDate(data); - else arr[R][C] = data; - } - - function prn_to_aoa_str(f/*:string*/, opts)/*:AOA*/ { - var o = opts || {}; - var arr/*:AOA*/ = ([]/*:any*/); - if(!f || f.length === 0) return arr; - var lines = f.split(/[\r\n]/); - var L = lines.length - 1; - while(L >= 0 && lines[L].length === 0) --L; - var start = 10, idx = 0; - var R = 0; - for(; R <= L; ++R) { - idx = lines[R].indexOf(" "); - if(idx == -1) idx = lines[R].length; else idx++; - start = Math.max(start, idx); - } - for(R = 0; R <= L; ++R) { - arr[R] = []; - /* TODO: confirm that widths are always 10 */ - var C = 0; - set_text_arr(lines[R].slice(0, start).trim(), arr, R, C, o); - for(C = 1; C <= (lines[R].length - start)/10 + 1; ++C) - set_text_arr(lines[R].slice(start+(C-1)*10,start+C*10).trim(),arr,R,C,o); - } - if(o.sheetRows) arr = arr.slice(0, o.sheetRows); - return arr; - } - - // List of accepted CSV separators - var guess_seps = { - /*::[*/0x2C/*::]*/: ',', - /*::[*/0x09/*::]*/: "\t", - /*::[*/0x3B/*::]*/: ';', - /*::[*/0x7C/*::]*/: '|' - }; - - // CSV separator weights to be used in case of equal numbers - var guess_sep_weights = { - /*::[*/0x2C/*::]*/: 3, - /*::[*/0x09/*::]*/: 2, - /*::[*/0x3B/*::]*/: 1, - /*::[*/0x7C/*::]*/: 0 - }; - - function guess_sep(str) { - var cnt = {}, instr = false, end = 0, cc = 0; - for(;end < str.length;++end) { - if((cc=str.charCodeAt(end)) == 0x22) instr = !instr; - else if(!instr && cc in guess_seps) cnt[cc] = (cnt[cc]||0)+1; - } - - cc = []; - for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) { - cc.push([ cnt[end], end ]); - } - - if ( !cc.length ) { - cnt = guess_sep_weights; - for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) { - cc.push([ cnt[end], end ]); - } - } - - cc.sort(function(a, b) { return a[0] - b[0] || guess_sep_weights[a[1]] - guess_sep_weights[b[1]]; }); - - return guess_seps[cc.pop()[1]] || 0x2C; - } - - function dsv_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ { - var o = opts || {}; - var sep = ""; - if(DENSE != null && o.dense == null) o.dense = DENSE; - var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/); - var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/); - - if(str.slice(0,4) == "sep=") { - // If the line ends in \r\n - if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) { - sep = str.charAt(4); str = str.slice(7); - } - // If line ends in \r OR \n - else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) { - sep = str.charAt(4); str = str.slice(6); - } - else sep = guess_sep(str.slice(0,1024)); - } - else if(o && o.FS) sep = o.FS; - else sep = guess_sep(str.slice(0,1024)); - var R = 0, C = 0, v = 0; - var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0, startcc=str.charCodeAt(0); - str = str.replace(/\r\n/mg, "\n"); - var _re/*:?RegExp*/ = o.dateNF != null ? dateNF_regex(o.dateNF) : null; - function finish_cell() { - var s = str.slice(start, end); - var cell = ({}/*:any*/); - if(s.charAt(0) == '"' && s.charAt(s.length - 1) == '"') s = s.slice(1,-1).replace(/""/g,'"'); - if(s.length === 0) cell.t = 'z'; - else if(o.raw) { cell.t = 's'; cell.v = s; } - else if(s.trim().length === 0) { cell.t = 's'; cell.v = s; } - else if(s.charCodeAt(0) == 0x3D) { - if(s.charCodeAt(1) == 0x22 && s.charCodeAt(s.length - 1) == 0x22) { cell.t = 's'; cell.v = s.slice(2,-1).replace(/""/g,'"'); } - else if(fuzzyfmla(s)) { cell.t = 'n'; cell.f = s.slice(1); } - else { cell.t = 's'; cell.v = s; } } - else if(s == "TRUE") { cell.t = 'b'; cell.v = true; } - else if(s == "FALSE") { cell.t = 'b'; cell.v = false; } - else if(!isNaN(v = fuzzynum(s))) { cell.t = 'n'; if(o.cellText !== false) cell.w = s; cell.v = v; } - else if(!isNaN(fuzzydate(s).getDate()) || _re && s.match(_re)) { - cell.z = o.dateNF || SSF._table[14]; - var k = 0; - if(_re && s.match(_re)){ s=dateNF_fix(s, o.dateNF, (s.match(_re)||[])); k=1; } - if(o.cellDates) { cell.t = 'd'; cell.v = parseDate(s, k); } - else { cell.t = 'n'; cell.v = datenum(parseDate(s, k)); } - if(o.cellText !== false) cell.w = SSF.format(cell.z, cell.v instanceof Date ? datenum(cell.v):cell.v); - if(!o.cellNF) delete cell.z; - } else { - cell.t = 's'; - cell.v = s; - } - if(cell.t == 'z'){} - else if(o.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = cell; } - else ws[encode_cell({c:C,r:R})] = cell; - start = end+1; startcc = str.charCodeAt(start); - if(range.e.c < C) range.e.c = C; - if(range.e.r < R) range.e.r = R; - if(cc == sepcc) ++C; else { C = 0; ++R; if(o.sheetRows && o.sheetRows <= R) return true; } - } - outer: for(;end < str.length;++end) switch((cc=str.charCodeAt(end))) { - case 0x22: if(startcc === 0x22) instr = !instr; break; - case sepcc: case 0x0a: case 0x0d: if(!instr && finish_cell()) break outer; break; - default: break; - } - if(end - start > 0) finish_cell(); - - ws['!ref'] = encode_range(range); - return ws; - } - - function prn_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ { - if(!(opts && opts.PRN)) return dsv_to_sheet_str(str, opts); - if(opts.FS) return dsv_to_sheet_str(str, opts); - if(str.slice(0,4) == "sep=") return dsv_to_sheet_str(str, opts); - if(str.indexOf("\t") >= 0 || str.indexOf(",") >= 0 || str.indexOf(";") >= 0) return dsv_to_sheet_str(str, opts); - return aoa_to_sheet(prn_to_aoa_str(str, opts), opts); - } - - function prn_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ { - var str = "", bytes = opts.type == 'string' ? [0,0,0,0] : firstbyte(d, opts); - switch(opts.type) { - case 'base64': str = Base64.decode(d); break; - case 'binary': str = d; break; - case 'buffer': - if(opts.codepage == 65001) str = d.toString('utf8'); // TODO: test if buf - else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d); - else str = has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d); - break; - case 'array': str = cc2str(d); break; - case 'string': str = d; break; - default: throw new Error("Unrecognized type " + opts.type); - } - if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3)); - else if(opts.type != 'string' && opts.type != 'buffer' && opts.codepage == 65001) str = utf8read(str); - else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(28591,str)); - if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts); - return prn_to_sheet_str(str, opts); - } - - function prn_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(prn_to_sheet(d, opts), opts); } - - function sheet_to_prn(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ { - var o/*:Array*/ = []; - var r = safe_decode_range(ws['!ref']), cell/*:Cell*/; - var dense = Array.isArray(ws); - for(var R = r.s.r; R <= r.e.r; ++R) { - var oo/*:Array*/ = []; - for(var C = r.s.c; C <= r.e.c; ++C) { - var coord = encode_cell({r:R,c:C}); - cell = dense ? (ws[R]||[])[C] : ws[coord]; - if(!cell || cell.v == null) { oo.push(" "); continue; } - var w = (cell.w || (format_cell(cell), cell.w) || "").slice(0,10); - while(w.length < 10) w += " "; - oo.push(w + (C === 0 ? " " : "")); - } - o.push(oo.join("")); - } - return o.join("\n"); - } - - return { - to_workbook: prn_to_workbook, - to_sheet: prn_to_sheet, - from_sheet: sheet_to_prn - }; -})(); - -/* Excel defaults to SYLK but warns if data is not valid */ -function read_wb_ID(d, opts) { - var o = opts || {}, OLD_WTF = !!o.WTF; o.WTF = true; - try { - var out = SYLK.to_workbook(d, o); - o.WTF = OLD_WTF; - return out; - } catch(e) { - o.WTF = OLD_WTF; - if(!e.message.match(/SYLK bad record ID/) && OLD_WTF) throw e; - return PRN.to_workbook(d, opts); - } -} - -var WK_ = /*#__PURE__*/ (function() { - function lotushopper(data, cb/*:RecordHopperCB*/, opts/*:any*/) { - if(!data) return; - prep_blob(data, data.l || 0); - var Enum = opts.Enum || WK1Enum; - while(data.l < data.length) { - var RT = data.read_shift(2); - var R = Enum[RT] || Enum[0xFFFF]; - var length = data.read_shift(2); - var tgt = data.l + length; - var d = R.f && R.f(data, length, opts); - data.l = tgt; - if(cb(d, R, RT)) return; - } - } - - function lotus_to_workbook(d/*:RawData*/, opts) { - switch(opts.type) { - case 'base64': return lotus_to_workbook_buf(s2a(Base64.decode(d)), opts); - case 'binary': return lotus_to_workbook_buf(s2a(d), opts); - case 'buffer': - case 'array': return lotus_to_workbook_buf(d, opts); - } - throw "Unsupported type " + opts.type; - } - - function lotus_to_workbook_buf(d, opts)/*:Workbook*/ { - if(!d) return d; - var o = opts || {}; - if(DENSE != null && o.dense == null) o.dense = DENSE; - var s/*:Worksheet*/ = ((o.dense ? [] : {})/*:any*/), n = "Sheet1", next_n = "", sidx = 0; - var sheets = {}, snames = [], realnames = []; - - var refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; - var sheetRows = o.sheetRows || 0; - - if(d[2] == 0x00) { - if(d[3] == 0x08 || d[3] == 0x09) { - if(d.length >= 16 && d[14] == 0x05 && d[15] === 0x6c) throw new Error("Unsupported Works 3 for Mac file"); - } - } - - if(d[2] == 0x02) { - o.Enum = WK1Enum; - lotushopper(d, function(val, R, RT) { switch(RT) { - case 0x00: /* BOF */ - o.vers = val; - if(val >= 0x1000) o.qpro = true; - break; - case 0x06: refguess = val; break; /* RANGE */ - case 0xCC: if(val) next_n = val; break; /* SHEETNAMECS */ - case 0xDE: next_n = val; break; /* SHEETNAMELP */ - case 0x0F: /* LABEL */ - case 0x33: /* STRING */ - if(!o.qpro) val[1].v = val[1].v.slice(1); - /* falls through */ - case 0x0D: /* INTEGER */ - case 0x0E: /* NUMBER */ - case 0x10: /* FORMULA */ - /* TODO: actual translation of the format code */ - if(RT == 0x0E && (val[2] & 0x70) == 0x70 && (val[2] & 0x0F) > 1 && (val[2] & 0x0F) < 15) { - val[1].z = o.dateNF || SSF._table[14]; - if(o.cellDates) { val[1].t = 'd'; val[1].v = numdate(val[1].v); } - } - - if(o.qpro) { - if(val[3] > sidx) { - s["!ref"] = encode_range(refguess); - sheets[n] = s; - snames.push(n); - s = (o.dense ? [] : {}); - refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; - sidx = val[3]; n = next_n || "Sheet" + (sidx + 1); next_n = ""; - } - } - - var tmpcell = o.dense ? (s[val[0].r]||[])[val[0].c] : s[encode_cell(val[0])]; - if(tmpcell) { - tmpcell.t = val[1].t; tmpcell.v = val[1].v; - if(val[1].z != null) tmpcell.z = val[1].z; - if(val[1].f != null) tmpcell.f = val[1].f; - break; - } - if(o.dense) { - if(!s[val[0].r]) s[val[0].r] = []; - s[val[0].r][val[0].c] = val[1]; - } else s[encode_cell(val[0])] = val[1]; - break; - default: - }}, o); - } else if(d[2] == 0x1A || d[2] == 0x0E) { - o.Enum = WK3Enum; - if(d[2] == 0x0E) { o.qpro = true; d.l = 0; } - lotushopper(d, function(val, R, RT) { switch(RT) { - case 0xCC: n = val; break; /* SHEETNAMECS */ - case 0x16: /* LABEL16 */ - val[1].v = val[1].v.slice(1); - /* falls through */ - case 0x17: /* NUMBER17 */ - case 0x18: /* NUMBER18 */ - case 0x19: /* FORMULA19 */ - case 0x25: /* NUMBER25 */ - case 0x27: /* NUMBER27 */ - case 0x28: /* FORMULA28 */ - if(val[3] > sidx) { - s["!ref"] = encode_range(refguess); - sheets[n] = s; - snames.push(n); - s = (o.dense ? [] : {}); - refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; - sidx = val[3]; n = "Sheet" + (sidx + 1); - } - if(sheetRows > 0 && val[0].r >= sheetRows) break; - if(o.dense) { - if(!s[val[0].r]) s[val[0].r] = []; - s[val[0].r][val[0].c] = val[1]; - } else s[encode_cell(val[0])] = val[1]; - if(refguess.e.c < val[0].c) refguess.e.c = val[0].c; - if(refguess.e.r < val[0].r) refguess.e.r = val[0].r; - break; - case 0x1B: /* XFORMAT */ - if(val[0x36b0]) realnames[val[0x36b0][0]] = val[0x36b0][1]; - break; - case 0x0601: /* SHEETINFOQP */ - realnames[val[0]] = val[1]; if(val[0] == sidx) n = val[1]; break; - default: break; - }}, o); - } else throw new Error("Unrecognized LOTUS BOF " + d[2]); - s["!ref"] = encode_range(refguess); - sheets[next_n || n] = s; - snames.push(next_n || n); - if(!realnames.length) return { SheetNames: snames, Sheets: sheets }; - var osheets = {}, rnames = []; - /* TODO: verify no collisions */ - for(var i = 0; i < realnames.length; ++i) if(sheets[snames[i]]) { - rnames.push(realnames[i] || snames[i]); - osheets[realnames[i]] = sheets[realnames[i]] || sheets[snames[i]]; - } else { - rnames.push(realnames[i]); - osheets[realnames[i]] = ({ "!ref": "A1" }); - } - return { SheetNames: rnames, Sheets: osheets }; - } - - function sheet_to_wk1(ws/*:Worksheet*/, opts/*:WriteOpts*/) { - var o = opts || {}; - if(+o.codepage >= 0) set_cp(+o.codepage); - if(o.type == "string") throw new Error("Cannot write WK1 to JS string"); - var ba = buf_array(); - var range = safe_decode_range(ws["!ref"]); - var dense = Array.isArray(ws); - var cols = []; - - write_biff_rec(ba, 0x00, write_BOF_WK1(0x0406)); - write_biff_rec(ba, 0x06, write_RANGE(range)); - var max_R = Math.min(range.e.r, 8191); - for(var R = range.s.r; R <= max_R; ++R) { - var rr = encode_row(R); - for(var C = range.s.c; C <= range.e.c; ++C) { - if(R === range.s.r) cols[C] = encode_col(C); - var ref = cols[C] + rr; - var cell = dense ? (ws[R]||[])[C] : ws[ref]; - if(!cell || cell.t == "z") continue; - /* TODO: formula records */ - if(cell.t == "n") { - if((cell.v|0)==cell.v && cell.v >= -32768 && cell.v <= 32767) write_biff_rec(ba, 0x0d, write_INTEGER(R, C, cell.v)); - else write_biff_rec(ba, 0x0e, write_NUMBER(R, C, cell.v)); - } else { - var str = format_cell(cell); - write_biff_rec(ba, 0x0F, write_LABEL(R, C, str.slice(0, 239))); - } - } - } - - write_biff_rec(ba, 0x01); - return ba.end(); - } - - function book_to_wk3(wb/*:Workbook*/, opts/*:WriteOpts*/) { - var o = opts || {}; - if(+o.codepage >= 0) set_cp(+o.codepage); - if(o.type == "string") throw new Error("Cannot write WK3 to JS string"); - var ba = buf_array(); - - write_biff_rec(ba, 0x00, write_BOF_WK3(wb)); - - for(var i = 0, cnt = 0; i < wb.SheetNames.length; ++i) if((wb.Sheets[wb.SheetNames[i]] || {})["!ref"]) write_biff_rec(ba, 0x1b, write_XFORMAT_SHEETNAME(wb.SheetNames[i], cnt++)); - - var wsidx = 0; - for(i = 0; i < wb.SheetNames.length; ++i) { - var ws = wb.Sheets[wb.SheetNames[i]]; - if(!ws || !ws["!ref"]) continue; - var range = safe_decode_range(ws["!ref"]); - var dense = Array.isArray(ws); - var cols = []; - var max_R = Math.min(range.e.r, 8191); - for(var R = range.s.r; R <= max_R; ++R) { - var rr = encode_row(R); - for(var C = range.s.c; C <= range.e.c; ++C) { - if(R === range.s.r) cols[C] = encode_col(C); - var ref = cols[C] + rr; - var cell = dense ? (ws[R]||[])[C] : ws[ref]; - if(!cell || cell.t == "z") continue; - /* TODO: FORMULA19 NUMBER18 records */ - if(cell.t == "n") { - write_biff_rec(ba, 0x17, write_NUMBER_17(R, C, wsidx, cell.v)); - } else { - var str = format_cell(cell); - /* TODO: max len? */ - write_biff_rec(ba, 0x16, write_LABEL_16(R, C, wsidx, str.slice(0, 239))); - } - } - } - ++wsidx; - } - - write_biff_rec(ba, 0x01); - return ba.end(); - } - - - function write_BOF_WK1(v/*:number*/) { - var out = new_buf(2); - out.write_shift(2, v); - return out; - } - - function write_BOF_WK3(wb/*:Workbook*/) { - var out = new_buf(26); - out.write_shift(2, 0x1000); - out.write_shift(2, 0x0004); - out.write_shift(4, 0x0000); - var rows = 0, cols = 0, wscnt = 0; - for(var i = 0; i < wb.SheetNames.length; ++i) { - var name = wb.SheetNames[i]; - var ws = wb.Sheets[name]; - if(!ws || !ws["!ref"]) continue; - ++wscnt; - var range = decode_range(ws["!ref"]); - if(rows < range.e.r) rows = range.e.r; - if(cols < range.e.c) cols = range.e.c; - } - if(rows > 8191) rows = 8191; - out.write_shift(2, rows); - out.write_shift(1, wscnt); - out.write_shift(1, cols); - out.write_shift(2, 0x00); - out.write_shift(2, 0x00); - out.write_shift(1, 0x01); - out.write_shift(1, 0x02); - out.write_shift(4, 0); - out.write_shift(4, 0); - return out; - } - - function parse_RANGE(blob, length, opts) { - var o = {s:{c:0,r:0},e:{c:0,r:0}}; - if(length == 8 && opts.qpro) { - o.s.c = blob.read_shift(1); - blob.l++; - o.s.r = blob.read_shift(2); - o.e.c = blob.read_shift(1); - blob.l++; - o.e.r = blob.read_shift(2); - return o; - } - o.s.c = blob.read_shift(2); - o.s.r = blob.read_shift(2); - if(length == 12 && opts.qpro) blob.l += 2; - o.e.c = blob.read_shift(2); - o.e.r = blob.read_shift(2); - if(length == 12 && opts.qpro) blob.l += 2; - if(o.s.c == 0xFFFF) o.s.c = o.e.c = o.s.r = o.e.r = 0; - return o; - } - function write_RANGE(range) { - var out = new_buf(8); - out.write_shift(2, range.s.c); - out.write_shift(2, range.s.r); - out.write_shift(2, range.e.c); - out.write_shift(2, range.e.r); - return out; - } - - function parse_cell(blob, length, opts) { - var o = [{c:0,r:0}, {t:'n',v:0}, 0, 0]; - if(opts.qpro && opts.vers != 0x5120) { - o[0].c = blob.read_shift(1); - o[3] = blob.read_shift(1); - o[0].r = blob.read_shift(2); - blob.l+=2; - } else { - o[2] = blob.read_shift(1); - o[0].c = blob.read_shift(2); o[0].r = blob.read_shift(2); - } - return o; - } - - function parse_LABEL(blob, length, opts) { - var tgt = blob.l + length; - var o = parse_cell(blob, length, opts); - o[1].t = 's'; - if(opts.vers == 0x5120) { - blob.l++; - var len = blob.read_shift(1); - o[1].v = blob.read_shift(len, 'utf8'); - return o; - } - if(opts.qpro) blob.l++; - o[1].v = blob.read_shift(tgt - blob.l, 'cstr'); - return o; - } - function write_LABEL(R, C, s) { - /* TODO: encoding */ - var o = new_buf(7 + s.length); - o.write_shift(1, 0xFF); - o.write_shift(2, C); - o.write_shift(2, R); - o.write_shift(1, 0x27); // ?? - for(var i = 0; i < o.length; ++i) { - var cc = s.charCodeAt(i); - o.write_shift(1, cc >= 0x80 ? 0x5F : cc); - } - o.write_shift(1, 0); - return o; - } - - function parse_INTEGER(blob, length, opts) { - var o = parse_cell(blob, length, opts); - o[1].v = blob.read_shift(2, 'i'); - return o; - } - function write_INTEGER(R, C, v) { - var o = new_buf(7); - o.write_shift(1, 0xFF); - o.write_shift(2, C); - o.write_shift(2, R); - o.write_shift(2, v, 'i'); - return o; - } - - function parse_NUMBER(blob, length, opts) { - var o = parse_cell(blob, length, opts); - o[1].v = blob.read_shift(8, 'f'); - return o; - } - function write_NUMBER(R, C, v) { - var o = new_buf(13); - o.write_shift(1, 0xFF); - o.write_shift(2, C); - o.write_shift(2, R); - o.write_shift(8, v, 'f'); - return o; - } - - function parse_FORMULA(blob, length, opts) { - var tgt = blob.l + length; - var o = parse_cell(blob, length, opts); - /* TODO: formula */ - o[1].v = blob.read_shift(8, 'f'); - if(opts.qpro) blob.l = tgt; - else { - var flen = blob.read_shift(2); - wk1_fmla_to_csf(blob.slice(blob.l, blob.l + flen), o); - blob.l += flen; - } - return o; - } - - function wk1_parse_rc(B, V, col) { - var rel = V & 0x8000; - V &= ~0x8000; - V = (rel ? B : 0) + ((V >= 0x2000) ? V - 0x4000 : V); - return (rel ? "" : "$") + (col ? encode_col(V) : encode_row(V)); - } - var oprec = [ - 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 4, 5, 5, 7, 3, 3, - 3, 3, 3, 3, 1, 1, 2, 6, 8, 8, 8, 8, 8, 8, 8, 8 - ]; - /* TODO: flesh out */ - var FuncTab = { - 0x33: ["FALSE", 0], - 0x34: ["TRUE", 0], - 0x46: ["LEN", 1], - 0x50: ["SUM", 69], - 0x51: ["AVERAGEA", 69], - 0x52: ["COUNTA", 69], - 0x53: ["MINA", 69], - 0x54: ["MAXA", 69], - 0x6F: ["T", 1] - }; - var BinOpTab = [ - "", "", "", "", "", "", "", "", - "", "+", "-", "*", "/", "^", "=", "<>", - "<=", ">=", "<", ">", "", "", "", "", - "&", "", "", "", "", "", "", "" - ]; - - function wk1_fmla_to_csf(blob, o) { - prep_blob(blob, 0); - var out = [], argc = 0, R = "", C = "", argL = "", argR = ""; - while(blob.l < blob.length) { - var cc = blob[blob.l++]; - switch(cc) { - case 0x00: out.push(blob.read_shift(8, 'f')); break; - case 0x01: { - C = wk1_parse_rc(o[0].c, blob.read_shift(2), true); - R = wk1_parse_rc(o[0].r, blob.read_shift(2), false); - out.push(C + R); - } break; - case 0x02: { - var c = wk1_parse_rc(o[0].c, blob.read_shift(2), true); - var r = wk1_parse_rc(o[0].r, blob.read_shift(2), false); - C = wk1_parse_rc(o[0].c, blob.read_shift(2), true); - R = wk1_parse_rc(o[0].r, blob.read_shift(2), false); - out.push(c + r + ":" + C + R); - } break; - case 0x03: - if(blob.l < blob.length) { console.error("WK1 premature formula end"); return; } - break; - case 0x04: out.push("(" + out.pop() + ")"); break; - case 0x05: out.push(blob.read_shift(2)); break; - case 0x06: { - /* TODO: text encoding */ - var Z = ""; while((cc = blob[blob.l++])) Z += String.fromCharCode(cc); - out.push('"' + Z.replace(/"/g, '""') + '"'); break; - } break; - - case 0x08: out.push("-" + out.pop()); break; - case 0x17: out.push("+" + out.pop()); break; - case 0x16: out.push("NOT(" + out.pop() + ")"); break; - - case 0x14: case 0x15: { - argR = out.pop(); argL = out.pop(); - out.push(["AND", "OR"][cc - 0x14] + "(" + argL + "," + argR + ")"); - } break; - - default: - if(cc < 0x20 && BinOpTab[cc]) { - argR = out.pop(); argL = out.pop(); - out.push(argL + BinOpTab[cc] + argR); - } else if(FuncTab[cc]) { - argc = FuncTab[cc][1]; - if(argc == 69) argc = blob[blob.l++]; - if(argc > out.length) { console.error("WK1 bad formula parse 0x" + cc.toString(16) + ":|" + out.join("|") + "|"); return; } - var args = out.slice(-argc); - out.length -= argc; - out.push(FuncTab[cc][0] + "(" + args.join(",") + ")"); - } - else if(cc <= 0x07) return console.error("WK1 invalid opcode " + cc.toString(16)); - else if(cc <= 0x18) return console.error("WK1 unsupported op " + cc.toString(16)); - else if(cc <= 0x1E) return console.error("WK1 invalid opcode " + cc.toString(16)); - else if(cc <= 0x73) return console.error("WK1 unsupported function opcode " + cc.toString(16)); - // possible future functions ?? - else return console.error("WK1 unrecognized opcode " + cc.toString(16)); - } - } - if(out.length == 1) o[1].f = "" + out[0]; - else console.error("WK1 bad formula parse |" + out.join("|") + "|"); - } - - - function parse_cell_3(blob/*::, length*/) { - var o = [{c:0,r:0}, {t:'n',v:0}, 0]; - o[0].r = blob.read_shift(2); o[3] = blob[blob.l++]; o[0].c = blob[blob.l++]; - return o; - } - - function parse_LABEL_16(blob, length) { - var o = parse_cell_3(blob, length); - o[1].t = 's'; - o[1].v = blob.read_shift(length - 4, 'cstr'); - return o; - } - function write_LABEL_16(R, C, wsidx, s) { - /* TODO: encoding */ - var o = new_buf(6 + s.length); - o.write_shift(2, R); - o.write_shift(1, wsidx); - o.write_shift(1, C); - o.write_shift(1, 0x27); - for(var i = 0; i < s.length; ++i) { - var cc = s.charCodeAt(i); - o.write_shift(1, cc >= 0x80 ? 0x5F : cc); - } - o.write_shift(1, 0); - return o; - } - - function parse_NUMBER_18(blob, length) { - var o = parse_cell_3(blob, length); - o[1].v = blob.read_shift(2); - var v = o[1].v >> 1; - if(o[1].v & 0x1) { - switch(v & 0x07) { - case 0: v = (v >> 3) * 5000; break; - case 1: v = (v >> 3) * 500; break; - case 2: v = (v >> 3) / 20; break; - case 3: v = (v >> 3) / 200; break; - case 4: v = (v >> 3) / 2000; break; - case 5: v = (v >> 3) / 20000; break; - case 6: v = (v >> 3) / 16; break; - case 7: v = (v >> 3) / 64; break; - } - } - o[1].v = v; - return o; - } - - function parse_NUMBER_17(blob, length) { - var o = parse_cell_3(blob, length); - var v1 = blob.read_shift(4); - var v2 = blob.read_shift(4); - var e = blob.read_shift(2); - if(e == 0xFFFF) { - if(v1 === 0 && v2 === 0xC0000000) { o[1].t = "e"; o[1].v = 0x0F; } // ERR -> #VALUE! - else if(v1 === 0 && v2 === 0xD0000000) { o[1].t = "e"; o[1].v = 0x2A; } // NA -> #N/A - else o[1].v = 0; - return o; - } - var s = e & 0x8000; e = (e&0x7FFF) - 16446; - o[1].v = (1 - s*2) * (v2 * Math.pow(2, e+32) + v1 * Math.pow(2, e)); - return o; - } - function write_NUMBER_17(R, C, wsidx, v) { - var o = new_buf(14); - o.write_shift(2, R); - o.write_shift(1, wsidx); - o.write_shift(1, C); - if(v == 0) { - o.write_shift(4, 0); - o.write_shift(4, 0); - o.write_shift(2, 0xFFFF); - return o; - } - var s = 0, e = 0, v1 = 0, v2 = 0; - if(v < 0) { s = 1; v = -v; } - e = Math.log2(v) | 0; - v /= Math.pow(2, e-31); - v2 = (v)>>>0; - if((v2&0x80000000) == 0) { v/=2; ++e; v2 = v >>> 0; } - v -= v2; - v2 |= 0x80000000; - v2 >>>= 0; - v *= Math.pow(2, 32); - v1 = v>>>0; - o.write_shift(4, v1); - o.write_shift(4, v2); - e += 0x3FFF + (s ? 0x8000 : 0); - o.write_shift(2, e); - return o; - } - - function parse_FORMULA_19(blob, length) { - var o = parse_NUMBER_17(blob, 14); - blob.l += length - 14; /* TODO: WK3 formula */ - return o; - } - - function parse_NUMBER_25(blob, length) { - var o = parse_cell_3(blob, length); - var v1 = blob.read_shift(4); - o[1].v = v1 >> 6; - return o; - } - - function parse_NUMBER_27(blob, length) { - var o = parse_cell_3(blob, length); - var v1 = blob.read_shift(8,'f'); - o[1].v = v1; - return o; - } - - function parse_FORMULA_28(blob, length) { - var o = parse_NUMBER_27(blob, 14); - blob.l += length - 10; /* TODO: formula */ - return o; - } - - function parse_SHEETNAMECS(blob, length) { - return blob[blob.l + length - 1] == 0 ? blob.read_shift(length, 'cstr') : ""; - } - - function parse_SHEETNAMELP(blob, length) { - var len = blob[blob.l++]; - if(len > length - 1) len = length - 1; - var o = ""; while(o.length < len) o += String.fromCharCode(blob[blob.l++]); - return o; - } - - function parse_SHEETINFOQP(blob, length, opts) { - if(!opts.qpro || length < 21) return; - var id = blob.read_shift(1); - blob.l += 17; - var len = blob.read_shift(1); - blob.l += 2; - var nm = blob.read_shift(length - 21, 'cstr'); - return [id, nm]; - } - - function parse_XFORMAT(blob, length) { - var o = {}, tgt = blob.l + length; - while(blob.l < tgt) { - var dt = blob.read_shift(2); - if(dt == 0x36b0) { - o[dt] = [0, ""]; - o[dt][0] = blob.read_shift(2); - while(blob[blob.l]) { o[dt][1] += String.fromCharCode(blob[blob.l]); blob.l++; } blob.l++; - } - // TODO: 0x3a99 ?? - } - return o; - } - function write_XFORMAT_SHEETNAME(name, wsidx) { - var out = new_buf(5 + name.length); - out.write_shift(2, 0x36b0); - out.write_shift(2, wsidx); - for(var i = 0; i < name.length; ++i) { - var cc = name.charCodeAt(i); - out[out.l++] = cc > 0x7F ? 0x5F : cc; - } - out[out.l++] = 0; - return out; - } - - var WK1Enum = { - /*::[*/0x0000/*::]*/: { n:"BOF", f:parseuint16 }, - /*::[*/0x0001/*::]*/: { n:"EOF" }, - /*::[*/0x0002/*::]*/: { n:"CALCMODE" }, - /*::[*/0x0003/*::]*/: { n:"CALCORDER" }, - /*::[*/0x0004/*::]*/: { n:"SPLIT" }, - /*::[*/0x0005/*::]*/: { n:"SYNC" }, - /*::[*/0x0006/*::]*/: { n:"RANGE", f:parse_RANGE }, - /*::[*/0x0007/*::]*/: { n:"WINDOW1" }, - /*::[*/0x0008/*::]*/: { n:"COLW1" }, - /*::[*/0x0009/*::]*/: { n:"WINTWO" }, - /*::[*/0x000A/*::]*/: { n:"COLW2" }, - /*::[*/0x000B/*::]*/: { n:"NAME" }, - /*::[*/0x000C/*::]*/: { n:"BLANK" }, - /*::[*/0x000D/*::]*/: { n:"INTEGER", f:parse_INTEGER }, - /*::[*/0x000E/*::]*/: { n:"NUMBER", f:parse_NUMBER }, - /*::[*/0x000F/*::]*/: { n:"LABEL", f:parse_LABEL }, - /*::[*/0x0010/*::]*/: { n:"FORMULA", f:parse_FORMULA }, - /*::[*/0x0018/*::]*/: { n:"TABLE" }, - /*::[*/0x0019/*::]*/: { n:"ORANGE" }, - /*::[*/0x001A/*::]*/: { n:"PRANGE" }, - /*::[*/0x001B/*::]*/: { n:"SRANGE" }, - /*::[*/0x001C/*::]*/: { n:"FRANGE" }, - /*::[*/0x001D/*::]*/: { n:"KRANGE1" }, - /*::[*/0x0020/*::]*/: { n:"HRANGE" }, - /*::[*/0x0023/*::]*/: { n:"KRANGE2" }, - /*::[*/0x0024/*::]*/: { n:"PROTEC" }, - /*::[*/0x0025/*::]*/: { n:"FOOTER" }, - /*::[*/0x0026/*::]*/: { n:"HEADER" }, - /*::[*/0x0027/*::]*/: { n:"SETUP" }, - /*::[*/0x0028/*::]*/: { n:"MARGINS" }, - /*::[*/0x0029/*::]*/: { n:"LABELFMT" }, - /*::[*/0x002A/*::]*/: { n:"TITLES" }, - /*::[*/0x002B/*::]*/: { n:"SHEETJS" }, - /*::[*/0x002D/*::]*/: { n:"GRAPH" }, - /*::[*/0x002E/*::]*/: { n:"NGRAPH" }, - /*::[*/0x002F/*::]*/: { n:"CALCCOUNT" }, - /*::[*/0x0030/*::]*/: { n:"UNFORMATTED" }, - /*::[*/0x0031/*::]*/: { n:"CURSORW12" }, - /*::[*/0x0032/*::]*/: { n:"WINDOW" }, - /*::[*/0x0033/*::]*/: { n:"STRING", f:parse_LABEL }, - /*::[*/0x0037/*::]*/: { n:"PASSWORD" }, - /*::[*/0x0038/*::]*/: { n:"LOCKED" }, - /*::[*/0x003C/*::]*/: { n:"QUERY" }, - /*::[*/0x003D/*::]*/: { n:"QUERYNAME" }, - /*::[*/0x003E/*::]*/: { n:"PRINT" }, - /*::[*/0x003F/*::]*/: { n:"PRINTNAME" }, - /*::[*/0x0040/*::]*/: { n:"GRAPH2" }, - /*::[*/0x0041/*::]*/: { n:"GRAPHNAME" }, - /*::[*/0x0042/*::]*/: { n:"ZOOM" }, - /*::[*/0x0043/*::]*/: { n:"SYMSPLIT" }, - /*::[*/0x0044/*::]*/: { n:"NSROWS" }, - /*::[*/0x0045/*::]*/: { n:"NSCOLS" }, - /*::[*/0x0046/*::]*/: { n:"RULER" }, - /*::[*/0x0047/*::]*/: { n:"NNAME" }, - /*::[*/0x0048/*::]*/: { n:"ACOMM" }, - /*::[*/0x0049/*::]*/: { n:"AMACRO" }, - /*::[*/0x004A/*::]*/: { n:"PARSE" }, - /*::[*/0x0066/*::]*/: { n:"PRANGES??" }, - /*::[*/0x0067/*::]*/: { n:"RRANGES??" }, - /*::[*/0x0068/*::]*/: { n:"FNAME??" }, - /*::[*/0x0069/*::]*/: { n:"MRANGES??" }, - /*::[*/0x00CC/*::]*/: { n:"SHEETNAMECS", f:parse_SHEETNAMECS }, - /*::[*/0x00DE/*::]*/: { n:"SHEETNAMELP", f:parse_SHEETNAMELP }, - /*::[*/0xFFFF/*::]*/: { n:"" } - }; - - var WK3Enum = { - /*::[*/0x0000/*::]*/: { n:"BOF" }, - /*::[*/0x0001/*::]*/: { n:"EOF" }, - /*::[*/0x0002/*::]*/: { n:"PASSWORD" }, - /*::[*/0x0003/*::]*/: { n:"CALCSET" }, - /*::[*/0x0004/*::]*/: { n:"WINDOWSET" }, - /*::[*/0x0005/*::]*/: { n:"SHEETCELLPTR" }, - /*::[*/0x0006/*::]*/: { n:"SHEETLAYOUT" }, - /*::[*/0x0007/*::]*/: { n:"COLUMNWIDTH" }, - /*::[*/0x0008/*::]*/: { n:"HIDDENCOLUMN" }, - /*::[*/0x0009/*::]*/: { n:"USERRANGE" }, - /*::[*/0x000A/*::]*/: { n:"SYSTEMRANGE" }, - /*::[*/0x000B/*::]*/: { n:"ZEROFORCE" }, - /*::[*/0x000C/*::]*/: { n:"SORTKEYDIR" }, - /*::[*/0x000D/*::]*/: { n:"FILESEAL" }, - /*::[*/0x000E/*::]*/: { n:"DATAFILLNUMS" }, - /*::[*/0x000F/*::]*/: { n:"PRINTMAIN" }, - /*::[*/0x0010/*::]*/: { n:"PRINTSTRING" }, - /*::[*/0x0011/*::]*/: { n:"GRAPHMAIN" }, - /*::[*/0x0012/*::]*/: { n:"GRAPHSTRING" }, - /*::[*/0x0013/*::]*/: { n:"??" }, - /*::[*/0x0014/*::]*/: { n:"ERRCELL" }, - /*::[*/0x0015/*::]*/: { n:"NACELL" }, - /*::[*/0x0016/*::]*/: { n:"LABEL16", f:parse_LABEL_16}, - /*::[*/0x0017/*::]*/: { n:"NUMBER17", f:parse_NUMBER_17 }, - /*::[*/0x0018/*::]*/: { n:"NUMBER18", f:parse_NUMBER_18 }, - /*::[*/0x0019/*::]*/: { n:"FORMULA19", f:parse_FORMULA_19}, - /*::[*/0x001A/*::]*/: { n:"FORMULA1A" }, - /*::[*/0x001B/*::]*/: { n:"XFORMAT", f:parse_XFORMAT }, - /*::[*/0x001C/*::]*/: { n:"DTLABELMISC" }, - /*::[*/0x001D/*::]*/: { n:"DTLABELCELL" }, - /*::[*/0x001E/*::]*/: { n:"GRAPHWINDOW" }, - /*::[*/0x001F/*::]*/: { n:"CPA" }, - /*::[*/0x0020/*::]*/: { n:"LPLAUTO" }, - /*::[*/0x0021/*::]*/: { n:"QUERY" }, - /*::[*/0x0022/*::]*/: { n:"HIDDENSHEET" }, - /*::[*/0x0023/*::]*/: { n:"??" }, - /*::[*/0x0025/*::]*/: { n:"NUMBER25", f:parse_NUMBER_25 }, - /*::[*/0x0026/*::]*/: { n:"??" }, - /*::[*/0x0027/*::]*/: { n:"NUMBER27", f:parse_NUMBER_27 }, - /*::[*/0x0028/*::]*/: { n:"FORMULA28", f:parse_FORMULA_28 }, - /*::[*/0x008E/*::]*/: { n:"??" }, - /*::[*/0x0093/*::]*/: { n:"??" }, - /*::[*/0x0096/*::]*/: { n:"??" }, - /*::[*/0x0097/*::]*/: { n:"??" }, - /*::[*/0x0098/*::]*/: { n:"??" }, - /*::[*/0x0099/*::]*/: { n:"??" }, - /*::[*/0x009A/*::]*/: { n:"??" }, - /*::[*/0x009B/*::]*/: { n:"??" }, - /*::[*/0x009C/*::]*/: { n:"??" }, - /*::[*/0x00A3/*::]*/: { n:"??" }, - /*::[*/0x00AE/*::]*/: { n:"??" }, - /*::[*/0x00AF/*::]*/: { n:"??" }, - /*::[*/0x00B0/*::]*/: { n:"??" }, - /*::[*/0x00B1/*::]*/: { n:"??" }, - /*::[*/0x00B8/*::]*/: { n:"??" }, - /*::[*/0x00B9/*::]*/: { n:"??" }, - /*::[*/0x00BA/*::]*/: { n:"??" }, - /*::[*/0x00BB/*::]*/: { n:"??" }, - /*::[*/0x00BC/*::]*/: { n:"??" }, - /*::[*/0x00C3/*::]*/: { n:"??" }, - /*::[*/0x00C9/*::]*/: { n:"??" }, - /*::[*/0x00CC/*::]*/: { n:"SHEETNAMECS", f:parse_SHEETNAMECS }, - /*::[*/0x00CD/*::]*/: { n:"??" }, - /*::[*/0x00CE/*::]*/: { n:"??" }, - /*::[*/0x00CF/*::]*/: { n:"??" }, - /*::[*/0x00D0/*::]*/: { n:"??" }, - /*::[*/0x0100/*::]*/: { n:"??" }, - /*::[*/0x0103/*::]*/: { n:"??" }, - /*::[*/0x0104/*::]*/: { n:"??" }, - /*::[*/0x0105/*::]*/: { n:"??" }, - /*::[*/0x0106/*::]*/: { n:"??" }, - /*::[*/0x0107/*::]*/: { n:"??" }, - /*::[*/0x0109/*::]*/: { n:"??" }, - /*::[*/0x010A/*::]*/: { n:"??" }, - /*::[*/0x010B/*::]*/: { n:"??" }, - /*::[*/0x010C/*::]*/: { n:"??" }, - /*::[*/0x010E/*::]*/: { n:"??" }, - /*::[*/0x010F/*::]*/: { n:"??" }, - /*::[*/0x0180/*::]*/: { n:"??" }, - /*::[*/0x0185/*::]*/: { n:"??" }, - /*::[*/0x0186/*::]*/: { n:"??" }, - /*::[*/0x0189/*::]*/: { n:"??" }, - /*::[*/0x018C/*::]*/: { n:"??" }, - /*::[*/0x0200/*::]*/: { n:"??" }, - /*::[*/0x0202/*::]*/: { n:"??" }, - /*::[*/0x0201/*::]*/: { n:"??" }, - /*::[*/0x0204/*::]*/: { n:"??" }, - /*::[*/0x0205/*::]*/: { n:"??" }, - /*::[*/0x0280/*::]*/: { n:"??" }, - /*::[*/0x0281/*::]*/: { n:"??" }, - /*::[*/0x0282/*::]*/: { n:"??" }, - /*::[*/0x0283/*::]*/: { n:"??" }, - /*::[*/0x0284/*::]*/: { n:"??" }, - /*::[*/0x0285/*::]*/: { n:"??" }, - /*::[*/0x0286/*::]*/: { n:"??" }, - /*::[*/0x0287/*::]*/: { n:"??" }, - /*::[*/0x0288/*::]*/: { n:"??" }, - /*::[*/0x0292/*::]*/: { n:"??" }, - /*::[*/0x0293/*::]*/: { n:"??" }, - /*::[*/0x0294/*::]*/: { n:"??" }, - /*::[*/0x0295/*::]*/: { n:"??" }, - /*::[*/0x0296/*::]*/: { n:"??" }, - /*::[*/0x0299/*::]*/: { n:"??" }, - /*::[*/0x029A/*::]*/: { n:"??" }, - /*::[*/0x0300/*::]*/: { n:"??" }, - /*::[*/0x0304/*::]*/: { n:"??" }, - /*::[*/0x0601/*::]*/: { n:"SHEETINFOQP", f:parse_SHEETINFOQP }, - /*::[*/0x0640/*::]*/: { n:"??" }, - /*::[*/0x0642/*::]*/: { n:"??" }, - /*::[*/0x0701/*::]*/: { n:"??" }, - /*::[*/0x0702/*::]*/: { n:"??" }, - /*::[*/0x0703/*::]*/: { n:"??" }, - /*::[*/0x0704/*::]*/: { n:"??" }, - /*::[*/0x0780/*::]*/: { n:"??" }, - /*::[*/0x0800/*::]*/: { n:"??" }, - /*::[*/0x0801/*::]*/: { n:"??" }, - /*::[*/0x0804/*::]*/: { n:"??" }, - /*::[*/0x0A80/*::]*/: { n:"??" }, - /*::[*/0x2AF6/*::]*/: { n:"??" }, - /*::[*/0x3231/*::]*/: { n:"??" }, - /*::[*/0x6E49/*::]*/: { n:"??" }, - /*::[*/0x6F44/*::]*/: { n:"??" }, - /*::[*/0xFFFF/*::]*/: { n:"" } - }; - return { - sheet_to_wk1: sheet_to_wk1, - book_to_wk3: book_to_wk3, - to_workbook: lotus_to_workbook - }; -})(); -/* 18.4.7 rPr CT_RPrElt */ -function parse_rpr(rpr) { - var font = {}, m = rpr.match(tagregex), i = 0; - var pass = false; - if(m) for(;i!=m.length; ++i) { - var y = parsexmltag(m[i]); - switch(y[0].replace(/\w*:/g,"")) { - /* 18.8.12 condense CT_BooleanProperty */ - /* ** not required . */ - case '': - case '': font.shadow = 1; break; - case '': break; - - /* 18.4.1 charset CT_IntProperty TODO */ - case '': - case '': font.outline = 1; break; - case '': break; - - /* 18.4.5 rFont CT_FontName */ - case '': - case '': font.strike = 1; break; - case '': break; - - /* 18.4.13 u CT_UnderlineProperty */ - case '': - case '': font.u = 1; break; - case '': break; - - /* 18.8.2 b */ - case '': - case '': font.b = 1; break; - case '': break; - - /* 18.8.26 i */ - case '': - case '': font.i = 1; break; - case '': break; - - /* 18.3.1.15 color CT_Color TODO: tint, theme, auto, indexed */ - case '': case '': case '': break; - - /* 18.8.18 family ST_FontFamily */ - case '': case '': case '': break; - - /* 18.4.14 vertAlign CT_VerticalAlignFontProperty TODO */ - case '': case '': case '': break; - - /* 18.8.35 scheme CT_FontScheme TODO */ - case '': case '': case '': break; - - /* 18.2.10 extLst CT_ExtensionList ? */ - case '': case '': break; - case '': pass = false; break; - default: - if(y[0].charCodeAt(1) !== 47 && !pass) throw new Error('Unrecognized rich format ' + y[0]); - } - } - return font; -} - -var parse_rs = (function() { - var tregex = matchtag("t"), rpregex = matchtag("rPr"); - /* 18.4.4 r CT_RElt */ - function parse_r(r) { - /* 18.4.12 t ST_Xstring */ - var t = r.match(tregex)/*, cp = 65001*/; - if(!t) return {t:"s", v:""}; - - var o/*:Cell*/ = ({t:'s', v:unescapexml(t[1])}/*:any*/); - var rpr = r.match(rpregex); - if(rpr) o.s = parse_rpr(rpr[1]); - return o; - } - var rregex = /<(?:\w+:)?r>/g, rend = /<\/(?:\w+:)?r>/; - return function parse_rs(rs) { - return rs.replace(rregex,"").split(rend).map(parse_r).filter(function(r) { return r.v; }); - }; -})(); - - -/* Parse a list of tags */ -var rs_to_html = (function parse_rs_factory() { - var nlregex = /(\r\n|\n)/g; - function parse_rpr2(font, intro, outro) { - var style/*:Array*/ = []; - - if(font.u) style.push("text-decoration: underline;"); - if(font.uval) style.push("text-underline-style:" + font.uval + ";"); - if(font.sz) style.push("font-size:" + font.sz + "pt;"); - if(font.outline) style.push("text-effect: outline;"); - if(font.shadow) style.push("text-shadow: auto;"); - intro.push(''); - - if(font.b) { intro.push(""); outro.push(""); } - if(font.i) { intro.push(""); outro.push(""); } - if(font.strike) { intro.push(""); outro.push(""); } - - var align = font.valign || ""; - if(align == "superscript" || align == "super") align = "sup"; - else if(align == "subscript") align = "sub"; - if(align != "") { intro.push("<" + align + ">"); outro.push(""); } - - outro.push(""); - return font; - } - - /* 18.4.4 r CT_RElt */ - function r_to_html(r) { - var terms/*:[Array, string, Array]*/ = [[],r.v,[]]; - if(!r.v) return ""; - - if(r.s) parse_rpr2(r.s, terms[0], terms[2]); - - return terms[0].join("") + terms[1].replace(nlregex,'
') + terms[2].join(""); - } - - return function parse_rs(rs) { - return rs.map(r_to_html).join(""); - }; -})(); - -/* 18.4.8 si CT_Rst */ -var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g, sirregex = /<(?:\w+:)?r>/; -var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g; -function parse_si(x, opts) { - var html = opts ? opts.cellHTML : true; - var z = {}; - if(!x) return { t: "" }; - //var y; - /* 18.4.12 t ST_Xstring (Plaintext String) */ - // TODO: is whitespace actually valid here? - if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)) { - z.t = unescapexml(utf8read(x.slice(x.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")); - z.r = utf8read(x); - if(html) z.h = escapehtml(z.t); - } - /* 18.4.4 r CT_RElt (Rich Text Run) */ - else if((/*y = */x.match(sirregex))) { - z.r = utf8read(x); - z.t = unescapexml(utf8read((x.replace(sirphregex, '').match(sitregex)||[]).join("").replace(tagregex,""))); - if(html) z.h = rs_to_html(parse_rs(z.r)); - } - /* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ - /* 18.4.6 rPh CT_PhoneticRun (TODO: needed for Asian support) */ - return z; -} - -/* 18.4 Shared String Table */ -var sstr0 = /<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/; -var sstr1 = /<(?:\w+:)?(?:si|sstItem)>/g; -var sstr2 = /<\/(?:\w+:)?(?:si|sstItem)>/; -function parse_sst_xml(data/*:string*/, opts)/*:SST*/ { - var s/*:SST*/ = ([]/*:any*/), ss = ""; - if(!data) return s; - /* 18.4.9 sst CT_Sst */ - var sst = data.match(sstr0); - if(sst) { - ss = sst[2].replace(sstr1,"").split(sstr2); - for(var i = 0; i != ss.length; ++i) { - var o = parse_si(ss[i].trim(), opts); - if(o != null) s[s.length] = o; - } - sst = parsexmltag(sst[1]); s.Count = sst.count; s.Unique = sst.uniqueCount; - } - return s; -} - -RELS.SST = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"; -var straywsregex = /^\s|\s$|[\t\n\r]/; -function write_sst_xml(sst/*:SST*/, opts)/*:string*/ { - if(!opts.bookSST) return ""; - var o = [XML_HEADER]; - o[o.length] = (writextag('sst', null, { - xmlns: XMLNS.main[0], - count: sst.Count, - uniqueCount: sst.Unique - })); - for(var i = 0; i != sst.length; ++i) { if(sst[i] == null) continue; - var s/*:XLString*/ = sst[i]; - var sitag = ""; - if(s.r) sitag += s.r; - else { - sitag += ""; - } - sitag += ""; - o[o.length] = (sitag); - } - if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* [MS-XLSB] 2.4.221 BrtBeginSst */ -function parse_BrtBeginSst(data) { - return [data.read_shift(4), data.read_shift(4)]; -} - -/* [MS-XLSB] 2.1.7.45 Shared Strings */ -function parse_sst_bin(data, opts)/*:SST*/ { - var s/*:SST*/ = ([]/*:any*/); - var pass = false; - recordhopper(data, function hopper_sst(val, R_n, RT) { - switch(RT) { - case 0x009F: /* 'BrtBeginSst' */ - s.Count = val[0]; s.Unique = val[1]; break; - case 0x0013: /* 'BrtSSTItem' */ - s.push(val); break; - case 0x00A0: /* 'BrtEndSst' */ - return true; - - case 0x0023: /* 'BrtFRTBegin' */ - pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - pass = false; break; - - default: - if(R_n.indexOf("Begin") > 0){/* empty */} - else if(R_n.indexOf("End") > 0){/* empty */} - if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); - } - }); - return s; -} - -function write_BrtBeginSst(sst, o) { - if(!o) o = new_buf(8); - o.write_shift(4, sst.Count); - o.write_shift(4, sst.Unique); - return o; -} - -var write_BrtSSTItem = write_RichStr; - -function write_sst_bin(sst/*::, opts*/) { - var ba = buf_array(); - write_record(ba, "BrtBeginSst", write_BrtBeginSst(sst)); - for(var i = 0; i < sst.length; ++i) write_record(ba, "BrtSSTItem", write_BrtSSTItem(sst[i])); - /* FRTSST */ - write_record(ba, "BrtEndSst"); - return ba.end(); -} -function _JS2ANSI(str/*:string*/)/*:Array*/ { - if(typeof cptable !== 'undefined') return cptable.utils.encode(current_ansi, str); - var o/*:Array*/ = [], oo = str.split(""); - for(var i = 0; i < oo.length; ++i) o[i] = oo[i].charCodeAt(0); - return o; -} - -/* [MS-OFFCRYPTO] 2.1.4 Version */ -function parse_CRYPTOVersion(blob, length/*:?number*/) { - var o/*:any*/ = {}; - o.Major = blob.read_shift(2); - o.Minor = blob.read_shift(2); - /*:: if(length == null) return o; */ - if(length >= 4) blob.l += length - 4; - return o; -} - -/* [MS-OFFCRYPTO] 2.1.5 DataSpaceVersionInfo */ -function parse_DataSpaceVersionInfo(blob) { - var o = {}; - o.id = blob.read_shift(0, 'lpp4'); - o.R = parse_CRYPTOVersion(blob, 4); - o.U = parse_CRYPTOVersion(blob, 4); - o.W = parse_CRYPTOVersion(blob, 4); - return o; -} - -/* [MS-OFFCRYPTO] 2.1.6.1 DataSpaceMapEntry Structure */ -function parse_DataSpaceMapEntry(blob) { - var len = blob.read_shift(4); - var end = blob.l + len - 4; - var o = {}; - var cnt = blob.read_shift(4); - var comps/*:Array<{t:number, v:string}>*/ = []; - /* [MS-OFFCRYPTO] 2.1.6.2 DataSpaceReferenceComponent Structure */ - while(cnt-- > 0) comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, 'lpp4') }); - o.name = blob.read_shift(0, 'lpp4'); - o.comps = comps; - if(blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end); - return o; -} - -/* [MS-OFFCRYPTO] 2.1.6 DataSpaceMap */ -function parse_DataSpaceMap(blob) { - var o = []; - blob.l += 4; // must be 0x8 - var cnt = blob.read_shift(4); - while(cnt-- > 0) o.push(parse_DataSpaceMapEntry(blob)); - return o; -} - -/* [MS-OFFCRYPTO] 2.1.7 DataSpaceDefinition */ -function parse_DataSpaceDefinition(blob)/*:Array*/ { - var o/*:Array*/ = []; - blob.l += 4; // must be 0x8 - var cnt = blob.read_shift(4); - while(cnt-- > 0) o.push(blob.read_shift(0, 'lpp4')); - return o; -} - -/* [MS-OFFCRYPTO] 2.1.8 DataSpaceDefinition */ -function parse_TransformInfoHeader(blob) { - var o = {}; - /*var len = */blob.read_shift(4); - blob.l += 4; // must be 0x1 - o.id = blob.read_shift(0, 'lpp4'); - o.name = blob.read_shift(0, 'lpp4'); - o.R = parse_CRYPTOVersion(blob, 4); - o.U = parse_CRYPTOVersion(blob, 4); - o.W = parse_CRYPTOVersion(blob, 4); - return o; -} - -function parse_Primary(blob) { - /* [MS-OFFCRYPTO] 2.2.6 IRMDSTransformInfo */ - var hdr = parse_TransformInfoHeader(blob); - /* [MS-OFFCRYPTO] 2.1.9 EncryptionTransformInfo */ - hdr.ename = blob.read_shift(0, '8lpp4'); - hdr.blksz = blob.read_shift(4); - hdr.cmode = blob.read_shift(4); - if(blob.read_shift(4) != 0x04) throw new Error("Bad !Primary record"); - return hdr; -} - -/* [MS-OFFCRYPTO] 2.3.2 Encryption Header */ -function parse_EncryptionHeader(blob, length/*:number*/) { - var tgt = blob.l + length; - var o = {}; - o.Flags = (blob.read_shift(4) & 0x3F); - blob.l += 4; - o.AlgID = blob.read_shift(4); - var valid = false; - switch(o.AlgID) { - case 0x660E: case 0x660F: case 0x6610: valid = (o.Flags == 0x24); break; - case 0x6801: valid = (o.Flags == 0x04); break; - case 0: valid = (o.Flags == 0x10 || o.Flags == 0x04 || o.Flags == 0x24); break; - default: throw 'Unrecognized encryption algorithm: ' + o.AlgID; - } - if(!valid) throw new Error("Encryption Flags/AlgID mismatch"); - o.AlgIDHash = blob.read_shift(4); - o.KeySize = blob.read_shift(4); - o.ProviderType = blob.read_shift(4); - blob.l += 8; - o.CSPName = blob.read_shift((tgt-blob.l)>>1, 'utf16le'); - blob.l = tgt; - return o; -} - -/* [MS-OFFCRYPTO] 2.3.3 Encryption Verifier */ -function parse_EncryptionVerifier(blob, length/*:number*/) { - var o = {}, tgt = blob.l + length; - blob.l += 4; // SaltSize must be 0x10 - o.Salt = blob.slice(blob.l, blob.l+16); blob.l += 16; - o.Verifier = blob.slice(blob.l, blob.l+16); blob.l += 16; - /*var sz = */blob.read_shift(4); - o.VerifierHash = blob.slice(blob.l, tgt); blob.l = tgt; - return o; -} - -/* [MS-OFFCRYPTO] 2.3.4.* EncryptionInfo Stream */ -function parse_EncryptionInfo(blob) { - var vers = parse_CRYPTOVersion(blob); - switch(vers.Minor) { - case 0x02: return [vers.Minor, parse_EncInfoStd(blob, vers)]; - case 0x03: return [vers.Minor, parse_EncInfoExt(blob, vers)]; - case 0x04: return [vers.Minor, parse_EncInfoAgl(blob, vers)]; - } - throw new Error("ECMA-376 Encrypted file unrecognized Version: " + vers.Minor); -} - -/* [MS-OFFCRYPTO] 2.3.4.5 EncryptionInfo Stream (Standard Encryption) */ -function parse_EncInfoStd(blob/*::, vers*/) { - var flags = blob.read_shift(4); - if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch"); - var sz = blob.read_shift(4); - //var tgt = blob.l + sz; - var hdr = parse_EncryptionHeader(blob, sz); - var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l); - return { t:"Std", h:hdr, v:verifier }; -} -/* [MS-OFFCRYPTO] 2.3.4.6 EncryptionInfo Stream (Extensible Encryption) */ -function parse_EncInfoExt(/*::blob, vers*/) { throw new Error("File is password-protected: ECMA-376 Extensible"); } -/* [MS-OFFCRYPTO] 2.3.4.10 EncryptionInfo Stream (Agile Encryption) */ -function parse_EncInfoAgl(blob/*::, vers*/) { - var KeyData = ["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"]; - blob.l+=4; - var xml = blob.read_shift(blob.length - blob.l, 'utf8'); - var o = {}; - xml.replace(tagregex, function xml_agile(x) { - var y/*:any*/ = parsexmltag(x); - switch(strip_ns(y[0])) { - case '': break; - case '': case '': break; - - case '': break; - case ' 4 || vers.Major < 2) throw new Error('unrecognized major version code: ' + vers.Major); - o.Flags = blob.read_shift(4); length -= 4; - var sz = blob.read_shift(4); length -= 4; - o.EncryptionHeader = parse_EncryptionHeader(blob, sz); length -= sz; - o.EncryptionVerifier = parse_EncryptionVerifier(blob, length); - return o; -} -/* [MS-OFFCRYPTO] 2.3.6.1 RC4 Encryption Header */ -function parse_RC4Header(blob/*::, length*/) { - var o = {}; - var vers = o.EncryptionVersionInfo = parse_CRYPTOVersion(blob, 4); - if(vers.Major != 1 || vers.Minor != 1) throw 'unrecognized version code ' + vers.Major + ' : ' + vers.Minor; - o.Salt = blob.read_shift(16); - o.EncryptedVerifier = blob.read_shift(16); - o.EncryptedVerifierHash = blob.read_shift(16); - return o; -} - -/* [MS-OFFCRYPTO] 2.3.7.1 Binary Document Password Verifier Derivation */ -function crypto_CreatePasswordVerifier_Method1(Password/*:string*/) { - var Verifier = 0x0000, PasswordArray; - var PasswordDecoded = _JS2ANSI(Password); - var len = PasswordDecoded.length + 1, i, PasswordByte; - var Intermediate1, Intermediate2, Intermediate3; - PasswordArray = new_raw_buf(len); - PasswordArray[0] = PasswordDecoded.length; - for(i = 1; i != len; ++i) PasswordArray[i] = PasswordDecoded[i-1]; - for(i = len-1; i >= 0; --i) { - PasswordByte = PasswordArray[i]; - Intermediate1 = ((Verifier & 0x4000) === 0x0000) ? 0 : 1; - Intermediate2 = (Verifier << 1) & 0x7FFF; - Intermediate3 = Intermediate1 | Intermediate2; - Verifier = Intermediate3 ^ PasswordByte; - } - return Verifier ^ 0xCE4B; -} - -/* [MS-OFFCRYPTO] 2.3.7.2 Binary Document XOR Array Initialization */ -var crypto_CreateXorArray_Method1 = (function() { - var PadArray = [0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80, 0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00]; - var InitialCode = [0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE, 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A, 0x4EC3]; - var XorMatrix = [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09, 0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF, 0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0, 0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40, 0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5, 0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A, 0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9, 0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0, 0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC, 0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10, 0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168, 0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C, 0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD, 0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC, 0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4]; - var Ror = function(Byte) { return ((Byte/2) | (Byte*128)) & 0xFF; }; - var XorRor = function(byte1, byte2) { return Ror(byte1 ^ byte2); }; - var CreateXorKey_Method1 = function(Password) { - var XorKey = InitialCode[Password.length - 1]; - var CurrentElement = 0x68; - for(var i = Password.length-1; i >= 0; --i) { - var Char = Password[i]; - for(var j = 0; j != 7; ++j) { - if(Char & 0x40) XorKey ^= XorMatrix[CurrentElement]; - Char *= 2; --CurrentElement; - } - } - return XorKey; - }; - return function(password/*:string*/) { - var Password = _JS2ANSI(password); - var XorKey = CreateXorKey_Method1(Password); - var Index = Password.length; - var ObfuscationArray = new_raw_buf(16); - for(var i = 0; i != 16; ++i) ObfuscationArray[i] = 0x00; - var Temp, PasswordLastChar, PadIndex; - if((Index & 1) === 1) { - Temp = XorKey >> 8; - ObfuscationArray[Index] = XorRor(PadArray[0], Temp); - --Index; - Temp = XorKey & 0xFF; - PasswordLastChar = Password[Password.length - 1]; - ObfuscationArray[Index] = XorRor(PasswordLastChar, Temp); - } - while(Index > 0) { - --Index; - Temp = XorKey >> 8; - ObfuscationArray[Index] = XorRor(Password[Index], Temp); - --Index; - Temp = XorKey & 0xFF; - ObfuscationArray[Index] = XorRor(Password[Index], Temp); - } - Index = 15; - PadIndex = 15 - Password.length; - while(PadIndex > 0) { - Temp = XorKey >> 8; - ObfuscationArray[Index] = XorRor(PadArray[PadIndex], Temp); - --Index; - --PadIndex; - Temp = XorKey & 0xFF; - ObfuscationArray[Index] = XorRor(Password[Index], Temp); - --Index; - --PadIndex; - } - return ObfuscationArray; - }; -})(); - -/* [MS-OFFCRYPTO] 2.3.7.3 Binary Document XOR Data Transformation Method 1 */ -var crypto_DecryptData_Method1 = function(password/*:string*/, Data, XorArrayIndex, XorArray, O) { - /* If XorArray is set, use it; if O is not set, make changes in-place */ - if(!O) O = Data; - if(!XorArray) XorArray = crypto_CreateXorArray_Method1(password); - var Index, Value; - for(Index = 0; Index != Data.length; ++Index) { - Value = Data[Index]; - Value ^= XorArray[XorArrayIndex]; - Value = ((Value>>5) | (Value<<3)) & 0xFF; - O[Index] = Value; - ++XorArrayIndex; - } - return [O, XorArrayIndex, XorArray]; -}; - -var crypto_MakeXorDecryptor = function(password/*:string*/) { - var XorArrayIndex = 0, XorArray = crypto_CreateXorArray_Method1(password); - return function(Data) { - var O = crypto_DecryptData_Method1("", Data, XorArrayIndex, XorArray); - XorArrayIndex = O[1]; - return O[0]; - }; -}; - -/* 2.5.343 */ -function parse_XORObfuscation(blob, length, opts, out) { - var o = ({ key: parseuint16(blob), verificationBytes: parseuint16(blob) }/*:any*/); - if(opts.password) o.verifier = crypto_CreatePasswordVerifier_Method1(opts.password); - out.valid = o.verificationBytes === o.verifier; - if(out.valid) out.insitu = crypto_MakeXorDecryptor(opts.password); - return o; -} - -/* 2.4.117 */ -function parse_FilePassHeader(blob, length/*:number*/, oo) { - var o = oo || {}; o.Info = blob.read_shift(2); blob.l -= 2; - if(o.Info === 1) o.Data = parse_RC4Header(blob, length); - else o.Data = parse_RC4CryptoHeader(blob, length); - return o; -} -function parse_FilePass(blob, length/*:number*/, opts) { - var o = ({ Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }/*:any*/); /* wEncryptionType */ - if(o.Type) parse_FilePassHeader(blob, length-2, o); - else parse_XORObfuscation(blob, opts.biff >= 8 ? length : length - 2, opts, o); - return o; -} - - -var RTF = (function() { - function rtf_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ { - switch(opts.type) { - case 'base64': return rtf_to_sheet_str(Base64.decode(d), opts); - case 'binary': return rtf_to_sheet_str(d, opts); - case 'buffer': return rtf_to_sheet_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); - case 'array': return rtf_to_sheet_str(cc2str(d), opts); - } - throw new Error("Unrecognized type " + opts.type); - } - - /* TODO: this is a stub */ - function rtf_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ { - var o = opts || {}; - var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/); - - var rows = str.match(/\\trowd.*?\\row\b/g); - if(!rows.length) throw new Error("RTF missing table"); - var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:rows.length - 1}}/*:any*/); - rows.forEach(function(rowtf, R) { - if(Array.isArray(ws)) ws[R] = []; - var rtfre = /\\\w+\b/g; - var last_index = 0; - var res; - var C = -1; - while((res = rtfre.exec(rowtf))) { - switch(res[0]) { - case "\\cell": - var data = rowtf.slice(last_index, rtfre.lastIndex - res[0].length); - if(data[0] == " ") data = data.slice(1); - ++C; - if(data.length) { - // TODO: value parsing, including codepage adjustments - var cell = {v: data, t:"s"}; - if(Array.isArray(ws)) ws[R][C] = cell; - else ws[encode_cell({r:R, c:C})] = cell; - } - break; - } - last_index = rtfre.lastIndex; - } - if(C > range.e.c) range.e.c = C; - }); - ws['!ref'] = encode_range(range); - return ws; - } - - function rtf_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(rtf_to_sheet(d, opts), opts); } - - /* TODO: this is a stub */ - function sheet_to_rtf(ws/*:Worksheet*//*::, opts*/)/*:string*/ { - var o = ["{\\rtf1\\ansi"]; - var r = safe_decode_range(ws['!ref']), cell/*:Cell*/; - var dense = Array.isArray(ws); - for(var R = r.s.r; R <= r.e.r; ++R) { - o.push("\\trowd\\trautofit1"); - for(var C = r.s.c; C <= r.e.c; ++C) o.push("\\cellx" + (C+1)); - o.push("\\pard\\intbl"); - for(C = r.s.c; C <= r.e.c; ++C) { - var coord = encode_cell({r:R,c:C}); - cell = dense ? (ws[R]||[])[C]: ws[coord]; - if(!cell || cell.v == null && (!cell.f || cell.F)) continue; - o.push(" " + (cell.w || (format_cell(cell), cell.w))); - o.push("\\cell"); - } - o.push("\\pard\\intbl\\row"); - } - return o.join("") + "}"; - } - - return { - to_workbook: rtf_to_workbook, - to_sheet: rtf_to_sheet, - from_sheet: sheet_to_rtf - }; -})(); -function hex2RGB(h) { - var o = h.slice(h[0]==="#"?1:0).slice(0,6); - return [parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16)]; -} -function rgb2Hex(rgb) { - for(var i=0,o=1; i!=3; ++i) o = o*256 + (rgb[i]>255?255:rgb[i]<0?0:rgb[i]); - return o.toString(16).toUpperCase().slice(1); -} - -function rgb2HSL(rgb) { - var R = rgb[0]/255, G = rgb[1]/255, B=rgb[2]/255; - var M = Math.max(R, G, B), m = Math.min(R, G, B), C = M - m; - if(C === 0) return [0, 0, R]; - - var H6 = 0, S = 0, L2 = (M + m); - S = C / (L2 > 1 ? 2 - L2 : L2); - switch(M){ - case R: H6 = ((G - B) / C + 6)%6; break; - case G: H6 = ((B - R) / C + 2); break; - case B: H6 = ((R - G) / C + 4); break; - } - return [H6 / 6, S, L2 / 2]; -} - -function hsl2RGB(hsl){ - var H = hsl[0], S = hsl[1], L = hsl[2]; - var C = S * 2 * (L < 0.5 ? L : 1 - L), m = L - C/2; - var rgb = [m,m,m], h6 = 6*H; - - var X; - if(S !== 0) switch(h6|0) { - case 0: case 6: X = C * h6; rgb[0] += C; rgb[1] += X; break; - case 1: X = C * (2 - h6); rgb[0] += X; rgb[1] += C; break; - case 2: X = C * (h6 - 2); rgb[1] += C; rgb[2] += X; break; - case 3: X = C * (4 - h6); rgb[1] += X; rgb[2] += C; break; - case 4: X = C * (h6 - 4); rgb[2] += C; rgb[0] += X; break; - case 5: X = C * (6 - h6); rgb[2] += X; rgb[0] += C; break; - } - for(var i = 0; i != 3; ++i) rgb[i] = Math.round(rgb[i]*255); - return rgb; -} - -/* 18.8.3 bgColor tint algorithm */ -function rgb_tint(hex, tint) { - if(tint === 0) return hex; - var hsl = rgb2HSL(hex2RGB(hex)); - if (tint < 0) hsl[2] = hsl[2] * (1 + tint); - else hsl[2] = 1 - (1 - hsl[2]) * (1 - tint); - return rgb2Hex(hsl2RGB(hsl)); -} - -/* 18.3.1.13 width calculations */ -/* [MS-OI29500] 2.1.595 Column Width & Formatting */ -var DEF_MDW = 6, MAX_MDW = 15, MIN_MDW = 1, MDW = DEF_MDW; -function width2px(width) { return Math.floor(( width + (Math.round(128/MDW))/256 )* MDW ); } -function px2char(px) { return (Math.floor((px - 5)/MDW * 100 + 0.5))/100; } -function char2width(chr) { return (Math.round((chr * MDW + 5)/MDW*256))/256; } -//function px2char_(px) { return (((px - 5)/MDW * 100 + 0.5))/100; } -//function char2width_(chr) { return (((chr * MDW + 5)/MDW*256))/256; } -function cycle_width(collw) { return char2width(px2char(width2px(collw))); } -/* XLSX/XLSB/XLS specify width in units of MDW */ -function find_mdw_colw(collw) { - var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW; - if(delta > 0.005) for(MDW=MIN_MDW; MDW 0.5) guess--; - if(Math.abs(guess) < delta) { delta = Math.abs(guess); _MDW = MDW; } - } - MDW = _MDW; -}*/ - -function process_col(coll/*:ColInfo*/) { - if(coll.width) { - coll.wpx = width2px(coll.width); - coll.wch = px2char(coll.wpx); - coll.MDW = MDW; - } else if(coll.wpx) { - coll.wch = px2char(coll.wpx); - coll.width = char2width(coll.wch); - coll.MDW = MDW; - } else if(typeof coll.wch == 'number') { - coll.width = char2width(coll.wch); - coll.wpx = width2px(coll.width); - coll.MDW = MDW; - } - if(coll.customWidth) delete coll.customWidth; -} - -var DEF_PPI = 96, PPI = DEF_PPI; -function px2pt(px) { return px * 96 / PPI; } -function pt2px(pt) { return pt * PPI / 96; } - -/* [MS-EXSPXML3] 2.4.54 ST_enmPattern */ -var XLMLPatternTypeMap = { - "None": "none", - "Solid": "solid", - "Gray50": "mediumGray", - "Gray75": "darkGray", - "Gray25": "lightGray", - "HorzStripe": "darkHorizontal", - "VertStripe": "darkVertical", - "ReverseDiagStripe": "darkDown", - "DiagStripe": "darkUp", - "DiagCross": "darkGrid", - "ThickDiagCross": "darkTrellis", - "ThinHorzStripe": "lightHorizontal", - "ThinVertStripe": "lightVertical", - "ThinReverseDiagStripe": "lightDown", - "ThinHorzCross": "lightGrid" -}; - -/* 18.8.5 borders CT_Borders */ -function parse_borders(t, styles, themes, opts) { - styles.Borders = []; - var border = {}; - var pass = false; - (t[0].match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - switch(strip_ns(y[0])) { - case '': case '': break; - - /* 18.8.4 border CT_Border */ - case '': case '': - border = /*::(*/{}/*:: :any)*/; - if(y.diagonalUp) border.diagonalUp = parsexmlbool(y.diagonalUp); - if(y.diagonalDown) border.diagonalDown = parsexmlbool(y.diagonalDown); - styles.Borders.push(border); - break; - case '': break; - - /* note: not in spec, appears to be CT_BorderPr */ - case '': break; - case '': break; - case '': break; - - /* note: not in spec, appears to be CT_BorderPr */ - case '': break; - case '': break; - case '': break; - - /* 18.8.43 top CT_BorderPr */ - case '': break; - case '': break; - case '': break; - - /* 18.8.6 bottom CT_BorderPr */ - case '': break; - case '': break; - case '': break; - - /* 18.8.13 diagonal CT_BorderPr */ - case '': case '': break; - case '': break; - - /* 18.8.25 horizontal CT_BorderPr */ - case '': case '': break; - case '': break; - - /* 18.8.44 vertical CT_BorderPr */ - case '': case '': break; - case '': break; - - /* 18.8.37 start CT_BorderPr */ - case '': case '': break; - case '': break; - - /* 18.8.16 end CT_BorderPr */ - case '': case '': break; - case '': break; - - /* 18.8.? color CT_Color */ - case '': - break; - case '': case '': break; - - /* 18.2.10 extLst CT_ExtensionList ? */ - case '': case '': break; - case '': pass = false; break; - default: if(opts && opts.WTF) { - if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders'); - } - } - }); -} - -/* 18.8.21 fills CT_Fills */ -function parse_fills(t, styles, themes, opts) { - styles.Fills = []; - var fill = {}; - var pass = false; - (t[0].match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - switch(strip_ns(y[0])) { - case '': case '': break; - - /* 18.8.20 fill CT_Fill */ - case '': case '': - fill = {}; styles.Fills.push(fill); break; - case '': break; - - /* 18.8.24 gradientFill CT_GradientFill */ - case '': break; - case '': styles.Fills.push(fill); fill = {}; break; - - /* 18.8.32 patternFill CT_PatternFill */ - case '': - if(y.patternType) fill.patternType = y.patternType; - break; - case '': case '': break; - - /* 18.8.3 bgColor CT_Color */ - case '': case '': break; - - /* 18.8.19 fgColor CT_Color */ - case '': case '': break; - - /* 18.8.38 stop CT_GradientStop */ - case '': break; - case '': break; - - /* 18.8.? color CT_Color */ - case '': break; - case '': break; - - /* 18.2.10 extLst CT_ExtensionList ? */ - case '': case '': break; - case '': pass = false; break; - default: if(opts && opts.WTF) { - if(!pass) throw new Error('unrecognized ' + y[0] + ' in fills'); - } - } - }); -} - -/* 18.8.23 fonts CT_Fonts */ -function parse_fonts(t, styles, themes, opts) { - styles.Fonts = []; - var font = {}; - var pass = false; - (t[0].match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - switch(strip_ns(y[0])) { - case '': case '': break; - - /* 18.8.22 font CT_Font */ - case '': break; - case '': case '': - styles.Fonts.push(font); - font = {}; - break; - - /* 18.8.29 name CT_FontName */ - case '': case '': break; - - /* 18.8.2 b CT_BooleanProperty */ - case '': font.bold = 1; break; - - /* 18.8.26 i CT_BooleanProperty */ - case '': font.italic = 1; break; - - /* 18.4.13 u CT_UnderlineProperty */ - case '': font.underline = 1; break; - - /* 18.4.10 strike CT_BooleanProperty */ - case '': font.strike = 1; break; - - /* 18.4.2 outline CT_BooleanProperty */ - case '': font.outline = 1; break; - - /* 18.8.36 shadow CT_BooleanProperty */ - case '': font.shadow = 1; break; - - /* 18.8.12 condense CT_BooleanProperty */ - case '': font.condense = 1; break; - - /* 18.8.17 extend CT_BooleanProperty */ - case '': font.extend = 1; break; - - /* 18.4.11 sz CT_FontSize */ - case '': case '': break; - - /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */ - case '': case '': break; - - /* 18.8.18 family CT_FontFamily */ - case '': case '': break; - - /* 18.8.35 scheme CT_FontScheme */ - case '': case '': break; - - /* 18.4.1 charset CT_IntProperty */ - case '': case '': break; - - /* note: sometimes mc:AlternateContent appears bare */ - case '': pass = false; break; - - /* 18.2.10 extLst CT_ExtensionList ? */ - case '': case '': break; - case '': pass = false; break; - default: if(opts && opts.WTF) { - if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts'); - } - } - }); -} - -/* 18.8.31 numFmts CT_NumFmts */ -function parse_numFmts(t, styles, opts) { - styles.NumberFmt = []; - var k/*Array*/ = (keys(SSF._table)/*:any*/); - for(var i=0; i < k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]]; - var m = t[0].match(tagregex); - if(!m) return; - for(i=0; i < m.length; ++i) { - var y = parsexmltag(m[i]); - switch(strip_ns(y[0])) { - case '': case '': case '': break; - case '0) { - if(j > 0x188) { - for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break; - styles.NumberFmt[j] = f; - } - SSF.load(f,j); - } - } break; - case '': break; - default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts'); - } - } -} - -function write_numFmts(NF/*:{[n:number|string]:string}*//*::, opts*/) { - var o = [""]; - [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { - for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) o[o.length] = (writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])})); - }); - if(o.length === 1) return ""; - o[o.length] = (""); - o[0] = writextag('numFmts', null, { count:o.length-2 }).replace("/>", ">"); - return o.join(""); -} - -/* 18.8.10 cellXfs CT_CellXfs */ -var cellXF_uint = [ "numFmtId", "fillId", "fontId", "borderId", "xfId" ]; -var cellXF_bool = [ "applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix" ]; -function parse_cellXfs(t, styles, opts) { - styles.CellXf = []; - var xf; - var pass = false; - (t[0].match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x), i = 0; - switch(strip_ns(y[0])) { - case '': case '': case '': break; - - /* 18.8.45 xf CT_Xf */ - case '': - xf = y; - delete xf[0]; - for(i = 0; i < cellXF_uint.length; ++i) if(xf[cellXF_uint[i]]) - xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10); - for(i = 0; i < cellXF_bool.length; ++i) if(xf[cellXF_bool[i]]) - xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]); - if(styles.NumberFmt && xf.numFmtId > 0x188) { - for(i = 0x188; i > 0x3c; --i) if(styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) { xf.numFmtId = i; break; } - } - styles.CellXf.push(xf); break; - case '': break; - - /* 18.8.1 alignment CT_CellAlignment */ - case '': - var alignment = {}; - if(y.vertical) alignment.vertical = y.vertical; - if(y.horizontal) alignment.horizontal = y.horizontal; - if(y.textRotation != null) alignment.textRotation = y.textRotation; - if(y.indent) alignment.indent = y.indent; - if(y.wrapText) alignment.wrapText = parsexmlbool(y.wrapText); - xf.alignment = alignment; - break; - case '': break; - - /* 18.8.33 protection CT_CellProtection */ - case '': case '': break; - - /* note: sometimes mc:AlternateContent appears bare */ - case '': pass = false; break; - - /* 18.2.10 extLst CT_ExtensionList ? */ - case '': case '': break; - case '': pass = false; break; - default: if(opts && opts.WTF) { - if(!pass) throw new Error('unrecognized ' + y[0] + ' in cellXfs'); - } - } - }); -} - -function write_cellXfs(cellXfs)/*:string*/ { - var o/*:Array*/ = []; - o[o.length] = (writextag('cellXfs',null)); - cellXfs.forEach(function(c) { - o[o.length] = (writextag('xf', null, c)); - }); - o[o.length] = (""); - if(o.length === 2) return ""; - o[0] = writextag('cellXfs',null, {count:o.length-2}).replace("/>",">"); - return o.join(""); -} - -/* 18.8 Styles CT_Stylesheet*/ -var parse_sty_xml= (function make_pstyx() { -var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/; -var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/; -var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/; -var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/; -var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/; - -return function parse_sty_xml(data, themes, opts) { - var styles = {}; - if(!data) return styles; - data = data.replace(//mg,"").replace(//gm,""); - /* 18.8.39 styleSheet CT_Stylesheet */ - var t; - - /* 18.8.31 numFmts CT_NumFmts ? */ - if((t=data.match(numFmtRegex))) parse_numFmts(t, styles, opts); - - /* 18.8.23 fonts CT_Fonts ? */ - if((t=data.match(fontsRegex))) parse_fonts(t, styles, themes, opts); - - /* 18.8.21 fills CT_Fills ? */ - if((t=data.match(fillsRegex))) parse_fills(t, styles, themes, opts); - - /* 18.8.5 borders CT_Borders ? */ - if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts); - - /* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */ - /* 18.8.8 cellStyles CT_CellStyles ? */ - - /* 18.8.10 cellXfs CT_CellXfs ? */ - if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts); - - /* 18.8.15 dxfs CT_Dxfs ? */ - /* 18.8.42 tableStyles CT_TableStyles ? */ - /* 18.8.11 colors CT_Colors ? */ - /* 18.2.10 extLst CT_ExtensionList ? */ - - return styles; -}; -})(); - -var STYLES_XML_ROOT = writextag('styleSheet', null, { - 'xmlns': XMLNS.main[0], - 'xmlns:vt': XMLNS.vt -}); - -RELS.STY = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - -function write_sty_xml(wb/*:Workbook*/, opts)/*:string*/ { - var o = [XML_HEADER, STYLES_XML_ROOT], w; - if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w; - o[o.length] = (''); - o[o.length] = (''); - o[o.length] = (''); - o[o.length] = (''); - if((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w); - o[o.length] = (''); - o[o.length] = (''); - o[o.length] = (''); - - if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* [MS-XLSB] 2.4.657 BrtFmt */ -function parse_BrtFmt(data, length/*:number*/) { - var numFmtId = data.read_shift(2); - var stFmtCode = parse_XLWideString(data,length-2); - return [numFmtId, stFmtCode]; -} -function write_BrtFmt(i/*:number*/, f/*:string*/, o) { - if(!o) o = new_buf(6 + 4 * f.length); - o.write_shift(2, i); - write_XLWideString(f, o); - var out = (o.length > o.l) ? o.slice(0, o.l) : o; - if(o.l == null) o.l = o.length; - return out; -} - -/* [MS-XLSB] 2.4.659 BrtFont TODO */ -function parse_BrtFont(data, length/*:number*/, opts) { - var out = ({}/*:any*/); - - out.sz = data.read_shift(2) / 20; - - var grbit = parse_FontFlags(data, 2, opts); - if(grbit.fItalic) out.italic = 1; - if(grbit.fCondense) out.condense = 1; - if(grbit.fExtend) out.extend = 1; - if(grbit.fShadow) out.shadow = 1; - if(grbit.fOutline) out.outline = 1; - if(grbit.fStrikeout) out.strike = 1; - - var bls = data.read_shift(2); - if(bls === 0x02BC) out.bold = 1; - - switch(data.read_shift(2)) { - /* case 0: out.vertAlign = "baseline"; break; */ - case 1: out.vertAlign = "superscript"; break; - case 2: out.vertAlign = "subscript"; break; - } - - var underline = data.read_shift(1); - if(underline != 0) out.underline = underline; - - var family = data.read_shift(1); - if(family > 0) out.family = family; - - var bCharSet = data.read_shift(1); - if(bCharSet > 0) out.charset = bCharSet; - - data.l++; - out.color = parse_BrtColor(data, 8); - - switch(data.read_shift(1)) { - /* case 0: out.scheme = "none": break; */ - case 1: out.scheme = "major"; break; - case 2: out.scheme = "minor"; break; - } - - out.name = parse_XLWideString(data, length - 21); - - return out; -} -function write_BrtFont(font/*:any*/, o) { - if(!o) o = new_buf(25+4*32); - o.write_shift(2, font.sz * 20); - write_FontFlags(font, o); - o.write_shift(2, font.bold ? 0x02BC : 0x0190); - var sss = 0; - if(font.vertAlign == "superscript") sss = 1; - else if(font.vertAlign == "subscript") sss = 2; - o.write_shift(2, sss); - o.write_shift(1, font.underline || 0); - o.write_shift(1, font.family || 0); - o.write_shift(1, font.charset || 0); - o.write_shift(1, 0); - write_BrtColor(font.color, o); - var scheme = 0; - if(font.scheme == "major") scheme = 1; - if(font.scheme == "minor") scheme = 2; - o.write_shift(1, scheme); - write_XLWideString(font.name, o); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.650 BrtFill */ -var XLSBFillPTNames = [ - "none", - "solid", - "mediumGray", - "darkGray", - "lightGray", - "darkHorizontal", - "darkVertical", - "darkDown", - "darkUp", - "darkGrid", - "darkTrellis", - "lightHorizontal", - "lightVertical", - "lightDown", - "lightUp", - "lightGrid", - "lightTrellis", - "gray125", - "gray0625" -]; -var rev_XLSBFillPTNames/*:EvertNumType*/ = (evert(XLSBFillPTNames)/*:any*/); -/* TODO: gradient fill representation */ -var parse_BrtFill = parsenoop; -function write_BrtFill(fill, o) { - if(!o) o = new_buf(4*3 + 8*7 + 16*1); - var fls/*:number*/ = rev_XLSBFillPTNames[fill.patternType]; - if(fls == null) fls = 0x28; - o.write_shift(4, fls); - var j = 0; - if(fls != 0x28) { - /* TODO: custom FG Color */ - write_BrtColor({auto:1}, o); - /* TODO: custom BG Color */ - write_BrtColor({auto:1}, o); - - for(; j < 12; ++j) o.write_shift(4, 0); - } else { - for(; j < 4; ++j) o.write_shift(4, 0); - - for(; j < 12; ++j) o.write_shift(4, 0); /* TODO */ - /* iGradientType */ - /* xnumDegree */ - /* xnumFillToLeft */ - /* xnumFillToRight */ - /* xnumFillToTop */ - /* xnumFillToBottom */ - /* cNumStop */ - /* xfillGradientStop */ - } - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.824 BrtXF */ -function parse_BrtXF(data, length/*:number*/) { - var tgt = data.l + length; - var ixfeParent = data.read_shift(2); - var ifmt = data.read_shift(2); - data.l = tgt; - return {ixfe:ixfeParent, numFmtId:ifmt }; -} -function write_BrtXF(data, ixfeP, o) { - if(!o) o = new_buf(16); - o.write_shift(2, ixfeP||0); - o.write_shift(2, data.numFmtId||0); - o.write_shift(2, 0); /* iFont */ - o.write_shift(2, 0); /* iFill */ - o.write_shift(2, 0); /* ixBorder */ - o.write_shift(1, 0); /* trot */ - o.write_shift(1, 0); /* indent */ - var flow = 0; - o.write_shift(1, flow); /* flags */ - o.write_shift(1, 0); /* flags */ - o.write_shift(1, 0); /* xfGrbitAtr */ - o.write_shift(1, 0); - return o; -} - -/* [MS-XLSB] 2.5.4 Blxf TODO */ -function write_Blxf(data, o) { - if(!o) o = new_buf(10); - o.write_shift(1, 0); /* dg */ - o.write_shift(1, 0); - o.write_shift(4, 0); /* color */ - o.write_shift(4, 0); /* color */ - return o; -} -/* [MS-XLSB] 2.4.302 BrtBorder TODO */ -var parse_BrtBorder = parsenoop; -function write_BrtBorder(border, o) { - if(!o) o = new_buf(51); - o.write_shift(1, 0); /* diagonal */ - write_Blxf(null, o); /* top */ - write_Blxf(null, o); /* bottom */ - write_Blxf(null, o); /* left */ - write_Blxf(null, o); /* right */ - write_Blxf(null, o); /* diag */ - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.763 BrtStyle TODO */ -function write_BrtStyle(style, o) { - if(!o) o = new_buf(12+4*10); - o.write_shift(4, style.xfId); - o.write_shift(2, 1); - o.write_shift(1, +style.builtinId); - o.write_shift(1, 0); /* iLevel */ - write_XLNullableWideString(style.name || "", o); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.272 BrtBeginTableStyles */ -function write_BrtBeginTableStyles(cnt, defTableStyle, defPivotStyle) { - var o = new_buf(4+256*2*4); - o.write_shift(4, cnt); - write_XLNullableWideString(defTableStyle, o); - write_XLNullableWideString(defPivotStyle, o); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.1.7.50 Styles */ -function parse_sty_bin(data, themes, opts) { - var styles = {}; - styles.NumberFmt = ([]/*:any*/); - for(var y in SSF._table) styles.NumberFmt[y] = SSF._table[y]; - - styles.CellXf = []; - styles.Fonts = []; - var state/*:Array*/ = []; - var pass = false; - recordhopper(data, function hopper_sty(val, R_n, RT) { - switch(RT) { - case 0x002C: /* 'BrtFmt' */ - styles.NumberFmt[val[0]] = val[1]; SSF.load(val[1], val[0]); - break; - case 0x002B: /* 'BrtFont' */ - styles.Fonts.push(val); - if(val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) { - val.color.rgb = rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb, val.color.tint || 0); - } - break; - case 0x0401: /* 'BrtKnownFonts' */ break; - case 0x002D: /* 'BrtFill' */ - break; - case 0x002E: /* 'BrtBorder' */ - break; - case 0x002F: /* 'BrtXF' */ - if(state[state.length - 1] == "BrtBeginCellXFs") { - styles.CellXf.push(val); - } - break; - case 0x0030: /* 'BrtStyle' */ - case 0x01FB: /* 'BrtDXF' */ - case 0x023C: /* 'BrtMRUColor' */ - case 0x01DB: /* 'BrtIndexedColor': */ - break; - - case 0x0493: /* 'BrtDXF14' */ - case 0x0836: /* 'BrtDXF15' */ - case 0x046A: /* 'BrtSlicerStyleElement' */ - case 0x0200: /* 'BrtTableStyleElement' */ - case 0x082F: /* 'BrtTimelineStyleElement' */ - case 0x0C00: /* 'BrtUid' */ - break; - - case 0x0023: /* 'BrtFRTBegin' */ - pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - pass = false; break; - case 0x0025: /* 'BrtACBegin' */ - state.push(R_n); pass = true; break; - case 0x0026: /* 'BrtACEnd' */ - state.pop(); pass = false; break; - - default: - if((R_n||"").indexOf("Begin") > 0) state.push(R_n); - else if((R_n||"").indexOf("End") > 0) state.pop(); - else if(!pass || (opts.WTF && state[state.length-1] != "BrtACBegin")) throw new Error("Unexpected record " + RT + " " + R_n); - } - }); - return styles; -} - -function write_FMTS_bin(ba, NF/*:?SSFTable*/) { - if(!NF) return; - var cnt = 0; - [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { - /*:: if(!NF) return; */ - for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) ++cnt; - }); - - if(cnt == 0) return; - write_record(ba, "BrtBeginFmts", write_UInt32LE(cnt)); - [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { - /*:: if(!NF) return; */ - for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, "BrtFmt", write_BrtFmt(i, NF[i])); - }); - write_record(ba, "BrtEndFmts"); -} - -function write_FONTS_bin(ba/*::, data*/) { - var cnt = 1; - - if(cnt == 0) return; - write_record(ba, "BrtBeginFonts", write_UInt32LE(cnt)); - write_record(ba, "BrtFont", write_BrtFont({ - sz:12, - color: {theme:1}, - name: "Calibri", - family: 2, - scheme: "minor" - })); - /* 1*65491BrtFont [ACFONTS] */ - write_record(ba, "BrtEndFonts"); -} - -function write_FILLS_bin(ba/*::, data*/) { - var cnt = 2; - - if(cnt == 0) return; - write_record(ba, "BrtBeginFills", write_UInt32LE(cnt)); - write_record(ba, "BrtFill", write_BrtFill({patternType:"none"})); - write_record(ba, "BrtFill", write_BrtFill({patternType:"gray125"})); - /* 1*65431BrtFill */ - write_record(ba, "BrtEndFills"); -} - -function write_BORDERS_bin(ba/*::, data*/) { - var cnt = 1; - - if(cnt == 0) return; - write_record(ba, "BrtBeginBorders", write_UInt32LE(cnt)); - write_record(ba, "BrtBorder", write_BrtBorder({})); - /* 1*65430BrtBorder */ - write_record(ba, "BrtEndBorders"); -} - -function write_CELLSTYLEXFS_bin(ba/*::, data*/) { - var cnt = 1; - write_record(ba, "BrtBeginCellStyleXFs", write_UInt32LE(cnt)); - write_record(ba, "BrtXF", write_BrtXF({ - numFmtId: 0, - fontId: 0, - fillId: 0, - borderId: 0 - }, 0xFFFF)); - /* 1*65430(BrtXF *FRT) */ - write_record(ba, "BrtEndCellStyleXFs"); -} - -function write_CELLXFS_bin(ba, data) { - write_record(ba, "BrtBeginCellXFs", write_UInt32LE(data.length)); - data.forEach(function(c) { write_record(ba, "BrtXF", write_BrtXF(c,0)); }); - /* 1*65430(BrtXF *FRT) */ - write_record(ba, "BrtEndCellXFs"); -} - -function write_STYLES_bin(ba/*::, data*/) { - var cnt = 1; - - write_record(ba, "BrtBeginStyles", write_UInt32LE(cnt)); - write_record(ba, "BrtStyle", write_BrtStyle({ - xfId:0, - builtinId:0, - name:"Normal" - })); - /* 1*65430(BrtStyle *FRT) */ - write_record(ba, "BrtEndStyles"); -} - -function write_DXFS_bin(ba/*::, data*/) { - var cnt = 0; - - write_record(ba, "BrtBeginDXFs", write_UInt32LE(cnt)); - /* *2147483647(BrtDXF *FRT) */ - write_record(ba, "BrtEndDXFs"); -} - -function write_TABLESTYLES_bin(ba/*::, data*/) { - var cnt = 0; - - write_record(ba, "BrtBeginTableStyles", write_BrtBeginTableStyles(cnt, "TableStyleMedium9", "PivotStyleMedium4")); - /* *TABLESTYLE */ - write_record(ba, "BrtEndTableStyles"); -} - -function write_COLORPALETTE_bin(/*::ba, data*/) { - return; - /* BrtBeginColorPalette [INDEXEDCOLORS] [MRUCOLORS] BrtEndColorPalette */ -} - -/* [MS-XLSB] 2.1.7.50 Styles */ -function write_sty_bin(wb, opts) { - var ba = buf_array(); - write_record(ba, "BrtBeginStyleSheet"); - write_FMTS_bin(ba, wb.SSF); - write_FONTS_bin(ba, wb); - write_FILLS_bin(ba, wb); - write_BORDERS_bin(ba, wb); - write_CELLSTYLEXFS_bin(ba, wb); - write_CELLXFS_bin(ba, opts.cellXfs); - write_STYLES_bin(ba, wb); - write_DXFS_bin(ba, wb); - write_TABLESTYLES_bin(ba, wb); - write_COLORPALETTE_bin(ba, wb); - /* FRTSTYLESHEET*/ - write_record(ba, "BrtEndStyleSheet"); - return ba.end(); -} -RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"; - -/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */ -var XLSXThemeClrScheme = [ - '', '', '', '', - '', '', '', - '', '', '', - '', '' -]; -/* 20.1.6.2 clrScheme CT_ColorScheme */ -function parse_clrScheme(t, themes, opts) { - themes.themeElements.clrScheme = []; - var color = {}; - (t[0].match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - switch(y[0]) { - /* 20.1.6.2 clrScheme (Color Scheme) CT_ColorScheme */ - case '': break; - - /* 20.1.2.3.32 srgbClr CT_SRgbColor */ - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - case '': case '': - if (y[0].charAt(1) === '/') { - themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color; - color = {}; - } else { - color.name = y[0].slice(3, y[0].length - 1); - } - break; - - default: if(opts && opts.WTF) throw new Error('Unrecognized ' + y[0] + ' in clrScheme'); - } - }); -} - -/* 20.1.4.1.18 fontScheme CT_FontScheme */ -function parse_fontScheme(/*::t, themes, opts*/) { } - -/* 20.1.4.1.15 fmtScheme CT_StyleMatrix */ -function parse_fmtScheme(/*::t, themes, opts*/) { } - -var clrsregex = /]*)>[\s\S]*<\/a:clrScheme>/; -var fntsregex = /]*)>[\s\S]*<\/a:fontScheme>/; -var fmtsregex = /]*)>[\s\S]*<\/a:fmtScheme>/; - -/* 20.1.6.10 themeElements CT_BaseStyles */ -function parse_themeElements(data, themes, opts) { - themes.themeElements = {}; - - var t; - - [ - /* clrScheme CT_ColorScheme */ - ['clrScheme', clrsregex, parse_clrScheme], - /* fontScheme CT_FontScheme */ - ['fontScheme', fntsregex, parse_fontScheme], - /* fmtScheme CT_StyleMatrix */ - ['fmtScheme', fmtsregex, parse_fmtScheme] - ].forEach(function(m) { - if(!(t=data.match(m[1]))) throw new Error(m[0] + ' not found in themeElements'); - m[2](t, themes, opts); - }); -} - -var themeltregex = /]*)>[\s\S]*<\/a:themeElements>/; - -/* 14.2.7 Theme Part */ -function parse_theme_xml(data/*:string*/, opts) { - /* 20.1.6.9 theme CT_OfficeStyleSheet */ - if(!data || data.length === 0) return parse_theme_xml(write_theme()); - - var t; - var themes = {}; - - /* themeElements CT_BaseStyles */ - if(!(t=data.match(themeltregex))) throw new Error('themeElements not found in theme'); - parse_themeElements(t[0], themes, opts); - themes.raw = data; - return themes; -} - -function write_theme(Themes, opts)/*:string*/ { - if(opts && opts.themeXLSX) return opts.themeXLSX; - if(Themes && typeof Themes.raw == "string") return Themes.raw; - var o = [XML_HEADER]; - o[o.length] = ''; - o[o.length] = ''; - - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - o[o.length] = ''; - return o.join(""); -} -/* [MS-XLS] 2.4.326 TODO: payload is a zip file */ -function parse_Theme(blob, length, opts) { - var end = blob.l + length; - var dwThemeVersion = blob.read_shift(4); - if(dwThemeVersion === 124226) return; - if(!opts.cellStyles) { blob.l = end; return; } - var data = blob.slice(blob.l); - blob.l = end; - var zip; try { zip = zip_read(data, {type: "array"}); } catch(e) { return; } - var themeXML = getzipstr(zip, "theme/theme/theme1.xml", true); - if(!themeXML) return; - return parse_theme_xml(themeXML, opts); -} - -/* 2.5.49 */ -function parse_ColorTheme(blob/*::, length*/) { return blob.read_shift(4); } - -/* 2.5.155 */ -function parse_FullColorExt(blob/*::, length*/) { - var o = {}; - o.xclrType = blob.read_shift(2); - o.nTintShade = blob.read_shift(2); - switch(o.xclrType) { - case 0: blob.l += 4; break; - case 1: o.xclrValue = parse_IcvXF(blob, 4); break; - case 2: o.xclrValue = parse_LongRGBA(blob, 4); break; - case 3: o.xclrValue = parse_ColorTheme(blob, 4); break; - case 4: blob.l += 4; break; - } - blob.l += 8; - return o; -} - -/* 2.5.164 TODO: read 7 bits*/ -function parse_IcvXF(blob, length) { - return parsenoop(blob, length); -} - -/* 2.5.280 */ -function parse_XFExtGradient(blob, length) { - return parsenoop(blob, length); -} - -/* [MS-XLS] 2.5.108 */ -function parse_ExtProp(blob/*::, length*/)/*:Array*/ { - var extType = blob.read_shift(2); - var cb = blob.read_shift(2) - 4; - var o = [extType]; - switch(extType) { - case 0x04: case 0x05: case 0x07: case 0x08: - case 0x09: case 0x0A: case 0x0B: case 0x0D: - o[1] = parse_FullColorExt(blob, cb); break; - case 0x06: o[1] = parse_XFExtGradient(blob, cb); break; - case 0x0E: case 0x0F: o[1] = blob.read_shift(cb === 1 ? 1 : 2); break; - default: throw new Error("Unrecognized ExtProp type: " + extType + " " + cb); - } - return o; -} - -/* 2.4.355 */ -function parse_XFExt(blob, length) { - var end = blob.l + length; - blob.l += 2; - var ixfe = blob.read_shift(2); - blob.l += 2; - var cexts = blob.read_shift(2); - var ext/*:AOA*/ = []; - while(cexts-- > 0) ext.push(parse_ExtProp(blob, end-blob.l)); - return {ixfe:ixfe, ext:ext}; -} - -/* xf is an XF, see parse_XFExt for xfext */ -function update_xfext(xf, xfext) { - xfext.forEach(function(xfe) { - switch(xfe[0]) { /* 2.5.108 extPropData */ - case 0x04: break; /* foreground color */ - case 0x05: break; /* background color */ - case 0x06: break; /* gradient fill */ - case 0x07: break; /* top cell border color */ - case 0x08: break; /* bottom cell border color */ - case 0x09: break; /* left cell border color */ - case 0x0a: break; /* right cell border color */ - case 0x0b: break; /* diagonal cell border color */ - case 0x0d: /* text color */ - break; - case 0x0e: break; /* font scheme */ - case 0x0f: break; /* indentation level */ - } - }); -} - -/* 18.6 Calculation Chain */ -function parse_cc_xml(data/*::, name, opts*/)/*:Array*/ { - var d = []; - if(!data) return d; - var i = 1; - (data.match(tagregex)||[]).forEach(function(x) { - var y = parsexmltag(x); - switch(y[0]) { - case '': case '': break; - /* 18.6.1 c CT_CalcCell 1 */ - case ' 0){/* empty */} - else if((R_n||"").indexOf("End") > 0){/* empty */} - else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); - } - }); - return out; -} - -//function write_cc_bin(data, opts) { } -/* 18.14 Supplementary Workbook Data */ -function parse_xlink_xml(/*::data, rel, name:string, _opts*/) { - //var opts = _opts || {}; - //if(opts.WTF) throw "XLSX External Link"; -} - -/* [MS-XLSB] 2.1.7.25 External Link */ -function parse_xlink_bin(data, rel, name/*:string*/, _opts) { - if(!data) return data; - var opts = _opts || {}; - - var pass = false, end = false; - - recordhopper(data, function xlink_parse(val, R_n, RT) { - if(end) return; - switch(RT) { - case 0x0167: /* 'BrtSupTabs' */ - case 0x016B: /* 'BrtExternTableStart' */ - case 0x016C: /* 'BrtExternTableEnd' */ - case 0x016E: /* 'BrtExternRowHdr' */ - case 0x016F: /* 'BrtExternCellBlank' */ - case 0x0170: /* 'BrtExternCellReal' */ - case 0x0171: /* 'BrtExternCellBool' */ - case 0x0172: /* 'BrtExternCellError' */ - case 0x0173: /* 'BrtExternCellString' */ - case 0x01D8: /* 'BrtExternValueMeta' */ - case 0x0241: /* 'BrtSupNameStart' */ - case 0x0242: /* 'BrtSupNameValueStart' */ - case 0x0243: /* 'BrtSupNameValueEnd' */ - case 0x0244: /* 'BrtSupNameNum' */ - case 0x0245: /* 'BrtSupNameErr' */ - case 0x0246: /* 'BrtSupNameSt' */ - case 0x0247: /* 'BrtSupNameNil' */ - case 0x0248: /* 'BrtSupNameBool' */ - case 0x0249: /* 'BrtSupNameFmla' */ - case 0x024A: /* 'BrtSupNameBits' */ - case 0x024B: /* 'BrtSupNameEnd' */ - break; - - case 0x0023: /* 'BrtFRTBegin' */ - pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - pass = false; break; - - default: - if((R_n||"").indexOf("Begin") > 0){/* empty */} - else if((R_n||"").indexOf("End") > 0){/* empty */} - else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT.toString(16) + " " + R_n); - } - }, opts); -} -/* 20.5 DrawingML - SpreadsheetML Drawing */ -RELS.IMG = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; -RELS.DRAW = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"; - -/* 20.5.2.35 wsDr CT_Drawing */ -function parse_drawing(data, rels/*:any*/) { - if(!data) return "??"; - /* - Chartsheet Drawing: - - 20.5.2.35 wsDr CT_Drawing - - 20.5.2.1 absoluteAnchor CT_AbsoluteAnchor - - 20.5.2.16 graphicFrame CT_GraphicalObjectFrame - - 20.1.2.2.16 graphic CT_GraphicalObject - - 20.1.2.2.17 graphicData CT_GraphicalObjectData - - chart reference - the actual type is based on the URI of the graphicData - TODO: handle embedded charts and other types of graphics - */ - var id = (data.match(/]*r:id="([^"]*)"/)||["",""])[1]; - - return rels['!id'][id].Target; -} - -/* L.5.5.2 SpreadsheetML Comments + VML Schema */ -var _shapeid = 1024; -function write_comments_vml(rId/*:number*/, comments) { - var csize = [21600, 21600]; - /* L.5.2.1.2 Path Attribute */ - var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(","); - var o = [ - writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"), - writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}), - writextag("v:shapetype", [ - writextag("v:stroke", null, {joinstyle:"miter"}), - writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"}) - ].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox}) - ]; - while(_shapeid < rId * 1000) _shapeid += 1000; - - comments.forEach(function(x) { - var c = decode_cell(x[0]); - var fillopts = /*::(*/{'color2':"#BEFF82", 'type':"gradient"}/*:: :any)*/; - if(fillopts.type == "gradient") fillopts.angle = "-180"; - var fillparm = fillopts.type == "gradient" ? writextag("o:fill", null, {type:"gradientUnscaled", 'v:ext':"view"}) : null; - var fillxml = writextag('v:fill', fillparm, fillopts); - - var shadata = ({on:"t", 'obscured':"t"}/*:any*/); - ++_shapeid; - - o = o.concat([ - '', - fillxml, - writextag("v:shadow", null, shadata), - writextag("v:path", null, {'o:connecttype':"none"}), - '
', - '', - '', - '', - /* Part 4 19.4.2.3 Anchor (Anchor) */ - writetag('x:Anchor', [c.c+1, 0, c.r+1, 0, c.c+3, 20, c.r+5, 20].join(",")), - writetag('x:AutoFill', "False"), - writetag('x:Row', String(c.r)), - writetag('x:Column', String(c.c)), - x[1].hidden ? '' : '', - '', - '' - ]); }); - o.push(''); - return o.join(""); -} -RELS.CMNT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"; - -function sheet_insert_comments(sheet, comments/*:Array*/) { - var dense = Array.isArray(sheet); - var cell/*:Cell*/; - comments.forEach(function(comment) { - var r = decode_cell(comment.ref); - if(dense) { - if(!sheet[r.r]) sheet[r.r] = []; - cell = sheet[r.r][r.c]; - } else cell = sheet[comment.ref]; - if (!cell) { - cell = ({t:"z"}/*:any*/); - if(dense) sheet[r.r][r.c] = cell; - else sheet[comment.ref] = cell; - var range = safe_decode_range(sheet["!ref"]||"BDWGO1000001:A1"); - if(range.s.r > r.r) range.s.r = r.r; - if(range.e.r < r.r) range.e.r = r.r; - if(range.s.c > r.c) range.s.c = r.c; - if(range.e.c < r.c) range.e.c = r.c; - var encoded = encode_range(range); - if (encoded !== sheet["!ref"]) sheet["!ref"] = encoded; - } - - if (!cell.c) cell.c = []; - var o/*:Comment*/ = ({a: comment.author, t: comment.t, r: comment.r}); - if(comment.h) o.h = comment.h; - cell.c.push(o); - }); -} - -/* 18.7 Comments */ -function parse_comments_xml(data/*:string*/, opts)/*:Array*/ { - /* 18.7.6 CT_Comments */ - if(data.match(/<(?:\w+:)?comments *\/>/)) return []; - var authors/*:Array*/ = []; - var commentList/*:Array*/ = []; - var authtag = data.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/); - if(authtag && authtag[1]) authtag[1].split(/<\/\w*:?author>/).forEach(function(x) { - if(x === "" || x.trim() === "") return; - var a = x.match(/<(?:\w+:)?author[^>]*>(.*)/); - if(a) authors.push(a[1]); - }); - var cmnttag = data.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/); - if(cmnttag && cmnttag[1]) cmnttag[1].split(/<\/\w*:?comment>/).forEach(function(x) { - if(x === "" || x.trim() === "") return; - var cm = x.match(/<(?:\w+:)?comment[^>]*>/); - if(!cm) return; - var y = parsexmltag(cm[0]); - var comment/*:RawComment*/ = ({ author: y.authorId && authors[y.authorId] || "sheetjsghost", ref: y.ref, guid: y.guid }/*:any*/); - var cell = decode_cell(y.ref); - if(opts.sheetRows && opts.sheetRows <= cell.r) return; - var textMatch = x.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/); - var rt = !!textMatch && !!textMatch[1] && parse_si(textMatch[1]) || {r:"",t:"",h:""}; - comment.r = rt.r; - if(rt.r == "") rt.t = rt.h = ""; - comment.t = (rt.t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"); - if(opts.cellHTML) comment.h = rt.h; - commentList.push(comment); - }); - return commentList; -} - -var CMNT_XML_ROOT = writextag('comments', null, { 'xmlns': XMLNS.main[0] }); -function write_comments_xml(data/*::, opts*/) { - var o = [XML_HEADER, CMNT_XML_ROOT]; - - var iauthor/*:Array*/ = []; - o.push(""); - data.forEach(function(x) { x[1].forEach(function(w) { var a = escapexml(w.a); - if(iauthor.indexOf(a) > -1) return; - iauthor.push(a); - o.push("" + a + ""); - }); }); - o.push(""); - o.push(""); - data.forEach(function(d) { - d[1].forEach(function(c) { - /* 18.7.3 CT_Comment */ - o.push(''); - o.push(writetag("t", c.t == null ? "" : escapexml(c.t))); - o.push(''); - }); - }); - o.push(""); - if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* [MS-XLSB] 2.4.28 BrtBeginComment */ -function parse_BrtBeginComment(data) { - var out = {}; - out.iauthor = data.read_shift(4); - var rfx = parse_UncheckedRfX(data, 16); - out.rfx = rfx.s; - out.ref = encode_cell(rfx.s); - data.l += 16; /*var guid = parse_GUID(data); */ - return out; -} -function write_BrtBeginComment(data, o) { - if(o == null) o = new_buf(36); - o.write_shift(4, data[1].iauthor); - write_UncheckedRfX((data[0]/*:any*/), o); - o.write_shift(4, 0); - o.write_shift(4, 0); - o.write_shift(4, 0); - o.write_shift(4, 0); - return o; -} - -/* [MS-XLSB] 2.4.327 BrtCommentAuthor */ -var parse_BrtCommentAuthor = parse_XLWideString; -function write_BrtCommentAuthor(data) { return write_XLWideString(data.slice(0, 54)); } - -/* [MS-XLSB] 2.1.7.8 Comments */ -function parse_comments_bin(data, opts)/*:Array*/ { - var out/*:Array*/ = []; - var authors/*:Array*/ = []; - var c = {}; - var pass = false; - recordhopper(data, function hopper_cmnt(val, R_n, RT) { - switch(RT) { - case 0x0278: /* 'BrtCommentAuthor' */ - authors.push(val); break; - case 0x027B: /* 'BrtBeginComment' */ - c = val; break; - case 0x027D: /* 'BrtCommentText' */ - c.t = val.t; c.h = val.h; c.r = val.r; break; - case 0x027C: /* 'BrtEndComment' */ - c.author = authors[c.iauthor]; - delete (c/*:any*/).iauthor; - if(opts.sheetRows && c.rfx && opts.sheetRows <= c.rfx.r) break; - if(!c.t) c.t = ""; - delete c.rfx; out.push(c); break; - - case 0x0C00: /* 'BrtUid' */ - break; - - case 0x0023: /* 'BrtFRTBegin' */ - pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - pass = false; break; - case 0x0025: /* 'BrtACBegin' */ break; - case 0x0026: /* 'BrtACEnd' */ break; - - - default: - if((R_n||"").indexOf("Begin") > 0){/* empty */} - else if((R_n||"").indexOf("End") > 0){/* empty */} - else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); - } - }); - return out; -} - -function write_comments_bin(data/*::, opts*/) { - var ba = buf_array(); - var iauthor/*:Array*/ = []; - write_record(ba, "BrtBeginComments"); - - write_record(ba, "BrtBeginCommentAuthors"); - data.forEach(function(comment) { - comment[1].forEach(function(c) { - if(iauthor.indexOf(c.a) > -1) return; - iauthor.push(c.a.slice(0,54)); - write_record(ba, "BrtCommentAuthor", write_BrtCommentAuthor(c.a)); - }); - }); - write_record(ba, "BrtEndCommentAuthors"); - - write_record(ba, "BrtBeginCommentList"); - data.forEach(function(comment) { - comment[1].forEach(function(c) { - c.iauthor = iauthor.indexOf(c.a); - var range = {s:decode_cell(comment[0]),e:decode_cell(comment[0])}; - write_record(ba, "BrtBeginComment", write_BrtBeginComment([range, c])); - if(c.t && c.t.length > 0) write_record(ba, "BrtCommentText", write_BrtCommentText(c)); - write_record(ba, "BrtEndComment"); - delete c.iauthor; - }); - }); - write_record(ba, "BrtEndCommentList"); - - write_record(ba, "BrtEndComments"); - return ba.end(); -} -var CT_VBA = "application/vnd.ms-office.vbaProject"; -function make_vba_xls(cfb) { - var newcfb = CFB.utils.cfb_new({ root: "R" }); - cfb.FullPaths.forEach(function(p, i) { - if (p.slice(-1) === "/" || !p.match(/_VBA_PROJECT_CUR/)) - return; - var newpath = p.replace(/^[^\/]*/, "R").replace(/\/_VBA_PROJECT_CUR\u0000*/, ""); - CFB.utils.cfb_add(newcfb, newpath, cfb.FileIndex[i].content); - }); - return CFB.write(newcfb); -} -function fill_vba_xls(cfb, vba) { - vba.FullPaths.forEach(function(p, i) { - if (i == 0) - return; - var newpath = p.replace(/[^\/]*[\/]/, "/_VBA_PROJECT_CUR/"); - if (newpath.slice(-1) !== "/") - CFB.utils.cfb_add(cfb, newpath, vba.FileIndex[i].content); - }); -} -var VBAFMTS = ["xlsb", "xlsm", "xlam", "biff8", "xla"]; -RELS.DS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet"; -RELS.MS = "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet"; - -/* macro and dialog sheet stubs */ -function parse_ds_bin(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'dialog'}; } -function parse_ds_xml(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'dialog'}; } -function parse_ms_bin(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'macro'}; } -function parse_ms_xml(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'macro'}; } -/* TODO: it will be useful to parse the function str */ -var rc_to_a1 = (function(){ - var rcregex = /(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g; - var rcbase/*:Cell*/ = ({r:0,c:0}/*:any*/); - function rcfunc($$,$1,$2,$3) { - var cRel = false, rRel = false; - - if($2.length == 0) rRel = true; - else if($2.charAt(0) == "[") { rRel = true; $2 = $2.slice(1, -1); } - - if($3.length == 0) cRel = true; - else if($3.charAt(0) == "[") { cRel = true; $3 = $3.slice(1, -1); } - - var R = $2.length>0?parseInt($2,10)|0:0, C = $3.length>0?parseInt($3,10)|0:0; - - if(cRel) C += rcbase.c; else --C; - if(rRel) R += rcbase.r; else --R; - return $1 + (cRel ? "" : "$") + encode_col(C) + (rRel ? "" : "$") + encode_row(R); - } - return function rc_to_a1(fstr/*:string*/, base/*:Cell*/)/*:string*/ { - rcbase = base; - return fstr.replace(rcregex, rcfunc); - }; -})(); - -var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g; -var a1_to_rc =(function(){ - return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) { - return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) { - var c = decode_col($3) - ($2 ? 0 : base.c); - var r = decode_row($5) - ($4 ? 0 : base.r); - var R = (r == 0 ? "" : !$4 ? "[" + r + "]" : (r+1)); - var C = (c == 0 ? "" : !$2 ? "[" + c + "]" : (c+1)); - return $1 + "R" + R + "C" + C; - }); - }; -})(); - -/* no defined name can collide with a valid cell address A1:XFD1048576 ... except LOG10! */ -function shift_formula_str(f/*:string*/, delta/*:Cell*/)/*:string*/ { - return f.replace(crefregex, function($0, $1, $2, $3, $4, $5) { - return $1+($2=="$" ? $2+$3 : encode_col(decode_col($3)+delta.c))+($4=="$" ? $4+$5 : encode_row(decode_row($5) + delta.r)); - }); -} - -function shift_formula_xlsx(f/*:string*/, range/*:string*/, cell/*:string*/)/*:string*/ { - var r = decode_range(range), s = r.s, c = decode_cell(cell); - var delta = {r:c.r - s.r, c:c.c - s.c}; - return shift_formula_str(f, delta); -} - -/* TODO: parse formula */ -function fuzzyfmla(f/*:string*/)/*:boolean*/ { - if(f.length == 1) return false; - return true; -} - -function _xlfn(f/*:string*/)/*:string*/ { - return f.replace(/_xlfn\./g,""); -} -function parseread1(blob) { blob.l+=1; return; } - -/* [MS-XLS] 2.5.51 */ -function parse_ColRelU(blob, length) { - var c = blob.read_shift(length == 1 ? 1 : 2); - return [c & 0x3FFF, (c >> 14) & 1, (c >> 15) & 1]; -} - -/* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.89 */ -function parse_RgceArea(blob, length, opts) { - var w = 2; - if(opts) { - if(opts.biff >= 2 && opts.biff <= 5) return parse_RgceArea_BIFF2(blob, length, opts); - else if(opts.biff == 12) w = 4; - } - var r=blob.read_shift(w), R=blob.read_shift(w); - var c=parse_ColRelU(blob, 2); - var C=parse_ColRelU(blob, 2); - return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} }; -} -/* BIFF 2-5 encodes flags in the row field */ -function parse_RgceArea_BIFF2(blob/*::, length, opts*/) { - var r=parse_ColRelU(blob, 2), R=parse_ColRelU(blob, 2); - var c=blob.read_shift(1); - var C=blob.read_shift(1); - return { s:{r:r[0], c:c, cRel:r[1], rRel:r[2]}, e:{r:R[0], c:C, cRel:R[1], rRel:R[2]} }; -} - -/* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.90 */ -function parse_RgceAreaRel(blob, length, opts) { - if(opts.biff < 8) return parse_RgceArea_BIFF2(blob, length, opts); - var r=blob.read_shift(opts.biff == 12 ? 4 : 2), R=blob.read_shift(opts.biff == 12 ? 4 : 2); - var c=parse_ColRelU(blob, 2); - var C=parse_ColRelU(blob, 2); - return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} }; -} - -/* [MS-XLS] 2.5.198.109 ; [MS-XLSB] 2.5.97.91 */ -function parse_RgceLoc(blob, length, opts) { - if(opts && opts.biff >= 2 && opts.biff <= 5) return parse_RgceLoc_BIFF2(blob, length, opts); - var r = blob.read_shift(opts && opts.biff == 12 ? 4 : 2); - var c = parse_ColRelU(blob, 2); - return {r:r, c:c[0], cRel:c[1], rRel:c[2]}; -} -function parse_RgceLoc_BIFF2(blob/*::, length, opts*/) { - var r = parse_ColRelU(blob, 2); - var c = blob.read_shift(1); - return {r:r[0], c:c, cRel:r[1], rRel:r[2]}; -} - -/* [MS-XLS] 2.5.198.107, 2.5.47 */ -function parse_RgceElfLoc(blob/*::, length, opts*/) { - var r = blob.read_shift(2); - var c = blob.read_shift(2); - return {r:r, c:c & 0xFF, fQuoted:!!(c & 0x4000), cRel:c>>15, rRel:c>>15 }; -} - -/* [MS-XLS] 2.5.198.111 ; [MS-XLSB] 2.5.97.92 TODO */ -function parse_RgceLocRel(blob, length, opts) { - var biff = opts && opts.biff ? opts.biff : 8; - if(biff >= 2 && biff <= 5) return parse_RgceLocRel_BIFF2(blob, length, opts); - var r = blob.read_shift(biff >= 12 ? 4 : 2); - var cl = blob.read_shift(2); - var cRel = (cl & 0x4000) >> 14, rRel = (cl & 0x8000) >> 15; - cl &= 0x3FFF; - if(rRel == 1) while(r > 0x7FFFF) r -= 0x100000; - if(cRel == 1) while(cl > 0x1FFF) cl = cl - 0x4000; - return {r:r,c:cl,cRel:cRel,rRel:rRel}; -} -function parse_RgceLocRel_BIFF2(blob/*::, length:number, opts*/) { - var rl = blob.read_shift(2); - var c = blob.read_shift(1); - var rRel = (rl & 0x8000) >> 15, cRel = (rl & 0x4000) >> 14; - rl &= 0x3FFF; - if(rRel == 1 && rl >= 0x2000) rl = rl - 0x4000; - if(cRel == 1 && c >= 0x80) c = c - 0x100; - return {r:rl,c:c,cRel:cRel,rRel:rRel}; -} - -/* [MS-XLS] 2.5.198.27 ; [MS-XLSB] 2.5.97.18 */ -function parse_PtgArea(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - var area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts); - return [type, area]; -} - -/* [MS-XLS] 2.5.198.28 ; [MS-XLSB] 2.5.97.19 */ -function parse_PtgArea3d(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - var ixti = blob.read_shift(2, 'i'); - var w = 8; - if(opts) switch(opts.biff) { - case 5: blob.l += 12; w = 6; break; - case 12: w = 12; break; - } - var area = parse_RgceArea(blob, w, opts); - return [type, ixti, area]; -} - -/* [MS-XLS] 2.5.198.29 ; [MS-XLSB] 2.5.97.20 */ -function parse_PtgAreaErr(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - blob.l += opts && (opts.biff > 8) ? 12 : (opts.biff < 8 ? 6 : 8); - return [type]; -} -/* [MS-XLS] 2.5.198.30 ; [MS-XLSB] 2.5.97.21 */ -function parse_PtgAreaErr3d(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - var ixti = blob.read_shift(2); - var w = 8; - if(opts) switch(opts.biff) { - case 5: blob.l += 12; w = 6; break; - case 12: w = 12; break; - } - blob.l += w; - return [type, ixti]; -} - -/* [MS-XLS] 2.5.198.31 ; [MS-XLSB] 2.5.97.22 */ -function parse_PtgAreaN(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - var area = parse_RgceAreaRel(blob, length - 1, opts); - return [type, area]; -} - -/* [MS-XLS] 2.5.198.32 ; [MS-XLSB] 2.5.97.23 */ -function parse_PtgArray(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - blob.l += opts.biff == 2 ? 6 : opts.biff == 12 ? 14 : 7; - return [type]; -} - -/* [MS-XLS] 2.5.198.33 ; [MS-XLSB] 2.5.97.24 */ -function parse_PtgAttrBaxcel(blob) { - var bitSemi = blob[blob.l+1] & 0x01; /* 1 = volatile */ - var bitBaxcel = 1; - blob.l += 4; - return [bitSemi, bitBaxcel]; -} - -/* [MS-XLS] 2.5.198.34 ; [MS-XLSB] 2.5.97.25 */ -function parse_PtgAttrChoose(blob, length, opts)/*:Array*/ { - blob.l +=2; - var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); - var o/*:Array*/ = []; - /* offset is 1 less than the number of elements */ - for(var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2)); - return o; -} - -/* [MS-XLS] 2.5.198.35 ; [MS-XLSB] 2.5.97.26 */ -function parse_PtgAttrGoto(blob, length, opts) { - var bitGoto = (blob[blob.l+1] & 0xFF) ? 1 : 0; - blob.l += 2; - return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; -} - -/* [MS-XLS] 2.5.198.36 ; [MS-XLSB] 2.5.97.27 */ -function parse_PtgAttrIf(blob, length, opts) { - var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; - blob.l += 2; - return [bitIf, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; -} - -/* [MS-XLSB] 2.5.97.28 */ -function parse_PtgAttrIfError(blob) { - var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; - blob.l += 2; - return [bitIf, blob.read_shift(2)]; -} - -/* [MS-XLS] 2.5.198.37 ; [MS-XLSB] 2.5.97.29 */ -function parse_PtgAttrSemi(blob, length, opts) { - var bitSemi = (blob[blob.l+1] & 0xFF) ? 1 : 0; - blob.l += opts && opts.biff == 2 ? 3 : 4; - return [bitSemi]; -} - -/* [MS-XLS] 2.5.198.40 ; [MS-XLSB] 2.5.97.32 */ -function parse_PtgAttrSpaceType(blob/*::, length*/) { - var type = blob.read_shift(1), cch = blob.read_shift(1); - return [type, cch]; -} - -/* [MS-XLS] 2.5.198.38 ; [MS-XLSB] 2.5.97.30 */ -function parse_PtgAttrSpace(blob) { - blob.read_shift(2); - return parse_PtgAttrSpaceType(blob, 2); -} - -/* [MS-XLS] 2.5.198.39 ; [MS-XLSB] 2.5.97.31 */ -function parse_PtgAttrSpaceSemi(blob) { - blob.read_shift(2); - return parse_PtgAttrSpaceType(blob, 2); -} - -/* [MS-XLS] 2.5.198.84 ; [MS-XLSB] 2.5.97.68 TODO */ -function parse_PtgRef(blob, length, opts) { - //var ptg = blob[blob.l] & 0x1F; - var type = (blob[blob.l] & 0x60)>>5; - blob.l += 1; - var loc = parse_RgceLoc(blob, 0, opts); - return [type, loc]; -} - -/* [MS-XLS] 2.5.198.88 ; [MS-XLSB] 2.5.97.72 TODO */ -function parse_PtgRefN(blob, length, opts) { - var type = (blob[blob.l] & 0x60)>>5; - blob.l += 1; - var loc = parse_RgceLocRel(blob, 0, opts); - return [type, loc]; -} - -/* [MS-XLS] 2.5.198.85 ; [MS-XLSB] 2.5.97.69 TODO */ -function parse_PtgRef3d(blob, length, opts) { - var type = (blob[blob.l] & 0x60)>>5; - blob.l += 1; - var ixti = blob.read_shift(2); // XtiIndex - if(opts && opts.biff == 5) blob.l += 12; - var loc = parse_RgceLoc(blob, 0, opts); // TODO: or RgceLocRel - return [type, ixti, loc]; -} - - -/* [MS-XLS] 2.5.198.62 ; [MS-XLSB] 2.5.97.45 TODO */ -function parse_PtgFunc(blob, length, opts) { - //var ptg = blob[blob.l] & 0x1F; - var type = (blob[blob.l] & 0x60)>>5; - blob.l += 1; - var iftab = blob.read_shift(opts && opts.biff <= 3 ? 1 : 2); - return [FtabArgc[iftab], Ftab[iftab], type]; -} -/* [MS-XLS] 2.5.198.63 ; [MS-XLSB] 2.5.97.46 TODO */ -function parse_PtgFuncVar(blob, length, opts) { - var type = blob[blob.l++]; - var cparams = blob.read_shift(1), tab = opts && opts.biff <= 3 ? [(type == 0x58 ? -1 : 0), blob.read_shift(1)]: parsetab(blob); - return [cparams, (tab[0] === 0 ? Ftab : Cetab)[tab[1]]]; -} - -function parsetab(blob) { - return [blob[blob.l+1]>>7, blob.read_shift(2) & 0x7FFF]; -} - -/* [MS-XLS] 2.5.198.41 ; [MS-XLSB] 2.5.97.33 */ -function parse_PtgAttrSum(blob, length, opts) { - blob.l += opts && opts.biff == 2 ? 3 : 4; return; -} - -/* [MS-XLS] 2.5.198.58 ; [MS-XLSB] 2.5.97.40 */ -function parse_PtgExp(blob, length, opts) { - blob.l++; - if(opts && opts.biff == 12) return [blob.read_shift(4, 'i'), 0]; - var row = blob.read_shift(2); - var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); - return [row, col]; -} - -/* [MS-XLS] 2.5.198.57 ; [MS-XLSB] 2.5.97.39 */ -function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; } - -/* [MS-XLS] 2.5.198.66 ; [MS-XLSB] 2.5.97.49 */ -function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); } - -/* [MS-XLS] 2.5.198.42 ; [MS-XLSB] 2.5.97.34 */ -function parse_PtgBool(blob) { blob.l++; return blob.read_shift(1)!==0;} - -/* [MS-XLS] 2.5.198.79 ; [MS-XLSB] 2.5.97.63 */ -function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); } - -/* [MS-XLS] 2.5.198.89 ; [MS-XLSB] 2.5.97.74 */ -function parse_PtgStr(blob, length, opts) { blob.l++; return parse_ShortXLUnicodeString(blob, length-1, opts); } - -/* [MS-XLS] 2.5.192.112 + 2.5.192.11{3,4,5,6,7} */ -/* [MS-XLSB] 2.5.97.93 + 2.5.97.9{4,5,6,7} */ -function parse_SerAr(blob, biff/*:number*/) { - var val = [blob.read_shift(1)]; - if(biff == 12) switch(val[0]) { - case 0x02: val[0] = 0x04; break; /* SerBool */ - case 0x04: val[0] = 0x10; break; /* SerErr */ - case 0x00: val[0] = 0x01; break; /* SerNum */ - case 0x01: val[0] = 0x02; break; /* SerStr */ - } - switch(val[0]) { - case 0x04: /* SerBool -- boolean */ - val[1] = parsebool(blob, 1) ? 'TRUE' : 'FALSE'; - if(biff != 12) blob.l += 7; break; - case 0x25: /* appears to be an alias */ - case 0x10: /* SerErr -- error */ - val[1] = BErr[blob[blob.l]]; - blob.l += ((biff == 12) ? 4 : 8); break; - case 0x00: /* SerNil -- honestly, I'm not sure how to reproduce this */ - blob.l += 8; break; - case 0x01: /* SerNum -- Xnum */ - val[1] = parse_Xnum(blob, 8); break; - case 0x02: /* SerStr -- XLUnicodeString (<256 chars) */ - val[1] = parse_XLUnicodeString2(blob, 0, {biff:biff > 0 && biff < 8 ? 2 : biff}); break; - default: throw new Error("Bad SerAr: " + val[0]); /* Unreachable */ - } - return val; -} - -/* [MS-XLS] 2.5.198.61 ; [MS-XLSB] 2.5.97.44 */ -function parse_PtgExtraMem(blob, cce, opts) { - var count = blob.read_shift((opts.biff == 12) ? 4 : 2); - var out/*:Array*/ = []; - for(var i = 0; i != count; ++i) out.push(((opts.biff == 12) ? parse_UncheckedRfX : parse_Ref8U)(blob, 8)); - return out; -} - -/* [MS-XLS] 2.5.198.59 ; [MS-XLSB] 2.5.97.41 */ -function parse_PtgExtraArray(blob, length, opts) { - var rows = 0, cols = 0; - if(opts.biff == 12) { - rows = blob.read_shift(4); // DRw - cols = blob.read_shift(4); // DCol - } else { - cols = 1 + blob.read_shift(1); //DColByteU - rows = 1 + blob.read_shift(2); //DRw - } - if(opts.biff >= 2 && opts.biff < 8) { --rows; if(--cols == 0) cols = 0x100; } - // $FlowIgnore - for(var i = 0, o/*:Array>*/ = []; i != rows && (o[i] = []); ++i) - for(var j = 0; j != cols; ++j) o[i][j] = parse_SerAr(blob, opts.biff); - return o; -} - -/* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 */ -function parse_PtgName(blob, length, opts) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - var w = (!opts || (opts.biff >= 8)) ? 4 : 2; - var nameindex = blob.read_shift(w); - switch(opts.biff) { - case 2: blob.l += 5; break; - case 3: case 4: blob.l += 8; break; - case 5: blob.l += 12; break; - } - return [type, 0, nameindex]; -} - -/* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 */ -function parse_PtgNameX(blob, length, opts) { - if(opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts); - var type = (blob.read_shift(1) >>> 5) & 0x03; - var ixti = blob.read_shift(2); // XtiIndex - var nameindex = blob.read_shift(4); - return [type, ixti, nameindex]; -} -function parse_PtgNameX_BIFF5(blob/*::, length, opts*/) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - var ixti = blob.read_shift(2, 'i'); // XtiIndex - blob.l += 8; - var nameindex = blob.read_shift(2); - blob.l += 12; - return [type, ixti, nameindex]; -} - -/* [MS-XLS] 2.5.198.70 ; [MS-XLSB] 2.5.97.54 */ -function parse_PtgMemArea(blob, length, opts) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - blob.l += (opts && opts.biff == 2 ? 3 : 4); - var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); - return [type, cce]; -} - -/* [MS-XLS] 2.5.198.72 ; [MS-XLSB] 2.5.97.56 */ -function parse_PtgMemFunc(blob, length, opts) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); - return [type, cce]; -} - - -/* [MS-XLS] 2.5.198.86 ; [MS-XLSB] 2.5.97.69 */ -function parse_PtgRefErr(blob, length, opts) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - blob.l += 4; - if(opts.biff < 8) blob.l--; - if(opts.biff == 12) blob.l += 2; - return [type]; -} - -/* [MS-XLS] 2.5.198.87 ; [MS-XLSB] 2.5.97.71 */ -function parse_PtgRefErr3d(blob, length, opts) { - var type = (blob[blob.l++] & 0x60) >> 5; - var ixti = blob.read_shift(2); - var w = 4; - if(opts) switch(opts.biff) { - case 5: w = 15; break; - case 12: w = 6; break; - } - blob.l += w; - return [type, ixti]; -} - -/* [MS-XLS] 2.5.198.71 ; [MS-XLSB] 2.5.97.55 */ -var parse_PtgMemErr = parsenoop; -/* [MS-XLS] 2.5.198.73 ; [MS-XLSB] 2.5.97.57 */ -var parse_PtgMemNoMem = parsenoop; -/* [MS-XLS] 2.5.198.92 */ -var parse_PtgTbl = parsenoop; - -function parse_PtgElfLoc(blob, length, opts) { - blob.l += 2; - return [parse_RgceElfLoc(blob, 4, opts)]; -} -function parse_PtgElfNoop(blob/*::, length, opts*/) { - blob.l += 6; - return []; -} -/* [MS-XLS] 2.5.198.46 */ -var parse_PtgElfCol = parse_PtgElfLoc; -/* [MS-XLS] 2.5.198.47 */ -var parse_PtgElfColS = parse_PtgElfNoop; -/* [MS-XLS] 2.5.198.48 */ -var parse_PtgElfColSV = parse_PtgElfNoop; -/* [MS-XLS] 2.5.198.49 */ -var parse_PtgElfColV = parse_PtgElfLoc; -/* [MS-XLS] 2.5.198.50 */ -function parse_PtgElfLel(blob/*::, length, opts*/) { - blob.l += 2; - return [parseuint16(blob), blob.read_shift(2) & 0x01]; -} -/* [MS-XLS] 2.5.198.51 */ -var parse_PtgElfRadical = parse_PtgElfLoc; -/* [MS-XLS] 2.5.198.52 */ -var parse_PtgElfRadicalLel = parse_PtgElfLel; -/* [MS-XLS] 2.5.198.53 */ -var parse_PtgElfRadicalS = parse_PtgElfNoop; -/* [MS-XLS] 2.5.198.54 */ -var parse_PtgElfRw = parse_PtgElfLoc; -/* [MS-XLS] 2.5.198.55 */ -var parse_PtgElfRwV = parse_PtgElfLoc; - -/* [MS-XLSB] 2.5.97.52 TODO */ -var PtgListRT = [ - "Data", - "All", - "Headers", - "??", - "?Data2", - "??", - "?DataHeaders", - "??", - "Totals", - "??", - "??", - "??", - "?DataTotals", - "??", - "??", - "??", - "?Current" -]; -function parse_PtgList(blob/*::, length, opts*/) { - blob.l += 2; - var ixti = blob.read_shift(2); - var flags = blob.read_shift(2); - var idx = blob.read_shift(4); - var c = blob.read_shift(2); - var C = blob.read_shift(2); - var rt = PtgListRT[(flags >> 2) & 0x1F]; - return {ixti: ixti, coltype:(flags&0x3), rt:rt, idx:idx, c:c, C:C}; -} -/* [MS-XLS] 2.5.198.91 ; [MS-XLSB] 2.5.97.76 */ -function parse_PtgSxName(blob/*::, length, opts*/) { - blob.l += 2; - return [blob.read_shift(4)]; -} - -/* [XLS] old spec */ -function parse_PtgSheet(blob, length, opts) { - blob.l += 5; - blob.l += 2; - blob.l += (opts.biff == 2 ? 1 : 4); - return ["PTGSHEET"]; -} -function parse_PtgEndSheet(blob, length, opts) { - blob.l += (opts.biff == 2 ? 4 : 5); - return ["PTGENDSHEET"]; -} -function parse_PtgMemAreaN(blob/*::, length, opts*/) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - var cce = blob.read_shift(2); - return [type, cce]; -} -function parse_PtgMemNoMemN(blob/*::, length, opts*/) { - var type = (blob.read_shift(1) >>> 5) & 0x03; - var cce = blob.read_shift(2); - return [type, cce]; -} -function parse_PtgAttrNoop(blob/*::, length, opts*/) { - blob.l += 4; - return [0, 0]; -} - -/* [MS-XLS] 2.5.198.25 ; [MS-XLSB] 2.5.97.16 */ -var PtgTypes = { - /*::[*/0x01/*::]*/: { n:'PtgExp', f:parse_PtgExp }, - /*::[*/0x02/*::]*/: { n:'PtgTbl', f:parse_PtgTbl }, - /*::[*/0x03/*::]*/: { n:'PtgAdd', f:parseread1 }, - /*::[*/0x04/*::]*/: { n:'PtgSub', f:parseread1 }, - /*::[*/0x05/*::]*/: { n:'PtgMul', f:parseread1 }, - /*::[*/0x06/*::]*/: { n:'PtgDiv', f:parseread1 }, - /*::[*/0x07/*::]*/: { n:'PtgPower', f:parseread1 }, - /*::[*/0x08/*::]*/: { n:'PtgConcat', f:parseread1 }, - /*::[*/0x09/*::]*/: { n:'PtgLt', f:parseread1 }, - /*::[*/0x0A/*::]*/: { n:'PtgLe', f:parseread1 }, - /*::[*/0x0B/*::]*/: { n:'PtgEq', f:parseread1 }, - /*::[*/0x0C/*::]*/: { n:'PtgGe', f:parseread1 }, - /*::[*/0x0D/*::]*/: { n:'PtgGt', f:parseread1 }, - /*::[*/0x0E/*::]*/: { n:'PtgNe', f:parseread1 }, - /*::[*/0x0F/*::]*/: { n:'PtgIsect', f:parseread1 }, - /*::[*/0x10/*::]*/: { n:'PtgUnion', f:parseread1 }, - /*::[*/0x11/*::]*/: { n:'PtgRange', f:parseread1 }, - /*::[*/0x12/*::]*/: { n:'PtgUplus', f:parseread1 }, - /*::[*/0x13/*::]*/: { n:'PtgUminus', f:parseread1 }, - /*::[*/0x14/*::]*/: { n:'PtgPercent', f:parseread1 }, - /*::[*/0x15/*::]*/: { n:'PtgParen', f:parseread1 }, - /*::[*/0x16/*::]*/: { n:'PtgMissArg', f:parseread1 }, - /*::[*/0x17/*::]*/: { n:'PtgStr', f:parse_PtgStr }, - /*::[*/0x1A/*::]*/: { n:'PtgSheet', f:parse_PtgSheet }, - /*::[*/0x1B/*::]*/: { n:'PtgEndSheet', f:parse_PtgEndSheet }, - /*::[*/0x1C/*::]*/: { n:'PtgErr', f:parse_PtgErr }, - /*::[*/0x1D/*::]*/: { n:'PtgBool', f:parse_PtgBool }, - /*::[*/0x1E/*::]*/: { n:'PtgInt', f:parse_PtgInt }, - /*::[*/0x1F/*::]*/: { n:'PtgNum', f:parse_PtgNum }, - /*::[*/0x20/*::]*/: { n:'PtgArray', f:parse_PtgArray }, - /*::[*/0x21/*::]*/: { n:'PtgFunc', f:parse_PtgFunc }, - /*::[*/0x22/*::]*/: { n:'PtgFuncVar', f:parse_PtgFuncVar }, - /*::[*/0x23/*::]*/: { n:'PtgName', f:parse_PtgName }, - /*::[*/0x24/*::]*/: { n:'PtgRef', f:parse_PtgRef }, - /*::[*/0x25/*::]*/: { n:'PtgArea', f:parse_PtgArea }, - /*::[*/0x26/*::]*/: { n:'PtgMemArea', f:parse_PtgMemArea }, - /*::[*/0x27/*::]*/: { n:'PtgMemErr', f:parse_PtgMemErr }, - /*::[*/0x28/*::]*/: { n:'PtgMemNoMem', f:parse_PtgMemNoMem }, - /*::[*/0x29/*::]*/: { n:'PtgMemFunc', f:parse_PtgMemFunc }, - /*::[*/0x2A/*::]*/: { n:'PtgRefErr', f:parse_PtgRefErr }, - /*::[*/0x2B/*::]*/: { n:'PtgAreaErr', f:parse_PtgAreaErr }, - /*::[*/0x2C/*::]*/: { n:'PtgRefN', f:parse_PtgRefN }, - /*::[*/0x2D/*::]*/: { n:'PtgAreaN', f:parse_PtgAreaN }, - /*::[*/0x2E/*::]*/: { n:'PtgMemAreaN', f:parse_PtgMemAreaN }, - /*::[*/0x2F/*::]*/: { n:'PtgMemNoMemN', f:parse_PtgMemNoMemN }, - /*::[*/0x39/*::]*/: { n:'PtgNameX', f:parse_PtgNameX }, - /*::[*/0x3A/*::]*/: { n:'PtgRef3d', f:parse_PtgRef3d }, - /*::[*/0x3B/*::]*/: { n:'PtgArea3d', f:parse_PtgArea3d }, - /*::[*/0x3C/*::]*/: { n:'PtgRefErr3d', f:parse_PtgRefErr3d }, - /*::[*/0x3D/*::]*/: { n:'PtgAreaErr3d', f:parse_PtgAreaErr3d }, - /*::[*/0xFF/*::]*/: {} -}; -/* These are duplicated in the PtgTypes table */ -var PtgDupes = { - /*::[*/0x40/*::]*/: 0x20, /*::[*/0x60/*::]*/: 0x20, - /*::[*/0x41/*::]*/: 0x21, /*::[*/0x61/*::]*/: 0x21, - /*::[*/0x42/*::]*/: 0x22, /*::[*/0x62/*::]*/: 0x22, - /*::[*/0x43/*::]*/: 0x23, /*::[*/0x63/*::]*/: 0x23, - /*::[*/0x44/*::]*/: 0x24, /*::[*/0x64/*::]*/: 0x24, - /*::[*/0x45/*::]*/: 0x25, /*::[*/0x65/*::]*/: 0x25, - /*::[*/0x46/*::]*/: 0x26, /*::[*/0x66/*::]*/: 0x26, - /*::[*/0x47/*::]*/: 0x27, /*::[*/0x67/*::]*/: 0x27, - /*::[*/0x48/*::]*/: 0x28, /*::[*/0x68/*::]*/: 0x28, - /*::[*/0x49/*::]*/: 0x29, /*::[*/0x69/*::]*/: 0x29, - /*::[*/0x4A/*::]*/: 0x2A, /*::[*/0x6A/*::]*/: 0x2A, - /*::[*/0x4B/*::]*/: 0x2B, /*::[*/0x6B/*::]*/: 0x2B, - /*::[*/0x4C/*::]*/: 0x2C, /*::[*/0x6C/*::]*/: 0x2C, - /*::[*/0x4D/*::]*/: 0x2D, /*::[*/0x6D/*::]*/: 0x2D, - /*::[*/0x4E/*::]*/: 0x2E, /*::[*/0x6E/*::]*/: 0x2E, - /*::[*/0x4F/*::]*/: 0x2F, /*::[*/0x6F/*::]*/: 0x2F, - /*::[*/0x58/*::]*/: 0x22, /*::[*/0x78/*::]*/: 0x22, - /*::[*/0x59/*::]*/: 0x39, /*::[*/0x79/*::]*/: 0x39, - /*::[*/0x5A/*::]*/: 0x3A, /*::[*/0x7A/*::]*/: 0x3A, - /*::[*/0x5B/*::]*/: 0x3B, /*::[*/0x7B/*::]*/: 0x3B, - /*::[*/0x5C/*::]*/: 0x3C, /*::[*/0x7C/*::]*/: 0x3C, - /*::[*/0x5D/*::]*/: 0x3D, /*::[*/0x7D/*::]*/: 0x3D -}; -(function(){for(var y in PtgDupes) PtgTypes[y] = PtgTypes[PtgDupes[y]];})(); - -var Ptg18 = { - /*::[*/0x01/*::]*/: { n:'PtgElfLel', f:parse_PtgElfLel }, - /*::[*/0x02/*::]*/: { n:'PtgElfRw', f:parse_PtgElfRw }, - /*::[*/0x03/*::]*/: { n:'PtgElfCol', f:parse_PtgElfCol }, - /*::[*/0x06/*::]*/: { n:'PtgElfRwV', f:parse_PtgElfRwV }, - /*::[*/0x07/*::]*/: { n:'PtgElfColV', f:parse_PtgElfColV }, - /*::[*/0x0A/*::]*/: { n:'PtgElfRadical', f:parse_PtgElfRadical }, - /*::[*/0x0B/*::]*/: { n:'PtgElfRadicalS', f:parse_PtgElfRadicalS }, - /*::[*/0x0D/*::]*/: { n:'PtgElfColS', f:parse_PtgElfColS }, - /*::[*/0x0F/*::]*/: { n:'PtgElfColSV', f:parse_PtgElfColSV }, - /*::[*/0x10/*::]*/: { n:'PtgElfRadicalLel', f:parse_PtgElfRadicalLel }, - /*::[*/0x19/*::]*/: { n:'PtgList', f:parse_PtgList }, - /*::[*/0x1D/*::]*/: { n:'PtgSxName', f:parse_PtgSxName }, - /*::[*/0xFF/*::]*/: {} -}; -var Ptg19 = { - /*::[*/0x00/*::]*/: { n:'PtgAttrNoop', f:parse_PtgAttrNoop }, - /*::[*/0x01/*::]*/: { n:'PtgAttrSemi', f:parse_PtgAttrSemi }, - /*::[*/0x02/*::]*/: { n:'PtgAttrIf', f:parse_PtgAttrIf }, - /*::[*/0x04/*::]*/: { n:'PtgAttrChoose', f:parse_PtgAttrChoose }, - /*::[*/0x08/*::]*/: { n:'PtgAttrGoto', f:parse_PtgAttrGoto }, - /*::[*/0x10/*::]*/: { n:'PtgAttrSum', f:parse_PtgAttrSum }, - /*::[*/0x20/*::]*/: { n:'PtgAttrBaxcel', f:parse_PtgAttrBaxcel }, - /*::[*/0x40/*::]*/: { n:'PtgAttrSpace', f:parse_PtgAttrSpace }, - /*::[*/0x41/*::]*/: { n:'PtgAttrSpaceSemi', f:parse_PtgAttrSpaceSemi }, - /*::[*/0x80/*::]*/: { n:'PtgAttrIfError', f:parse_PtgAttrIfError }, - /*::[*/0xFF/*::]*/: {} -}; -Ptg19[0x21] = Ptg19[0x20]; - -/* [MS-XLS] 2.5.198.103 ; [MS-XLSB] 2.5.97.87 */ -function parse_RgbExtra(blob, length, rgce, opts) { - if(opts.biff < 8) return parsenoop(blob, length); - var target = blob.l + length; - var o = []; - for(var i = 0; i !== rgce.length; ++i) { - switch(rgce[i][0]) { - case 'PtgArray': /* PtgArray -> PtgExtraArray */ - rgce[i][1] = parse_PtgExtraArray(blob, 0, opts); - o.push(rgce[i][1]); - break; - case 'PtgMemArea': /* PtgMemArea -> PtgExtraMem */ - rgce[i][2] = parse_PtgExtraMem(blob, rgce[i][1], opts); - o.push(rgce[i][2]); - break; - case 'PtgExp': /* PtgExp -> PtgExtraCol */ - if(opts && opts.biff == 12) { - rgce[i][1][1] = blob.read_shift(4); - o.push(rgce[i][1]); - } break; - case 'PtgList': /* TODO: PtgList -> PtgExtraList */ - case 'PtgElfRadicalS': /* TODO: PtgElfRadicalS -> PtgExtraElf */ - case 'PtgElfColS': /* TODO: PtgElfColS -> PtgExtraElf */ - case 'PtgElfColSV': /* TODO: PtgElfColSV -> PtgExtraElf */ - throw "Unsupported " + rgce[i][0]; - default: break; - } - } - length = target - blob.l; - /* note: this is technically an error but Excel disregards */ - //if(target !== blob.l && blob.l !== target - length) throw new Error(target + " != " + blob.l); - if(length !== 0) o.push(parsenoop(blob, length)); - return o; -} - -/* [MS-XLS] 2.5.198.104 ; [MS-XLSB] 2.5.97.88 */ -function parse_Rgce(blob, length, opts) { - var target = blob.l + length; - var R, id, ptgs = []; - while(target != blob.l) { - length = target - blob.l; - id = blob[blob.l]; - R = PtgTypes[id]; - if(id === 0x18 || id === 0x19) R = (id === 0x18 ? Ptg18 : Ptg19)[blob[blob.l + 1]]; - if(!R || !R.f) { /*ptgs.push*/(parsenoop(blob, length)); } - else { ptgs.push([R.n, R.f(blob, length, opts)]); } - } - return ptgs; -} - -function stringify_array(f/*:Array>*/)/*:string*/ { - var o/*:Array*/ = []; - for(var i = 0; i < f.length; ++i) { - var x = f[i], r/*:Array*/ = []; - for(var j = 0; j < x.length; ++j) { - var y = x[j]; - if(y) switch(y[0]) { - // TODO: handle embedded quotes - case 0x02: - /*:: if(typeof y[1] != 'string') throw "unreachable"; */ - r.push('"' + y[1].replace(/"/g,'""') + '"'); break; - default: r.push(y[1]); - } else r.push(""); - } - o.push(r.join(",")); - } - return o.join(";"); -} - -/* [MS-XLS] 2.2.2 ; [MS-XLSB] 2.2.2 TODO */ -var PtgBinOp = { - PtgAdd: "+", - PtgConcat: "&", - PtgDiv: "/", - PtgEq: "=", - PtgGe: ">=", - PtgGt: ">", - PtgLe: "<=", - PtgLt: "<", - PtgMul: "*", - PtgNe: "<>", - PtgPower: "^", - PtgSub: "-" -}; - -// List of invalid characters needs to be tested further -var quoteCharacters /*:RegExp */ = new RegExp(/[^\w\u4E00-\u9FFF\u3040-\u30FF]/); -function formula_quote_sheet_name(sname/*:string*/, opts)/*:string*/ { - if(!sname && !(opts && opts.biff <= 5 && opts.biff >= 2)) throw new Error("empty sheet name"); - if (quoteCharacters.test(sname)) return "'" + sname + "'"; - return sname; -} -function get_ixti_raw(supbooks, ixti/*:number*/, opts)/*:string*/ { - if(!supbooks) return "SH33TJSERR0"; - if(opts.biff > 8 && (!supbooks.XTI || !supbooks.XTI[ixti])) return supbooks.SheetNames[ixti]; - if(!supbooks.XTI) return "SH33TJSERR6"; - var XTI = supbooks.XTI[ixti]; - if(opts.biff < 8) { - if(ixti > 10000) ixti-= 65536; - if(ixti < 0) ixti = -ixti; - return ixti == 0 ? "" : supbooks.XTI[ixti - 1]; - } - if(!XTI) return "SH33TJSERR1"; - var o = ""; - if(opts.biff > 8) switch(supbooks[XTI[0]][0]) { - case 0x0165: /* 'BrtSupSelf' */ - o = XTI[1] == -1 ? "#REF" : supbooks.SheetNames[XTI[1]]; - return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; - case 0x0166: /* 'BrtSupSame' */ - if(opts.SID != null) return supbooks.SheetNames[opts.SID]; - return "SH33TJSSAME" + supbooks[XTI[0]][0]; - case 0x0163: /* 'BrtSupBookSrc' */ - /* falls through */ - default: return "SH33TJSSRC" + supbooks[XTI[0]][0]; - } - switch(supbooks[XTI[0]][0][0]) { - case 0x0401: - o = XTI[1] == -1 ? "#REF" : (supbooks.SheetNames[XTI[1]] || "SH33TJSERR3"); - return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; - case 0x3A01: return supbooks[XTI[0]].slice(1).map(function(name) { return name.Name; }).join(";;"); //return "SH33TJSERR8"; - default: - if(!supbooks[XTI[0]][0][3]) return "SH33TJSERR2"; - o = XTI[1] == -1 ? "#REF" : (supbooks[XTI[0]][0][3][XTI[1]] || "SH33TJSERR4"); - return XTI[1] == XTI[2] ? o : o + ":" + supbooks[XTI[0]][0][3][XTI[2]]; - } -} -function get_ixti(supbooks, ixti/*:number*/, opts)/*:string*/ { - var ixtiraw = get_ixti_raw(supbooks, ixti, opts); - return ixtiraw == "#REF" ? ixtiraw : formula_quote_sheet_name(ixtiraw, opts); -} -function stringify_formula(formula/*Array*/, range, cell/*:any*/, supbooks, opts)/*:string*/ { - var biff = (opts && opts.biff) || 8; - var _range = /*range != null ? range :*/ {s:{c:0, r:0},e:{c:0, r:0}}; - var stack/*:Array*/ = [], e1, e2, /*::type,*/ c/*:CellAddress*/, ixti=0, nameidx=0, r, sname=""; - if(!formula[0] || !formula[0][0]) return ""; - var last_sp = -1, sp = ""; - for(var ff = 0, fflen = formula[0].length; ff < fflen; ++ff) { - var f = formula[0][ff]; - switch(f[0]) { - case 'PtgUminus': /* [MS-XLS] 2.5.198.93 */ - stack.push("-" + stack.pop()); break; - case 'PtgUplus': /* [MS-XLS] 2.5.198.95 */ - stack.push("+" + stack.pop()); break; - case 'PtgPercent': /* [MS-XLS] 2.5.198.81 */ - stack.push(stack.pop() + "%"); break; - - case 'PtgAdd': /* [MS-XLS] 2.5.198.26 */ - case 'PtgConcat': /* [MS-XLS] 2.5.198.43 */ - case 'PtgDiv': /* [MS-XLS] 2.5.198.45 */ - case 'PtgEq': /* [MS-XLS] 2.5.198.56 */ - case 'PtgGe': /* [MS-XLS] 2.5.198.64 */ - case 'PtgGt': /* [MS-XLS] 2.5.198.65 */ - case 'PtgLe': /* [MS-XLS] 2.5.198.68 */ - case 'PtgLt': /* [MS-XLS] 2.5.198.69 */ - case 'PtgMul': /* [MS-XLS] 2.5.198.75 */ - case 'PtgNe': /* [MS-XLS] 2.5.198.78 */ - case 'PtgPower': /* [MS-XLS] 2.5.198.82 */ - case 'PtgSub': /* [MS-XLS] 2.5.198.90 */ - e1 = stack.pop(); e2 = stack.pop(); - if(last_sp >= 0) { - switch(formula[0][last_sp][1][0]) { - case 0: - // $FlowIgnore - sp = fill(" ", formula[0][last_sp][1][1]); break; - case 1: - // $FlowIgnore - sp = fill("\r", formula[0][last_sp][1][1]); break; - default: - sp = ""; - // $FlowIgnore - if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); - } - e2 = e2 + sp; - last_sp = -1; - } - stack.push(e2+PtgBinOp[f[0]]+e1); - break; - - case 'PtgIsect': /* [MS-XLS] 2.5.198.67 */ - e1 = stack.pop(); e2 = stack.pop(); - stack.push(e2+" "+e1); - break; - case 'PtgUnion': /* [MS-XLS] 2.5.198.94 */ - e1 = stack.pop(); e2 = stack.pop(); - stack.push(e2+","+e1); - break; - case 'PtgRange': /* [MS-XLS] 2.5.198.83 */ - e1 = stack.pop(); e2 = stack.pop(); - stack.push(e2+":"+e1); - break; - - case 'PtgAttrChoose': /* [MS-XLS] 2.5.198.34 */ - break; - case 'PtgAttrGoto': /* [MS-XLS] 2.5.198.35 */ - break; - case 'PtgAttrIf': /* [MS-XLS] 2.5.198.36 */ - break; - case 'PtgAttrIfError': /* [MS-XLSB] 2.5.97.28 */ - break; - - - case 'PtgRef': /* [MS-XLS] 2.5.198.84 */ - /*::type = f[1][0]; */c = shift_cell_xls((f[1][1]/*:any*/), _range, opts); - stack.push(encode_cell_xls(c, biff)); - break; - case 'PtgRefN': /* [MS-XLS] 2.5.198.88 */ - /*::type = f[1][0]; */c = cell ? shift_cell_xls((f[1][1]/*:any*/), cell, opts) : (f[1][1]/*:any*/); - stack.push(encode_cell_xls(c, biff)); - break; - case 'PtgRef3d': /* [MS-XLS] 2.5.198.85 */ - /*::type = f[1][0]; */ixti = /*::Number(*/f[1][1]/*::)*/; c = shift_cell_xls((f[1][2]/*:any*/), _range, opts); - sname = get_ixti(supbooks, ixti, opts); - var w = sname; /* IE9 fails on defined names */ // eslint-disable-line no-unused-vars - stack.push(sname + "!" + encode_cell_xls(c, biff)); - break; - - case 'PtgFunc': /* [MS-XLS] 2.5.198.62 */ - case 'PtgFuncVar': /* [MS-XLS] 2.5.198.63 */ - /* f[1] = [argc, func, type] */ - var argc/*:number*/ = (f[1][0]/*:any*/), func/*:string*/ = (f[1][1]/*:any*/); - if(!argc) argc = 0; - argc &= 0x7F; - var args = argc == 0 ? [] : stack.slice(-argc); - stack.length -= argc; - if(func === 'User') func = args.shift(); - stack.push(func + "(" + args.join(",") + ")"); - break; - - case 'PtgBool': /* [MS-XLS] 2.5.198.42 */ - stack.push(f[1] ? "TRUE" : "FALSE"); break; - case 'PtgInt': /* [MS-XLS] 2.5.198.66 */ - stack.push(/*::String(*/f[1]/*::)*/); break; - case 'PtgNum': /* [MS-XLS] 2.5.198.79 TODO: precision? */ - stack.push(String(f[1])); break; - case 'PtgStr': /* [MS-XLS] 2.5.198.89 */ - // $FlowIgnore - stack.push('"' + f[1].replace(/"/g, '""') + '"'); break; - case 'PtgErr': /* [MS-XLS] 2.5.198.57 */ - stack.push(/*::String(*/f[1]/*::)*/); break; - case 'PtgAreaN': /* [MS-XLS] 2.5.198.31 TODO */ - /*::type = f[1][0]; */r = shift_range_xls(f[1][1], cell ? {s:cell} : _range, opts); - stack.push(encode_range_xls((r/*:any*/), opts)); - break; - case 'PtgArea': /* [MS-XLS] 2.5.198.27 TODO: fixed points */ - /*::type = f[1][0]; */r = shift_range_xls(f[1][1], _range, opts); - stack.push(encode_range_xls((r/*:any*/), opts)); - break; - case 'PtgArea3d': /* [MS-XLS] 2.5.198.28 TODO */ - /*::type = f[1][0]; */ixti = /*::Number(*/f[1][1]/*::)*/; r = f[1][2]; - sname = get_ixti(supbooks, ixti, opts); - stack.push(sname + "!" + encode_range_xls((r/*:any*/), opts)); - break; - case 'PtgAttrSum': /* [MS-XLS] 2.5.198.41 */ - stack.push("SUM(" + stack.pop() + ")"); - break; - - case 'PtgAttrBaxcel': /* [MS-XLS] 2.5.198.33 */ - case 'PtgAttrSemi': /* [MS-XLS] 2.5.198.37 */ - break; - - case 'PtgName': /* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 TODO: revisions */ - /* f[1] = type, 0, nameindex */ - nameidx = (f[1][2]/*:any*/); - var lbl = (supbooks.names||[])[nameidx-1] || (supbooks[0]||[])[nameidx]; - var name = lbl ? lbl.Name : "SH33TJSNAME" + String(nameidx); - /* [MS-XLSB] 2.5.97.10 Ftab -- last verified 20220204 */ - if(name && name.slice(0,6) == "_xlfn.") name = name.slice(6); - stack.push(name); - break; - - case 'PtgNameX': /* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 TODO: revisions */ - /* f[1] = type, ixti, nameindex */ - var bookidx/*:number*/ = (f[1][1]/*:any*/); nameidx = (f[1][2]/*:any*/); var externbook; - /* TODO: Properly handle missing values -- this should be using get_ixti_raw primarily */ - if(opts.biff <= 5) { - if(bookidx < 0) bookidx = -bookidx; - if(supbooks[bookidx]) externbook = supbooks[bookidx][nameidx]; - } else { - var o = ""; - if(((supbooks[bookidx]||[])[0]||[])[0] == 0x3A01){/* empty */} - else if(((supbooks[bookidx]||[])[0]||[])[0] == 0x0401){ - if(supbooks[bookidx][nameidx] && supbooks[bookidx][nameidx].itab > 0) { - o = supbooks.SheetNames[supbooks[bookidx][nameidx].itab-1] + "!"; - } - } - else o = supbooks.SheetNames[nameidx-1]+ "!"; - if(supbooks[bookidx] && supbooks[bookidx][nameidx]) o += supbooks[bookidx][nameidx].Name; - else if(supbooks[0] && supbooks[0][nameidx]) o += supbooks[0][nameidx].Name; - else { - var ixtidata = (get_ixti_raw(supbooks, bookidx, opts)||"").split(";;"); - if(ixtidata[nameidx - 1]) o = ixtidata[nameidx - 1]; // TODO: confirm this is correct - else o += "SH33TJSERRX"; - } - stack.push(o); - break; - } - if(!externbook) externbook = {Name: "SH33TJSERRY"}; - stack.push(externbook.Name); - break; - - case 'PtgParen': /* [MS-XLS] 2.5.198.80 */ - var lp = '(', rp = ')'; - if(last_sp >= 0) { - sp = ""; - switch(formula[0][last_sp][1][0]) { - // $FlowIgnore - case 2: lp = fill(" ", formula[0][last_sp][1][1]) + lp; break; - // $FlowIgnore - case 3: lp = fill("\r", formula[0][last_sp][1][1]) + lp; break; - // $FlowIgnore - case 4: rp = fill(" ", formula[0][last_sp][1][1]) + rp; break; - // $FlowIgnore - case 5: rp = fill("\r", formula[0][last_sp][1][1]) + rp; break; - default: - // $FlowIgnore - if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); - } - last_sp = -1; - } - stack.push(lp + stack.pop() + rp); break; - - case 'PtgRefErr': /* [MS-XLS] 2.5.198.86 */ - stack.push('#REF!'); break; - - case 'PtgRefErr3d': /* [MS-XLS] 2.5.198.87 */ - stack.push('#REF!'); break; - - case 'PtgExp': /* [MS-XLS] 2.5.198.58 TODO */ - c = {c:(f[1][1]/*:any*/),r:(f[1][0]/*:any*/)}; - var q = ({c: cell.c, r:cell.r}/*:any*/); - if(supbooks.sharedf[encode_cell(c)]) { - var parsedf = (supbooks.sharedf[encode_cell(c)]); - stack.push(stringify_formula(parsedf, _range, q, supbooks, opts)); - } else { - var fnd = false; - for(e1=0;e1!=supbooks.arrayf.length; ++e1) { - /* TODO: should be something like range_has */ - e2 = supbooks.arrayf[e1]; - if(c.c < e2[0].s.c || c.c > e2[0].e.c) continue; - if(c.r < e2[0].s.r || c.r > e2[0].e.r) continue; - stack.push(stringify_formula(e2[1], _range, q, supbooks, opts)); - fnd = true; - break; - } - if(!fnd) stack.push(/*::String(*/f[1]/*::)*/); - } - break; - - case 'PtgArray': /* [MS-XLS] 2.5.198.32 TODO */ - stack.push("{" + stringify_array(/*::(*/f[1]/*:: :any)*/) + "}"); - break; - - case 'PtgMemArea': /* [MS-XLS] 2.5.198.70 TODO: confirm this is a non-display */ - //stack.push("(" + f[2].map(encode_range).join(",") + ")"); - break; - - case 'PtgAttrSpace': /* [MS-XLS] 2.5.198.38 */ - case 'PtgAttrSpaceSemi': /* [MS-XLS] 2.5.198.39 */ - last_sp = ff; - break; - - case 'PtgTbl': /* [MS-XLS] 2.5.198.92 TODO */ - break; - - case 'PtgMemErr': /* [MS-XLS] 2.5.198.71 */ - break; - - case 'PtgMissArg': /* [MS-XLS] 2.5.198.74 */ - stack.push(""); - break; - - case 'PtgAreaErr': /* [MS-XLS] 2.5.198.29 */ - stack.push("#REF!"); break; - - case 'PtgAreaErr3d': /* [MS-XLS] 2.5.198.30 */ - stack.push("#REF!"); break; - - case 'PtgList': /* [MS-XLSB] 2.5.97.52 */ - // $FlowIgnore - stack.push("Table" + f[1].idx + "[#" + f[1].rt + "]"); - break; - - case 'PtgMemAreaN': - case 'PtgMemNoMemN': - case 'PtgAttrNoop': - case 'PtgSheet': - case 'PtgEndSheet': - break; - - case 'PtgMemFunc': /* [MS-XLS] 2.5.198.72 TODO */ - break; - case 'PtgMemNoMem': /* [MS-XLS] 2.5.198.73 TODO */ - break; - - case 'PtgElfCol': /* [MS-XLS] 2.5.198.46 */ - case 'PtgElfColS': /* [MS-XLS] 2.5.198.47 */ - case 'PtgElfColSV': /* [MS-XLS] 2.5.198.48 */ - case 'PtgElfColV': /* [MS-XLS] 2.5.198.49 */ - case 'PtgElfLel': /* [MS-XLS] 2.5.198.50 */ - case 'PtgElfRadical': /* [MS-XLS] 2.5.198.51 */ - case 'PtgElfRadicalLel': /* [MS-XLS] 2.5.198.52 */ - case 'PtgElfRadicalS': /* [MS-XLS] 2.5.198.53 */ - case 'PtgElfRw': /* [MS-XLS] 2.5.198.54 */ - case 'PtgElfRwV': /* [MS-XLS] 2.5.198.55 */ - throw new Error("Unsupported ELFs"); - - case 'PtgSxName': /* [MS-XLS] 2.5.198.91 TODO -- find a test case */ - throw new Error('Unrecognized Formula Token: ' + String(f)); - default: throw new Error('Unrecognized Formula Token: ' + String(f)); - } - var PtgNonDisp = ['PtgAttrSpace', 'PtgAttrSpaceSemi', 'PtgAttrGoto']; - if(opts.biff != 3) if(last_sp >= 0 && PtgNonDisp.indexOf(formula[0][ff][0]) == -1) { - f = formula[0][last_sp]; - var _left = true; - switch(f[1][0]) { - /* note: some bad XLSB files omit the PtgParen */ - case 4: _left = false; - /* falls through */ - case 0: - // $FlowIgnore - sp = fill(" ", f[1][1]); break; - case 5: _left = false; - /* falls through */ - case 1: - // $FlowIgnore - sp = fill("\r", f[1][1]); break; - default: - sp = ""; - // $FlowIgnore - if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + f[1][0]); - } - stack.push((_left ? sp : "") + stack.pop() + (_left ? "" : sp)); - last_sp = -1; - } - } - if(stack.length > 1 && opts.WTF) throw new Error("bad formula stack"); - return stack[0]; -} - -/* [MS-XLS] 2.5.198.1 TODO */ -function parse_ArrayParsedFormula(blob, length, opts/*::, ref*/) { - var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; - var rgcb, cce = blob.read_shift(len); // length of rgce - if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; - var rgce = parse_Rgce(blob, cce, opts); - if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); - blob.l = target; - return [rgce, rgcb]; -} - -/* [MS-XLS] 2.5.198.3 TODO */ -function parse_XLSCellParsedFormula(blob, length, opts) { - var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; - var rgcb, cce = blob.read_shift(len); // length of rgce - if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; - var rgce = parse_Rgce(blob, cce, opts); - if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); - blob.l = target; - return [rgce, rgcb]; -} - -/* [MS-XLS] 2.5.198.21 */ -function parse_NameParsedFormula(blob, length, opts, cce) { - var target = blob.l + length; - var rgce = parse_Rgce(blob, cce, opts); - var rgcb; - if(target !== blob.l) rgcb = parse_RgbExtra(blob, target - blob.l, rgce, opts); - return [rgce, rgcb]; -} - -/* [MS-XLS] 2.5.198.118 TODO */ -function parse_SharedParsedFormula(blob, length, opts) { - var target = blob.l + length; - var rgcb, cce = blob.read_shift(2); // length of rgce - var rgce = parse_Rgce(blob, cce, opts); - if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; - if(length !== cce + 2) rgcb = parse_RgbExtra(blob, target - cce - 2, rgce, opts); - return [rgce, rgcb]; -} - -/* [MS-XLS] 2.5.133 TODO: how to emit empty strings? */ -function parse_FormulaValue(blob/*::, length*/) { - var b; - if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n']; - switch(blob[blob.l]) { - case 0x00: blob.l += 8; return ["String", 's']; - case 0x01: b = blob[blob.l+2] === 0x1; blob.l += 8; return [b,'b']; - case 0x02: b = blob[blob.l+2]; blob.l += 8; return [b,'e']; - case 0x03: blob.l += 8; return ["",'s']; - } - return []; -} -function write_FormulaValue(value) { - if(value == null) { - // Blank String Value - var o = new_buf(8); - o.write_shift(1, 0x03); - o.write_shift(1, 0); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, 0xFFFF); - return o; - } else if(typeof value == "number") return write_Xnum(value); - return write_Xnum(0); -} - -/* [MS-XLS] 2.4.127 TODO */ -function parse_Formula(blob, length, opts) { - var end = blob.l + length; - var cell = parse_XLSCell(blob, 6); - if(opts.biff == 2) ++blob.l; - var val = parse_FormulaValue(blob,8); - var flags = blob.read_shift(1); - if(opts.biff != 2) { - blob.read_shift(1); - if(opts.biff >= 5) { - /*var chn = */blob.read_shift(4); - } - } - var cbf = parse_XLSCellParsedFormula(blob, end - blob.l, opts); - return {cell:cell, val:val[0], formula:cbf, shared: (flags >> 3) & 1, tt:val[1]}; -} -function write_Formula(cell/*:Cell*/, R/*:number*/, C/*:number*/, opts, os/*:number*/) { - // Cell - var o1 = write_XLSCell(R, C, os); - - // FormulaValue - var o2 = write_FormulaValue(cell.v); - - // flags + cache - var o3 = new_buf(6); - var flags = 0x01 | 0x20; - o3.write_shift(2, flags); - o3.write_shift(4, 0); - - // CellParsedFormula - var bf = new_buf(cell.bf.length); - for(var i = 0; i < cell.bf.length; ++i) bf[i] = cell.bf[i]; - - var out = bconcat([o1, o2, o3, bf]); - return out; -} - - -/* XLSB Parsed Formula records have the same shape */ -function parse_XLSBParsedFormula(data, length, opts) { - var cce = data.read_shift(4); - var rgce = parse_Rgce(data, cce, opts); - var cb = data.read_shift(4); - var rgcb = cb > 0 ? parse_RgbExtra(data, cb, rgce, opts) : null; - return [rgce, rgcb]; -} - -/* [MS-XLSB] 2.5.97.1 ArrayParsedFormula */ -var parse_XLSBArrayParsedFormula = parse_XLSBParsedFormula; -/* [MS-XLSB] 2.5.97.4 CellParsedFormula */ -var parse_XLSBCellParsedFormula = parse_XLSBParsedFormula; -/* [MS-XLSB] 2.5.97.8 DVParsedFormula */ -//var parse_XLSBDVParsedFormula = parse_XLSBParsedFormula; -/* [MS-XLSB] 2.5.97.9 FRTParsedFormula */ -//var parse_XLSBFRTParsedFormula = parse_XLSBParsedFormula2; -/* [MS-XLSB] 2.5.97.12 NameParsedFormula */ -var parse_XLSBNameParsedFormula = parse_XLSBParsedFormula; -/* [MS-XLSB] 2.5.97.98 SharedParsedFormula */ -var parse_XLSBSharedParsedFormula = parse_XLSBParsedFormula; -var Cetab = { - 0: "BEEP", - 1: "OPEN", - 2: "OPEN.LINKS", - 3: "CLOSE.ALL", - 4: "SAVE", - 5: "SAVE.AS", - 6: "FILE.DELETE", - 7: "PAGE.SETUP", - 8: "PRINT", - 9: "PRINTER.SETUP", - 10: "QUIT", - 11: "NEW.WINDOW", - 12: "ARRANGE.ALL", - 13: "WINDOW.SIZE", - 14: "WINDOW.MOVE", - 15: "FULL", - 16: "CLOSE", - 17: "RUN", - 22: "SET.PRINT.AREA", - 23: "SET.PRINT.TITLES", - 24: "SET.PAGE.BREAK", - 25: "REMOVE.PAGE.BREAK", - 26: "FONT", - 27: "DISPLAY", - 28: "PROTECT.DOCUMENT", - 29: "PRECISION", - 30: "A1.R1C1", - 31: "CALCULATE.NOW", - 32: "CALCULATION", - 34: "DATA.FIND", - 35: "EXTRACT", - 36: "DATA.DELETE", - 37: "SET.DATABASE", - 38: "SET.CRITERIA", - 39: "SORT", - 40: "DATA.SERIES", - 41: "TABLE", - 42: "FORMAT.NUMBER", - 43: "ALIGNMENT", - 44: "STYLE", - 45: "BORDER", - 46: "CELL.PROTECTION", - 47: "COLUMN.WIDTH", - 48: "UNDO", - 49: "CUT", - 50: "COPY", - 51: "PASTE", - 52: "CLEAR", - 53: "PASTE.SPECIAL", - 54: "EDIT.DELETE", - 55: "INSERT", - 56: "FILL.RIGHT", - 57: "FILL.DOWN", - 61: "DEFINE.NAME", - 62: "CREATE.NAMES", - 63: "FORMULA.GOTO", - 64: "FORMULA.FIND", - 65: "SELECT.LAST.CELL", - 66: "SHOW.ACTIVE.CELL", - 67: "GALLERY.AREA", - 68: "GALLERY.BAR", - 69: "GALLERY.COLUMN", - 70: "GALLERY.LINE", - 71: "GALLERY.PIE", - 72: "GALLERY.SCATTER", - 73: "COMBINATION", - 74: "PREFERRED", - 75: "ADD.OVERLAY", - 76: "GRIDLINES", - 77: "SET.PREFERRED", - 78: "AXES", - 79: "LEGEND", - 80: "ATTACH.TEXT", - 81: "ADD.ARROW", - 82: "SELECT.CHART", - 83: "SELECT.PLOT.AREA", - 84: "PATTERNS", - 85: "MAIN.CHART", - 86: "OVERLAY", - 87: "SCALE", - 88: "FORMAT.LEGEND", - 89: "FORMAT.TEXT", - 90: "EDIT.REPEAT", - 91: "PARSE", - 92: "JUSTIFY", - 93: "HIDE", - 94: "UNHIDE", - 95: "WORKSPACE", - 96: "FORMULA", - 97: "FORMULA.FILL", - 98: "FORMULA.ARRAY", - 99: "DATA.FIND.NEXT", - 100: "DATA.FIND.PREV", - 101: "FORMULA.FIND.NEXT", - 102: "FORMULA.FIND.PREV", - 103: "ACTIVATE", - 104: "ACTIVATE.NEXT", - 105: "ACTIVATE.PREV", - 106: "UNLOCKED.NEXT", - 107: "UNLOCKED.PREV", - 108: "COPY.PICTURE", - 109: "SELECT", - 110: "DELETE.NAME", - 111: "DELETE.FORMAT", - 112: "VLINE", - 113: "HLINE", - 114: "VPAGE", - 115: "HPAGE", - 116: "VSCROLL", - 117: "HSCROLL", - 118: "ALERT", - 119: "NEW", - 120: "CANCEL.COPY", - 121: "SHOW.CLIPBOARD", - 122: "MESSAGE", - 124: "PASTE.LINK", - 125: "APP.ACTIVATE", - 126: "DELETE.ARROW", - 127: "ROW.HEIGHT", - 128: "FORMAT.MOVE", - 129: "FORMAT.SIZE", - 130: "FORMULA.REPLACE", - 131: "SEND.KEYS", - 132: "SELECT.SPECIAL", - 133: "APPLY.NAMES", - 134: "REPLACE.FONT", - 135: "FREEZE.PANES", - 136: "SHOW.INFO", - 137: "SPLIT", - 138: "ON.WINDOW", - 139: "ON.DATA", - 140: "DISABLE.INPUT", - 142: "OUTLINE", - 143: "LIST.NAMES", - 144: "FILE.CLOSE", - 145: "SAVE.WORKBOOK", - 146: "DATA.FORM", - 147: "COPY.CHART", - 148: "ON.TIME", - 149: "WAIT", - 150: "FORMAT.FONT", - 151: "FILL.UP", - 152: "FILL.LEFT", - 153: "DELETE.OVERLAY", - 155: "SHORT.MENUS", - 159: "SET.UPDATE.STATUS", - 161: "COLOR.PALETTE", - 162: "DELETE.STYLE", - 163: "WINDOW.RESTORE", - 164: "WINDOW.MAXIMIZE", - 166: "CHANGE.LINK", - 167: "CALCULATE.DOCUMENT", - 168: "ON.KEY", - 169: "APP.RESTORE", - 170: "APP.MOVE", - 171: "APP.SIZE", - 172: "APP.MINIMIZE", - 173: "APP.MAXIMIZE", - 174: "BRING.TO.FRONT", - 175: "SEND.TO.BACK", - 185: "MAIN.CHART.TYPE", - 186: "OVERLAY.CHART.TYPE", - 187: "SELECT.END", - 188: "OPEN.MAIL", - 189: "SEND.MAIL", - 190: "STANDARD.FONT", - 191: "CONSOLIDATE", - 192: "SORT.SPECIAL", - 193: "GALLERY.3D.AREA", - 194: "GALLERY.3D.COLUMN", - 195: "GALLERY.3D.LINE", - 196: "GALLERY.3D.PIE", - 197: "VIEW.3D", - 198: "GOAL.SEEK", - 199: "WORKGROUP", - 200: "FILL.GROUP", - 201: "UPDATE.LINK", - 202: "PROMOTE", - 203: "DEMOTE", - 204: "SHOW.DETAIL", - 206: "UNGROUP", - 207: "OBJECT.PROPERTIES", - 208: "SAVE.NEW.OBJECT", - 209: "SHARE", - 210: "SHARE.NAME", - 211: "DUPLICATE", - 212: "APPLY.STYLE", - 213: "ASSIGN.TO.OBJECT", - 214: "OBJECT.PROTECTION", - 215: "HIDE.OBJECT", - 216: "SET.EXTRACT", - 217: "CREATE.PUBLISHER", - 218: "SUBSCRIBE.TO", - 219: "ATTRIBUTES", - 220: "SHOW.TOOLBAR", - 222: "PRINT.PREVIEW", - 223: "EDIT.COLOR", - 224: "SHOW.LEVELS", - 225: "FORMAT.MAIN", - 226: "FORMAT.OVERLAY", - 227: "ON.RECALC", - 228: "EDIT.SERIES", - 229: "DEFINE.STYLE", - 240: "LINE.PRINT", - 243: "ENTER.DATA", - 249: "GALLERY.RADAR", - 250: "MERGE.STYLES", - 251: "EDITION.OPTIONS", - 252: "PASTE.PICTURE", - 253: "PASTE.PICTURE.LINK", - 254: "SPELLING", - 256: "ZOOM", - 259: "INSERT.OBJECT", - 260: "WINDOW.MINIMIZE", - 265: "SOUND.NOTE", - 266: "SOUND.PLAY", - 267: "FORMAT.SHAPE", - 268: "EXTEND.POLYGON", - 269: "FORMAT.AUTO", - 272: "GALLERY.3D.BAR", - 273: "GALLERY.3D.SURFACE", - 274: "FILL.AUTO", - 276: "CUSTOMIZE.TOOLBAR", - 277: "ADD.TOOL", - 278: "EDIT.OBJECT", - 279: "ON.DOUBLECLICK", - 280: "ON.ENTRY", - 281: "WORKBOOK.ADD", - 282: "WORKBOOK.MOVE", - 283: "WORKBOOK.COPY", - 284: "WORKBOOK.OPTIONS", - 285: "SAVE.WORKSPACE", - 288: "CHART.WIZARD", - 289: "DELETE.TOOL", - 290: "MOVE.TOOL", - 291: "WORKBOOK.SELECT", - 292: "WORKBOOK.ACTIVATE", - 293: "ASSIGN.TO.TOOL", - 295: "COPY.TOOL", - 296: "RESET.TOOL", - 297: "CONSTRAIN.NUMERIC", - 298: "PASTE.TOOL", - 302: "WORKBOOK.NEW", - 305: "SCENARIO.CELLS", - 306: "SCENARIO.DELETE", - 307: "SCENARIO.ADD", - 308: "SCENARIO.EDIT", - 309: "SCENARIO.SHOW", - 310: "SCENARIO.SHOW.NEXT", - 311: "SCENARIO.SUMMARY", - 312: "PIVOT.TABLE.WIZARD", - 313: "PIVOT.FIELD.PROPERTIES", - 314: "PIVOT.FIELD", - 315: "PIVOT.ITEM", - 316: "PIVOT.ADD.FIELDS", - 318: "OPTIONS.CALCULATION", - 319: "OPTIONS.EDIT", - 320: "OPTIONS.VIEW", - 321: "ADDIN.MANAGER", - 322: "MENU.EDITOR", - 323: "ATTACH.TOOLBARS", - 324: "VBAActivate", - 325: "OPTIONS.CHART", - 328: "VBA.INSERT.FILE", - 330: "VBA.PROCEDURE.DEFINITION", - 336: "ROUTING.SLIP", - 338: "ROUTE.DOCUMENT", - 339: "MAIL.LOGON", - 342: "INSERT.PICTURE", - 343: "EDIT.TOOL", - 344: "GALLERY.DOUGHNUT", - 350: "CHART.TREND", - 352: "PIVOT.ITEM.PROPERTIES", - 354: "WORKBOOK.INSERT", - 355: "OPTIONS.TRANSITION", - 356: "OPTIONS.GENERAL", - 370: "FILTER.ADVANCED", - 373: "MAIL.ADD.MAILER", - 374: "MAIL.DELETE.MAILER", - 375: "MAIL.REPLY", - 376: "MAIL.REPLY.ALL", - 377: "MAIL.FORWARD", - 378: "MAIL.NEXT.LETTER", - 379: "DATA.LABEL", - 380: "INSERT.TITLE", - 381: "FONT.PROPERTIES", - 382: "MACRO.OPTIONS", - 383: "WORKBOOK.HIDE", - 384: "WORKBOOK.UNHIDE", - 385: "WORKBOOK.DELETE", - 386: "WORKBOOK.NAME", - 388: "GALLERY.CUSTOM", - 390: "ADD.CHART.AUTOFORMAT", - 391: "DELETE.CHART.AUTOFORMAT", - 392: "CHART.ADD.DATA", - 393: "AUTO.OUTLINE", - 394: "TAB.ORDER", - 395: "SHOW.DIALOG", - 396: "SELECT.ALL", - 397: "UNGROUP.SHEETS", - 398: "SUBTOTAL.CREATE", - 399: "SUBTOTAL.REMOVE", - 400: "RENAME.OBJECT", - 412: "WORKBOOK.SCROLL", - 413: "WORKBOOK.NEXT", - 414: "WORKBOOK.PREV", - 415: "WORKBOOK.TAB.SPLIT", - 416: "FULL.SCREEN", - 417: "WORKBOOK.PROTECT", - 420: "SCROLLBAR.PROPERTIES", - 421: "PIVOT.SHOW.PAGES", - 422: "TEXT.TO.COLUMNS", - 423: "FORMAT.CHARTTYPE", - 424: "LINK.FORMAT", - 425: "TRACER.DISPLAY", - 430: "TRACER.NAVIGATE", - 431: "TRACER.CLEAR", - 432: "TRACER.ERROR", - 433: "PIVOT.FIELD.GROUP", - 434: "PIVOT.FIELD.UNGROUP", - 435: "CHECKBOX.PROPERTIES", - 436: "LABEL.PROPERTIES", - 437: "LISTBOX.PROPERTIES", - 438: "EDITBOX.PROPERTIES", - 439: "PIVOT.REFRESH", - 440: "LINK.COMBO", - 441: "OPEN.TEXT", - 442: "HIDE.DIALOG", - 443: "SET.DIALOG.FOCUS", - 444: "ENABLE.OBJECT", - 445: "PUSHBUTTON.PROPERTIES", - 446: "SET.DIALOG.DEFAULT", - 447: "FILTER", - 448: "FILTER.SHOW.ALL", - 449: "CLEAR.OUTLINE", - 450: "FUNCTION.WIZARD", - 451: "ADD.LIST.ITEM", - 452: "SET.LIST.ITEM", - 453: "REMOVE.LIST.ITEM", - 454: "SELECT.LIST.ITEM", - 455: "SET.CONTROL.VALUE", - 456: "SAVE.COPY.AS", - 458: "OPTIONS.LISTS.ADD", - 459: "OPTIONS.LISTS.DELETE", - 460: "SERIES.AXES", - 461: "SERIES.X", - 462: "SERIES.Y", - 463: "ERRORBAR.X", - 464: "ERRORBAR.Y", - 465: "FORMAT.CHART", - 466: "SERIES.ORDER", - 467: "MAIL.LOGOFF", - 468: "CLEAR.ROUTING.SLIP", - 469: "APP.ACTIVATE.MICROSOFT", - 470: "MAIL.EDIT.MAILER", - 471: "ON.SHEET", - 472: "STANDARD.WIDTH", - 473: "SCENARIO.MERGE", - 474: "SUMMARY.INFO", - 475: "FIND.FILE", - 476: "ACTIVE.CELL.FONT", - 477: "ENABLE.TIPWIZARD", - 478: "VBA.MAKE.ADDIN", - 480: "INSERTDATATABLE", - 481: "WORKGROUP.OPTIONS", - 482: "MAIL.SEND.MAILER", - 485: "AUTOCORRECT", - 489: "POST.DOCUMENT", - 491: "PICKLIST", - 493: "VIEW.SHOW", - 494: "VIEW.DEFINE", - 495: "VIEW.DELETE", - 509: "SHEET.BACKGROUND", - 510: "INSERT.MAP.OBJECT", - 511: "OPTIONS.MENONO", - 517: "MSOCHECKS", - 518: "NORMAL", - 519: "LAYOUT", - 520: "RM.PRINT.AREA", - 521: "CLEAR.PRINT.AREA", - 522: "ADD.PRINT.AREA", - 523: "MOVE.BRK", - 545: "HIDECURR.NOTE", - 546: "HIDEALL.NOTES", - 547: "DELETE.NOTE", - 548: "TRAVERSE.NOTES", - 549: "ACTIVATE.NOTES", - 620: "PROTECT.REVISIONS", - 621: "UNPROTECT.REVISIONS", - 647: "OPTIONS.ME", - 653: "WEB.PUBLISH", - 667: "NEWWEBQUERY", - 673: "PIVOT.TABLE.CHART", - 753: "OPTIONS.SAVE", - 755: "OPTIONS.SPELL", - 808: "HIDEALL.INKANNOTS" -}; -var Ftab = { - 0: "COUNT", - 1: "IF", - 2: "ISNA", - 3: "ISERROR", - 4: "SUM", - 5: "AVERAGE", - 6: "MIN", - 7: "MAX", - 8: "ROW", - 9: "COLUMN", - 10: "NA", - 11: "NPV", - 12: "STDEV", - 13: "DOLLAR", - 14: "FIXED", - 15: "SIN", - 16: "COS", - 17: "TAN", - 18: "ATAN", - 19: "PI", - 20: "SQRT", - 21: "EXP", - 22: "LN", - 23: "LOG10", - 24: "ABS", - 25: "INT", - 26: "SIGN", - 27: "ROUND", - 28: "LOOKUP", - 29: "INDEX", - 30: "REPT", - 31: "MID", - 32: "LEN", - 33: "VALUE", - 34: "TRUE", - 35: "FALSE", - 36: "AND", - 37: "OR", - 38: "NOT", - 39: "MOD", - 40: "DCOUNT", - 41: "DSUM", - 42: "DAVERAGE", - 43: "DMIN", - 44: "DMAX", - 45: "DSTDEV", - 46: "VAR", - 47: "DVAR", - 48: "TEXT", - 49: "LINEST", - 50: "TREND", - 51: "LOGEST", - 52: "GROWTH", - 53: "GOTO", - 54: "HALT", - 55: "RETURN", - 56: "PV", - 57: "FV", - 58: "NPER", - 59: "PMT", - 60: "RATE", - 61: "MIRR", - 62: "IRR", - 63: "RAND", - 64: "MATCH", - 65: "DATE", - 66: "TIME", - 67: "DAY", - 68: "MONTH", - 69: "YEAR", - 70: "WEEKDAY", - 71: "HOUR", - 72: "MINUTE", - 73: "SECOND", - 74: "NOW", - 75: "AREAS", - 76: "ROWS", - 77: "COLUMNS", - 78: "OFFSET", - 79: "ABSREF", - 80: "RELREF", - 81: "ARGUMENT", - 82: "SEARCH", - 83: "TRANSPOSE", - 84: "ERROR", - 85: "STEP", - 86: "TYPE", - 87: "ECHO", - 88: "SET.NAME", - 89: "CALLER", - 90: "DEREF", - 91: "WINDOWS", - 92: "SERIES", - 93: "DOCUMENTS", - 94: "ACTIVE.CELL", - 95: "SELECTION", - 96: "RESULT", - 97: "ATAN2", - 98: "ASIN", - 99: "ACOS", - 100: "CHOOSE", - 101: "HLOOKUP", - 102: "VLOOKUP", - 103: "LINKS", - 104: "INPUT", - 105: "ISREF", - 106: "GET.FORMULA", - 107: "GET.NAME", - 108: "SET.VALUE", - 109: "LOG", - 110: "EXEC", - 111: "CHAR", - 112: "LOWER", - 113: "UPPER", - 114: "PROPER", - 115: "LEFT", - 116: "RIGHT", - 117: "EXACT", - 118: "TRIM", - 119: "REPLACE", - 120: "SUBSTITUTE", - 121: "CODE", - 122: "NAMES", - 123: "DIRECTORY", - 124: "FIND", - 125: "CELL", - 126: "ISERR", - 127: "ISTEXT", - 128: "ISNUMBER", - 129: "ISBLANK", - 130: "T", - 131: "N", - 132: "FOPEN", - 133: "FCLOSE", - 134: "FSIZE", - 135: "FREADLN", - 136: "FREAD", - 137: "FWRITELN", - 138: "FWRITE", - 139: "FPOS", - 140: "DATEVALUE", - 141: "TIMEVALUE", - 142: "SLN", - 143: "SYD", - 144: "DDB", - 145: "GET.DEF", - 146: "REFTEXT", - 147: "TEXTREF", - 148: "INDIRECT", - 149: "REGISTER", - 150: "CALL", - 151: "ADD.BAR", - 152: "ADD.MENU", - 153: "ADD.COMMAND", - 154: "ENABLE.COMMAND", - 155: "CHECK.COMMAND", - 156: "RENAME.COMMAND", - 157: "SHOW.BAR", - 158: "DELETE.MENU", - 159: "DELETE.COMMAND", - 160: "GET.CHART.ITEM", - 161: "DIALOG.BOX", - 162: "CLEAN", - 163: "MDETERM", - 164: "MINVERSE", - 165: "MMULT", - 166: "FILES", - 167: "IPMT", - 168: "PPMT", - 169: "COUNTA", - 170: "CANCEL.KEY", - 171: "FOR", - 172: "WHILE", - 173: "BREAK", - 174: "NEXT", - 175: "INITIATE", - 176: "REQUEST", - 177: "POKE", - 178: "EXECUTE", - 179: "TERMINATE", - 180: "RESTART", - 181: "HELP", - 182: "GET.BAR", - 183: "PRODUCT", - 184: "FACT", - 185: "GET.CELL", - 186: "GET.WORKSPACE", - 187: "GET.WINDOW", - 188: "GET.DOCUMENT", - 189: "DPRODUCT", - 190: "ISNONTEXT", - 191: "GET.NOTE", - 192: "NOTE", - 193: "STDEVP", - 194: "VARP", - 195: "DSTDEVP", - 196: "DVARP", - 197: "TRUNC", - 198: "ISLOGICAL", - 199: "DCOUNTA", - 200: "DELETE.BAR", - 201: "UNREGISTER", - 204: "USDOLLAR", - 205: "FINDB", - 206: "SEARCHB", - 207: "REPLACEB", - 208: "LEFTB", - 209: "RIGHTB", - 210: "MIDB", - 211: "LENB", - 212: "ROUNDUP", - 213: "ROUNDDOWN", - 214: "ASC", - 215: "DBCS", - 216: "RANK", - 219: "ADDRESS", - 220: "DAYS360", - 221: "TODAY", - 222: "VDB", - 223: "ELSE", - 224: "ELSE.IF", - 225: "END.IF", - 226: "FOR.CELL", - 227: "MEDIAN", - 228: "SUMPRODUCT", - 229: "SINH", - 230: "COSH", - 231: "TANH", - 232: "ASINH", - 233: "ACOSH", - 234: "ATANH", - 235: "DGET", - 236: "CREATE.OBJECT", - 237: "VOLATILE", - 238: "LAST.ERROR", - 239: "CUSTOM.UNDO", - 240: "CUSTOM.REPEAT", - 241: "FORMULA.CONVERT", - 242: "GET.LINK.INFO", - 243: "TEXT.BOX", - 244: "INFO", - 245: "GROUP", - 246: "GET.OBJECT", - 247: "DB", - 248: "PAUSE", - 251: "RESUME", - 252: "FREQUENCY", - 253: "ADD.TOOLBAR", - 254: "DELETE.TOOLBAR", - 255: "User", - 256: "RESET.TOOLBAR", - 257: "EVALUATE", - 258: "GET.TOOLBAR", - 259: "GET.TOOL", - 260: "SPELLING.CHECK", - 261: "ERROR.TYPE", - 262: "APP.TITLE", - 263: "WINDOW.TITLE", - 264: "SAVE.TOOLBAR", - 265: "ENABLE.TOOL", - 266: "PRESS.TOOL", - 267: "REGISTER.ID", - 268: "GET.WORKBOOK", - 269: "AVEDEV", - 270: "BETADIST", - 271: "GAMMALN", - 272: "BETAINV", - 273: "BINOMDIST", - 274: "CHIDIST", - 275: "CHIINV", - 276: "COMBIN", - 277: "CONFIDENCE", - 278: "CRITBINOM", - 279: "EVEN", - 280: "EXPONDIST", - 281: "FDIST", - 282: "FINV", - 283: "FISHER", - 284: "FISHERINV", - 285: "FLOOR", - 286: "GAMMADIST", - 287: "GAMMAINV", - 288: "CEILING", - 289: "HYPGEOMDIST", - 290: "LOGNORMDIST", - 291: "LOGINV", - 292: "NEGBINOMDIST", - 293: "NORMDIST", - 294: "NORMSDIST", - 295: "NORMINV", - 296: "NORMSINV", - 297: "STANDARDIZE", - 298: "ODD", - 299: "PERMUT", - 300: "POISSON", - 301: "TDIST", - 302: "WEIBULL", - 303: "SUMXMY2", - 304: "SUMX2MY2", - 305: "SUMX2PY2", - 306: "CHITEST", - 307: "CORREL", - 308: "COVAR", - 309: "FORECAST", - 310: "FTEST", - 311: "INTERCEPT", - 312: "PEARSON", - 313: "RSQ", - 314: "STEYX", - 315: "SLOPE", - 316: "TTEST", - 317: "PROB", - 318: "DEVSQ", - 319: "GEOMEAN", - 320: "HARMEAN", - 321: "SUMSQ", - 322: "KURT", - 323: "SKEW", - 324: "ZTEST", - 325: "LARGE", - 326: "SMALL", - 327: "QUARTILE", - 328: "PERCENTILE", - 329: "PERCENTRANK", - 330: "MODE", - 331: "TRIMMEAN", - 332: "TINV", - 334: "MOVIE.COMMAND", - 335: "GET.MOVIE", - 336: "CONCATENATE", - 337: "POWER", - 338: "PIVOT.ADD.DATA", - 339: "GET.PIVOT.TABLE", - 340: "GET.PIVOT.FIELD", - 341: "GET.PIVOT.ITEM", - 342: "RADIANS", - 343: "DEGREES", - 344: "SUBTOTAL", - 345: "SUMIF", - 346: "COUNTIF", - 347: "COUNTBLANK", - 348: "SCENARIO.GET", - 349: "OPTIONS.LISTS.GET", - 350: "ISPMT", - 351: "DATEDIF", - 352: "DATESTRING", - 353: "NUMBERSTRING", - 354: "ROMAN", - 355: "OPEN.DIALOG", - 356: "SAVE.DIALOG", - 357: "VIEW.GET", - 358: "GETPIVOTDATA", - 359: "HYPERLINK", - 360: "PHONETIC", - 361: "AVERAGEA", - 362: "MAXA", - 363: "MINA", - 364: "STDEVPA", - 365: "VARPA", - 366: "STDEVA", - 367: "VARA", - 368: "BAHTTEXT", - 369: "THAIDAYOFWEEK", - 370: "THAIDIGIT", - 371: "THAIMONTHOFYEAR", - 372: "THAINUMSOUND", - 373: "THAINUMSTRING", - 374: "THAISTRINGLENGTH", - 375: "ISTHAIDIGIT", - 376: "ROUNDBAHTDOWN", - 377: "ROUNDBAHTUP", - 378: "THAIYEAR", - 379: "RTD", - 380: "CUBEVALUE", - 381: "CUBEMEMBER", - 382: "CUBEMEMBERPROPERTY", - 383: "CUBERANKEDMEMBER", - 384: "HEX2BIN", - 385: "HEX2DEC", - 386: "HEX2OCT", - 387: "DEC2BIN", - 388: "DEC2HEX", - 389: "DEC2OCT", - 390: "OCT2BIN", - 391: "OCT2HEX", - 392: "OCT2DEC", - 393: "BIN2DEC", - 394: "BIN2OCT", - 395: "BIN2HEX", - 396: "IMSUB", - 397: "IMDIV", - 398: "IMPOWER", - 399: "IMABS", - 400: "IMSQRT", - 401: "IMLN", - 402: "IMLOG2", - 403: "IMLOG10", - 404: "IMSIN", - 405: "IMCOS", - 406: "IMEXP", - 407: "IMARGUMENT", - 408: "IMCONJUGATE", - 409: "IMAGINARY", - 410: "IMREAL", - 411: "COMPLEX", - 412: "IMSUM", - 413: "IMPRODUCT", - 414: "SERIESSUM", - 415: "FACTDOUBLE", - 416: "SQRTPI", - 417: "QUOTIENT", - 418: "DELTA", - 419: "GESTEP", - 420: "ISEVEN", - 421: "ISODD", - 422: "MROUND", - 423: "ERF", - 424: "ERFC", - 425: "BESSELJ", - 426: "BESSELK", - 427: "BESSELY", - 428: "BESSELI", - 429: "XIRR", - 430: "XNPV", - 431: "PRICEMAT", - 432: "YIELDMAT", - 433: "INTRATE", - 434: "RECEIVED", - 435: "DISC", - 436: "PRICEDISC", - 437: "YIELDDISC", - 438: "TBILLEQ", - 439: "TBILLPRICE", - 440: "TBILLYIELD", - 441: "PRICE", - 442: "YIELD", - 443: "DOLLARDE", - 444: "DOLLARFR", - 445: "NOMINAL", - 446: "EFFECT", - 447: "CUMPRINC", - 448: "CUMIPMT", - 449: "EDATE", - 450: "EOMONTH", - 451: "YEARFRAC", - 452: "COUPDAYBS", - 453: "COUPDAYS", - 454: "COUPDAYSNC", - 455: "COUPNCD", - 456: "COUPNUM", - 457: "COUPPCD", - 458: "DURATION", - 459: "MDURATION", - 460: "ODDLPRICE", - 461: "ODDLYIELD", - 462: "ODDFPRICE", - 463: "ODDFYIELD", - 464: "RANDBETWEEN", - 465: "WEEKNUM", - 466: "AMORDEGRC", - 467: "AMORLINC", - 468: "CONVERT", - 724: "SHEETJS", - 469: "ACCRINT", - 470: "ACCRINTM", - 471: "WORKDAY", - 472: "NETWORKDAYS", - 473: "GCD", - 474: "MULTINOMIAL", - 475: "LCM", - 476: "FVSCHEDULE", - 477: "CUBEKPIMEMBER", - 478: "CUBESET", - 479: "CUBESETCOUNT", - 480: "IFERROR", - 481: "COUNTIFS", - 482: "SUMIFS", - 483: "AVERAGEIF", - 484: "AVERAGEIFS" -}; -var FtabArgc = { - 2: 1, - 3: 1, - 10: 0, - 15: 1, - 16: 1, - 17: 1, - 18: 1, - 19: 0, - 20: 1, - 21: 1, - 22: 1, - 23: 1, - 24: 1, - 25: 1, - 26: 1, - 27: 2, - 30: 2, - 31: 3, - 32: 1, - 33: 1, - 34: 0, - 35: 0, - 38: 1, - 39: 2, - 40: 3, - 41: 3, - 42: 3, - 43: 3, - 44: 3, - 45: 3, - 47: 3, - 48: 2, - 53: 1, - 61: 3, - 63: 0, - 65: 3, - 66: 3, - 67: 1, - 68: 1, - 69: 1, - 70: 1, - 71: 1, - 72: 1, - 73: 1, - 74: 0, - 75: 1, - 76: 1, - 77: 1, - 79: 2, - 80: 2, - 83: 1, - 85: 0, - 86: 1, - 89: 0, - 90: 1, - 94: 0, - 95: 0, - 97: 2, - 98: 1, - 99: 1, - 101: 3, - 102: 3, - 105: 1, - 106: 1, - 108: 2, - 111: 1, - 112: 1, - 113: 1, - 114: 1, - 117: 2, - 118: 1, - 119: 4, - 121: 1, - 126: 1, - 127: 1, - 128: 1, - 129: 1, - 130: 1, - 131: 1, - 133: 1, - 134: 1, - 135: 1, - 136: 2, - 137: 2, - 138: 2, - 140: 1, - 141: 1, - 142: 3, - 143: 4, - 144: 4, - 161: 1, - 162: 1, - 163: 1, - 164: 1, - 165: 2, - 172: 1, - 175: 2, - 176: 2, - 177: 3, - 178: 2, - 179: 1, - 184: 1, - 186: 1, - 189: 3, - 190: 1, - 195: 3, - 196: 3, - 197: 1, - 198: 1, - 199: 3, - 201: 1, - 207: 4, - 210: 3, - 211: 1, - 212: 2, - 213: 2, - 214: 1, - 215: 1, - 225: 0, - 229: 1, - 230: 1, - 231: 1, - 232: 1, - 233: 1, - 234: 1, - 235: 3, - 244: 1, - 247: 4, - 252: 2, - 257: 1, - 261: 1, - 271: 1, - 273: 4, - 274: 2, - 275: 2, - 276: 2, - 277: 3, - 278: 3, - 279: 1, - 280: 3, - 281: 3, - 282: 3, - 283: 1, - 284: 1, - 285: 2, - 286: 4, - 287: 3, - 288: 2, - 289: 4, - 290: 3, - 291: 3, - 292: 3, - 293: 4, - 294: 1, - 295: 3, - 296: 1, - 297: 3, - 298: 1, - 299: 2, - 300: 3, - 301: 3, - 302: 4, - 303: 2, - 304: 2, - 305: 2, - 306: 2, - 307: 2, - 308: 2, - 309: 3, - 310: 2, - 311: 2, - 312: 2, - 313: 2, - 314: 2, - 315: 2, - 316: 4, - 325: 2, - 326: 2, - 327: 2, - 328: 2, - 331: 2, - 332: 2, - 337: 2, - 342: 1, - 343: 1, - 346: 2, - 347: 1, - 350: 4, - 351: 3, - 352: 1, - 353: 2, - 360: 1, - 368: 1, - 369: 1, - 370: 1, - 371: 1, - 372: 1, - 373: 1, - 374: 1, - 375: 1, - 376: 1, - 377: 1, - 378: 1, - 382: 3, - 385: 1, - 392: 1, - 393: 1, - 396: 2, - 397: 2, - 398: 2, - 399: 1, - 400: 1, - 401: 1, - 402: 1, - 403: 1, - 404: 1, - 405: 1, - 406: 1, - 407: 1, - 408: 1, - 409: 1, - 410: 1, - 414: 4, - 415: 1, - 416: 1, - 417: 2, - 420: 1, - 421: 1, - 422: 2, - 424: 1, - 425: 2, - 426: 2, - 427: 2, - 428: 2, - 430: 3, - 438: 3, - 439: 3, - 440: 3, - 443: 2, - 444: 2, - 445: 2, - 446: 2, - 447: 6, - 448: 6, - 449: 2, - 450: 2, - 464: 2, - 468: 3, - 476: 2, - 479: 1, - 480: 2, - 65535: 0 -}; -/* Part 3 TODO: actually parse formulae */ -function ods_to_csf_formula(f/*:string*/)/*:string*/ { - if(f.slice(0,3) == "of:") f = f.slice(3); - /* 5.2 Basic Expressions */ - if(f.charCodeAt(0) == 61) { - f = f.slice(1); - if(f.charCodeAt(0) == 61) f = f.slice(1); - } - f = f.replace(/COM\.MICROSOFT\./g, ""); - /* Part 3 Section 5.8 References */ - f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function($$, $1) { return $1.replace(/\./g,""); }); - /* TODO: something other than this */ - f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1"); - return f.replace(/[;~]/g,",").replace(/\|/g,";"); -} - -function csf_to_ods_formula(f/*:string*/)/*:string*/ { - var o = "of:=" + f.replace(crefregex, "$1[.$2$3$4$5]").replace(/\]:\[/g,":"); - /* TODO: something other than this */ - return o.replace(/;/g, "|").replace(/,/g,";"); -} - -function ods_to_csf_3D(r/*:string*/)/*:[string, string]*/ { - var a = r.split(":"); - var s = a[0].split(".")[0]; - return [s, a[0].split(".")[1] + (a.length > 1 ? (":" + (a[1].split(".")[1] || a[1].split(".")[0])) : "")]; -} - -function csf_to_ods_3D(r/*:string*/)/*:string*/ { - return r.replace(/\./,"!"); -} - -var strs = {}; // shared strings -var _ssfopts = {}; // spreadsheet formatting options - -RELS.WS = [ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", - "http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet" -]; - -/*global Map */ -var browser_has_Map = typeof Map !== 'undefined'; - -function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ { - var i = 0, len = sst.length; - if(rev) { - if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) { - var revarr = browser_has_Map ? rev.get(str) : rev[str]; - for(; i < revarr.length; ++i) { - if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; } - } - } - } else for(; i < len; ++i) { - if(sst[i].t === str) { sst.Count ++; return i; } - } - sst[len] = ({t:str}/*:any*/); sst.Count ++; sst.Unique ++; - if(rev) { - if(browser_has_Map) { - if(!rev.has(str)) rev.set(str, []); - rev.get(str).push(len); - } else { - if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = []; - rev[str].push(len); - } - } - return len; -} - -function col_obj_w(C/*:number*/, col) { - var p = ({min:C+1,max:C+1}/*:any*/); - /* wch (chars), wpx (pixels) */ - var wch = -1; - if(col.MDW) MDW = col.MDW; - if(col.width != null) p.customWidth = 1; - else if(col.wpx != null) wch = px2char(col.wpx); - else if(col.wch != null) wch = col.wch; - if(wch > -1) { p.width = char2width(wch); p.customWidth = 1; } - else if(col.width != null) p.width = col.width; - if(col.hidden) p.hidden = true; - if(col.level != null) { p.outlineLevel = p.level = col.level; } - return p; -} - -function default_margins(margins/*:Margins*/, mode/*:?string*/) { - if(!margins) return; - var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3]; - if(mode == 'xlml') defs = [1, 1, 1, 1, 0.5, 0.5]; - if(margins.left == null) margins.left = defs[0]; - if(margins.right == null) margins.right = defs[1]; - if(margins.top == null) margins.top = defs[2]; - if(margins.bottom == null) margins.bottom = defs[3]; - if(margins.header == null) margins.header = defs[4]; - if(margins.footer == null) margins.footer = defs[5]; -} - -function get_cell_style(styles/*:Array*/, cell/*:Cell*/, opts) { - var z = opts.revssf[cell.z != null ? cell.z : "General"]; - var i = 0x3c, len = styles.length; - if(z == null && opts.ssf) { - for(; i < 0x188; ++i) if(opts.ssf[i] == null) { - SSF.load(cell.z, i); - // $FlowIgnore - opts.ssf[i] = cell.z; - opts.revssf[cell.z] = z = i; - break; - } - } - for(i = 0; i != len; ++i) if(styles[i].numFmtId === z) return i; - styles[len] = { - numFmtId:z, - fontId:0, - fillId:0, - borderId:0, - xfId:0, - applyNumberFormat:1 - }; - return len; -} - -function safe_format(p/*:Cell*/, fmtid/*:number*/, fillid/*:?number*/, opts, themes, styles) { - try { - if(opts.cellNF) p.z = SSF._table[fmtid]; - } catch(e) { if(opts.WTF) throw e; } - if(p.t === 'z' && !opts.cellStyles) return; - if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v); - if((!opts || opts.cellText !== false) && p.t !== 'z') try { - if(SSF._table[fmtid] == null) SSF.load(SSFImplicit[fmtid] || "General", fmtid); - if(p.t === 'e') p.w = p.w || BErr[p.v]; - else if(fmtid === 0) { - if(p.t === 'n') { - if((p.v|0) === p.v) p.w = SSF._general_int(p.v); - else p.w = SSF._general_num(p.v); - } - else if(p.t === 'd') { - var dd = datenum(p.v); - if((dd|0) === dd) p.w = SSF._general_int(dd); - else p.w = SSF._general_num(dd); - } - else if(p.v === undefined) return ""; - else p.w = SSF._general(p.v,_ssfopts); - } - else if(p.t === 'd') p.w = SSF.format(fmtid,datenum(p.v),_ssfopts); - else p.w = SSF.format(fmtid,p.v,_ssfopts); - } catch(e) { if(opts.WTF) throw e; } - if(!opts.cellStyles) return; - if(fillid != null) try { - p.s = styles.Fills[fillid]; - if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) { - p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0); - if(opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb; - } - if (p.s.bgColor && p.s.bgColor.theme) { - p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0); - if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb; - } - } catch(e) { if(opts.WTF && styles.Fills) throw e; } -} - -function check_ws(ws/*:Worksheet*/, sname/*:string*/, i/*:number*/) { - if(ws && ws['!ref']) { - var range = safe_decode_range(ws['!ref']); - if(range.e.c < range.s.c || range.e.r < range.s.r) throw new Error("Bad range (" + i + "): " + ws['!ref']); - } -} -function parse_ws_xml_dim(ws/*:Worksheet*/, s/*:string*/) { - var d = safe_decode_range(s); - if(d.s.r<=d.e.r && d.s.c<=d.e.c && d.s.r>=0 && d.s.c>=0) ws["!ref"] = encode_range(d); -} -var mergecregex = /<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g; -var sheetdataregex = /<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/; -var hlinkregex = /<(?:\w:)?hyperlink [^>]*>/mg; -var dimregex = /"(\w*:\w*)"/; -var colregex = /<(?:\w:)?col\b[^>]*[\/]?>/g; -var afregex = /<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g; -var marginregex= /<(?:\w:)?pageMargins[^>]*\/>/g; -var sheetprregex = /<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/; -var sheetprregex2= /<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/; -var svsregex = /<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/; - -/* 18.3 Worksheets */ -function parse_ws_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*:WBWBProps*/, themes, styles)/*:Worksheet*/ { - if(!data) return data; - if(!rels) rels = {'!id':{}}; - if(DENSE != null && opts.dense == null) opts.dense = DENSE; - - /* 18.3.1.99 worksheet CT_Worksheet */ - var s = opts.dense ? ([]/*:any*/) : ({}/*:any*/); - var refguess/*:Range*/ = ({s: {r:2000000, c:2000000}, e: {r:0, c:0} }/*:any*/); - - var data1 = "", data2 = ""; - var mtch/*:?any*/ = data.match(sheetdataregex); - if(mtch) { - data1 = data.slice(0, mtch.index); - data2 = data.slice(mtch.index + mtch[0].length); - } else data1 = data2 = data; - - /* 18.3.1.82 sheetPr CT_SheetPr */ - var sheetPr = data1.match(sheetprregex); - if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); - else if((sheetPr = data1.match(sheetprregex2))) parse_ws_xml_sheetpr2(sheetPr[0], sheetPr[1]||"", s, wb, idx, styles, themes); - - /* 18.3.1.35 dimension CT_SheetDimension */ - var ridx = (data1.match(/<(?:\w*:)?dimension/)||{index:-1}).index; - if(ridx > 0) { - var ref = data1.slice(ridx,ridx+50).match(dimregex); - if(ref) parse_ws_xml_dim(s, ref[1]); - } - - /* 18.3.1.88 sheetViews CT_SheetViews */ - var svs = data1.match(svsregex); - if(svs && svs[1]) parse_ws_xml_sheetviews(svs[1], wb); - - /* 18.3.1.17 cols CT_Cols */ - var columns/*:Array*/ = []; - if(opts.cellStyles) { - /* 18.3.1.13 col CT_Col */ - var cols = data1.match(colregex); - if(cols) parse_ws_xml_cols(columns, cols); - } - - /* 18.3.1.80 sheetData CT_SheetData ? */ - if(mtch) parse_ws_xml_data(mtch[1], s, opts, refguess, themes, styles); - - /* 18.3.1.2 autoFilter CT_AutoFilter */ - var afilter = data2.match(afregex); - if(afilter) s['!autofilter'] = parse_ws_xml_autofilter(afilter[0]); - - /* 18.3.1.55 mergeCells CT_MergeCells */ - var merges/*:Array*/ = []; - var _merge = data2.match(mergecregex); - if(_merge) for(ridx = 0; ridx != _merge.length; ++ridx) - merges[ridx] = safe_decode_range(_merge[ridx].slice(_merge[ridx].indexOf("\"")+1)); - - /* 18.3.1.48 hyperlinks CT_Hyperlinks */ - var hlink = data2.match(hlinkregex); - if(hlink) parse_ws_xml_hlinks(s, hlink, rels); - - /* 18.3.1.62 pageMargins CT_PageMargins */ - var margins = data2.match(marginregex); - if(margins) s['!margins'] = parse_ws_xml_margins(parsexmltag(margins[0])); - - if(!s["!ref"] && refguess.e.c >= refguess.s.c && refguess.e.r >= refguess.s.r) s["!ref"] = encode_range(refguess); - if(opts.sheetRows > 0 && s["!ref"]) { - var tmpref = safe_decode_range(s["!ref"]); - if(opts.sheetRows <= +tmpref.e.r) { - tmpref.e.r = opts.sheetRows - 1; - if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r; - if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r; - if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c; - if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c; - s["!fullref"] = s["!ref"]; - s["!ref"] = encode_range(tmpref); - } - } - if(columns.length > 0) s["!cols"] = columns; - if(merges.length > 0) s["!merges"] = merges; - return s; -} - -function write_ws_xml_merges(merges/*:Array*/)/*:string*/ { - if(merges.length === 0) return ""; - var o = ''; - for(var i = 0; i != merges.length; ++i) o += ''; - return o + ''; -} - -/* 18.3.1.82-3 sheetPr CT_ChartsheetPr / CT_SheetPr */ -function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) { - var data = parsexmltag(sheetPr); - if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; - if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName)); -} -function parse_ws_xml_sheetpr2(sheetPr/*:string*/, body/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/, styles, themes) { - parse_ws_xml_sheetpr(sheetPr.slice(0, sheetPr.indexOf(">")), s, wb, idx); -} -function write_ws_xml_sheetpr(ws, wb, idx, opts, o) { - var needed = false; - var props = {}, payload = null; - if(opts.bookType !== 'xlsx' && wb.vbaraw) { - var cname = wb.SheetNames[idx]; - try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {} - needed = true; - props.codeName = utf8write(escapexml(cname)); - } - - if(ws && ws["!outline"]) { - var outlineprops = {summaryBelow:1, summaryRight:1}; - if(ws["!outline"].above) outlineprops.summaryBelow = 0; - if(ws["!outline"].left) outlineprops.summaryRight = 0; - payload = (payload||"") + writextag('outlinePr', null, outlineprops); - } - - if(!needed && !payload) return; - o[o.length] = (writextag('sheetPr', payload, props)); -} - -/* 18.3.1.85 sheetProtection CT_SheetProtection */ -var sheetprot_deffalse = ["objects", "scenarios", "selectLockedCells", "selectUnlockedCells"]; -var sheetprot_deftrue = [ - "formatColumns", "formatRows", "formatCells", - "insertColumns", "insertRows", "insertHyperlinks", - "deleteColumns", "deleteRows", - "sort", "autoFilter", "pivotTables" -]; -function write_ws_xml_protection(sp)/*:string*/ { - // algorithmName, hashValue, saltValue, spinCount - var o = ({sheet:1}/*:any*/); - sheetprot_deffalse.forEach(function(n) { if(sp[n] != null && sp[n]) o[n] = "1"; }); - sheetprot_deftrue.forEach(function(n) { if(sp[n] != null && !sp[n]) o[n] = "0"; }); - /* TODO: algorithm */ - if(sp.password) o.password = crypto_CreatePasswordVerifier_Method1(sp.password).toString(16).toUpperCase(); - return writextag('sheetProtection', null, o); -} - -function parse_ws_xml_hlinks(s, data/*:Array*/, rels) { - var dense = Array.isArray(s); - for(var i = 0; i != data.length; ++i) { - var val = parsexmltag(utf8read(data[i]), true); - if(!val.ref) return; - var rel = ((rels || {})['!id']||[])[val.id]; - if(rel) { - val.Target = rel.Target; - if(val.location) val.Target += "#"+unescapexml(val.location); - } else { - val.Target = "#" + unescapexml(val.location); - rel = {Target: val.Target, TargetMode: 'Internal'}; - } - val.Rel = rel; - if(val.tooltip) { val.Tooltip = val.tooltip; delete val.tooltip; } - var rng = safe_decode_range(val.ref); - for(var R=rng.s.r;R<=rng.e.r;++R) for(var C=rng.s.c;C<=rng.e.c;++C) { - var addr = encode_cell({c:C,r:R}); - if(dense) { - if(!s[R]) s[R] = []; - if(!s[R][C]) s[R][C] = {t:"z",v:undefined}; - s[R][C].l = val; - } else { - if(!s[addr]) s[addr] = {t:"z",v:undefined}; - s[addr].l = val; - } - } - } -} - -function parse_ws_xml_margins(margin) { - var o = {}; - ["left", "right", "top", "bottom", "header", "footer"].forEach(function(k) { - if(margin[k]) o[k] = parseFloat(margin[k]); - }); - return o; -} -function write_ws_xml_margins(margin)/*:string*/ { - default_margins(margin); - return writextag('pageMargins', null, margin); -} - -function parse_ws_xml_cols(columns, cols) { - var seencol = false; - for(var coli = 0; coli != cols.length; ++coli) { - var coll = parsexmltag(cols[coli], true); - if(coll.hidden) coll.hidden = parsexmlbool(coll.hidden); - var colm=parseInt(coll.min, 10)-1, colM=parseInt(coll.max,10)-1; - if(coll.outlineLevel) coll.level = (+coll.outlineLevel || 0); - delete coll.min; delete coll.max; coll.width = +coll.width; - if(!seencol && coll.width) { seencol = true; find_mdw_colw(coll.width); } - process_col(coll); - while(colm <= colM) columns[colm++] = dup(coll); - } -} -function write_ws_xml_cols(ws, cols)/*:string*/ { - var o = [""], col; - for(var i = 0; i != cols.length; ++i) { - if(!(col = cols[i])) continue; - o[o.length] = (writextag('col', null, col_obj_w(i, col))); - } - o[o.length] = ""; - return o.join(""); -} - -function parse_ws_xml_autofilter(data/*:string*/) { - var o = { ref: (data.match(/ref="([^"]*)"/)||[])[1]}; - return o; -} -function write_ws_xml_autofilter(data, ws, wb, idx)/*:string*/ { - var ref = typeof data.ref == "string" ? data.ref : encode_range(data.ref); - if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/); - if(!wb.Workbook.Names) wb.Workbook.Names = []; - var names/*: Array */ = wb.Workbook.Names; - var range = decode_range(ref); - if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); } - for(var i = 0; i < names.length; ++i) { - var name = names[i]; - if(name.Name != '_xlnm._FilterDatabase') continue; - if(name.Sheet != idx) continue; - name.Ref = "'" + wb.SheetNames[idx] + "'!" + ref; break; - } - if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetNames[idx] + "'!" + ref }); - return writextag("autoFilter", null, {ref:ref}); -} - -/* 18.3.1.88 sheetViews CT_SheetViews */ -/* 18.3.1.87 sheetView CT_SheetView */ -var sviewregex = /<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/; -function parse_ws_xml_sheetviews(data, wb/*:WBWBProps*/) { - if(!wb.Views) wb.Views = [{}]; - (data.match(sviewregex)||[]).forEach(function(r/*:string*/, i/*:number*/) { - var tag = parsexmltag(r); - // $FlowIgnore - if(!wb.Views[i]) wb.Views[i] = {}; - // $FlowIgnore - if(+tag.zoomScale) wb.Views[i].zoom = +tag.zoomScale; - // $FlowIgnore - if(parsexmlbool(tag.rightToLeft)) wb.Views[i].RTL = true; - }); -} -function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ { - var sview = ({workbookViewId:"0"}/*:any*/); - // $FlowIgnore - if((((wb||{}).Workbook||{}).Views||[])[0]) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0"; - return writextag("sheetViews", writextag("sheetView", null, sview), {}); -} - -function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string*/ { - if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return ""; - var vv = ""; - var oldt = cell.t, oldv = cell.v; - if(cell.t !== "z") switch(cell.t) { - case 'b': vv = cell.v ? "1" : "0"; break; - case 'n': vv = ''+cell.v; break; - case 'e': vv = BErr[cell.v]; break; - case 'd': - if(opts && opts.cellDates) vv = parseDate(cell.v, -1).toISOString(); - else { - cell = dup(cell); - cell.t = 'n'; - vv = ''+(cell.v = datenum(parseDate(cell.v))); - } - if(typeof cell.z === 'undefined') cell.z = SSF._table[14]; - break; - default: vv = cell.v; break; - } - var v = writetag('v', escapexml(vv)), o = ({r:ref}/*:any*/); - /* TODO: cell style */ - var os = get_cell_style(opts.cellXfs, cell, opts); - if(os !== 0) o.s = os; - switch(cell.t) { - case 'n': break; - case 'd': o.t = "d"; break; - case 'b': o.t = "b"; break; - case 'e': o.t = "e"; break; - case 'z': break; - default: if(cell.v == null) { delete cell.t; break; } - if(cell.v.length > 32767) throw new Error("Text length must not exceed 32767 characters"); - if(opts && opts.bookSST) { - v = writetag('v', ''+get_sst_id(opts.Strings, cell.v, opts.revStrings)); - o.t = "s"; break; - } - o.t = "str"; break; - } - if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; } - if(typeof cell.f == "string" && cell.f) { - var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null; - v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : ""); - } - if(cell.l) ws['!links'].push([ref, cell.l]); - if(cell.c) ws['!comments'].push([ref, cell.c]); - return writextag('c', v, o); -} - -var parse_ws_xml_data = (function() { - var cellregex = /<(?:\w+:)?c[ \/>]/, rowregex = /<\/(?:\w+:)?row>/; - var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/; - var refregex = /ref=["']([^"']*)["']/; - var match_v = matchtag("v"), match_f = matchtag("f"); - -return function parse_ws_xml_data(sdata/*:string*/, s, opts, guess/*:Range*/, themes, styles) { - var ri = 0, x = "", cells/*:Array*/ = [], cref/*:?Array*/ = [], idx=0, i=0, cc=0, d="", p/*:any*/; - var tag, tagr = 0, tagc = 0; - var sstr, ftag; - var fmtid = 0, fillid = 0; - var do_format = Array.isArray(styles.CellXf), cf; - var arrayf/*:Array<[Range, string]>*/ = []; - var sharedf = []; - var dense = Array.isArray(s); - var rows/*:Array*/ = [], rowobj = {}, rowrite = false; - var sheetStubs = !!opts.sheetStubs; - for(var marr = sdata.split(rowregex), mt = 0, marrlen = marr.length; mt != marrlen; ++mt) { - x = marr[mt].trim(); - var xlen = x.length; - if(xlen === 0) continue; - - /* 18.3.1.73 row CT_Row */ - var rstarti = 0; - outa: for(ri = 0; ri < xlen; ++ri) switch(/*x.charCodeAt(ri)*/x[ri]) { - case ">" /*62*/: - if(/*x.charCodeAt(ri-1) != 47*/x[ri-1] != "/") { ++ri; break outa; } - if(opts && opts.cellStyles) { - // TODO: avoid duplication - tag = parsexmltag(x.slice(rstarti,ri), true); - tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; - if(opts.sheetRows && opts.sheetRows < tagr) continue; - rowobj = {}; rowrite = false; - if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); } - if(tag.hidden == "1") { rowrite = true; rowobj.hidden = true; } - if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; } - if(rowrite) rows[tagr-1] = rowobj; - } - break; - case "<" /*60*/: rstarti = ri; break; - } - if(rstarti >= ri) break; - tag = parsexmltag(x.slice(rstarti,ri), true); - tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; - if(opts.sheetRows && opts.sheetRows < tagr) continue; - if(guess.s.r > tagr - 1) guess.s.r = tagr - 1; - if(guess.e.r < tagr - 1) guess.e.r = tagr - 1; - - if(opts && opts.cellStyles) { - rowobj = {}; rowrite = false; - if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); } - if(tag.hidden == "1") { rowrite = true; rowobj.hidden = true; } - if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; } - if(rowrite) rows[tagr-1] = rowobj; - } - - /* 18.3.1.4 c CT_Cell */ - cells = x.slice(ri).split(cellregex); - for(var rslice = 0; rslice != cells.length; ++rslice) if(cells[rslice].trim().charAt(0) != "<") break; - cells = cells.slice(rslice); - for(ri = 0; ri != cells.length; ++ri) { - x = cells[ri].trim(); - if(x.length === 0) continue; - cref = x.match(rregex); idx = ri; i=0; cc=0; - x = "":"") + x; - if(cref != null && cref.length === 2) { - idx = 0; d=cref[1]; - for(i=0; i != d.length; ++i) { - if((cc=d.charCodeAt(i)-64) < 1 || cc > 26) break; - idx = 26*idx + cc; - } - --idx; - tagc = idx; - } else ++tagc; - for(i = 0; i != x.length; ++i) if(x.charCodeAt(i) === 62) break; ++i; - tag = parsexmltag(x.slice(0,i), true); - if(!tag.r) tag.r = encode_cell({r:tagr-1, c:tagc}); - d = x.slice(i); - p = ({t:""}/*:any*/); - - if((cref=d.match(match_v))!= null && /*::cref != null && */cref[1] !== '') p.v=unescapexml(cref[1]); - if(opts.cellFormula) { - if((cref=d.match(match_f))!= null && /*::cref != null && */cref[1] !== '') { - /* TODO: match against XLSXFutureFunctions */ - p.f=unescapexml(utf8read(cref[1])).replace(/\r\n/g, "\n"); - if(!opts.xlfn) p.f = _xlfn(p.f); - if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="array"') > -1) { - p.F = (d.match(refregex)||[])[1]; - if(p.F.indexOf(":") > -1) arrayf.push([safe_decode_range(p.F), p.F]); - } else if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="shared"') > -1) { - // TODO: parse formula - ftag = parsexmltag(cref[0]); - var ___f = unescapexml(utf8read(cref[1])); - if(!opts.xlfn) ___f = _xlfn(___f); - sharedf[parseInt(ftag.si, 10)] = [ftag, ___f, tag.r]; - } - } else if((cref=d.match(/]*\/>/))) { - ftag = parsexmltag(cref[0]); - if(sharedf[ftag.si]) p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2]/*[0].ref*/, tag.r); - } - /* TODO: factor out contains logic */ - var _tag = decode_cell(tag.r); - for(i = 0; i < arrayf.length; ++i) - if(_tag.r >= arrayf[i][0].s.r && _tag.r <= arrayf[i][0].e.r) - if(_tag.c >= arrayf[i][0].s.c && _tag.c <= arrayf[i][0].e.c) - p.F = arrayf[i][1]; - } - - if(tag.t == null && p.v === undefined) { - if(p.f || p.F) { - p.v = 0; p.t = "n"; - } else if(!sheetStubs) continue; - else p.t = "z"; - } - else p.t = tag.t || "n"; - if(guess.s.c > tagc) guess.s.c = tagc; - if(guess.e.c < tagc) guess.e.c = tagc; - /* 18.18.11 t ST_CellType */ - switch(p.t) { - case 'n': - if(p.v == "" || p.v == null) { - if(!sheetStubs) continue; - p.t = 'z'; - } else p.v = parseFloat(p.v); - break; - case 's': - if(typeof p.v == 'undefined') { - if(!sheetStubs) continue; - p.t = 'z'; - } else { - sstr = strs[parseInt(p.v, 10)]; - p.v = sstr.t; - p.r = sstr.r; - if(opts.cellHTML) p.h = sstr.h; - } - break; - case 'str': - p.t = "s"; - p.v = (p.v!=null) ? utf8read(p.v) : ''; - if(opts.cellHTML) p.h = escapehtml(p.v); - break; - case 'inlineStr': - cref = d.match(isregex); - p.t = 's'; - if(cref != null && (sstr = parse_si(cref[1]))) { - p.v = sstr.t; - if(opts.cellHTML) p.h = sstr.h; - } else p.v = ""; - break; - case 'b': p.v = parsexmlbool(p.v); break; - case 'd': - if(opts.cellDates) p.v = parseDate(p.v, 1); - else { p.v = datenum(parseDate(p.v, 1)); p.t = 'n'; } - break; - /* error string in .w, number in .v */ - case 'e': - if(!opts || opts.cellText !== false) p.w = p.v; - p.v = RBErr[p.v]; break; - } - /* formatting */ - fmtid = fillid = 0; - cf = null; - if(do_format && tag.s !== undefined) { - cf = styles.CellXf[tag.s]; - if(cf != null) { - if(cf.numFmtId != null) fmtid = cf.numFmtId; - if(opts.cellStyles) { - if(cf.fillId != null) fillid = cf.fillId; - } - } - } - safe_format(p, fmtid, fillid, opts, themes, styles); - if(opts.cellDates && do_format && p.t == 'n' && SSF.is_date(SSF._table[fmtid])) { p.t = 'd'; p.v = numdate(p.v); } - if(dense) { - var _r = decode_cell(tag.r); - if(!s[_r.r]) s[_r.r] = []; - s[_r.r][_r.c] = p; - } else s[tag.r] = p; - } - } - if(rows.length > 0) s['!rows'] = rows; -}; })(); - -function write_ws_xml_data(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*//*::, rels*/)/*:string*/ { - var o/*:Array*/ = [], r/*:Array*/ = [], range = safe_decode_range(ws['!ref']), cell="", ref, rr = "", cols/*:Array*/ = [], R=0, C=0, rows = ws['!rows']; - var dense = Array.isArray(ws); - var params = ({r:rr}/*:any*/), row/*:RowInfo*/, height = -1; - for(C = range.s.c; C <= range.e.c; ++C) cols[C] = encode_col(C); - for(R = range.s.r; R <= range.e.r; ++R) { - r = []; - rr = encode_row(R); - for(C = range.s.c; C <= range.e.c; ++C) { - ref = cols[C] + rr; - var _cell = dense ? (ws[R]||[])[C]: ws[ref]; - if(_cell === undefined) continue; - if((cell = write_ws_xml_cell(_cell, ref, ws, opts, idx, wb)) != null) r.push(cell); - } - if(r.length > 0 || (rows && rows[R])) { - params = ({r:rr}/*:any*/); - if(rows && rows[R]) { - row = rows[R]; - if(row.hidden) params.hidden = 1; - height = -1; - if(row.hpx) height = px2pt(row.hpx); - else if(row.hpt) height = row.hpt; - if(height > -1) { params.ht = height; params.customHeight = 1; } - if(row.level) { params.outlineLevel = row.level; } - } - o[o.length] = (writextag('row', r.join(""), params)); - } - } - if(rows) for(; R < rows.length; ++R) { - if(rows && rows[R]) { - params = ({r:R+1}/*:any*/); - row = rows[R]; - if(row.hidden) params.hidden = 1; - height = -1; - if (row.hpx) height = px2pt(row.hpx); - else if (row.hpt) height = row.hpt; - if (height > -1) { params.ht = height; params.customHeight = 1; } - if (row.level) { params.outlineLevel = row.level; } - o[o.length] = (writextag('row', "", params)); - } - } - return o.join(""); -} - -var WS_XML_ROOT = writextag('worksheet', null, { - 'xmlns': XMLNS.main[0], - 'xmlns:r': XMLNS.r -}); - -function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { - var o = [XML_HEADER, WS_XML_ROOT]; - var s = wb.SheetNames[idx], sidx = 0, rdata = ""; - var ws = wb.Sheets[s]; - if(ws == null) ws = {}; - var ref = ws['!ref'] || 'A1'; - var range = safe_decode_range(ref); - if(range.e.c > 0x3FFF || range.e.r > 0xFFFFF) { - if(opts.WTF) throw new Error("Range " + ref + " exceeds format limit A1:XFD1048576"); - range.e.c = Math.min(range.e.c, 0x3FFF); - range.e.r = Math.min(range.e.c, 0xFFFFF); - ref = encode_range(range); - } - if(!rels) rels = {}; - ws['!comments'] = []; - var _drawing = []; - - write_ws_xml_sheetpr(ws, wb, idx, opts, o); - - o[o.length] = (writextag('dimension', null, {'ref': ref})); - - o[o.length] = write_ws_xml_sheetviews(ws, opts, idx, wb); - - /* TODO: store in WB, process styles */ - if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, { - defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', - baseColWidth:opts.sheetFormat.baseColWidth||'10', - outlineLevelRow:opts.sheetFormat.outlineLevelRow||'7' - })); - - if(ws['!cols'] != null && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); - - o[sidx = o.length] = ''; - ws['!links'] = []; - if(ws['!ref'] != null) { - rdata = write_ws_xml_data(ws, opts, idx, wb, rels); - if(rdata.length > 0) o[o.length] = (rdata); - } - if(o.length>sidx+1) { o[o.length] = (''); o[sidx]=o[sidx].replace("/>",">"); } - - /* sheetCalcPr */ - - if(ws['!protect']) o[o.length] = write_ws_xml_protection(ws['!protect']); - - /* protectedRanges */ - /* scenarios */ - - if(ws['!autofilter'] != null) o[o.length] = write_ws_xml_autofilter(ws['!autofilter'], ws, wb, idx); - - /* sortState */ - /* dataConsolidate */ - /* customSheetViews */ - - if(ws['!merges'] != null && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges'])); - - /* phoneticPr */ - /* conditionalFormatting */ - /* dataValidations */ - - var relc = -1, rel, rId = -1; - if(/*::(*/ws['!links']/*::||[])*/.length > 0) { - o[o.length] = ""; - /*::(*/ws['!links']/*::||[])*/.forEach(function(l) { - if(!l[1].Target) return; - rel = ({"ref":l[0]}/*:any*/); - if(l[1].Target.charAt(0) != "#") { - rId = add_rels(rels, -1, escapexml(l[1].Target).replace(/#.*$/, ""), RELS.HLINK); - rel["r:id"] = "rId"+rId; - } - if((relc = l[1].Target.indexOf("#")) > -1) rel.location = escapexml(l[1].Target.slice(relc+1)); - if(l[1].Tooltip) rel.tooltip = escapexml(l[1].Tooltip); - o[o.length] = writextag("hyperlink",null,rel); - }); - o[o.length] = ""; - } - delete ws['!links']; - - /* printOptions */ - - if(ws['!margins'] != null) o[o.length] = write_ws_xml_margins(ws['!margins']); - - /* pageSetup */ - /* headerFooter */ - /* rowBreaks */ - /* colBreaks */ - /* customProperties */ - /* cellWatches */ - - if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref})); - - /* smartTags */ - - if(_drawing.length > 0) { - rId = add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); - o[o.length] = writextag("drawing", null, {"r:id":"rId" + rId}); - ws['!drawing'] = _drawing; - } - - if(ws['!comments'].length > 0) { - rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML); - o[o.length] = writextag("legacyDrawing", null, {"r:id":"rId" + rId}); - ws['!legacy'] = rId; - } - - /* legacyDrawingHF */ - /* picture */ - /* oleObjects */ - /* controls */ - /* webPublishItems */ - /* tableParts */ - /* extLst */ - - if(o.length>1) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} - -/* [MS-XLSB] 2.4.726 BrtRowHdr */ -function parse_BrtRowHdr(data, length) { - var z = ({}/*:any*/); - var tgt = data.l + length; - z.r = data.read_shift(4); - data.l += 4; // TODO: ixfe - var miyRw = data.read_shift(2); - data.l += 1; // TODO: top/bot padding - var flags = data.read_shift(1); - data.l = tgt; - if(flags & 0x07) z.level = flags & 0x07; - if(flags & 0x10) z.hidden = true; - if(flags & 0x20) z.hpt = miyRw / 20; - return z; -} -function write_BrtRowHdr(R/*:number*/, range, ws) { - var o = new_buf(17+8*16); - var row = (ws['!rows']||[])[R]||{}; - o.write_shift(4, R); - - o.write_shift(4, 0); /* TODO: ixfe */ - - var miyRw = 0x0140; - if(row.hpx) miyRw = px2pt(row.hpx) * 20; - else if(row.hpt) miyRw = row.hpt * 20; - o.write_shift(2, miyRw); - - o.write_shift(1, 0); /* top/bot padding */ - - var flags = 0x0; - if(row.level) flags |= row.level; - if(row.hidden) flags |= 0x10; - if(row.hpx || row.hpt) flags |= 0x20; - o.write_shift(1, flags); - - o.write_shift(1, 0); /* phonetic guide */ - - /* [MS-XLSB] 2.5.8 BrtColSpan explains the mechanism */ - var ncolspan = 0, lcs = o.l; - o.l += 4; - - var caddr = {r:R, c:0}; - for(var i = 0; i < 16; ++i) { - if((range.s.c > ((i+1) << 10)) || (range.e.c < (i << 10))) continue; - var first = -1, last = -1; - for(var j = (i<<10); j < ((i+1)<<10); ++j) { - caddr.c = j; - var cell = Array.isArray(ws) ? (ws[caddr.r]||[])[caddr.c] : ws[encode_cell(caddr)]; - if(cell) { if(first < 0) first = j; last = j; } - } - if(first < 0) continue; - ++ncolspan; - o.write_shift(4, first); - o.write_shift(4, last); - } - - var l = o.l; - o.l = lcs; - o.write_shift(4, ncolspan); - o.l = l; - - return o.length > o.l ? o.slice(0, o.l) : o; -} -function write_row_header(ba, ws, range, R) { - var o = write_BrtRowHdr(R, range, ws); - if((o.length > 17) || (ws['!rows']||[])[R]) write_record(ba, 'BrtRowHdr', o); -} - -/* [MS-XLSB] 2.4.820 BrtWsDim */ -var parse_BrtWsDim = parse_UncheckedRfX; -var write_BrtWsDim = write_UncheckedRfX; - -/* [MS-XLSB] 2.4.821 BrtWsFmtInfo */ -function parse_BrtWsFmtInfo(/*::data, length*/) { -} -//function write_BrtWsFmtInfo(ws, o) { } - -/* [MS-XLSB] 2.4.823 BrtWsProp */ -function parse_BrtWsProp(data, length) { - var z = {}; - var f = data[data.l]; ++data.l; - z.above = !(f & 0x40); - z.left = !(f & 0x80); - /* TODO: pull flags */ - data.l += 18; - z.name = parse_XLSBCodeName(data, length - 19); - return z; -} -function write_BrtWsProp(str, outl, o) { - if(o == null) o = new_buf(84+4*str.length); - var f = 0xC0; - if(outl) { - if(outl.above) f &= ~0x40; - if(outl.left) f &= ~0x80; - } - o.write_shift(1, f); - for(var i = 1; i < 3; ++i) o.write_shift(1,0); - write_BrtColor({auto:1}, o); - o.write_shift(-4,-1); - o.write_shift(-4,-1); - write_XLSBCodeName(str, o); - return o.slice(0, o.l); -} - -/* [MS-XLSB] 2.4.306 BrtCellBlank */ -function parse_BrtCellBlank(data) { - var cell = parse_XLSBCell(data); - return [cell]; -} -function write_BrtCellBlank(cell, ncell, o) { - if(o == null) o = new_buf(8); - return write_XLSBCell(ncell, o); -} -function parse_BrtShortBlank(data) { - var cell = parse_XLSBShortCell(data); - return [cell]; -} -function write_BrtShortBlank(cell, ncell, o) { - if(o == null) o = new_buf(4); - return write_XLSBShortCell(ncell, o); -} - -/* [MS-XLSB] 2.4.307 BrtCellBool */ -function parse_BrtCellBool(data) { - var cell = parse_XLSBCell(data); - var fBool = data.read_shift(1); - return [cell, fBool, 'b']; -} -function write_BrtCellBool(cell, ncell, o) { - if(o == null) o = new_buf(9); - write_XLSBCell(ncell, o); - o.write_shift(1, cell.v ? 1 : 0); - return o; -} -function parse_BrtShortBool(data) { - var cell = parse_XLSBShortCell(data); - var fBool = data.read_shift(1); - return [cell, fBool, 'b']; -} -function write_BrtShortBool(cell, ncell, o) { - if(o == null) o = new_buf(5); - write_XLSBShortCell(ncell, o); - o.write_shift(1, cell.v ? 1 : 0); - return o; -} - -/* [MS-XLSB] 2.4.308 BrtCellError */ -function parse_BrtCellError(data) { - var cell = parse_XLSBCell(data); - var bError = data.read_shift(1); - return [cell, bError, 'e']; -} -function write_BrtCellError(cell, ncell, o) { - if(o == null) o = new_buf(9); - write_XLSBCell(ncell, o); - o.write_shift(1, cell.v); - return o; -} -function parse_BrtShortError(data) { - var cell = parse_XLSBShortCell(data); - var bError = data.read_shift(1); - return [cell, bError, 'e']; -} -function write_BrtShortError(cell, ncell, o) { - if(o == null) o = new_buf(8); - write_XLSBShortCell(ncell, o); - o.write_shift(1, cell.v); - o.write_shift(2, 0); - o.write_shift(1, 0); - return o; -} - - -/* [MS-XLSB] 2.4.311 BrtCellIsst */ -function parse_BrtCellIsst(data) { - var cell = parse_XLSBCell(data); - var isst = data.read_shift(4); - return [cell, isst, 's']; -} -function write_BrtCellIsst(cell, ncell, o) { - if(o == null) o = new_buf(12); - write_XLSBCell(ncell, o); - o.write_shift(4, ncell.v); - return o; -} -function parse_BrtShortIsst(data) { - var cell = parse_XLSBShortCell(data); - var isst = data.read_shift(4); - return [cell, isst, 's']; -} -function write_BrtShortIsst(cell, ncell, o) { - if(o == null) o = new_buf(8); - write_XLSBShortCell(ncell, o); - o.write_shift(4, ncell.v); - return o; -} - -/* [MS-XLSB] 2.4.313 BrtCellReal */ -function parse_BrtCellReal(data) { - var cell = parse_XLSBCell(data); - var value = parse_Xnum(data); - return [cell, value, 'n']; -} -function write_BrtCellReal(cell, ncell, o) { - if(o == null) o = new_buf(16); - write_XLSBCell(ncell, o); - write_Xnum(cell.v, o); - return o; -} -function parse_BrtShortReal(data) { - var cell = parse_XLSBShortCell(data); - var value = parse_Xnum(data); - return [cell, value, 'n']; -} -function write_BrtShortReal(cell, ncell, o) { - if(o == null) o = new_buf(12); - write_XLSBShortCell(ncell, o); - write_Xnum(cell.v, o); - return o; -} - -/* [MS-XLSB] 2.4.314 BrtCellRk */ -function parse_BrtCellRk(data) { - var cell = parse_XLSBCell(data); - var value = parse_RkNumber(data); - return [cell, value, 'n']; -} -function write_BrtCellRk(cell, ncell, o) { - if(o == null) o = new_buf(12); - write_XLSBCell(ncell, o); - write_RkNumber(cell.v, o); - return o; -} -function parse_BrtShortRk(data) { - var cell = parse_XLSBShortCell(data); - var value = parse_RkNumber(data); - return [cell, value, 'n']; -} -function write_BrtShortRk(cell, ncell, o) { - if(o == null) o = new_buf(8); - write_XLSBShortCell(ncell, o); - write_RkNumber(cell.v, o); - return o; -} - -/* [MS-XLSB] 2.4.323 BrtCellRString */ -function parse_BrtCellRString(data) { - var cell = parse_XLSBCell(data); - var value = parse_RichStr(data); - return [cell, value, 'is']; -} - -/* [MS-XLSB] 2.4.317 BrtCellSt */ -function parse_BrtCellSt(data) { - var cell = parse_XLSBCell(data); - var value = parse_XLWideString(data); - return [cell, value, 'str']; -} -function write_BrtCellSt(cell, ncell, o) { - if(o == null) o = new_buf(12 + 4 * cell.v.length); - write_XLSBCell(ncell, o); - write_XLWideString(cell.v, o); - return o.length > o.l ? o.slice(0, o.l) : o; -} -function parse_BrtShortSt(data) { - var cell = parse_XLSBShortCell(data); - var value = parse_XLWideString(data); - return [cell, value, 'str']; -} -function write_BrtShortSt(cell, ncell, o) { - if(o == null) o = new_buf(8 + 4 * cell.v.length); - write_XLSBShortCell(ncell, o); - write_XLWideString(cell.v, o); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.653 BrtFmlaBool */ -function parse_BrtFmlaBool(data, length, opts) { - var end = data.l + length; - var cell = parse_XLSBCell(data); - cell.r = opts['!row']; - var value = data.read_shift(1); - var o = [cell, value, 'b']; - if(opts.cellFormula) { - data.l += 2; - var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); - o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ - } - else data.l = end; - return o; -} - -/* [MS-XLSB] 2.4.654 BrtFmlaError */ -function parse_BrtFmlaError(data, length, opts) { - var end = data.l + length; - var cell = parse_XLSBCell(data); - cell.r = opts['!row']; - var value = data.read_shift(1); - var o = [cell, value, 'e']; - if(opts.cellFormula) { - data.l += 2; - var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); - o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ - } - else data.l = end; - return o; -} - -/* [MS-XLSB] 2.4.655 BrtFmlaNum */ -function parse_BrtFmlaNum(data, length, opts) { - var end = data.l + length; - var cell = parse_XLSBCell(data); - cell.r = opts['!row']; - var value = parse_Xnum(data); - var o = [cell, value, 'n']; - if(opts.cellFormula) { - data.l += 2; - var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); - o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ - } - else data.l = end; - return o; -} - -/* [MS-XLSB] 2.4.656 BrtFmlaString */ -function parse_BrtFmlaString(data, length, opts) { - var end = data.l + length; - var cell = parse_XLSBCell(data); - cell.r = opts['!row']; - var value = parse_XLWideString(data); - var o = [cell, value, 'str']; - if(opts.cellFormula) { - data.l += 2; - var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); - o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ - } - else data.l = end; - return o; -} - -/* [MS-XLSB] 2.4.682 BrtMergeCell */ -var parse_BrtMergeCell = parse_UncheckedRfX; -var write_BrtMergeCell = write_UncheckedRfX; -/* [MS-XLSB] 2.4.107 BrtBeginMergeCells */ -function write_BrtBeginMergeCells(cnt, o) { - if(o == null) o = new_buf(4); - o.write_shift(4, cnt); - return o; -} - -/* [MS-XLSB] 2.4.662 BrtHLink */ -function parse_BrtHLink(data, length/*::, opts*/) { - var end = data.l + length; - var rfx = parse_UncheckedRfX(data, 16); - var relId = parse_XLNullableWideString(data); - var loc = parse_XLWideString(data); - var tooltip = parse_XLWideString(data); - var display = parse_XLWideString(data); - data.l = end; - var o = ({rfx:rfx, relId:relId, loc:loc, display:display}/*:any*/); - if(tooltip) o.Tooltip = tooltip; - return o; -} -function write_BrtHLink(l, rId) { - var o = new_buf(50+4*(l[1].Target.length + (l[1].Tooltip || "").length)); - write_UncheckedRfX({s:decode_cell(l[0]), e:decode_cell(l[0])}, o); - write_RelID("rId" + rId, o); - var locidx = l[1].Target.indexOf("#"); - var loc = locidx == -1 ? "" : l[1].Target.slice(locidx+1); - write_XLWideString(loc || "", o); - write_XLWideString(l[1].Tooltip || "", o); - write_XLWideString("", o); - return o.slice(0, o.l); -} - -/* [MS-XLSB] 2.4.692 BrtPane */ -function parse_BrtPane(/*data, length, opts*/) { -} - -/* [MS-XLSB] 2.4.6 BrtArrFmla */ -function parse_BrtArrFmla(data, length, opts) { - var end = data.l + length; - var rfx = parse_RfX(data, 16); - var fAlwaysCalc = data.read_shift(1); - var o = [rfx]; o[2] = fAlwaysCalc; - if(opts.cellFormula) { - var formula = parse_XLSBArrayParsedFormula(data, end - data.l, opts); - o[1] = formula; - } else data.l = end; - return o; -} - -/* [MS-XLSB] 2.4.750 BrtShrFmla */ -function parse_BrtShrFmla(data, length, opts) { - var end = data.l + length; - var rfx = parse_UncheckedRfX(data, 16); - var o = [rfx]; - if(opts.cellFormula) { - var formula = parse_XLSBSharedParsedFormula(data, end - data.l, opts); - o[1] = formula; - data.l = end; - } else data.l = end; - return o; -} - -/* [MS-XLSB] 2.4.323 BrtColInfo */ -/* TODO: once XLS ColInfo is set, combine the functions */ -function write_BrtColInfo(C/*:number*/, col, o) { - if(o == null) o = new_buf(18); - var p = col_obj_w(C, col); - o.write_shift(-4, C); - o.write_shift(-4, C); - o.write_shift(4, (p.width || 10) * 256); - o.write_shift(4, 0/*ixfe*/); // style - var flags = 0; - if(col.hidden) flags |= 0x01; - if(typeof p.width == 'number') flags |= 0x02; - if(col.level) flags |= (col.level << 8); - o.write_shift(2, flags); // bit flag - return o; -} - -/* [MS-XLSB] 2.4.678 BrtMargins */ -var BrtMarginKeys = ["left","right","top","bottom","header","footer"]; -function parse_BrtMargins(data/*::, length, opts*/)/*:Margins*/ { - var margins = ({}/*:any*/); - BrtMarginKeys.forEach(function(k) { margins[k] = parse_Xnum(data, 8); }); - return margins; -} -function write_BrtMargins(margins/*:Margins*/, o) { - if(o == null) o = new_buf(6*8); - default_margins(margins); - BrtMarginKeys.forEach(function(k) { write_Xnum((margins/*:any*/)[k], o); }); - return o; -} - -/* [MS-XLSB] 2.4.299 BrtBeginWsView */ -function parse_BrtBeginWsView(data/*::, length, opts*/) { - var f = data.read_shift(2); - data.l += 28; - return { RTL: f & 0x20 }; -} -function write_BrtBeginWsView(ws, Workbook, o) { - if(o == null) o = new_buf(30); - var f = 0x39c; - if((((Workbook||{}).Views||[])[0]||{}).RTL) f |= 0x20; - o.write_shift(2, f); // bit flag - o.write_shift(4, 0); - o.write_shift(4, 0); // view first row - o.write_shift(4, 0); // view first col - o.write_shift(1, 0); // gridline color ICV - o.write_shift(1, 0); - o.write_shift(2, 0); - o.write_shift(2, 100); // zoom scale - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(2, 0); - o.write_shift(4, 0); // workbook view id - return o; -} - -/* [MS-XLSB] 2.4.309 BrtCellIgnoreEC */ -function write_BrtCellIgnoreEC(ref) { - var o = new_buf(24); - o.write_shift(4, 4); - o.write_shift(4, 1); - write_UncheckedRfX(ref, o); - return o; -} - -/* [MS-XLSB] 2.4.748 BrtSheetProtection */ -function write_BrtSheetProtection(sp, o) { - if(o == null) o = new_buf(16*4+2); - o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0); - o.write_shift(4, 1); // this record should not be written if no protection - [ - ["objects", false], // fObjects - ["scenarios", false], // fScenarios - ["formatCells", true], // fFormatCells - ["formatColumns", true], // fFormatColumns - ["formatRows", true], // fFormatRows - ["insertColumns", true], // fInsertColumns - ["insertRows", true], // fInsertRows - ["insertHyperlinks", true], // fInsertHyperlinks - ["deleteColumns", true], // fDeleteColumns - ["deleteRows", true], // fDeleteRows - ["selectLockedCells", false], // fSelLockedCells - ["sort", true], // fSort - ["autoFilter", true], // fAutoFilter - ["pivotTables", true], // fPivotTables - ["selectUnlockedCells", false] // fSelUnlockedCells - ].forEach(function(n) { - /*:: if(o == null) throw "unreachable"; */ - if(n[1]) o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0); - else o.write_shift(4, sp[n[0]] != null && sp[n[0]] ? 0 : 1); - }); - return o; -} - -function parse_BrtDVal(/*data, length, opts*/) { -} -function parse_BrtDVal14(/*data, length, opts*/) { -} -/* [MS-XLSB] 2.1.7.61 Worksheet */ -function parse_ws_bin(data, _opts, idx, rels, wb/*:WBWBProps*/, themes, styles)/*:Worksheet*/ { - if(!data) return data; - var opts = _opts || {}; - if(!rels) rels = {'!id':{}}; - if(DENSE != null && opts.dense == null) opts.dense = DENSE; - var s/*:Worksheet*/ = (opts.dense ? [] : {}); - - var ref; - var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; - - var state/*:Array*/ = []; - var pass = false, end = false; - var row, p, cf, R, C, addr, sstr, rr, cell/*:Cell*/; - var merges/*:Array*/ = []; - opts.biff = 12; - opts['!row'] = 0; - - var ai = 0, af = false; - - var arrayf/*:Array<[Range, string]>*/ = []; - var sharedf = {}; - var supbooks = opts.supbooks || /*::(*/wb/*:: :any)*/.supbooks || ([[]]/*:any*/); - supbooks.sharedf = sharedf; - supbooks.arrayf = arrayf; - supbooks.SheetNames = wb.SheetNames || wb.Sheets.map(function(x) { return x.name; }); - if(!opts.supbooks) { - opts.supbooks = supbooks; - if(wb.Names) for(var i = 0; i < wb.Names.length; ++i) supbooks[0][i+1] = wb.Names[i]; - } - - var colinfo/*:Array*/ = [], rowinfo/*:Array*/ = []; - var seencol = false; - - XLSBRecordEnum[0x0010] = { n:"BrtShortReal", f:parse_BrtShortReal }; - - recordhopper(data, function ws_parse(val, R_n, RT) { - if(end) return; - switch(RT) { - case 0x0094: /* 'BrtWsDim' */ - ref = val; break; - case 0x0000: /* 'BrtRowHdr' */ - row = val; - if(opts.sheetRows && opts.sheetRows <= row.r) end=true; - rr = encode_row(R = row.r); - opts['!row'] = row.r; - if(val.hidden || val.hpt || val.level != null) { - if(val.hpt) val.hpx = pt2px(val.hpt); - rowinfo[val.r] = val; - } - break; - - case 0x0002: /* 'BrtCellRk' */ - case 0x0003: /* 'BrtCellError' */ - case 0x0004: /* 'BrtCellBool' */ - case 0x0005: /* 'BrtCellReal' */ - case 0x0006: /* 'BrtCellSt' */ - case 0x0007: /* 'BrtCellIsst' */ - case 0x0008: /* 'BrtFmlaString' */ - case 0x0009: /* 'BrtFmlaNum' */ - case 0x000A: /* 'BrtFmlaBool' */ - case 0x000B: /* 'BrtFmlaError' */ - case 0x000D: /* 'BrtShortRk' */ - case 0x000E: /* 'BrtShortError' */ - case 0x000F: /* 'BrtShortBool' */ - case 0x0010: /* 'BrtShortReal' */ - case 0x0011: /* 'BrtShortSt' */ - case 0x0012: /* 'BrtShortIsst' */ - case 0x003E: /* 'BrtCellRString' */ - p = ({t:val[2]}/*:any*/); - switch(val[2]) { - case 'n': p.v = val[1]; break; - case 's': sstr = strs[val[1]]; p.v = sstr.t; p.r = sstr.r; break; - case 'b': p.v = val[1] ? true : false; break; - case 'e': p.v = val[1]; if(opts.cellText !== false) p.w = BErr[p.v]; break; - case 'str': p.t = 's'; p.v = val[1]; break; - case 'is': p.t = 's'; p.v = val[1].t; break; - } - if((cf = styles.CellXf[val[0].iStyleRef])) safe_format(p,cf.numFmtId,null,opts, themes, styles); - C = val[0].c == -1 ? C + 1 : val[0].c; - if(opts.dense) { if(!s[R]) s[R] = []; s[R][C] = p; } - else s[encode_col(C) + rr] = p; - if(opts.cellFormula) { - af = false; - for(ai = 0; ai < arrayf.length; ++ai) { - var aii = arrayf[ai]; - if(row.r >= aii[0].s.r && row.r <= aii[0].e.r) - if(C >= aii[0].s.c && C <= aii[0].e.c) { - p.F = encode_range(aii[0]); af = true; - } - } - if(!af && val.length > 3) p.f = val[3]; - } - if(refguess.s.r > row.r) refguess.s.r = row.r; - if(refguess.s.c > C) refguess.s.c = C; - if(refguess.e.r < row.r) refguess.e.r = row.r; - if(refguess.e.c < C) refguess.e.c = C; - if(opts.cellDates && cf && p.t == 'n' && SSF.is_date(SSF._table[cf.numFmtId])) { - var _d = SSF.parse_date_code(p.v); if(_d) { p.t = 'd'; p.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); } - } - break; - - case 0x0001: /* 'BrtCellBlank' */ - case 0x000C: /* 'BrtShortBlank' */ - if(!opts.sheetStubs || pass) break; - p = ({t:'z',v:undefined}/*:any*/); - C = val[0].c == -1 ? C + 1 : val[0].c; - if(opts.dense) { if(!s[R]) s[R] = []; s[R][C] = p; } - else s[encode_col(C) + rr] = p; - if(refguess.s.r > row.r) refguess.s.r = row.r; - if(refguess.s.c > C) refguess.s.c = C; - if(refguess.e.r < row.r) refguess.e.r = row.r; - if(refguess.e.c < C) refguess.e.c = C; - break; - - case 0x00B0: /* 'BrtMergeCell' */ - merges.push(val); break; - - case 0x01EE: /* 'BrtHLink' */ - var rel = rels['!id'][val.relId]; - if(rel) { - val.Target = rel.Target; - if(val.loc) val.Target += "#"+val.loc; - val.Rel = rel; - } else if(val.relId == '') { - val.Target = "#" + val.loc; - } - for(R=val.rfx.s.r;R<=val.rfx.e.r;++R) for(C=val.rfx.s.c;C<=val.rfx.e.c;++C) { - if(opts.dense) { - if(!s[R]) s[R] = []; - if(!s[R][C]) s[R][C] = {t:'z',v:undefined}; - s[R][C].l = val; - } else { - addr = encode_cell({c:C,r:R}); - if(!s[addr]) s[addr] = {t:'z',v:undefined}; - s[addr].l = val; - } - } - break; - - case 0x01AA: /* 'BrtArrFmla' */ - if(!opts.cellFormula) break; - arrayf.push(val); - cell = ((opts.dense ? s[R][C] : s[encode_col(C) + rr])/*:any*/); - cell.f = stringify_formula(val[1], refguess, {r:row.r, c:C}, supbooks, opts); - cell.F = encode_range(val[0]); - break; - case 0x01AB: /* 'BrtShrFmla' */ - if(!opts.cellFormula) break; - sharedf[encode_cell(val[0].s)] = val[1]; - cell = (opts.dense ? s[R][C] : s[encode_col(C) + rr]); - cell.f = stringify_formula(val[1], refguess, {r:row.r, c:C}, supbooks, opts); - break; - - /* identical to 'ColInfo' in XLS */ - case 0x003C: /* 'BrtColInfo' */ - if(!opts.cellStyles) break; - while(val.e >= val.s) { - colinfo[val.e--] = { width: val.w/256, hidden: !!(val.flags & 0x01), level: val.level }; - if(!seencol) { seencol = true; find_mdw_colw(val.w/256); } - process_col(colinfo[val.e+1]); - } - break; - - case 0x00A1: /* 'BrtBeginAFilter' */ - s['!autofilter'] = { ref:encode_range(val) }; - break; - - case 0x01DC: /* 'BrtMargins' */ - s['!margins'] = val; - break; - - case 0x0093: /* 'BrtWsProp' */ - if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; - if(val.name) wb.Sheets[idx].CodeName = val.name; - if(val.above || val.left) s['!outline'] = { above: val.above, left: val.left }; - break; - - case 0x0089: /* 'BrtBeginWsView' */ - if(!wb.Views) wb.Views = [{}]; - if(!wb.Views[0]) wb.Views[0] = {}; - if(val.RTL) wb.Views[0].RTL = true; - break; - - case 0x01E5: /* 'BrtWsFmtInfo' */ - break; - - case 0x0040: /* 'BrtDVal' */ - case 0x041D: /* 'BrtDVal14' */ - break; - - case 0x0097: /* 'BrtPane' */ - break; - case 0x0098: /* 'BrtSel' */ - case 0x00AF: /* 'BrtAFilterDateGroupItem' */ - case 0x0284: /* 'BrtActiveX' */ - case 0x0271: /* 'BrtBigName' */ - case 0x0232: /* 'BrtBkHim' */ - case 0x018C: /* 'BrtBrk' */ - case 0x0458: /* 'BrtCFIcon' */ - case 0x047A: /* 'BrtCFRuleExt' */ - case 0x01D7: /* 'BrtCFVO' */ - case 0x041A: /* 'BrtCFVO14' */ - case 0x0289: /* 'BrtCellIgnoreEC' */ - case 0x0451: /* 'BrtCellIgnoreEC14' */ - case 0x0031: /* 'BrtCellMeta' */ - case 0x024D: /* 'BrtCellSmartTagProperty' */ - case 0x025F: /* 'BrtCellWatch' */ - case 0x0234: /* 'BrtColor' */ - case 0x041F: /* 'BrtColor14' */ - case 0x00A8: /* 'BrtColorFilter' */ - case 0x00AE: /* 'BrtCustomFilter' */ - case 0x049C: /* 'BrtCustomFilter14' */ - case 0x01F3: /* 'BrtDRef' */ - case 0x01FB: /* 'BrtDXF' */ - case 0x0226: /* 'BrtDrawing' */ - case 0x00AB: /* 'BrtDynamicFilter' */ - case 0x00A7: /* 'BrtFilter' */ - case 0x0499: /* 'BrtFilter14' */ - case 0x00A9: /* 'BrtIconFilter' */ - case 0x049D: /* 'BrtIconFilter14' */ - case 0x0227: /* 'BrtLegacyDrawing' */ - case 0x0228: /* 'BrtLegacyDrawingHF' */ - case 0x0295: /* 'BrtListPart' */ - case 0x027F: /* 'BrtOleObject' */ - case 0x01DE: /* 'BrtPageSetup' */ - case 0x0219: /* 'BrtPhoneticInfo' */ - case 0x01DD: /* 'BrtPrintOptions' */ - case 0x0218: /* 'BrtRangeProtection' */ - case 0x044F: /* 'BrtRangeProtection14' */ - case 0x02A8: /* 'BrtRangeProtectionIso' */ - case 0x0450: /* 'BrtRangeProtectionIso14' */ - case 0x0400: /* 'BrtRwDescent' */ - case 0x0297: /* 'BrtSheetCalcProp' */ - case 0x0217: /* 'BrtSheetProtection' */ - case 0x02A6: /* 'BrtSheetProtectionIso' */ - case 0x01F8: /* 'BrtSlc' */ - case 0x0413: /* 'BrtSparkline' */ - case 0x01AC: /* 'BrtTable' */ - case 0x00AA: /* 'BrtTop10Filter' */ - case 0x0C00: /* 'BrtUid' */ - case 0x0032: /* 'BrtValueMeta' */ - case 0x0816: /* 'BrtWebExtension' */ - case 0x0415: /* 'BrtWsFmtInfoEx14' */ - break; - - case 0x0023: /* 'BrtFRTBegin' */ - pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - pass = false; break; - case 0x0025: /* 'BrtACBegin' */ - state.push(R_n); pass = true; break; - case 0x0026: /* 'BrtACEnd' */ - state.pop(); pass = false; break; - - default: - if((R_n||"").indexOf("Begin") > 0){/* empty */} - else if((R_n||"").indexOf("End") > 0){/* empty */} - else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); - } - }, opts); - - delete opts.supbooks; - delete opts['!row']; - - if(!s["!ref"] && (refguess.s.r < 2000000 || ref && (ref.e.r > 0 || ref.e.c > 0 || ref.s.r > 0 || ref.s.c > 0))) s["!ref"] = encode_range(ref || refguess); - if(opts.sheetRows && s["!ref"]) { - var tmpref = safe_decode_range(s["!ref"]); - if(opts.sheetRows <= +tmpref.e.r) { - tmpref.e.r = opts.sheetRows - 1; - if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r; - if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r; - if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c; - if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c; - s["!fullref"] = s["!ref"]; - s["!ref"] = encode_range(tmpref); - } - } - if(merges.length > 0) s["!merges"] = merges; - if(colinfo.length > 0) s["!cols"] = colinfo; - if(rowinfo.length > 0) s["!rows"] = rowinfo; - return s; -} - -/* TODO: something useful -- this is a stub */ -function write_ws_bin_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:number*/, opts, ws/*:Worksheet*/, last_seen/*:boolean*/)/*:boolean*/ { - if(cell.v === undefined) return false; - var vv = ""; - switch(cell.t) { - case 'b': vv = cell.v ? "1" : "0"; break; - case 'd': // no BrtCellDate :( - cell = dup(cell); - cell.z = cell.z || SSF._table[14]; - cell.v = datenum(parseDate(cell.v)); cell.t = 'n'; - break; - /* falls through */ - case 'n': case 'e': vv = ''+cell.v; break; - default: vv = cell.v; break; - } - var o/*:any*/ = ({r:R, c:C}/*:any*/); - /* TODO: cell style */ - o.s = get_cell_style(opts.cellXfs, cell, opts); - if(cell.l) ws['!links'].push([encode_cell(o), cell.l]); - if(cell.c) ws['!comments'].push([encode_cell(o), cell.c]); - switch(cell.t) { - case 's': case 'str': - if(opts.bookSST) { - vv = get_sst_id(opts.Strings, (cell.v/*:any*/), opts.revStrings); - o.t = "s"; o.v = vv; - if(last_seen) write_record(ba, "BrtShortIsst", write_BrtShortIsst(cell, o)); - else write_record(ba, "BrtCellIsst", write_BrtCellIsst(cell, o)); - } else { - o.t = "str"; - if(last_seen) write_record(ba, "BrtShortSt", write_BrtShortSt(cell, o)); - else write_record(ba, "BrtCellSt", write_BrtCellSt(cell, o)); - } - return true; - case 'n': - /* TODO: determine threshold for Real vs RK */ - if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) { - if(last_seen) write_record(ba, "BrtShortRk", write_BrtShortRk(cell, o)); - else write_record(ba, "BrtCellRk", write_BrtCellRk(cell, o)); - } else { - if(last_seen) write_record(ba, "BrtShortReal", write_BrtShortReal(cell, o)); - else write_record(ba, "BrtCellReal", write_BrtCellReal(cell, o)); - } return true; - case 'b': - o.t = "b"; - if(last_seen) write_record(ba, "BrtShortBool", write_BrtShortBool(cell, o)); - else write_record(ba, "BrtCellBool", write_BrtCellBool(cell, o)); - return true; - case 'e': - o.t = "e"; - if(last_seen) write_record(ba, "BrtShortError", write_BrtShortError(cell, o)); - else write_record(ba, "BrtCellError", write_BrtCellError(cell, o)); - return true; - } - if(last_seen) write_record(ba, "BrtShortBlank", write_BrtShortBlank(cell, o)); - else write_record(ba, "BrtCellBlank", write_BrtCellBlank(cell, o)); - return true; -} - -function write_CELLTABLE(ba, ws/*:Worksheet*/, idx/*:number*/, opts/*::, wb:Workbook*/) { - var range = safe_decode_range(ws['!ref'] || "A1"), ref, rr = "", cols/*:Array*/ = []; - write_record(ba, 'BrtBeginSheetData'); - var dense = Array.isArray(ws); - var cap = range.e.r; - if(ws['!rows']) cap = Math.max(range.e.r, ws['!rows'].length - 1); - for(var R = range.s.r; R <= cap; ++R) { - rr = encode_row(R); - /* [ACCELLTABLE] */ - /* BrtRowHdr */ - write_row_header(ba, ws, range, R); - var last_seen = false; - if(R <= range.e.r) for(var C = range.s.c; C <= range.e.c; ++C) { - /* *16384CELL */ - if(R === range.s.r) cols[C] = encode_col(C); - ref = cols[C] + rr; - var cell = dense ? (ws[R]||[])[C] : ws[ref]; - if(!cell) { last_seen = false; continue; } - /* write cell */ - last_seen = write_ws_bin_cell(ba, cell, R, C, opts, ws, last_seen); - } - } - write_record(ba, 'BrtEndSheetData'); -} - -function write_MERGECELLS(ba, ws/*:Worksheet*/) { - if(!ws || !ws['!merges']) return; - write_record(ba, 'BrtBeginMergeCells', write_BrtBeginMergeCells(ws['!merges'].length)); - ws['!merges'].forEach(function(m) { write_record(ba, 'BrtMergeCell', write_BrtMergeCell(m)); }); - write_record(ba, 'BrtEndMergeCells'); -} - -function write_COLINFOS(ba, ws/*:Worksheet*//*::, idx:number, opts, wb:Workbook*/) { - if(!ws || !ws['!cols']) return; - write_record(ba, 'BrtBeginColInfos'); - ws['!cols'].forEach(function(m, i) { if(m) write_record(ba, 'BrtColInfo', write_BrtColInfo(i, m)); }); - write_record(ba, 'BrtEndColInfos'); -} - -function write_IGNOREECS(ba, ws/*:Worksheet*/) { - if(!ws || !ws['!ref']) return; - write_record(ba, 'BrtBeginCellIgnoreECs'); - write_record(ba, 'BrtCellIgnoreEC', write_BrtCellIgnoreEC(safe_decode_range(ws['!ref']))); - write_record(ba, 'BrtEndCellIgnoreECs'); -} - -function write_HLINKS(ba, ws/*:Worksheet*/, rels) { - /* *BrtHLink */ - ws['!links'].forEach(function(l) { - if(!l[1].Target) return; - var rId = add_rels(rels, -1, l[1].Target.replace(/#.*$/, ""), RELS.HLINK); - write_record(ba, "BrtHLink", write_BrtHLink(l, rId)); - }); - delete ws['!links']; -} -function write_LEGACYDRAWING(ba, ws/*:Worksheet*/, idx/*:number*/, rels) { - /* [BrtLegacyDrawing] */ - if(ws['!comments'].length > 0) { - var rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML); - write_record(ba, "BrtLegacyDrawing", write_RelID("rId" + rId)); - ws['!legacy'] = rId; - } -} - -function write_AUTOFILTER(ba, ws, wb, idx) { - if(!ws['!autofilter']) return; - var data = ws['!autofilter']; - var ref = typeof data.ref === "string" ? data.ref : encode_range(data.ref); - - /* Update FilterDatabase defined name for the worksheet */ - if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/); - if(!wb.Workbook.Names) wb.Workbook.Names = []; - var names/*: Array */ = wb.Workbook.Names; - var range = decode_range(ref); - if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); } - for(var i = 0; i < names.length; ++i) { - var name = names[i]; - if(name.Name != '_xlnm._FilterDatabase') continue; - if(name.Sheet != idx) continue; - name.Ref = "'" + wb.SheetNames[idx] + "'!" + ref; break; - } - if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetNames[idx] + "'!" + ref }); - - write_record(ba, "BrtBeginAFilter", write_UncheckedRfX(safe_decode_range(ref))); - /* *FILTERCOLUMN */ - /* [SORTSTATE] */ - /* BrtEndAFilter */ - write_record(ba, "BrtEndAFilter"); -} - -function write_WSVIEWS2(ba, ws, Workbook) { - write_record(ba, "BrtBeginWsViews"); - { /* 1*WSVIEW2 */ - /* [ACUID] */ - write_record(ba, "BrtBeginWsView", write_BrtBeginWsView(ws, Workbook)); - /* [BrtPane] */ - /* *4BrtSel */ - /* *4SXSELECT */ - /* *FRT */ - write_record(ba, "BrtEndWsView"); - } - /* *FRT */ - write_record(ba, "BrtEndWsViews"); -} - -function write_WSFMTINFO(/*::ba, ws*/) { - /* [ACWSFMTINFO] */ - //write_record(ba, "BrtWsFmtInfo", write_BrtWsFmtInfo(ws)); -} - -function write_SHEETPROTECT(ba, ws) { - if(!ws['!protect']) return; - /* [BrtSheetProtectionIso] */ - write_record(ba, "BrtSheetProtection", write_BrtSheetProtection(ws['!protect'])); -} - -function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) { - var ba = buf_array(); - var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {}; - var c/*:string*/ = s; try { if(wb && wb.Workbook) c = wb.Workbook.Sheets[idx].CodeName || c; } catch(e) {} - var r = safe_decode_range(ws['!ref'] || "A1"); - if(r.e.c > 0x3FFF || r.e.r > 0xFFFFF) { - if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:XFD1048576"); - r.e.c = Math.min(r.e.c, 0x3FFF); - r.e.r = Math.min(r.e.c, 0xFFFFF); - } - ws['!links'] = []; - /* passed back to write_zip and removed there */ - ws['!comments'] = []; - write_record(ba, "BrtBeginSheet"); - if(wb.vbaraw || ws['!outline']) write_record(ba, "BrtWsProp", write_BrtWsProp(c, ws['!outline'])); - write_record(ba, "BrtWsDim", write_BrtWsDim(r)); - write_WSVIEWS2(ba, ws, wb.Workbook); - write_WSFMTINFO(ba, ws); - write_COLINFOS(ba, ws, idx, opts, wb); - write_CELLTABLE(ba, ws, idx, opts, wb); - /* [BrtSheetCalcProp] */ - write_SHEETPROTECT(ba, ws); - /* *([BrtRangeProtectionIso] BrtRangeProtection) */ - /* [SCENMAN] */ - write_AUTOFILTER(ba, ws, wb, idx); - /* [SORTSTATE] */ - /* [DCON] */ - /* [USERSHVIEWS] */ - write_MERGECELLS(ba, ws); - /* [BrtPhoneticInfo] */ - /* *CONDITIONALFORMATTING */ - /* [DVALS] */ - write_HLINKS(ba, ws, rels); - /* [BrtPrintOptions] */ - if(ws['!margins']) write_record(ba, "BrtMargins", write_BrtMargins(ws['!margins'])); - /* [BrtPageSetup] */ - /* [HEADERFOOTER] */ - /* [RWBRK] */ - /* [COLBRK] */ - /* *BrtBigName */ - /* [CELLWATCHES] */ - if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws); - /* [SMARTTAGS] */ - /* [BrtDrawing] */ - write_LEGACYDRAWING(ba, ws, idx, rels); - /* [BrtLegacyDrawingHF] */ - /* [BrtBkHim] */ - /* [OLEOBJECTS] */ - /* [ACTIVEXCONTROLS] */ - /* [WEBPUBITEMS] */ - /* [LISTPARTS] */ - /* FRTWORKSHEET */ - write_record(ba, "BrtEndSheet"); - return ba.end(); -} -RELS.CHART = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"; -RELS.CHARTEX = "http://schemas.microsoft.com/office/2014/relationships/chartEx"; - -function parse_Cache(data/*:string*/)/*:[Array, string, ?string]*/ { - var col/*:Array*/ = []; - var num = data.match(/^/); - var f; - - /* 21.2.2.150 pt CT_NumVal */ - (data.match(/(.*?)<\/c:pt>/mg)||[]).forEach(function(pt) { - var q = pt.match(/(.*)<\/c:v><\/c:pt>/); - if(!q) return; - col[+q[1]] = num ? +q[2] : q[2]; - }); - - /* 21.2.2.71 formatCode CT_Xstring */ - var nf = unescapexml((data.match(/([\s\S]*?)<\/c:formatCode>/) || ["","General"])[1]); - - (data.match(/(.*?)<\/c:f>/mg)||[]).forEach(function(F) { f = F.replace(/<.*?>/g,""); }); - - return [col, nf, f]; -} - -/* 21.2 DrawingML - Charts */ -function parse_chart(data/*:?string*/, name/*:string*/, opts, rels, wb, csheet) { - var cs/*:Worksheet*/ = ((csheet || {"!type":"chart"})/*:any*/); - if(!data) return csheet; - /* 21.2.2.27 chart CT_Chart */ - - var C = 0, R = 0, col = "A"; - var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; - - /* 21.2.2.120 numCache CT_NumData */ - (data.match(/[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) { - var cache = parse_Cache(nc); - refguess.s.r = refguess.s.c = 0; - refguess.e.c = C; - col = encode_col(C); - cache[0].forEach(function(n,i) { - cs[col + encode_row(i)] = {t:'n', v:n, z:cache[1] }; - R = i; - }); - if(refguess.e.r < R) refguess.e.r = R; - ++C; - }); - if(C > 0) cs["!ref"] = encode_range(refguess); - return cs; -} -RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet"; - -var CS_XML_ROOT = writextag('chartsheet', null, { - 'xmlns': XMLNS.main[0], - 'xmlns:r': XMLNS.r -}); - -/* 18.3 Worksheets also covers Chartsheets */ -function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ { - if(!data) return data; - /* 18.3.1.12 chartsheet CT_ChartSheet */ - if(!rels) rels = {'!id':{}}; - var s = ({'!type':"chart", '!drawel':null, '!rel':""}/*:any*/); - var m; - - /* 18.3.1.83 sheetPr CT_ChartsheetPr */ - var sheetPr = data.match(sheetprregex); - if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); - - /* 18.3.1.36 drawing CT_Drawing */ - if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1]; - - if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']]; - return s; -} -function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { - var o = [XML_HEADER, CS_XML_ROOT]; - o[o.length] = writextag("drawing", null, {"r:id": "rId1"}); - add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); - if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } - return o.join(""); -} - -/* [MS-XLSB] 2.4.331 BrtCsProp */ -function parse_BrtCsProp(data, length/*:number*/) { - data.l += 10; - var name = parse_XLWideString(data, length - 10); - return { name: name }; -} - -/* [MS-XLSB] 2.1.7.7 Chart Sheet */ -function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ { - if(!data) return data; - if(!rels) rels = {'!id':{}}; - var s = {'!type':"chart", '!drawel':null, '!rel':""}; - var state/*:Array*/ = []; - var pass = false; - recordhopper(data, function cs_parse(val, R_n, RT) { - switch(RT) { - - case 0x0226: /* 'BrtDrawing' */ - s['!rel'] = val; break; - - case 0x028B: /* 'BrtCsProp' */ - if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; - if(val.name) wb.Sheets[idx].CodeName = val.name; - break; - - case 0x0232: /* 'BrtBkHim' */ - case 0x028C: /* 'BrtCsPageSetup' */ - case 0x029D: /* 'BrtCsProtection' */ - case 0x02A7: /* 'BrtCsProtectionIso' */ - case 0x0227: /* 'BrtLegacyDrawing' */ - case 0x0228: /* 'BrtLegacyDrawingHF' */ - case 0x01DC: /* 'BrtMargins' */ - case 0x0C00: /* 'BrtUid' */ - break; - - case 0x0023: /* 'BrtFRTBegin' */ - pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - pass = false; break; - case 0x0025: /* 'BrtACBegin' */ - state.push(R_n); break; - case 0x0026: /* 'BrtACEnd' */ - state.pop(); break; - - default: - if((R_n||"").indexOf("Begin") > 0) state.push(R_n); - else if((R_n||"").indexOf("End") > 0) state.pop(); - else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); - } - }, opts); - - if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']]; - return s; -} -function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) { - var ba = buf_array(); - write_record(ba, "BrtBeginSheet"); - /* [BrtCsProp] */ - /* CSVIEWS */ - /* [[BrtCsProtectionIso] BrtCsProtection] */ - /* [USERCSVIEWS] */ - /* [BrtMargins] */ - /* [BrtCsPageSetup] */ - /* [HEADERFOOTER] */ - /* BrtDrawing */ - /* [BrtLegacyDrawing] */ - /* [BrtLegacyDrawingHF] */ - /* [BrtBkHim] */ - /* [WEBPUBITEMS] */ - /* FRTCHARTSHEET */ - write_record(ba, "BrtEndSheet"); - return ba.end(); -} -/* 18.2.28 (CT_WorkbookProtection) Defaults */ -var WBPropsDef = [ - ['allowRefreshQuery', false, "bool"], - ['autoCompressPictures', true, "bool"], - ['backupFile', false, "bool"], - ['checkCompatibility', false, "bool"], - ['CodeName', ''], - ['date1904', false, "bool"], - ['defaultThemeVersion', 0, "int"], - ['filterPrivacy', false, "bool"], - ['hidePivotFieldList', false, "bool"], - ['promptedSolutions', false, "bool"], - ['publishItems', false, "bool"], - ['refreshAllConnections', false, "bool"], - ['saveExternalLinkValues', true, "bool"], - ['showBorderUnselectedTables', true, "bool"], - ['showInkAnnotation', true, "bool"], - ['showObjects', 'all'], - ['showPivotChartFilter', false, "bool"], - ['updateLinks', 'userSet'] -]; - -/* 18.2.30 (CT_BookView) Defaults */ -var WBViewDef = [ - ['activeTab', 0, "int"], - ['autoFilterDateGrouping', true, "bool"], - ['firstSheet', 0, "int"], - ['minimized', false, "bool"], - ['showHorizontalScroll', true, "bool"], - ['showSheetTabs', true, "bool"], - ['showVerticalScroll', true, "bool"], - ['tabRatio', 600, "int"], - ['visibility', 'visible'] - //window{Height,Width}, {x,y}Window -]; - -/* 18.2.19 (CT_Sheet) Defaults */ -var SheetDef = [ - //['state', 'visible'] -]; - -/* 18.2.2 (CT_CalcPr) Defaults */ -var CalcPrDef = [ - ['calcCompleted', 'true'], - ['calcMode', 'auto'], - ['calcOnSave', 'true'], - ['concurrentCalc', 'true'], - ['fullCalcOnLoad', 'false'], - ['fullPrecision', 'true'], - ['iterate', 'false'], - ['iterateCount', '100'], - ['iterateDelta', '0.001'], - ['refMode', 'A1'] -]; - -/* 18.2.3 (CT_CustomWorkbookView) Defaults */ -/*var CustomWBViewDef = [ - ['autoUpdate', 'false'], - ['changesSavedWin', 'false'], - ['includeHiddenRowCol', 'true'], - ['includePrintSettings', 'true'], - ['maximized', 'false'], - ['minimized', 'false'], - ['onlySync', 'false'], - ['personalView', 'false'], - ['showComments', 'commIndicator'], - ['showFormulaBar', 'true'], - ['showHorizontalScroll', 'true'], - ['showObjects', 'all'], - ['showSheetTabs', 'true'], - ['showStatusbar', 'true'], - ['showVerticalScroll', 'true'], - ['tabRatio', '600'], - ['xWindow', '0'], - ['yWindow', '0'] -];*/ - -function push_defaults_array(target, defaults) { - for(var j = 0; j != target.length; ++j) { var w = target[j]; - for(var i=0; i != defaults.length; ++i) { var z = defaults[i]; - if(w[z[0]] == null) w[z[0]] = z[1]; - else switch(z[2]) { - case "bool": if(typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]); break; - case "int": if(typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10); break; - } - } - } -} -function push_defaults(target, defaults) { - for(var i = 0; i != defaults.length; ++i) { var z = defaults[i]; - if(target[z[0]] == null) target[z[0]] = z[1]; - else switch(z[2]) { - case "bool": if(typeof target[z[0]] == "string") target[z[0]] = parsexmlbool(target[z[0]]); break; - case "int": if(typeof target[z[0]] == "string") target[z[0]] = parseInt(target[z[0]], 10); break; - } - } -} - -function parse_wb_defaults(wb) { - push_defaults(wb.WBProps, WBPropsDef); - push_defaults(wb.CalcPr, CalcPrDef); - - push_defaults_array(wb.WBView, WBViewDef); - push_defaults_array(wb.Sheets, SheetDef); - - _ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904); -} - -function safe1904(wb/*:Workbook*/)/*:string*/ { - /* TODO: store date1904 somewhere else */ - if(!wb.Workbook) return "false"; - if(!wb.Workbook.WBProps) return "false"; - return parsexmlbool(wb.Workbook.WBProps.date1904) ? "true" : "false"; -} - -var badchars = "][*?\/\\".split(""); -function check_ws_name(n/*:string*/, safe/*:?boolean*/)/*:boolean*/ { - if(n.length > 31) { if(safe) return false; throw new Error("Sheet names cannot exceed 31 chars"); } - var _good = true; - badchars.forEach(function(c) { - if(n.indexOf(c) == -1) return; - if(!safe) throw new Error("Sheet name cannot contain : \\ / ? * [ ]"); - _good = false; - }); - return _good; -} -function check_wb_names(N, S, codes) { - N.forEach(function(n,i) { - check_ws_name(n); - for(var j = 0; j < i; ++j) if(n == N[j]) throw new Error("Duplicate Sheet Name: " + n); - if(codes) { - var cn = (S && S[i] && S[i].CodeName) || n; - if(cn.charCodeAt(0) == 95 && cn.length > 22) throw new Error("Bad Code Name: Worksheet" + cn); - } - }); -} -function check_wb(wb) { - if(!wb || !wb.SheetNames || !wb.Sheets) throw new Error("Invalid Workbook"); - if(!wb.SheetNames.length) throw new Error("Workbook is empty"); - var Sheets = (wb.Workbook && wb.Workbook.Sheets) || []; - check_wb_names(wb.SheetNames, Sheets, !!wb.vbaraw); - for(var i = 0; i < wb.SheetNames.length; ++i) check_ws(wb.Sheets[wb.SheetNames[i]], wb.SheetNames[i], i); - /* TODO: validate workbook */ -} -/* 18.2 Workbook */ -var wbnsregex = /<\w+:workbook/; -function parse_wb_xml(data, opts)/*:WorkbookFile*/ { - if(!data) throw new Error("Could not find file"); - var wb = /*::(*/{ AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, Names:[], xmlns: "" }/*::)*/; - var pass = false, xmlns = "xmlns"; - var dname = {}, dnstart = 0; - data.replace(tagregex, function xml_wb(x, idx) { - var y/*:any*/ = parsexmltag(x); - switch(strip_ns(y[0])) { - case '': break; - - /* 18.2.13 fileVersion CT_FileVersion ? */ - case '': case '': break; - - /* 18.2.12 fileSharing CT_FileSharing ? */ - case '': break; - - /* 18.2.28 workbookPr CT_WorkbookPr ? */ - case '': - WBPropsDef.forEach(function(w) { - if(y[w[0]] == null) return; - switch(w[2]) { - case "bool": wb.WBProps[w[0]] = parsexmlbool(y[w[0]]); break; - case "int": wb.WBProps[w[0]] = parseInt(y[w[0]], 10); break; - default: wb.WBProps[w[0]] = y[w[0]]; - } - }); - if(y.codeName) wb.WBProps.CodeName = utf8read(y.codeName); - break; - case '': break; - - /* 18.2.29 workbookProtection CT_WorkbookProtection ? */ - case '': break; - - /* 18.2.1 bookViews CT_BookViews ? */ - case '': case '': break; - /* 18.2.30 workbookView CT_BookView + */ - case '': delete y[0]; wb.WBView.push(y); break; - case '': break; - - /* 18.2.20 sheets CT_Sheets 1 */ - case '': case '': break; // aggregate sheet - /* 18.2.19 sheet CT_Sheet + */ - case '': break; - - /* 18.2.15 functionGroups CT_FunctionGroups ? */ - case '': break; - /* 18.2.14 functionGroup CT_FunctionGroup + */ - case '': case '': break; - /* 18.2.8 externalReference CT_ExternalReference + */ - case '': break; - case '': case '': pass=false; break; - /* 18.2.5 definedName CT_DefinedName + */ - case '': { - dname.Ref = unescapexml(utf8read(data.slice(dnstart, idx))); - wb.Names.push(dname); - } break; - case '': break; - - /* 18.2.2 calcPr CT_CalcPr ? */ - case '': delete y[0]; wb.CalcPr = y; break; - case '': break; - - /* 18.2.16 oleSize CT_OleSize ? (ref required) */ - case '': case '': case '': break; - - /* 18.2.18 pivotCaches CT_PivotCaches ? */ - case '': case '': case '': break; - - /* 18.2.23 smartTagTypes CT_SmartTagTypes ? */ - case '': case '': break; - /* 18.2.22 smartTagType CT_SmartTagType ? */ - case '': break; - - /* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */ - case '': break; - - /* 18.2.26 webPublishObjects CT_WebPublishObjects ? */ - case '': case '': break; - /* 18.2.25 webPublishObject CT_WebPublishObject ? */ - case '': case '': case '': break; - /* 18.2.7 ext CT_Extension + */ - case '': pass=false; break; - - /* Others */ - case '': pass=true; break; - case '': pass=false; break; - - /* TODO */ - case ' 0); - - /* fileVersion */ - /* fileSharing */ - - var workbookPr/*:any*/ = ({codeName:"ThisWorkbook"}/*:any*/); - if(wb.Workbook && wb.Workbook.WBProps) { - WBPropsDef.forEach(function(x) { - /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */ - if((wb.Workbook.WBProps[x[0]]/*:any*/) == null) return; - if((wb.Workbook.WBProps[x[0]]/*:any*/) == x[1]) return; - workbookPr[x[0]] = (wb.Workbook.WBProps[x[0]]/*:any*/); - }); - /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */ - if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.CodeName; delete workbookPr.CodeName; } - } - o[o.length] = (writextag('workbookPr', null, workbookPr)); - - /* workbookProtection */ - - var sheets = wb.Workbook && wb.Workbook.Sheets || []; - var i = 0; - - /* bookViews only written if first worksheet is hidden */ - if(sheets && sheets[0] && !!sheets[0].Hidden) { - o[o.length] = ""; - for(i = 0; i != wb.SheetNames.length; ++i) { - if(!sheets[i]) break; - if(!sheets[i].Hidden) break; - } - if(i == wb.SheetNames.length) i = 0; - o[o.length] = ''; - o[o.length] = ""; - } - - o[o.length] = ""; - for(i = 0; i != wb.SheetNames.length; ++i) { - var sht = ({name:escapexml(wb.SheetNames[i].slice(0,31))}/*:any*/); - sht.sheetId = ""+(i+1); - sht["r:id"] = "rId"+(i+1); - if(sheets[i]) switch(sheets[i].Hidden) { - case 1: sht.state = "hidden"; break; - case 2: sht.state = "veryHidden"; break; - } - o[o.length] = (writextag('sheet',null,sht)); - } - o[o.length] = ""; - - /* functionGroups */ - /* externalReferences */ - - if(write_names) { - o[o.length] = ""; - if(wb.Workbook && wb.Workbook.Names) wb.Workbook.Names.forEach(function(n) { - var d/*:any*/ = {name:n.Name}; - if(n.Comment) d.comment = n.Comment; - if(n.Sheet != null) d.localSheetId = ""+n.Sheet; - if(n.Hidden) d.hidden = "1"; - if(!n.Ref) return; - o[o.length] = writextag('definedName', escapexml(n.Ref), d); - }); - o[o.length] = ""; - } - - /* calcPr */ - /* oleSize */ - /* customWorkbookViews */ - /* pivotCaches */ - /* smartTagPr */ - /* smartTagTypes */ - /* webPublishing */ - /* fileRecoveryPr */ - /* webPublishObjects */ - /* extLst */ - - if(o.length>2){ o[o.length] = ''; o[1]=o[1].replace("/>",">"); } - return o.join(""); -} -/* [MS-XLSB] 2.4.304 BrtBundleSh */ -function parse_BrtBundleSh(data, length/*:number*/) { - var z = {}; - z.Hidden = data.read_shift(4); //hsState ST_SheetState - z.iTabID = data.read_shift(4); - z.strRelID = parse_RelID(data,length-8); - z.name = parse_XLWideString(data); - return z; -} -function write_BrtBundleSh(data, o) { - if(!o) o = new_buf(127); - o.write_shift(4, data.Hidden); - o.write_shift(4, data.iTabID); - write_RelID(data.strRelID, o); - write_XLWideString(data.name.slice(0,31), o); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.815 BrtWbProp */ -function parse_BrtWbProp(data, length)/*:WBProps*/ { - var o/*:WBProps*/ = ({}/*:any*/); - var flags = data.read_shift(4); - o.defaultThemeVersion = data.read_shift(4); - var strName = (length > 8) ? parse_XLWideString(data) : ""; - if(strName.length > 0) o.CodeName = strName; - o.autoCompressPictures = !!(flags & 0x10000); - o.backupFile = !!(flags & 0x40); - o.checkCompatibility = !!(flags & 0x1000); - o.date1904 = !!(flags & 0x01); - o.filterPrivacy = !!(flags & 0x08); - o.hidePivotFieldList = !!(flags & 0x400); - o.promptedSolutions = !!(flags & 0x10); - o.publishItems = !!(flags & 0x800); - o.refreshAllConnections = !!(flags & 0x40000); - o.saveExternalLinkValues = !!(flags & 0x80); - o.showBorderUnselectedTables = !!(flags & 0x04); - o.showInkAnnotation = !!(flags & 0x20); - o.showObjects = ["all", "placeholders", "none"][(flags >> 13) & 0x03]; - o.showPivotChartFilter = !!(flags & 0x8000); - o.updateLinks = ["userSet", "never", "always"][(flags >> 8) & 0x03]; - return o; -} -function write_BrtWbProp(data/*:?WBProps*/, o) { - if(!o) o = new_buf(72); - var flags = 0; - if(data) { - /* TODO: mirror parse_BrtWbProp fields */ - if(data.filterPrivacy) flags |= 0x08; - } - o.write_shift(4, flags); - o.write_shift(4, 0); - write_XLSBCodeName(data && data.CodeName || "ThisWorkbook", o); - return o.slice(0, o.l); -} - -function parse_BrtFRTArchID$(data, length) { - var o = {}; - data.read_shift(4); - o.ArchID = data.read_shift(4); - data.l += length - 8; - return o; -} - -/* [MS-XLSB] 2.4.687 BrtName */ -function parse_BrtName(data, length, opts) { - var end = data.l + length; - data.l += 4; //var flags = data.read_shift(4); - data.l += 1; //var chKey = data.read_shift(1); - var itab = data.read_shift(4); - var name = parse_XLNameWideString(data); - var formula = parse_XLSBNameParsedFormula(data, 0, opts); - var comment = parse_XLNullableWideString(data); - //if(0 /* fProc */) { - // unusedstring1: XLNullableWideString - // description: XLNullableWideString - // helpTopic: XLNullableWideString - // unusedstring2: XLNullableWideString - //} - data.l = end; - var out = ({Name:name, Ptg:formula}/*:any*/); - if(itab < 0xFFFFFFF) out.Sheet = itab; - if(comment) out.Comment = comment; - return out; -} - -/* [MS-XLSB] 2.1.7.61 Workbook */ -function parse_wb_bin(data, opts)/*:WorkbookFile*/ { - var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" }; - var state/*:Array*/ = []; - var pass = false; - - if(!opts) opts = {}; - opts.biff = 12; - - var Names = []; - var supbooks = ([[]]/*:any*/); - supbooks.SheetNames = []; - supbooks.XTI = []; - - XLSBRecordEnum[0x0010] = { n:"BrtFRTArchID$", f:parse_BrtFRTArchID$ }; - - recordhopper(data, function hopper_wb(val, R_n, RT) { - switch(RT) { - case 0x009C: /* 'BrtBundleSh' */ - supbooks.SheetNames.push(val.name); - wb.Sheets.push(val); break; - - case 0x0099: /* 'BrtWbProp' */ - wb.WBProps = val; break; - - case 0x0027: /* 'BrtName' */ - if(val.Sheet != null) opts.SID = val.Sheet; - val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts); - delete opts.SID; - delete val.Ptg; - Names.push(val); - break; - case 0x040C: /* 'BrtNameExt' */ break; - - case 0x0165: /* 'BrtSupSelf' */ - case 0x0166: /* 'BrtSupSame' */ - case 0x0163: /* 'BrtSupBookSrc' */ - case 0x029B: /* 'BrtSupAddin' */ - if(!supbooks[0].length) supbooks[0] = [RT, val]; - else supbooks.push([RT, val]); - supbooks[supbooks.length - 1].XTI = []; - break; - case 0x016A: /* 'BrtExternSheet' */ - if(supbooks.length === 0) { supbooks[0] = []; supbooks[0].XTI = []; } - supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); - supbooks.XTI = supbooks.XTI.concat(val); - break; - case 0x0169: /* 'BrtPlaceholderName' */ - break; - - case 0x0817: /* 'BrtAbsPath15' */ - case 0x009E: /* 'BrtBookView' */ - case 0x008F: /* 'BrtBeginBundleShs' */ - case 0x0298: /* 'BrtBeginFnGroup' */ - case 0x0161: /* 'BrtBeginExternals' */ - break; - - /* case 'BrtModelTimeGroupingCalcCol' */ - case 0x0C00: /* 'BrtUid' */ - case 0x0C01: /* 'BrtRevisionPtr' */ - case 0x0216: /* 'BrtBookProtection' */ - case 0x02A5: /* 'BrtBookProtectionIso' */ - case 0x009D: /* 'BrtCalcProp' */ - case 0x0262: /* 'BrtCrashRecErr' */ - case 0x0802: /* 'BrtDecoupledPivotCacheID' */ - case 0x009B: /* 'BrtFileRecover' */ - case 0x0224: /* 'BrtFileSharing' */ - case 0x02A4: /* 'BrtFileSharingIso' */ - case 0x0080: /* 'BrtFileVersion' */ - case 0x0299: /* 'BrtFnGroup' */ - case 0x0850: /* 'BrtModelRelationship' */ - case 0x084D: /* 'BrtModelTable' */ - case 0x0225: /* 'BrtOleSize' */ - case 0x0805: /* 'BrtPivotTableRef' */ - case 0x0254: /* 'BrtSmartTagType' */ - case 0x081C: /* 'BrtTableSlicerCacheID' */ - case 0x081B: /* 'BrtTableSlicerCacheIDs' */ - case 0x0822: /* 'BrtTimelineCachePivotCacheID' */ - case 0x018D: /* 'BrtUserBookView' */ - case 0x009A: /* 'BrtWbFactoid' */ - case 0x045D: /* 'BrtWbProp14' */ - case 0x0229: /* 'BrtWebOpt' */ - case 0x082B: /* 'BrtWorkBookPr15' */ - break; - - case 0x0023: /* 'BrtFRTBegin' */ - state.push(R_n); pass = true; break; - case 0x0024: /* 'BrtFRTEnd' */ - state.pop(); pass = false; break; - case 0x0025: /* 'BrtACBegin' */ - state.push(R_n); pass = true; break; - case 0x0026: /* 'BrtACEnd' */ - state.pop(); pass = false; break; - - case 0x0010: /* 'BrtFRTArchID$' */ break; - - default: - if((R_n||"").indexOf("Begin") > 0){/* empty */} - else if((R_n||"").indexOf("End") > 0){/* empty */} - else if(!pass || (opts.WTF && state[state.length-1] != "BrtACBegin" && state[state.length-1] != "BrtFRTBegin")) throw new Error("Unexpected record " + RT + " " + R_n); - } - }, opts); - - parse_wb_defaults(wb); - - // $FlowIgnore - wb.Names = Names; - - (wb/*:any*/).supbooks = supbooks; - return wb; -} - -function write_BUNDLESHS(ba, wb/*::, opts*/) { - write_record(ba, "BrtBeginBundleShs"); - for(var idx = 0; idx != wb.SheetNames.length; ++idx) { - var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].Hidden || 0; - var d = { Hidden: viz, iTabID: idx+1, strRelID: 'rId' + (idx+1), name: wb.SheetNames[idx] }; - write_record(ba, "BrtBundleSh", write_BrtBundleSh(d)); - } - write_record(ba, "BrtEndBundleShs"); -} - -/* [MS-XLSB] 2.4.649 BrtFileVersion */ -function write_BrtFileVersion(data, o) { - if(!o) o = new_buf(127); - for(var i = 0; i != 4; ++i) o.write_shift(4, 0); - write_XLWideString("SheetJS", o); - write_XLWideString(XLSX.version, o); - write_XLWideString(XLSX.version, o); - write_XLWideString("7262", o); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -/* [MS-XLSB] 2.4.301 BrtBookView */ -function write_BrtBookView(idx, o) { - if(!o) o = new_buf(29); - o.write_shift(-4, 0); - o.write_shift(-4, 460); - o.write_shift(4, 28800); - o.write_shift(4, 17600); - o.write_shift(4, 500); - o.write_shift(4, idx); - o.write_shift(4, idx); - var flags = 0x78; - o.write_shift(1, flags); - return o.length > o.l ? o.slice(0, o.l) : o; -} - -function write_BOOKVIEWS(ba, wb/*::, opts*/) { - /* required if hidden tab appears before visible tab */ - if(!wb.Workbook || !wb.Workbook.Sheets) return; - var sheets = wb.Workbook.Sheets; - var i = 0, vistab = -1, hidden = -1; - for(; i < sheets.length; ++i) { - if(!sheets[i] || !sheets[i].Hidden && vistab == -1) vistab = i; - else if(sheets[i].Hidden == 1 && hidden == -1) hidden = i; - } - if(hidden > vistab) return; - write_record(ba, "BrtBeginBookViews"); - write_record(ba, "BrtBookView", write_BrtBookView(vistab)); - /* 1*(BrtBookView *FRT) */ - write_record(ba, "BrtEndBookViews"); -} - -/* [MS-XLSB] 2.4.305 BrtCalcProp */ -/*function write_BrtCalcProp(data, o) { - if(!o) o = new_buf(26); - o.write_shift(4,0); // force recalc - o.write_shift(4,1); - o.write_shift(4,0); - write_Xnum(0, o); - o.write_shift(-4, 1023); - o.write_shift(1, 0x33); - o.write_shift(1, 0x00); - return o; -}*/ - -/* [MS-XLSB] 2.4.646 BrtFileRecover */ -/*function write_BrtFileRecover(data, o) { - if(!o) o = new_buf(1); - o.write_shift(1,0); - return o; -}*/ - -/* [MS-XLSB] 2.1.7.61 Workbook */ -function write_wb_bin(wb, opts) { - var ba = buf_array(); - write_record(ba, "BrtBeginBook"); - write_record(ba, "BrtFileVersion", write_BrtFileVersion()); - /* [[BrtFileSharingIso] BrtFileSharing] */ - write_record(ba, "BrtWbProp", write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null)); - /* [ACABSPATH] */ - /* [[BrtBookProtectionIso] BrtBookProtection] */ - write_BOOKVIEWS(ba, wb, opts); - write_BUNDLESHS(ba, wb, opts); - /* [FNGROUP] */ - /* [EXTERNALS] */ - /* *BrtName */ - /* write_record(ba, "BrtCalcProp", write_BrtCalcProp()); */ - /* [BrtOleSize] */ - /* *(BrtUserBookView *FRT) */ - /* [PIVOTCACHEIDS] */ - /* [BrtWbFactoid] */ - /* [SMARTTAGTYPES] */ - /* [BrtWebOpt] */ - /* write_record(ba, "BrtFileRecover", write_BrtFileRecover()); */ - /* [WEBPUBITEMS] */ - /* [CRERRS] */ - /* FRTWORKBOOK */ - write_record(ba, "BrtEndBook"); - - return ba.end(); -} -function parse_wb(data, name/*:string*/, opts)/*:WorkbookFile*/ { - if(name.slice(-4)===".bin") return parse_wb_bin((data/*:any*/), opts); - return parse_wb_xml((data/*:any*/), opts); -} - -function parse_ws(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { - if(name.slice(-4)===".bin") return parse_ws_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); - return parse_ws_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); -} - -function parse_cs(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { - if(name.slice(-4)===".bin") return parse_cs_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); - return parse_cs_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); -} - -function parse_ms(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { - if(name.slice(-4)===".bin") return parse_ms_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); - return parse_ms_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); -} - -function parse_ds(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { - if(name.slice(-4)===".bin") return parse_ds_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); - return parse_ds_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); -} - -function parse_sty(data, name/*:string*/, themes, opts) { - if(name.slice(-4)===".bin") return parse_sty_bin((data/*:any*/), themes, opts); - return parse_sty_xml((data/*:any*/), themes, opts); -} - -function parse_theme(data/*:string*/, name/*:string*/, opts) { - return parse_theme_xml(data, opts); -} - -function parse_sst(data, name/*:string*/, opts)/*:SST*/ { - if(name.slice(-4)===".bin") return parse_sst_bin((data/*:any*/), opts); - return parse_sst_xml((data/*:any*/), opts); -} - -function parse_cmnt(data, name/*:string*/, opts)/*:Array*/ { - if(name.slice(-4)===".bin") return parse_comments_bin((data/*:any*/), opts); - return parse_comments_xml((data/*:any*/), opts); -} - -function parse_cc(data, name/*:string*/, opts) { - if(name.slice(-4)===".bin") return parse_cc_bin((data/*:any*/), name, opts); - return parse_cc_xml((data/*:any*/), name, opts); -} - -function parse_xlink(data, rel, name/*:string*/, opts) { - if(name.slice(-4)===".bin") return parse_xlink_bin((data/*:any*/), rel, name, opts); - return parse_xlink_xml((data/*:any*/), rel, name, opts); -} - -function write_wb(wb, name/*:string*/, opts) { - return (name.slice(-4)===".bin" ? write_wb_bin : write_wb_xml)(wb, opts); -} - -function write_ws(data/*:number*/, name/*:string*/, opts, wb/*:Workbook*/, rels) { - return (name.slice(-4)===".bin" ? write_ws_bin : write_ws_xml)(data, opts, wb, rels); -} - -// eslint-disable-next-line no-unused-vars -function write_cs(data/*:number*/, name/*:string*/, opts, wb/*:Workbook*/, rels) { - return (name.slice(-4)===".bin" ? write_cs_bin : write_cs_xml)(data, opts, wb, rels); -} - -function write_sty(data, name/*:string*/, opts) { - return (name.slice(-4)===".bin" ? write_sty_bin : write_sty_xml)(data, opts); -} - -function write_sst(data/*:SST*/, name/*:string*/, opts) { - return (name.slice(-4)===".bin" ? write_sst_bin : write_sst_xml)(data, opts); -} - -function write_cmnt(data/*:Array*/, name/*:string*/, opts) { - return (name.slice(-4)===".bin" ? write_comments_bin : write_comments_xml)(data, opts); -} -/* -function write_cc(data, name:string, opts) { - return (name.slice(-4)===".bin" ? write_cc_bin : write_cc_xml)(data, opts); -} -*/ -var attregexg2=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g; -var attregex2=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/; -function xlml_parsexmltag(tag/*:string*/, skip_root/*:?boolean*/) { - var words = tag.split(/\s+/); - var z/*:any*/ = ([]/*:any*/); if(!skip_root) z[0] = words[0]; - if(words.length === 1) return z; - var m = tag.match(attregexg2), y, j, w, i; - if(m) for(i = 0; i != m.length; ++i) { - y = m[i].match(attregex2); -/*:: if(!y || !y[2]) continue; */ - if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1); - else { - if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6); - else w = y[1].slice(j+1); - z[w] = y[2].slice(1,y[2].length-1); - } - } - return z; -} -function xlml_parsexmltagobj(tag/*:string*/) { - var words = tag.split(/\s+/); - var z = {}; - if(words.length === 1) return z; - var m = tag.match(attregexg2), y, j, w, i; - if(m) for(i = 0; i != m.length; ++i) { - y = m[i].match(attregex2); -/*:: if(!y || !y[2]) continue; */ - if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1); - else { - if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6); - else w = y[1].slice(j+1); - z[w] = y[2].slice(1,y[2].length-1); - } - } - return z; -} - -// ---- - -function xlml_format(format, value)/*:string*/ { - var fmt = XLMLFormatMap[format] || unescapexml(format); - if(fmt === "General") return SSF._general(value); - return SSF.format(fmt, value); -} - -function xlml_set_custprop(Custprops, key, cp, val/*:string*/) { - var oval/*:any*/ = val; - switch((cp[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]) { - case "boolean": oval = parsexmlbool(val); break; - case "i2": case "int": oval = parseInt(val, 10); break; - case "r4": case "float": oval = parseFloat(val); break; - case "date": case "dateTime.tz": oval = parseDate(val); break; - case "i8": case "string": case "fixed": case "uuid": case "bin.base64": break; - default: throw new Error("bad custprop:" + cp[0]); - } - Custprops[unescapexml(key)] = oval; -} - -function safe_format_xlml(cell/*:Cell*/, nf, o) { - if(cell.t === 'z') return; - if(!o || o.cellText !== false) try { - if(cell.t === 'e') { cell.w = cell.w || BErr[cell.v]; } - else if(nf === "General") { - if(cell.t === 'n') { - if((cell.v|0) === cell.v) cell.w = SSF._general_int(cell.v); - else cell.w = SSF._general_num(cell.v); - } - else cell.w = SSF._general(cell.v); - } - else cell.w = xlml_format(nf||"General", cell.v); - } catch(e) { if(o.WTF) throw e; } - try { - var z = XLMLFormatMap[nf]||nf||"General"; - if(o.cellNF) cell.z = z; - if(o.cellDates && cell.t == 'n' && SSF.is_date(z)) { - var _d = SSF.parse_date_code(cell.v); if(_d) { cell.t = 'd'; cell.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); } - } - } catch(e) { if(o.WTF) throw e; } -} - -function process_style_xlml(styles, stag, opts) { - if(opts.cellStyles) { - if(stag.Interior) { - var I = stag.Interior; - if(I.Pattern) I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern; - } - } - styles[stag.ID] = stag; -} - -/* TODO: there must exist some form of OSP-blessed spec */ -function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, arrayf, o) { - var nf = "General", sid = cell.StyleID, S = {}; o = o || {}; - var interiors = []; - var i = 0; - if(sid === undefined && row) sid = row.StyleID; - if(sid === undefined && csty) sid = csty.StyleID; - while(styles[sid] !== undefined) { - if(styles[sid].nf) nf = styles[sid].nf; - if(styles[sid].Interior) interiors.push(styles[sid].Interior); - if(!styles[sid].Parent) break; - sid = styles[sid].Parent; - } - switch(data.Type) { - case 'Boolean': - cell.t = 'b'; - cell.v = parsexmlbool(xml); - break; - case 'String': - cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml)); - cell.v = (xml.indexOf("<") > -1 ? unescapexml(ss||xml).replace(/<.*?>/g, "") : cell.r); // todo: BR etc - break; - case 'DateTime': - if(xml.slice(-1) != "Z") xml += "Z"; - cell.v = (parseDate(xml) - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); - if(cell.v !== cell.v) cell.v = unescapexml(xml); - else if(cell.v<60) cell.v = cell.v -1; - if(!nf || nf == "General") nf = "yyyy-mm-dd"; - /* falls through */ - case 'Number': - if(cell.v === undefined) cell.v=+xml; - if(!cell.t) cell.t = 'n'; - break; - case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break; - default: - if(xml == "" && ss == "") { cell.t = 'z'; } - else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); } - break; - } - safe_format_xlml(cell, nf, o); - if(o.cellFormula !== false) { - if(cell.Formula) { - var fstr = unescapexml(cell.Formula); - /* strictly speaking, the leading = is required but some writers omit */ - if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1); - cell.f = rc_to_a1(fstr, base); - delete cell.Formula; - if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base); - else if(cell.ArrayRange) { - cell.F = rc_to_a1(cell.ArrayRange, base); - arrayf.push([safe_decode_range(cell.F), cell.F]); - } - } else { - for(i = 0; i < arrayf.length; ++i) - if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r) - if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c) - cell.F = arrayf[i][1]; - } - } - if(o.cellStyles) { - interiors.forEach(function(x) { - if(!S.patternType && x.patternType) S.patternType = x.patternType; - }); - cell.s = S; - } - if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID; -} - -function xlml_clean_comment(comment/*:any*/) { - comment.t = comment.v || ""; - comment.t = comment.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"); - comment.v = comment.w = comment.ixfe = undefined; -} - -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"); -} - -/* TODO: Everything */ -/* UOS uses CJK in tags */ -var xlmlregex = /<(\/?)([^\s?>:\/]+)(?:[\s?:\/][^>]*)?>/mg; -//var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/mg; -function parse_xlml_xml(d, _opts)/*:Workbook*/ { - var opts = _opts || {}; - make_ssf(SSF); - var str = debom(xlml_normalize(d)); - if(opts.type == 'binary' || opts.type == 'array' || opts.type == 'base64') { - if(typeof cptable !== 'undefined') str = cptable.utils.decode(65001, char_codes(str)); - else str = utf8read(str); - } - var opening = str.slice(0, 1024).toLowerCase(), ishtml = false; - opening = opening.replace(/".*?"/g, ""); - if((opening.indexOf(">") & 1023) > Math.min((opening.indexOf(",") & 1023), (opening.indexOf(";")&1023))) { var _o = dup(opts); _o.type = "string"; return PRN.to_workbook(str, _o); } - if(opening.indexOf("= 0) ishtml = true; }); - if(ishtml) return HTML_.to_workbook(str, opts); - var Rn; - var state = [], tmp; - if(DENSE != null && opts.dense == null) opts.dense = DENSE; - var sheets = {}, sheetnames/*:Array*/ = [], cursheet/*:Worksheet*/ = (opts.dense ? [] : {}), sheetname = ""; - var table = {}, cell = ({}/*:any*/), row = {};// eslint-disable-line no-unused-vars - var dtag = xlml_parsexmltag(''), didx = 0; - var c = 0, r = 0; - var refguess/*:Range*/ = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; - var styles = {}, stag = {}; - var ss = "", fidx = 0; - var merges/*:Array*/ = []; - var Props = {}, Custprops = {}, pidx = 0, cp = []; - var comments/*:Array*/ = [], comment/*:Comment*/ = ({}/*:any*/); - var cstys = [], csty, seencol = false; - var arrayf/*:Array<[Range, string]>*/ = []; - var rowinfo/*:Array*/ = [], rowobj = {}, cc = 0, rr = 0; - var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false} }/*:any*/), wsprops = {}; - xlmlregex.lastIndex = 0; - str = str.replace(//mg,""); - var raw_Rn3 = ""; - while((Rn = xlmlregex.exec(str))) switch((Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase())) { - case 'data' /*case 'Data'*/: - if(raw_Rn3 == "data") { - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} - else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); - break; - } - if(state[state.length-1][1]) break; - if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]==/*"Comment"*/"comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts); - else { ss = ""; dtag = xlml_parsexmltag(Rn[0]); didx = Rn.index + Rn[0].length; } - break; - case 'cell' /*case 'Cell'*/: - if(Rn[1]==='/'){ - if(comments.length > 0) cell.c = comments; - if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== undefined) { - if(opts.dense) { - if(!cursheet[r]) cursheet[r] = []; - cursheet[r][c] = cell; - } else cursheet[encode_col(c) + encode_row(r)] = cell; - } - if(cell.HRef) { - cell.l = ({Target:unescapexml(cell.HRef)}/*:any*/); - if(cell.HRefScreenTip) cell.l.Tooltip = cell.HRefScreenTip; - delete cell.HRef; delete cell.HRefScreenTip; - } - if(cell.MergeAcross || cell.MergeDown) { - cc = c + (parseInt(cell.MergeAcross,10)|0); - rr = r + (parseInt(cell.MergeDown,10)|0); - merges.push({s:{c:c,r:r},e:{c:cc,r:rr}}); - } - if(!opts.sheetStubs) { if(cell.MergeAcross) c = cc + 1; else ++c; } - else if(cell.MergeAcross || cell.MergeDown) { - /*:: if(!cc) cc = 0; if(!rr) rr = 0; */ - for(var cma = c; cma <= cc; ++cma) { - for(var cmd = r; cmd <= rr; ++cmd) { - if(cma > c || cmd > r) { - if(opts.dense) { - if(!cursheet[cmd]) cursheet[cmd] = []; - cursheet[cmd][cma] = {t:'z'}; - } else cursheet[encode_col(cma) + encode_row(cmd)] = {t:'z'}; - } - } - } - c = cc + 1; - } - else ++c; - } else { - cell = xlml_parsexmltagobj(Rn[0]); - if(cell.Index) c = +cell.Index - 1; - if(c < refguess.s.c) refguess.s.c = c; - if(c > refguess.e.c) refguess.e.c = c; - if(Rn[0].slice(-2) === "/>") ++c; - comments = []; - } - break; - case 'row' /*case 'Row'*/: - if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") { - if(r < refguess.s.r) refguess.s.r = r; - if(r > refguess.e.r) refguess.e.r = r; - if(Rn[0].slice(-2) === "/>") { - row = xlml_parsexmltag(Rn[0]); - if(row.Index) r = +row.Index - 1; - } - c = 0; ++r; - } else { - row = xlml_parsexmltag(Rn[0]); - if(row.Index) r = +row.Index - 1; - rowobj = {}; - if(row.AutoFitHeight == "0" || row.Height) { - rowobj.hpx = parseInt(row.Height, 10); rowobj.hpt = px2pt(rowobj.hpx); - rowinfo[r] = rowobj; - } - if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; } - } - break; - case 'worksheet' /*case 'Worksheet'*/: /* TODO: read range from FullRows/FullColumns */ - if(Rn[1]==='/'){ - if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); - sheetnames.push(sheetname); - if(refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) { - cursheet["!ref"] = encode_range(refguess); - if(opts.sheetRows && opts.sheetRows <= refguess.e.r) { - cursheet["!fullref"] = cursheet["!ref"]; - refguess.e.r = opts.sheetRows - 1; - cursheet["!ref"] = encode_range(refguess); - } - } - if(merges.length) cursheet["!merges"] = merges; - if(cstys.length > 0) cursheet["!cols"] = cstys; - if(rowinfo.length > 0) cursheet["!rows"] = rowinfo; - sheets[sheetname] = cursheet; - } else { - refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; - r = c = 0; - state.push([Rn[3], false]); - tmp = xlml_parsexmltag(Rn[0]); - sheetname = unescapexml(tmp.Name); - cursheet = (opts.dense ? [] : {}); - merges = []; - arrayf = []; - rowinfo = []; - wsprops = {name:sheetname, Hidden:0}; - Workbook.Sheets.push(wsprops); - } - break; - case 'table' /*case 'Table'*/: - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} - else if(Rn[0].slice(-2) == "/>") break; - else { - table = xlml_parsexmltag(Rn[0]); - state.push([Rn[3], false]); - cstys = []; seencol = false; - } - break; - - case 'style' /*case 'Style'*/: - if(Rn[1]==='/') process_style_xlml(styles, stag, opts); - else stag = xlml_parsexmltag(Rn[0]); - break; - - case 'numberformat' /*case 'NumberFormat'*/: - stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General"); - if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf]; - for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == stag.nf) break; - if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == null) { SSF.load(stag.nf, ssfidx); break; } - break; - - case 'column' /*case 'Column'*/: - if(state[state.length-1][0] !== /*'Table'*/'table') break; - csty = xlml_parsexmltag(Rn[0]); - if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; } - if(csty.Width) csty.wpx = parseInt(csty.Width, 10); - if(!seencol && csty.wpx > 10) { - seencol = true; MDW = DEF_MDW; //find_mdw_wpx(csty.wpx); - for(var _col = 0; _col < cstys.length; ++_col) if(cstys[_col]) process_col(cstys[_col]); - } - if(seencol) process_col(csty); - cstys[(csty.Index-1||cstys.length)] = csty; - for(var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty); - break; - - case 'namedrange' /*case 'NamedRange'*/: - if(Rn[1]==='/') break; - if(!Workbook.Names) Workbook.Names = []; - var _NamedRange = parsexmltag(Rn[0]); - var _DefinedName/*:DefinedName*/ = ({ - Name: _NamedRange.Name, - Ref: rc_to_a1(_NamedRange.RefersTo.slice(1), {r:0, c:0}) - }/*:any*/); - if(Workbook.Sheets.length>0) _DefinedName.Sheet=Workbook.Sheets.length-1; - /*:: if(Workbook.Names) */Workbook.Names.push(_DefinedName); - break; - - case 'namedcell' /*case 'NamedCell'*/: break; - case 'b' /*case 'B'*/: break; - case 'i' /*case 'I'*/: break; - case 'u' /*case 'U'*/: break; - case 's' /*case 'S'*/: break; - case 'em' /*case 'EM'*/: break; - case 'h2' /*case 'H2'*/: break; - case 'h3' /*case 'H3'*/: break; - case 'sub' /*case 'Sub'*/: break; - case 'sup' /*case 'Sup'*/: break; - case 'span' /*case 'Span'*/: break; - case 'alignment' /*case 'Alignment'*/: - break; - case 'borders' /*case 'Borders'*/: break; - case 'border' /*case 'Border'*/: break; - case 'font' /*case 'Font'*/: - if(Rn[0].slice(-2) === "/>") break; - else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index); - else fidx = Rn.index + Rn[0].length; - break; - case 'interior' /*case 'Interior'*/: - if(!opts.cellStyles) break; - stag.Interior = xlml_parsexmltag(Rn[0]); - break; - case 'protection' /*case 'Protection'*/: break; - - case 'author' /*case 'Author'*/: - case 'title' /*case 'Title'*/: - case 'description' /*case 'Description'*/: - case 'created' /*case 'Created'*/: - case 'keywords' /*case 'Keywords'*/: - case 'subject' /*case 'Subject'*/: - case 'category' /*case 'Category'*/: - case 'company' /*case 'Company'*/: - case 'lastauthor' /*case 'LastAuthor'*/: - case 'lastsaved' /*case 'LastSaved'*/: - case 'lastprinted' /*case 'LastPrinted'*/: - case 'version' /*case 'Version'*/: - case 'revision' /*case 'Revision'*/: - case 'totaltime' /*case 'TotalTime'*/: - case 'hyperlinkbase' /*case 'HyperlinkBase'*/: - case 'manager' /*case 'Manager'*/: - case 'contentstatus' /*case 'ContentStatus'*/: - case 'identifier' /*case 'Identifier'*/: - case 'language' /*case 'Language'*/: - case 'appname' /*case 'AppName'*/: - if(Rn[0].slice(-2) === "/>") break; - else if(Rn[1]==="/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index)); - else pidx = Rn.index + Rn[0].length; - break; - case 'paragraphs' /*case 'Paragraphs'*/: break; - - case 'styles' /*case 'Styles'*/: - case 'workbook' /*case 'Workbook'*/: - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} - else state.push([Rn[3], false]); - break; - - case 'comment' /*case 'Comment'*/: - if(Rn[1]==='/'){ - if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); - xlml_clean_comment(comment); - comments.push(comment); - } else { - state.push([Rn[3], false]); - tmp = xlml_parsexmltag(Rn[0]); - comment = ({a:tmp.Author}/*:any*/); - } - break; - - case 'autofilter' /*case 'AutoFilter'*/: - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} - else if(Rn[0].charAt(Rn[0].length-2) !== '/') { - var AutoFilter = xlml_parsexmltag(Rn[0]); - cursheet['!autofilter'] = { ref:rc_to_a1(AutoFilter.Range).replace(/\$/g,"") }; - state.push([Rn[3], true]); - } - break; - - case 'name' /*case 'Name'*/: break; - - case 'datavalidation' /*case 'DataValidation'*/: - if(Rn[1]==='/'){ - if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); - } else { - if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); - } - break; - - case 'pixelsperinch' /*case 'PixelsPerInch'*/: - break; - case 'componentoptions' /*case 'ComponentOptions'*/: - case 'documentproperties' /*case 'DocumentProperties'*/: - case 'customdocumentproperties' /*case 'CustomDocumentProperties'*/: - case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: - case 'pivottable' /*case 'PivotTable'*/: - case 'pivotcache' /*case 'PivotCache'*/: - case 'names' /*case 'Names'*/: - case 'mapinfo' /*case 'MapInfo'*/: - case 'pagebreaks' /*case 'PageBreaks'*/: - case 'querytable' /*case 'QueryTable'*/: - case 'sorting' /*case 'Sorting'*/: - case 'schema' /*case 'Schema'*/: //case 'data' /*case 'data'*/: - case 'conditionalformatting' /*case 'ConditionalFormatting'*/: - case 'smarttagtype' /*case 'SmartTagType'*/: - case 'smarttags' /*case 'SmartTags'*/: - case 'excelworkbook' /*case 'ExcelWorkbook'*/: - case 'workbookoptions' /*case 'WorkbookOptions'*/: - case 'worksheetoptions' /*case 'WorksheetOptions'*/: - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} - else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); - break; - - case 'null' /*case 'Null'*/: break; - - default: - /* FODS file root is */ - if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts); - /* UOS file root is */ - if(state.length == 0 && Rn[3] == "uof"/*"UOF"*/) return parse_fods(str, opts); - - var seen = true; - switch(state[state.length-1][0]) { - /* OfficeDocumentSettings */ - case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: switch(Rn[3]) { - case 'allowpng' /*case 'AllowPNG'*/: break; - case 'removepersonalinformation' /*case 'RemovePersonalInformation'*/: break; - case 'downloadcomponents' /*case 'DownloadComponents'*/: break; - case 'locationofcomponents' /*case 'LocationOfComponents'*/: break; - case 'colors' /*case 'Colors'*/: break; - case 'color' /*case 'Color'*/: break; - case 'index' /*case 'Index'*/: break; - case 'rgb' /*case 'RGB'*/: break; - case 'targetscreensize' /*case 'TargetScreenSize'*/: break; - case 'readonlyrecommended' /*case 'ReadOnlyRecommended'*/: break; - default: seen = false; - } break; - - /* ComponentOptions */ - case 'componentoptions' /*case 'ComponentOptions'*/: switch(Rn[3]) { - case 'toolbar' /*case 'Toolbar'*/: break; - case 'hideofficelogo' /*case 'HideOfficeLogo'*/: break; - case 'spreadsheetautofit' /*case 'SpreadsheetAutoFit'*/: break; - case 'label' /*case 'Label'*/: break; - case 'caption' /*case 'Caption'*/: break; - case 'maxheight' /*case 'MaxHeight'*/: break; - case 'maxwidth' /*case 'MaxWidth'*/: break; - case 'nextsheetnumber' /*case 'NextSheetNumber'*/: break; - default: seen = false; - } break; - - /* ExcelWorkbook */ - case 'excelworkbook' /*case 'ExcelWorkbook'*/: switch(Rn[3]) { - case 'date1904' /*case 'Date1904'*/: - /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ - Workbook.WBProps.date1904 = true; - break; - case 'windowheight' /*case 'WindowHeight'*/: break; - case 'windowwidth' /*case 'WindowWidth'*/: break; - case 'windowtopx' /*case 'WindowTopX'*/: break; - case 'windowtopy' /*case 'WindowTopY'*/: break; - case 'tabratio' /*case 'TabRatio'*/: break; - case 'protectstructure' /*case 'ProtectStructure'*/: break; - case 'protectwindow' /*case 'ProtectWindow'*/: break; - case 'protectwindows' /*case 'ProtectWindows'*/: break; - case 'activesheet' /*case 'ActiveSheet'*/: break; - case 'displayinknotes' /*case 'DisplayInkNotes'*/: break; - case 'firstvisiblesheet' /*case 'FirstVisibleSheet'*/: break; - case 'supbook' /*case 'SupBook'*/: break; - case 'sheetname' /*case 'SheetName'*/: break; - case 'sheetindex' /*case 'SheetIndex'*/: break; - case 'sheetindexfirst' /*case 'SheetIndexFirst'*/: break; - case 'sheetindexlast' /*case 'SheetIndexLast'*/: break; - case 'dll' /*case 'Dll'*/: break; - case 'acceptlabelsinformulas' /*case 'AcceptLabelsInFormulas'*/: break; - case 'donotsavelinkvalues' /*case 'DoNotSaveLinkValues'*/: break; - case 'iteration' /*case 'Iteration'*/: break; - case 'maxiterations' /*case 'MaxIterations'*/: break; - case 'maxchange' /*case 'MaxChange'*/: break; - case 'path' /*case 'Path'*/: break; - case 'xct' /*case 'Xct'*/: break; - case 'count' /*case 'Count'*/: break; - case 'selectedsheets' /*case 'SelectedSheets'*/: break; - case 'calculation' /*case 'Calculation'*/: break; - case 'uncalced' /*case 'Uncalced'*/: break; - case 'startupprompt' /*case 'StartupPrompt'*/: break; - case 'crn' /*case 'Crn'*/: break; - case 'externname' /*case 'ExternName'*/: break; - case 'formula' /*case 'Formula'*/: break; - case 'colfirst' /*case 'ColFirst'*/: break; - case 'collast' /*case 'ColLast'*/: break; - case 'wantadvise' /*case 'WantAdvise'*/: break; - case 'boolean' /*case 'Boolean'*/: break; - case 'error' /*case 'Error'*/: break; - case 'text' /*case 'Text'*/: break; - case 'ole' /*case 'OLE'*/: break; - case 'noautorecover' /*case 'NoAutoRecover'*/: break; - case 'publishobjects' /*case 'PublishObjects'*/: break; - case 'donotcalculatebeforesave' /*case 'DoNotCalculateBeforeSave'*/: break; - case 'number' /*case 'Number'*/: break; - case 'refmoder1c1' /*case 'RefModeR1C1'*/: break; - case 'embedsavesmarttags' /*case 'EmbedSaveSmartTags'*/: break; - default: seen = false; - } break; - - /* WorkbookOptions */ - case 'workbookoptions' /*case 'WorkbookOptions'*/: switch(Rn[3]) { - case 'owcversion' /*case 'OWCVersion'*/: break; - case 'height' /*case 'Height'*/: break; - case 'width' /*case 'Width'*/: break; - default: seen = false; - } break; - - /* WorksheetOptions */ - case 'worksheetoptions' /*case 'WorksheetOptions'*/: switch(Rn[3]) { - case 'visible' /*case 'Visible'*/: - if(Rn[0].slice(-2) === "/>"){/* empty */} - else if(Rn[1]==="/") switch(str.slice(pidx, Rn.index)) { - case "SheetHidden": wsprops.Hidden = 1; break; - case "SheetVeryHidden": wsprops.Hidden = 2; break; - } - else pidx = Rn.index + Rn[0].length; - break; - case 'header' /*case 'Header'*/: - if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml'); - cursheet['!margins'].header = parsexmltag(Rn[0]).Margin; - break; - case 'footer' /*case 'Footer'*/: - if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml'); - cursheet['!margins'].footer = parsexmltag(Rn[0]).Margin; - break; - case 'pagemargins' /*case 'PageMargins'*/: - var pagemargins = parsexmltag(Rn[0]); - if(!cursheet['!margins']) default_margins(cursheet['!margins']={},'xlml'); - if(pagemargins.Top) cursheet['!margins'].top = pagemargins.Top; - if(pagemargins.Left) cursheet['!margins'].left = pagemargins.Left; - if(pagemargins.Right) cursheet['!margins'].right = pagemargins.Right; - if(pagemargins.Bottom) cursheet['!margins'].bottom = pagemargins.Bottom; - break; - case 'displayrighttoleft' /*case 'DisplayRightToLeft'*/: - if(!Workbook.Views) Workbook.Views = []; - if(!Workbook.Views[0]) Workbook.Views[0] = {}; - Workbook.Views[0].RTL = true; - break; - - case 'freezepanes' /*case 'FreezePanes'*/: break; - case 'frozennosplit' /*case 'FrozenNoSplit'*/: break; - - case 'splithorizontal' /*case 'SplitHorizontal'*/: - case 'splitvertical' /*case 'SplitVertical'*/: - break; - - case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/: - break; - - case 'activerow' /*case 'ActiveRow'*/: break; - case 'activecol' /*case 'ActiveCol'*/: break; - case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break; - case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break; - - case 'unsynced' /*case 'Unsynced'*/: break; - case 'print' /*case 'Print'*/: break; - case 'printerrors' /*case 'PrintErrors'*/: break; - case 'panes' /*case 'Panes'*/: break; - case 'scale' /*case 'Scale'*/: break; - case 'pane' /*case 'Pane'*/: break; - case 'number' /*case 'Number'*/: break; - case 'layout' /*case 'Layout'*/: break; - case 'pagesetup' /*case 'PageSetup'*/: break; - case 'selected' /*case 'Selected'*/: break; - case 'protectobjects' /*case 'ProtectObjects'*/: break; - case 'enableselection' /*case 'EnableSelection'*/: break; - case 'protectscenarios' /*case 'ProtectScenarios'*/: break; - case 'validprinterinfo' /*case 'ValidPrinterInfo'*/: break; - case 'horizontalresolution' /*case 'HorizontalResolution'*/: break; - case 'verticalresolution' /*case 'VerticalResolution'*/: break; - case 'numberofcopies' /*case 'NumberofCopies'*/: break; - case 'activepane' /*case 'ActivePane'*/: break; - case 'toprowvisible' /*case 'TopRowVisible'*/: break; - case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break; - case 'fittopage' /*case 'FitToPage'*/: break; - case 'rangeselection' /*case 'RangeSelection'*/: break; - case 'papersizeindex' /*case 'PaperSizeIndex'*/: break; - case 'pagelayoutzoom' /*case 'PageLayoutZoom'*/: break; - case 'pagebreakzoom' /*case 'PageBreakZoom'*/: break; - case 'filteron' /*case 'FilterOn'*/: break; - case 'fitwidth' /*case 'FitWidth'*/: break; - case 'fitheight' /*case 'FitHeight'*/: break; - case 'commentslayout' /*case 'CommentsLayout'*/: break; - case 'zoom' /*case 'Zoom'*/: break; - case 'lefttoright' /*case 'LeftToRight'*/: break; - case 'gridlines' /*case 'Gridlines'*/: break; - case 'allowsort' /*case 'AllowSort'*/: break; - case 'allowfilter' /*case 'AllowFilter'*/: break; - case 'allowinsertrows' /*case 'AllowInsertRows'*/: break; - case 'allowdeleterows' /*case 'AllowDeleteRows'*/: break; - case 'allowinsertcols' /*case 'AllowInsertCols'*/: break; - case 'allowdeletecols' /*case 'AllowDeleteCols'*/: break; - case 'allowinserthyperlinks' /*case 'AllowInsertHyperlinks'*/: break; - case 'allowformatcells' /*case 'AllowFormatCells'*/: break; - case 'allowsizecols' /*case 'AllowSizeCols'*/: break; - case 'allowsizerows' /*case 'AllowSizeRows'*/: break; - case 'nosummaryrowsbelowdetail' /*case 'NoSummaryRowsBelowDetail'*/: - if(!cursheet["!outline"]) cursheet["!outline"] = {}; - cursheet["!outline"].above = true; - break; - case 'tabcolorindex' /*case 'TabColorIndex'*/: break; - case 'donotdisplayheadings' /*case 'DoNotDisplayHeadings'*/: break; - case 'showpagelayoutzoom' /*case 'ShowPageLayoutZoom'*/: break; - case 'nosummarycolumnsrightdetail' /*case 'NoSummaryColumnsRightDetail'*/: - if(!cursheet["!outline"]) cursheet["!outline"] = {}; - cursheet["!outline"].left = true; - break; - case 'blackandwhite' /*case 'BlackAndWhite'*/: break; - case 'donotdisplayzeros' /*case 'DoNotDisplayZeros'*/: break; - case 'displaypagebreak' /*case 'DisplayPageBreak'*/: break; - case 'rowcolheadings' /*case 'RowColHeadings'*/: break; - case 'donotdisplayoutline' /*case 'DoNotDisplayOutline'*/: break; - case 'noorientation' /*case 'NoOrientation'*/: break; - case 'allowusepivottables' /*case 'AllowUsePivotTables'*/: break; - case 'zeroheight' /*case 'ZeroHeight'*/: break; - case 'viewablerange' /*case 'ViewableRange'*/: break; - case 'selection' /*case 'Selection'*/: break; - case 'protectcontents' /*case 'ProtectContents'*/: break; - default: seen = false; - } break; - - /* PivotTable */ - case 'pivottable' /*case 'PivotTable'*/: case 'pivotcache' /*case 'PivotCache'*/: switch(Rn[3]) { - case 'immediateitemsondrop' /*case 'ImmediateItemsOnDrop'*/: break; - case 'showpagemultipleitemlabel' /*case 'ShowPageMultipleItemLabel'*/: break; - case 'compactrowindent' /*case 'CompactRowIndent'*/: break; - case 'location' /*case 'Location'*/: break; - case 'pivotfield' /*case 'PivotField'*/: break; - case 'orientation' /*case 'Orientation'*/: break; - case 'layoutform' /*case 'LayoutForm'*/: break; - case 'layoutsubtotallocation' /*case 'LayoutSubtotalLocation'*/: break; - case 'layoutcompactrow' /*case 'LayoutCompactRow'*/: break; - case 'position' /*case 'Position'*/: break; - case 'pivotitem' /*case 'PivotItem'*/: break; - case 'datatype' /*case 'DataType'*/: break; - case 'datafield' /*case 'DataField'*/: break; - case 'sourcename' /*case 'SourceName'*/: break; - case 'parentfield' /*case 'ParentField'*/: break; - case 'ptlineitems' /*case 'PTLineItems'*/: break; - case 'ptlineitem' /*case 'PTLineItem'*/: break; - case 'countofsameitems' /*case 'CountOfSameItems'*/: break; - case 'item' /*case 'Item'*/: break; - case 'itemtype' /*case 'ItemType'*/: break; - case 'ptsource' /*case 'PTSource'*/: break; - case 'cacheindex' /*case 'CacheIndex'*/: break; - case 'consolidationreference' /*case 'ConsolidationReference'*/: break; - case 'filename' /*case 'FileName'*/: break; - case 'reference' /*case 'Reference'*/: break; - case 'nocolumngrand' /*case 'NoColumnGrand'*/: break; - case 'norowgrand' /*case 'NoRowGrand'*/: break; - case 'blanklineafteritems' /*case 'BlankLineAfterItems'*/: break; - case 'hidden' /*case 'Hidden'*/: break; - case 'subtotal' /*case 'Subtotal'*/: break; - case 'basefield' /*case 'BaseField'*/: break; - case 'mapchilditems' /*case 'MapChildItems'*/: break; - case 'function' /*case 'Function'*/: break; - case 'refreshonfileopen' /*case 'RefreshOnFileOpen'*/: break; - case 'printsettitles' /*case 'PrintSetTitles'*/: break; - case 'mergelabels' /*case 'MergeLabels'*/: break; - case 'defaultversion' /*case 'DefaultVersion'*/: break; - case 'refreshname' /*case 'RefreshName'*/: break; - case 'refreshdate' /*case 'RefreshDate'*/: break; - case 'refreshdatecopy' /*case 'RefreshDateCopy'*/: break; - case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break; - case 'versionlastupdate' /*case 'VersionLastUpdate'*/: break; - case 'versionupdateablemin' /*case 'VersionUpdateableMin'*/: break; - case 'versionrefreshablemin' /*case 'VersionRefreshableMin'*/: break; - case 'calculation' /*case 'Calculation'*/: break; - default: seen = false; - } break; - - /* PageBreaks */ - case 'pagebreaks' /*case 'PageBreaks'*/: switch(Rn[3]) { - case 'colbreaks' /*case 'ColBreaks'*/: break; - case 'colbreak' /*case 'ColBreak'*/: break; - case 'rowbreaks' /*case 'RowBreaks'*/: break; - case 'rowbreak' /*case 'RowBreak'*/: break; - case 'colstart' /*case 'ColStart'*/: break; - case 'colend' /*case 'ColEnd'*/: break; - case 'rowend' /*case 'RowEnd'*/: break; - default: seen = false; - } break; - - /* AutoFilter */ - case 'autofilter' /*case 'AutoFilter'*/: switch(Rn[3]) { - case 'autofiltercolumn' /*case 'AutoFilterColumn'*/: break; - case 'autofiltercondition' /*case 'AutoFilterCondition'*/: break; - case 'autofilterand' /*case 'AutoFilterAnd'*/: break; - case 'autofilteror' /*case 'AutoFilterOr'*/: break; - default: seen = false; - } break; - - /* QueryTable */ - case 'querytable' /*case 'QueryTable'*/: switch(Rn[3]) { - case 'id' /*case 'Id'*/: break; - case 'autoformatfont' /*case 'AutoFormatFont'*/: break; - case 'autoformatpattern' /*case 'AutoFormatPattern'*/: break; - case 'querysource' /*case 'QuerySource'*/: break; - case 'querytype' /*case 'QueryType'*/: break; - case 'enableredirections' /*case 'EnableRedirections'*/: break; - case 'refreshedinxl9' /*case 'RefreshedInXl9'*/: break; - case 'urlstring' /*case 'URLString'*/: break; - case 'htmltables' /*case 'HTMLTables'*/: break; - case 'connection' /*case 'Connection'*/: break; - case 'commandtext' /*case 'CommandText'*/: break; - case 'refreshinfo' /*case 'RefreshInfo'*/: break; - case 'notitles' /*case 'NoTitles'*/: break; - case 'nextid' /*case 'NextId'*/: break; - case 'columninfo' /*case 'ColumnInfo'*/: break; - case 'overwritecells' /*case 'OverwriteCells'*/: break; - case 'donotpromptforfile' /*case 'DoNotPromptForFile'*/: break; - case 'textwizardsettings' /*case 'TextWizardSettings'*/: break; - case 'source' /*case 'Source'*/: break; - case 'number' /*case 'Number'*/: break; - case 'decimal' /*case 'Decimal'*/: break; - case 'thousandseparator' /*case 'ThousandSeparator'*/: break; - case 'trailingminusnumbers' /*case 'TrailingMinusNumbers'*/: break; - case 'formatsettings' /*case 'FormatSettings'*/: break; - case 'fieldtype' /*case 'FieldType'*/: break; - case 'delimiters' /*case 'Delimiters'*/: break; - case 'tab' /*case 'Tab'*/: break; - case 'comma' /*case 'Comma'*/: break; - case 'autoformatname' /*case 'AutoFormatName'*/: break; - case 'versionlastedit' /*case 'VersionLastEdit'*/: break; - case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break; - default: seen = false; - } break; - - case 'datavalidation' /*case 'DataValidation'*/: - switch(Rn[3]) { - case 'range' /*case 'Range'*/: break; - - case 'type' /*case 'Type'*/: break; - case 'min' /*case 'Min'*/: break; - case 'max' /*case 'Max'*/: break; - case 'sort' /*case 'Sort'*/: break; - case 'descending' /*case 'Descending'*/: break; - case 'order' /*case 'Order'*/: break; - case 'casesensitive' /*case 'CaseSensitive'*/: break; - case 'value' /*case 'Value'*/: break; - case 'errorstyle' /*case 'ErrorStyle'*/: break; - case 'errormessage' /*case 'ErrorMessage'*/: break; - case 'errortitle' /*case 'ErrorTitle'*/: break; - case 'inputmessage' /*case 'InputMessage'*/: break; - case 'inputtitle' /*case 'InputTitle'*/: break; - case 'combohide' /*case 'ComboHide'*/: break; - case 'inputhide' /*case 'InputHide'*/: break; - case 'condition' /*case 'Condition'*/: break; - case 'qualifier' /*case 'Qualifier'*/: break; - case 'useblank' /*case 'UseBlank'*/: break; - case 'value1' /*case 'Value1'*/: break; - case 'value2' /*case 'Value2'*/: break; - case 'format' /*case 'Format'*/: break; - - case 'cellrangelist' /*case 'CellRangeList'*/: break; - default: seen = false; - } break; - - case 'sorting' /*case 'Sorting'*/: - case 'conditionalformatting' /*case 'ConditionalFormatting'*/: - switch(Rn[3]) { - case 'range' /*case 'Range'*/: break; - case 'type' /*case 'Type'*/: break; - case 'min' /*case 'Min'*/: break; - case 'max' /*case 'Max'*/: break; - case 'sort' /*case 'Sort'*/: break; - case 'descending' /*case 'Descending'*/: break; - case 'order' /*case 'Order'*/: break; - case 'casesensitive' /*case 'CaseSensitive'*/: break; - case 'value' /*case 'Value'*/: break; - case 'errorstyle' /*case 'ErrorStyle'*/: break; - case 'errormessage' /*case 'ErrorMessage'*/: break; - case 'errortitle' /*case 'ErrorTitle'*/: break; - case 'cellrangelist' /*case 'CellRangeList'*/: break; - case 'inputmessage' /*case 'InputMessage'*/: break; - case 'inputtitle' /*case 'InputTitle'*/: break; - case 'combohide' /*case 'ComboHide'*/: break; - case 'inputhide' /*case 'InputHide'*/: break; - case 'condition' /*case 'Condition'*/: break; - case 'qualifier' /*case 'Qualifier'*/: break; - case 'useblank' /*case 'UseBlank'*/: break; - case 'value1' /*case 'Value1'*/: break; - case 'value2' /*case 'Value2'*/: break; - case 'format' /*case 'Format'*/: break; - default: seen = false; - } break; - - /* MapInfo (schema) */ - case 'mapinfo' /*case 'MapInfo'*/: case 'schema' /*case 'Schema'*/: case 'data' /*case 'data'*/: switch(Rn[3]) { - case 'map' /*case 'Map'*/: break; - case 'entry' /*case 'Entry'*/: break; - case 'range' /*case 'Range'*/: break; - case 'xpath' /*case 'XPath'*/: break; - case 'field' /*case 'Field'*/: break; - case 'xsdtype' /*case 'XSDType'*/: break; - case 'filteron' /*case 'FilterOn'*/: break; - case 'aggregate' /*case 'Aggregate'*/: break; - case 'elementtype' /*case 'ElementType'*/: break; - case 'attributetype' /*case 'AttributeType'*/: break; - /* These are from xsd (XML Schema Definition) */ - case 'schema' /*case 'schema'*/: - case 'element' /*case 'element'*/: - case 'complextype' /*case 'complexType'*/: - case 'datatype' /*case 'datatype'*/: - case 'all' /*case 'all'*/: - case 'attribute' /*case 'attribute'*/: - case 'extends' /*case 'extends'*/: break; - - case 'row' /*case 'row'*/: break; - default: seen = false; - } break; - - /* SmartTags (can be anything) */ - case 'smarttags' /*case 'SmartTags'*/: break; - - default: seen = false; break; - } - if(seen) break; - /* CustomDocumentProperties */ - if(Rn[3].match(/!\[CDATA/)) break; - if(!state[state.length-1][1]) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); - if(state[state.length-1][0]===/*'CustomDocumentProperties'*/'customdocumentproperties') { - if(Rn[0].slice(-2) === "/>") break; - else if(Rn[1]==="/") xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index)); - else { cp = Rn; pidx = Rn.index + Rn[0].length; } - break; - } - if(opts.WTF) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); - } - var out = ({}/*:any*/); - if(!opts.bookSheets && !opts.bookProps) out.Sheets = sheets; - out.SheetNames = sheetnames; - out.Workbook = Workbook; - out.SSF = SSF.get_table(); - out.Props = Props; - out.Custprops = Custprops; - return out; -} - -function parse_xlml(data/*:RawBytes|string*/, opts)/*:Workbook*/ { - fix_read_opts(opts=opts||{}); - switch(opts.type||"base64") { - case "base64": return parse_xlml_xml(Base64.decode(data), opts); - case "binary": case "buffer": case "file": return parse_xlml_xml(data, opts); - case "array": return parse_xlml_xml(a2s(data), opts); - } - /*:: throw new Error("unsupported type " + opts.type); */ -} - -/* TODO */ -function write_props_xlml(wb/*:Workbook*/, opts)/*:string*/ { - var o/*:Array*/ = []; - /* DocumentProperties */ - if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts)); - /* CustomDocumentProperties */ - if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts)); - return o.join(""); -} -/* TODO */ -function write_wb_xlml(/*::wb, opts*/)/*:string*/ { - /* OfficeDocumentSettings */ - /* ExcelWorkbook */ - return ""; -} -/* TODO */ -function write_sty_xlml(wb, opts)/*:string*/ { - /* Styles */ - var styles/*:Array*/ = ['']; - opts.cellXfs.forEach(function(xf, id) { - var payload/*:Array*/ = []; - payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])})); - - var o = /*::(*/{"ss:ID": "s" + (21+id)}/*:: :any)*/; - styles.push(writextag('Style', payload.join(""), o)); - }); - return writextag("Styles", styles.join("")); -} -function write_name_xlml(n) { return writextag("NamedRange", null, {"ss:Name": n.Name, "ss:RefersTo":"=" + a1_to_rc(n.Ref, {r:0,c:0})}); } -function write_names_xlml(wb/*::, opts*/)/*:string*/ { - if(!((wb||{}).Workbook||{}).Names) return ""; - /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */ - var names/*:Array*/ = wb.Workbook.Names; - var out/*:Array*/ = []; - for(var i = 0; i < names.length; ++i) { - var n = names[i]; - if(n.Sheet != null) continue; - if(n.Name.match(/^_xlfn\./)) continue; - out.push(write_name_xlml(n)); - } - return writextag("Names", out.join("")); -} -function write_ws_xlml_names(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { - if(!ws) return ""; - if(!((wb||{}).Workbook||{}).Names) return ""; - /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */ - var names/*:Array*/ = wb.Workbook.Names; - var out/*:Array*/ = []; - for(var i = 0; i < names.length; ++i) { - var n = names[i]; - if(n.Sheet != idx) continue; - /*switch(n.Name) { - case "_": continue; - }*/ - if(n.Name.match(/^_xlfn\./)) continue; - out.push(write_name_xlml(n)); - } - return out.join(""); -} -/* WorksheetOptions */ -function write_ws_xlml_wsopts(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { - if(!ws) return ""; - var o/*:Array*/ = []; - /* NOTE: spec technically allows any order, but stick with implied order */ - - /* FitToPage */ - /* DoNotDisplayColHeaders */ - /* DoNotDisplayRowHeaders */ - /* ViewableRange */ - /* Selection */ - /* GridlineColor */ - /* Name */ - /* ExcelWorksheetType */ - /* IntlMacro */ - /* Unsynced */ - /* Selected */ - /* CodeName */ - - if(ws['!margins']) { - o.push(""); - if(ws['!margins'].header) o.push(writextag("Header", null, {'x:Margin':ws['!margins'].header})); - if(ws['!margins'].footer) o.push(writextag("Footer", null, {'x:Margin':ws['!margins'].footer})); - o.push(writextag("PageMargins", null, { - 'x:Bottom': ws['!margins'].bottom || "0.75", - 'x:Left': ws['!margins'].left || "0.7", - 'x:Right': ws['!margins'].right || "0.7", - 'x:Top': ws['!margins'].top || "0.75" - })); - o.push(""); - } - - /* PageSetup */ - /* DisplayPageBreak */ - /* TransitionExpressionEvaluation */ - /* TransitionFormulaEntry */ - /* Print */ - /* Zoom */ - /* PageLayoutZoom */ - /* PageBreakZoom */ - /* ShowPageBreakZoom */ - /* DefaultRowHeight */ - /* DefaultColumnWidth */ - /* StandardWidth */ - - if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) { - /* Visible */ - if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == 1 ? "SheetHidden" : "SheetVeryHidden"), {})); - else { - /* Selected */ - for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break; - if(i == idx) o.push(""); - } - } - - /* LeftColumnVisible */ - - if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push(""); - - /* GridlineColorIndex */ - /* DisplayFormulas */ - /* DoNotDisplayGridlines */ - /* DoNotDisplayHeadings */ - /* DoNotDisplayOutline */ - /* ApplyAutomaticOutlineStyles */ - /* NoSummaryRowsBelowDetail */ - /* NoSummaryColumnsRightDetail */ - /* DoNotDisplayZeros */ - /* ActiveRow */ - /* ActiveColumn */ - /* FilterOn */ - /* RangeSelection */ - /* TopRowVisible */ - /* TopRowBottomPane */ - /* LeftColumnRightPane */ - /* ActivePane */ - /* SplitHorizontal */ - /* SplitVertical */ - /* FreezePanes */ - /* FrozenNoSplit */ - /* TabColorIndex */ - /* Panes */ - - /* NOTE: Password not supported in XLML Format */ - if(ws['!protect']) { - o.push(writetag("ProtectContents", "True")); - if(ws['!protect'].objects) o.push(writetag("ProtectObjects", "True")); - if(ws['!protect'].scenarios) o.push(writetag("ProtectScenarios", "True")); - if(ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) o.push(writetag("EnableSelection", "NoSelection")); - else if(ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) o.push(writetag("EnableSelection", "UnlockedCells")); - [ - [ "formatCells", "AllowFormatCells" ], - [ "formatColumns", "AllowSizeCols" ], - [ "formatRows", "AllowSizeRows" ], - [ "insertColumns", "AllowInsertCols" ], - [ "insertRows", "AllowInsertRows" ], - [ "insertHyperlinks", "AllowInsertHyperlinks" ], - [ "deleteColumns", "AllowDeleteCols" ], - [ "deleteRows", "AllowDeleteRows" ], - [ "sort", "AllowSort" ], - [ "autoFilter", "AllowFilter" ], - [ "pivotTables", "AllowUsePivotTables" ] - ].forEach(function(x) { if(ws['!protect'][x[0]]) o.push("<"+x[1]+"/>"); }); - } - - if(o.length == 0) return ""; - return writextag("WorksheetOptions", o.join(""), {xmlns:XLMLNS.x}); -} -function write_ws_xlml_comment(comments/*:Array*/)/*:string*/ { - return comments.map(function(c) { - // TODO: formatted text - var t = xlml_unfixstr(c.t||""); - var d =writextag("ss:Data", t, {"xmlns":"http://www.w3.org/TR/REC-html40"}); - return writextag("Comment", d, {"ss:Author":c.a}); - }).join(""); -} -function write_ws_xlml_cell(cell, ref/*:string*/, ws, opts, idx/*:number*/, wb, addr)/*:string*/{ - if(!cell || (cell.v == undefined && cell.f == undefined)) return ""; - - var attr = {}; - if(cell.f) attr["ss:Formula"] = "=" + escapexml(a1_to_rc(cell.f, addr)); - if(cell.F && cell.F.slice(0, ref.length) == ref) { - var end = decode_cell(cell.F.slice(ref.length + 1)); - attr["ss:ArrayRange"] = "RC:R" + (end.r == addr.r ? "" : "[" + (end.r - addr.r) + "]") + "C" + (end.c == addr.c ? "" : "[" + (end.c - addr.c) + "]"); - } - - if(cell.l && cell.l.Target) { - attr["ss:HRef"] = escapexml(cell.l.Target); - if(cell.l.Tooltip) attr["x:HRefScreenTip"] = escapexml(cell.l.Tooltip); - } - - if(ws['!merges']) { - var marr = ws['!merges']; - for(var mi = 0; mi != marr.length; ++mi) { - if(marr[mi].s.c != addr.c || marr[mi].s.r != addr.r) continue; - if(marr[mi].e.c > marr[mi].s.c) attr['ss:MergeAcross'] = marr[mi].e.c - marr[mi].s.c; - if(marr[mi].e.r > marr[mi].s.r) attr['ss:MergeDown'] = marr[mi].e.r - marr[mi].s.r; - } - } - - var t = "", p = ""; - switch(cell.t) { - case 'z': if(!opts.sheetStubs) return ""; break; - case 'n': t = 'Number'; p = String(cell.v); break; - case 'b': t = 'Boolean'; p = (cell.v ? "1" : "0"); break; - case 'e': t = 'Error'; p = BErr[cell.v]; break; - case 'd': t = 'DateTime'; p = new Date(cell.v).toISOString(); if(cell.z == null) cell.z = cell.z || SSF._table[14]; break; - case 's': t = 'String'; p = escapexlml(cell.v||""); break; - } - /* TODO: cell style */ - var os = get_cell_style(opts.cellXfs, cell, opts); - attr["ss:StyleID"] = "s" + (21+os); - attr["ss:Index"] = addr.c + 1; - var _v = (cell.v != null ? p : ""); - var m = cell.t == 'z' ? "" : ('' + _v + ''); - - if((cell.c||[]).length > 0) m += write_ws_xlml_comment(cell.c); - - return writextag("Cell", m, attr); -} -function write_ws_xlml_row(R/*:number*/, row)/*:string*/ { - var o = ''; -} -/* TODO */ -function write_ws_xlml_table(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { - if(!ws['!ref']) return ""; - var range/*:Range*/ = safe_decode_range(ws['!ref']); - var marr/*:Array*/ = ws['!merges'] || [], mi = 0; - var o/*:Array*/ = []; - if(ws['!cols']) ws['!cols'].forEach(function(n, i) { - process_col(n); - var w = !!n.width; - var p = col_obj_w(i, n); - var k/*:any*/ = {"ss:Index":i+1}; - if(w) k['ss:Width'] = width2px(p.width); - if(n.hidden) k['ss:Hidden']="1"; - o.push(writextag("Column",null,k)); - }); - var dense = Array.isArray(ws); - for(var R = range.s.r; R <= range.e.r; ++R) { - var row = [write_ws_xlml_row(R, (ws['!rows']||[])[R])]; - for(var C = range.s.c; C <= range.e.c; ++C) { - var skip = false; - for(mi = 0; mi != marr.length; ++mi) { - if(marr[mi].s.c > C) continue; - if(marr[mi].s.r > R) continue; - if(marr[mi].e.c < C) continue; - if(marr[mi].e.r < R) continue; - if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; - break; - } - if(skip) continue; - var addr = {r:R,c:C}; - var ref = encode_cell(addr), cell = dense ? (ws[R]||[])[C] : ws[ref]; - row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr)); - } - row.push(""); - if(row.length > 2) o.push(row.join("")); - } - return o.join(""); -} -function write_ws_xlml(idx/*:number*/, opts, wb/*:Workbook*/)/*:string*/ { - var o/*:Array*/ = []; - var s = wb.SheetNames[idx]; - var ws = wb.Sheets[s]; - - var t/*:string*/ = ws ? write_ws_xlml_names(ws, opts, idx, wb) : ""; - if(t.length > 0) o.push("" + t + ""); - - /* Table */ - t = ws ? write_ws_xlml_table(ws, opts, idx, wb) : ""; - if(t.length > 0) o.push("" + t + "
"); - - /* WorksheetOptions */ - o.push(write_ws_xlml_wsopts(ws, opts, idx, wb)); - - return o.join(""); -} -function write_xlml(wb, opts)/*:string*/ { - if(!opts) opts = {}; - if(!wb.SSF) wb.SSF = SSF.get_table(); - if(wb.SSF) { - make_ssf(SSF); SSF.load_table(wb.SSF); - // $FlowIgnore - opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; - opts.ssf = wb.SSF; - opts.cellXfs = []; - get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); - } - var d/*:Array*/ = []; - d.push(write_props_xlml(wb, opts)); - d.push(write_wb_xlml(wb, opts)); - d.push(""); - d.push(""); - for(var i = 0; i < wb.SheetNames.length; ++i) - d.push(writextag("Worksheet", write_ws_xlml(i, opts, wb), {"ss:Name":escapexml(wb.SheetNames[i])})); - d[2] = write_sty_xlml(wb, opts); - d[3] = write_names_xlml(wb, opts); - return XML_HEADER + writextag("Workbook", d.join(""), { - 'xmlns': XLMLNS.ss, - 'xmlns:o': XLMLNS.o, - 'xmlns:x': XLMLNS.x, - 'xmlns:ss': XLMLNS.ss, - 'xmlns:dt': XLMLNS.dt, - 'xmlns:html': XLMLNS.html - }); -} -/* [MS-OLEDS] 2.3.8 CompObjStream */ -function parse_compobj(obj/*:CFBEntry*/) { - var v = {}; - var o = obj.content; - /*:: if(o == null) return; */ - - /* [MS-OLEDS] 2.3.7 CompObjHeader -- All fields MUST be ignored */ - o.l = 28; - - v.AnsiUserType = o.read_shift(0, "lpstr-ansi"); - v.AnsiClipboardFormat = parse_ClipboardFormatOrAnsiString(o); - - if(o.length - o.l <= 4) return v; - - var m/*:number*/ = o.read_shift(4); - if(m == 0 || m > 40) return v; - o.l-=4; v.Reserved1 = o.read_shift(0, "lpstr-ansi"); - - if(o.length - o.l <= 4) return v; - m = o.read_shift(4); - if(m !== 0x71b239f4) return v; - v.UnicodeClipboardFormat = parse_ClipboardFormatOrUnicodeString(o); - - m = o.read_shift(4); - if(m == 0 || m > 40) return v; - o.l-=4; v.Reserved2 = o.read_shift(0, "lpwstr"); -} - -/* - Continue logic for: - - 2.4.58 Continue - - 2.4.59 ContinueBigName - - 2.4.60 ContinueFrt - - 2.4.61 ContinueFrt11 - - 2.4.62 ContinueFrt12 -*/ -function slurp(R, blob, length/*:number*/, opts)/*:any*/ { - var l = length; - var bufs = []; - var d = blob.slice(blob.l,blob.l+l); - if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(R.n) { - case 'BOF': case 'FilePass': case 'FileLock': case 'InterfaceHdr': case 'RRDInfo': case 'RRDHead': case 'UsrExcl': case 'EOF': - break; - case 'BoundSheet8': - break; - default: - opts.enc.insitu(d); - } - bufs.push(d); - blob.l += l; - var next = (XLSRecordEnum[__readUInt16LE(blob,blob.l)]); - var start = 0; - while(next != null && next.n.slice(0,8) === 'Continue') { - l = __readUInt16LE(blob,blob.l+2); - start = blob.l + 4; - if(next.n == 'ContinueFrt') start += 4; - else if(next.n.slice(0,11) == 'ContinueFrt') { - start += 12; - } - d = blob.slice(start,blob.l+4+l); - bufs.push(d); - blob.l += 4+l; - next = (XLSRecordEnum[__readUInt16LE(blob, blob.l)]); - } - var b = (bconcat(bufs)/*:any*/); - prep_blob(b, 0); - var ll = 0; b.lens = []; - for(var j = 0; j < bufs.length; ++j) { b.lens.push(ll); ll += bufs[j].length; } - if(b.length < length) throw "XLS Record " + (R && R.n || "??") + " Truncated: " + b.length + " < " + length; - return R.f(b, b.length, opts); -} - -function safe_format_xf(p/*:any*/, opts/*:ParseOpts*/, date1904/*:?boolean*/) { - if(p.t === 'z') return; - if(!p.XF) return; - var fmtid = 0; - try { - fmtid = p.z || p.XF.numFmtId || 0; - if(opts.cellNF) p.z = SSF._table[fmtid]; - } catch(e) { if(opts.WTF) throw e; } - if(!opts || opts.cellText !== false) try { - if(p.t === 'e') { p.w = p.w || BErr[p.v]; } - else if(fmtid === 0 || fmtid == "General") { - if(p.t === 'n') { - if((p.v|0) === p.v) p.w = SSF._general_int(p.v); - else p.w = SSF._general_num(p.v); - } - else p.w = SSF._general(p.v); - } - else p.w = SSF.format(fmtid,p.v, {date1904:!!date1904, dateNF: opts && opts.dateNF}); - } catch(e) { if(opts.WTF) throw e; } - if(opts.cellDates && fmtid && p.t == 'n' && SSF.is_date(SSF._table[fmtid] || String(fmtid))) { - var _d = SSF.parse_date_code(p.v); if(_d) { p.t = 'd'; p.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); } - } -} - -function make_cell(val, ixfe, t)/*:Cell*/ { - return ({v:val, ixfe:ixfe, t:t}/*:any*/); -} - -// 2.3.2 -function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ { - var wb = ({opts:{}}/*:any*/); - var Sheets = {}; - if(DENSE != null && options.dense == null) options.dense = DENSE; - var out/*:Worksheet*/ = ((options.dense ? [] : {})/*:any*/); - var Directory = {}; - var range/*:Range*/ = ({}/*:any*/); - var last_formula = null; - var sst/*:SST*/ = ([]/*:any*/); - var cur_sheet = ""; - var Preamble = {}; - var lastcell, last_cell = "", cc/*:Cell*/, cmnt, rngC, rngR; - var sharedf = {}; - var arrayf/*:Array<[Range, string]>*/ = []; - var temp_val/*:Cell*/; - var country; - var XFs = []; /* XF records */ - var palette/*:Array<[number, number, number]>*/ = []; - var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false}, Views:[{}] }/*:any*/), wsprops = {}; - var get_rgb = function getrgb(icv/*:number*/)/*:[number, number, number]*/ { - if(icv < 8) return XLSIcv[icv]; - if(icv < 64) return palette[icv-8] || XLSIcv[icv]; - return XLSIcv[icv]; - }; - var process_cell_style = function pcs(cell, line/*:any*/, options) { - var xfd = line.XF.data; - if(!xfd || !xfd.patternType || !options || !options.cellStyles) return; - line.s = ({}/*:any*/); - line.s.patternType = xfd.patternType; - var t; - if((t = rgb2Hex(get_rgb(xfd.icvFore)))) { line.s.fgColor = {rgb:t}; } - if((t = rgb2Hex(get_rgb(xfd.icvBack)))) { line.s.bgColor = {rgb:t}; } - }; - var addcell = function addcell(cell/*:any*/, line/*:any*/, options/*:any*/) { - if(file_depth > 1) return; - if(options.sheetRows && cell.r >= options.sheetRows) return; - if(options.cellStyles && line.XF && line.XF.data) process_cell_style(cell, line, options); - delete line.ixfe; delete line.XF; - lastcell = cell; - last_cell = encode_cell(cell); - if(!range || !range.s || !range.e) range = {s:{r:0,c:0},e:{r:0,c:0}}; - if(cell.r < range.s.r) range.s.r = cell.r; - if(cell.c < range.s.c) range.s.c = cell.c; - if(cell.r + 1 > range.e.r) range.e.r = cell.r + 1; - if(cell.c + 1 > range.e.c) range.e.c = cell.c + 1; - if(options.cellFormula && line.f) { - for(var afi = 0; afi < arrayf.length; ++afi) { - if(arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue; - if(arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue; - line.F = encode_range(arrayf[afi][0]); - if(arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) delete line.f; - if(line.f) line.f = "" + stringify_formula(arrayf[afi][1], range, cell, supbooks, opts); - break; - } - } - { - if(options.dense) { - if(!out[cell.r]) out[cell.r] = []; - out[cell.r][cell.c] = line; - } else out[last_cell] = line; - } - }; - var opts = ({ - enc: false, // encrypted - sbcch: 0, // cch in the preceding SupBook - snames: [], // sheetnames - sharedf: sharedf, // shared formulae by address - arrayf: arrayf, // array formulae array - rrtabid: [], // RRTabId - lastuser: "", // Last User from WriteAccess - biff: 8, // BIFF version - codepage: 0, // CP from CodePage record - winlocked: 0, // fLockWn from WinProtect - cellStyles: !!options && !!options.cellStyles, - WTF: !!options && !!options.wtf - }/*:any*/); - if(options.password) opts.password = options.password; - var themes; - var merges/*:Array*/ = []; - var objects = []; - var colinfo/*:Array*/ = [], rowinfo/*:Array*/ = []; - // eslint-disable-next-line no-unused-vars - var defwidth = 0, defheight = 0; // twips / MDW respectively - var seencol = false; - var supbooks = ([]/*:any*/); // 1-indexed, will hold extern names - supbooks.SheetNames = opts.snames; - supbooks.sharedf = opts.sharedf; - supbooks.arrayf = opts.arrayf; - supbooks.names = []; - supbooks.XTI = []; - var last_Rn = ''; - var file_depth = 0; /* TODO: make a real stack */ - var BIFF2Fmt = 0, BIFF2FmtTable/*:Array*/ = []; - var FilterDatabases = []; /* TODO: sort out supbooks and process elsewhere */ - var last_lbl/*:?DefinedName*/; - - /* explicit override for some broken writers */ - opts.codepage = 1200; - set_cp(1200); - var seen_codepage = false; - while(blob.l < blob.length - 1) { - var s = blob.l; - var RecordType = blob.read_shift(2); - if(RecordType === 0 && last_Rn === 'EOF') break; - var length = (blob.l === blob.length ? 0 : blob.read_shift(2)); - var R = XLSRecordEnum[RecordType]; - //console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length); - //if(!R) console.log(blob.slice(blob.l, blob.l + length)); - if(R && R.f) { - if(options.bookSheets) { - if(last_Rn === 'BoundSheet8' && R.n !== 'BoundSheet8') break; - } - last_Rn = R.n; - if(R.r === 2 || R.r == 12) { - var rt = blob.read_shift(2); length -= 2; - if(!opts.enc && rt !== RecordType && (((rt&0xFF)<<8)|(rt>>8)) !== RecordType) throw new Error("rt mismatch: " + rt + "!=" + RecordType); - if(R.r == 12){ - blob.l += 10; length -= 10; - } // skip FRT - } - //console.error(R,blob.l,length,blob.length); - var val/*:any*/ = ({}/*:any*/); - if(R.n === 'EOF') val = /*::(*/R.f(blob, length, opts)/*:: :any)*/; - else val = /*::(*/slurp(R, blob, length, opts)/*:: :any)*/; - var Rn = R.n; - /*:: val = (val:any); */ - if(file_depth == 0 && Rn != 'BOF') continue; - /* nested switch statements to workaround V8 128 limit */ - switch(Rn) { - /* Workbook Options */ - case 'Date1904': - /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ - wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break; - case 'WriteProtect': wb.opts.WriteProtect = true; break; - case 'FilePass': - if(!opts.enc) blob.l = 0; - opts.enc = val; - if(!options.password) throw new Error("File is password-protected"); - if(val.valid == null) throw new Error("Encryption scheme unsupported"); - if(!val.valid) throw new Error("Password is incorrect"); - break; - case 'WriteAccess': opts.lastuser = val; break; - case 'FileSharing': break; //TODO - case 'CodePage': - var cpval = Number(val); - /* overrides based on test cases */ - switch(cpval) { - case 0x5212: cpval = 1200; break; - case 0x8000: cpval = 10000; break; - case 0x8001: cpval = 1252; break; - } - set_cp(opts.codepage = cpval); - seen_codepage = true; - break; - case 'RRTabId': opts.rrtabid = val; break; - case 'WinProtect': opts.winlocked = val; break; - case 'Template': break; // TODO - case 'BookBool': break; // TODO - case 'UsesELFs': break; - case 'MTRSettings': break; - case 'RefreshAll': - case 'CalcCount': - case 'CalcDelta': - case 'CalcIter': - case 'CalcMode': - case 'CalcPrecision': - case 'CalcSaveRecalc': - wb.opts[Rn] = val; break; - case 'CalcRefMode': opts.CalcRefMode = val; break; // TODO: implement R1C1 - case 'Uncalced': break; - case 'ForceFullCalculation': wb.opts.FullCalc = val; break; - case 'WsBool': - if(val.fDialog) out["!type"] = "dialog"; - if(!val.fBelow) (out["!outline"] || (out["!outline"] = {})).above = true; - if(!val.fRight) (out["!outline"] || (out["!outline"] = {})).left = true; - break; // TODO - case 'XF': - XFs.push(val); break; - case 'ExtSST': break; // TODO - case 'BookExt': break; // TODO - case 'RichTextStream': break; - case 'BkHim': break; - - case 'SupBook': - supbooks.push([val]); - supbooks[supbooks.length-1].XTI = []; - break; - case 'ExternName': - supbooks[supbooks.length-1].push(val); - break; - case 'Index': break; // TODO - case 'Lbl': - last_lbl = ({ - Name: val.Name, - Ref: stringify_formula(val.rgce,range,null,supbooks,opts) - }/*:DefinedName*/); - if(val.itab > 0) last_lbl.Sheet = val.itab - 1; - supbooks.names.push(last_lbl); - if(!supbooks[0]) { supbooks[0] = []; supbooks[0].XTI = []; } - supbooks[supbooks.length-1].push(val); - if(val.Name == "_xlnm._FilterDatabase" && val.itab > 0) - if(val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d') - FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) }; - break; - case 'ExternCount': opts.ExternCount = val; break; - case 'ExternSheet': - if(supbooks.length == 0) { supbooks[0] = []; supbooks[0].XTI = []; } - supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); supbooks.XTI = supbooks.XTI.concat(val); break; - case 'NameCmt': - /* TODO: search for correct name */ - if(opts.biff < 8) break; - if(last_lbl != null) last_lbl.Comment = val[1]; - break; - - case 'Protect': out["!protect"] = val; break; /* for sheet or book */ - case 'Password': if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break; - case 'Prot4Rev': case 'Prot4RevPass': break; /*TODO: Revision Control*/ - - case 'BoundSheet8': { - Directory[val.pos] = val; - opts.snames.push(val.name); - } break; - case 'EOF': { - if(--file_depth) break; - if(range.e) { - if(range.e.r > 0 && range.e.c > 0) { - range.e.r--; range.e.c--; - out["!ref"] = encode_range(range); - if(options.sheetRows && options.sheetRows <= range.e.r) { - var tmpri = range.e.r; - range.e.r = options.sheetRows - 1; - out["!fullref"] = out["!ref"]; - out["!ref"] = encode_range(range); - range.e.r = tmpri; - } - range.e.r++; range.e.c++; - } - if(merges.length > 0) out["!merges"] = merges; - if(objects.length > 0) out["!objects"] = objects; - if(colinfo.length > 0) out["!cols"] = colinfo; - if(rowinfo.length > 0) out["!rows"] = rowinfo; - Workbook.Sheets.push(wsprops); - } - if(cur_sheet === "") Preamble = out; else Sheets[cur_sheet] = out; - out = ((options.dense ? [] : {})/*:any*/); - } break; - case 'BOF': { - if(opts.biff === 8) opts.biff = { - /*::[*/0x0009/*::]*/:2, - /*::[*/0x0209/*::]*/:3, - /*::[*/0x0409/*::]*/:4 - }[RecordType] || { - /*::[*/0x0200/*::]*/:2, - /*::[*/0x0300/*::]*/:3, - /*::[*/0x0400/*::]*/:4, - /*::[*/0x0500/*::]*/:5, - /*::[*/0x0600/*::]*/:8, - /*::[*/0x0002/*::]*/:2, - /*::[*/0x0007/*::]*/:2 - }[val.BIFFVer] || 8; - opts.biffguess = val.BIFFVer == 0; - if(val.BIFFVer == 0 && val.dt == 0x1000) { opts.biff = 5; seen_codepage = true; set_cp(opts.codepage = 28591); } - if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2; - if(file_depth++) break; - out = ((options.dense ? [] : {})/*:any*/); - - if(opts.biff < 8 && !seen_codepage) { seen_codepage = true; set_cp(opts.codepage = options.codepage || 1252); } - - if(opts.biff < 5 || val.BIFFVer == 0 && val.dt == 0x1000) { - if(cur_sheet === "") cur_sheet = "Sheet1"; - range = {s:{r:0,c:0},e:{r:0,c:0}}; - /* fake BoundSheet8 */ - var fakebs8 = {pos: blob.l - length, name:cur_sheet}; - Directory[fakebs8.pos] = fakebs8; - opts.snames.push(cur_sheet); - } - else cur_sheet = (Directory[s] || {name:""}).name; - if(val.dt == 0x20) out["!type"] = "chart"; - if(val.dt == 0x40) out["!type"] = "macro"; - merges = []; - objects = []; - opts.arrayf = arrayf = []; - colinfo = []; rowinfo = []; - defwidth = defheight = 0; - seencol = false; - wsprops = {Hidden:(Directory[s]||{hs:0}).hs, name:cur_sheet }; - } break; - - case 'Number': case 'BIFF2NUM': case 'BIFF2INT': { - if(out["!type"] == "chart") if(options.dense ? (out[val.r]||[])[val.c]: out[encode_cell({c:val.c, r:val.r})]) ++val.c; - temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe]||{}, v:val.val, t:'n'}/*:any*/); - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:val.c, r:val.r}, temp_val, options); - } break; - case 'BoolErr': { - temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.val, t:val.t}/*:any*/); - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:val.c, r:val.r}, temp_val, options); - } break; - case 'RK': { - temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.rknum, t:'n'}/*:any*/); - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:val.c, r:val.r}, temp_val, options); - } break; - case 'MulRk': { - for(var j = val.c; j <= val.C; ++j) { - var ixfe = val.rkrec[j-val.c][0]; - temp_val= ({ixfe:ixfe, XF:XFs[ixfe], v:val.rkrec[j-val.c][1], t:'n'}/*:any*/); - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:j, r:val.r}, temp_val, options); - } - } break; - case 'Formula': { - if(val.val == 'String') { last_formula = val; break; } - temp_val = make_cell(val.val, val.cell.ixfe, val.tt); - temp_val.XF = XFs[temp_val.ixfe]; - if(options.cellFormula) { - var _f = val.formula; - if(_f && _f[0] && _f[0][0] && _f[0][0][0] == 'PtgExp') { - var _fr = _f[0][0][1][0], _fc = _f[0][0][1][1]; - var _fe = encode_cell({r:_fr, c:_fc}); - if(sharedf[_fe]) temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts); - else temp_val.F = ((options.dense ? (out[_fr]||[])[_fc]: out[_fe]) || {}).F; - } else temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts); - } - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell(val.cell, temp_val, options); - last_formula = val; - } break; - case 'String': { - if(last_formula) { /* technically always true */ - last_formula.val = val; - temp_val = make_cell(val, last_formula.cell.ixfe, 's'); - temp_val.XF = XFs[temp_val.ixfe]; - if(options.cellFormula) { - temp_val.f = ""+stringify_formula(last_formula.formula, range, last_formula.cell, supbooks, opts); - } - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell(last_formula.cell, temp_val, options); - last_formula = null; - } else throw new Error("String record expects Formula"); - } break; - case 'Array': { - arrayf.push(val); - var _arraystart = encode_cell(val[0].s); - cc = options.dense ? (out[val[0].s.r]||[])[val[0].s.c] : out[_arraystart]; - if(options.cellFormula && cc) { - if(!last_formula) break; /* technically unreachable */ - if(!_arraystart || !cc) break; - cc.f = ""+stringify_formula(val[1], range, val[0], supbooks, opts); - cc.F = encode_range(val[0]); - } - } break; - case 'ShrFmla': { - if(!options.cellFormula) break; - if(last_cell) { - /* TODO: capture range */ - if(!last_formula) break; /* technically unreachable */ - sharedf[encode_cell(last_formula.cell)]= val[0]; - cc = options.dense ? (out[last_formula.cell.r]||[])[last_formula.cell.c] : out[encode_cell(last_formula.cell)]; - (cc||{}).f = ""+stringify_formula(val[0], range, lastcell, supbooks, opts); - } - } break; - case 'LabelSst': - temp_val=make_cell(sst[val.isst].t, val.ixfe, 's'); - if(sst[val.isst].h) temp_val.h = sst[val.isst].h; - temp_val.XF = XFs[temp_val.ixfe]; - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:val.c, r:val.r}, temp_val, options); - break; - case 'Blank': if(options.sheetStubs) { - temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], t:'z'}/*:any*/); - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:val.c, r:val.r}, temp_val, options); - } break; - case 'MulBlank': if(options.sheetStubs) { - for(var _j = val.c; _j <= val.C; ++_j) { - var _ixfe = val.ixfe[_j-val.c]; - temp_val= ({ixfe:_ixfe, XF:XFs[_ixfe], t:'z'}/*:any*/); - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:_j, r:val.r}, temp_val, options); - } - } break; - case 'RString': - case 'Label': case 'BIFF2STR': - temp_val=make_cell(val.val, val.ixfe, 's'); - temp_val.XF = XFs[temp_val.ixfe]; - if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; - safe_format_xf(temp_val, options, wb.opts.Date1904); - addcell({c:val.c, r:val.r}, temp_val, options); - break; - - case 'Dimensions': { - if(file_depth === 1) range = val; /* TODO: stack */ - } break; - case 'SST': { - sst = val; - } break; - case 'Format': { /* val = [id, fmt] */ - if(opts.biff == 4) { - BIFF2FmtTable[BIFF2Fmt++] = val[1]; - for(var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if(SSF._table[b4idx] == val[1]) break; - if(b4idx >= 163) SSF.load(val[1], BIFF2Fmt + 163); - } - else SSF.load(val[1], val[0]); - } break; - case 'BIFF2FORMAT': { - BIFF2FmtTable[BIFF2Fmt++] = val; - for(var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if(SSF._table[b2idx] == val) break; - if(b2idx >= 163) SSF.load(val, BIFF2Fmt + 163); - } break; - - case 'MergeCells': merges = merges.concat(val); break; - - case 'Obj': objects[val.cmo[0]] = opts.lastobj = val; break; - case 'TxO': opts.lastobj.TxO = val; break; - case 'ImData': opts.lastobj.ImData = val; break; - - case 'HLink': { - for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) - for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { - cc = options.dense ? (out[rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})]; - if(cc) cc.l = val[1]; - } - } break; - case 'HLinkTooltip': { - for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) - for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { - cc = options.dense ? (out[rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})]; - if(cc && cc.l) cc.l.Tooltip = val[1]; - } - } break; - - /* Comments */ - case 'Note': { - if(opts.biff <= 5 && opts.biff >= 2) break; /* TODO: BIFF5 */ - cc = options.dense ? (out[val[0].r]||[])[val[0].c] : out[encode_cell(val[0])]; - var noteobj = objects[val[2]]; - if(!cc) { - if(options.dense) { - if(!out[val[0].r]) out[val[0].r] = []; - cc = out[val[0].r][val[0].c] = ({t:"z"}/*:any*/); - } else { - cc = out[encode_cell(val[0])] = ({t:"z"}/*:any*/); - } - range.e.r = Math.max(range.e.r, val[0].r); - range.s.r = Math.min(range.s.r, val[0].r); - range.e.c = Math.max(range.e.c, val[0].c); - range.s.c = Math.min(range.s.c, val[0].c); - } - if(!cc.c) cc.c = []; - cmnt = {a:val[1],t:noteobj.TxO.t}; - cc.c.push(cmnt); - } break; - - default: switch(R.n) { /* nested */ - case 'ClrtClient': break; - case 'XFExt': update_xfext(XFs[val.ixfe], val.ext); break; - - case 'DefColWidth': defwidth = val; break; - case 'DefaultRowHeight': defheight = val[1]; break; // TODO: flags - - case 'ColInfo': { - if(!opts.cellStyles) break; - while(val.e >= val.s) { - colinfo[val.e--] = { width: val.w/256, level: (val.level || 0), hidden: !!(val.flags & 1) }; - if(!seencol) { seencol = true; find_mdw_colw(val.w/256); } - process_col(colinfo[val.e+1]); - } - } break; - case 'Row': { - var rowobj = {}; - if(val.level != null) { rowinfo[val.r] = rowobj; rowobj.level = val.level; } - if(val.hidden) { rowinfo[val.r] = rowobj; rowobj.hidden = true; } - if(val.hpt) { - rowinfo[val.r] = rowobj; - rowobj.hpt = val.hpt; rowobj.hpx = pt2px(val.hpt); - } - } break; - - case 'LeftMargin': - case 'RightMargin': - case 'TopMargin': - case 'BottomMargin': - if(!out['!margins']) default_margins(out['!margins'] = {}); - out['!margins'][Rn.slice(0,-6).toLowerCase()] = val; - break; - - case 'Selection': break; - - case 'Setup': // TODO - if(!out['!margins']) default_margins(out['!margins'] = {}); - out['!margins'].header = val.header; - out['!margins'].footer = val.footer; - break; - - case 'Window2': // TODO - // $FlowIgnore - if(val.RTL) Workbook.Views[0].RTL = true; - break; - - case 'Header': break; // TODO - case 'Footer': break; // TODO - case 'HCenter': break; // TODO - case 'VCenter': break; // TODO - case 'Pls': break; // TODO - case 'GCW': break; - case 'LHRecord': break; - case 'DBCell': break; // TODO - case 'EntExU2': break; // TODO - case 'SxView': break; // TODO - case 'Sxvd': break; // TODO - case 'SXVI': break; // TODO - case 'SXVDEx': break; // TODO - case 'SxIvd': break; // TODO - case 'SXString': break; // TODO - case 'Sync': break; - case 'Addin': break; - case 'SXDI': break; // TODO - case 'SXLI': break; // TODO - case 'SXEx': break; // TODO - case 'QsiSXTag': break; // TODO - case 'Feat': break; - case 'FeatHdr': case 'FeatHdr11': break; - case 'Feature11': case 'Feature12': case 'List12': break; - case 'Country': country = val; break; - case 'RecalcId': break; - case 'DxGCol': break; // TODO: htmlify - case 'Fbi': case 'Fbi2': case 'GelFrame': break; - case 'Font': break; // TODO - case 'XFCRC': break; // TODO - case 'Style': break; // TODO - case 'StyleExt': break; // TODO - case 'Palette': palette = val; break; - case 'Theme': themes = val; break; - /* Protection */ - case 'ScenarioProtect': break; - case 'ObjProtect': break; - - /* Conditional Formatting */ - case 'CondFmt12': break; - - /* Table */ - case 'Table': break; // TODO - case 'TableStyles': break; // TODO - case 'TableStyle': break; // TODO - case 'TableStyleElement': break; // TODO - - /* PivotTable */ - case 'SXStreamID': break; // TODO - case 'SXVS': break; // TODO - case 'DConRef': break; // TODO - case 'SXAddl': break; // TODO - case 'DConBin': break; // TODO - case 'DConName': break; // TODO - case 'SXPI': break; // TODO - case 'SxFormat': break; // TODO - case 'SxSelect': break; // TODO - case 'SxRule': break; // TODO - case 'SxFilt': break; // TODO - case 'SxItm': break; // TODO - case 'SxDXF': break; // TODO - - /* Scenario Manager */ - case 'ScenMan': break; - - /* Data Consolidation */ - case 'DCon': break; - - /* Watched Cell */ - case 'CellWatch': break; - - /* Print Settings */ - case 'PrintRowCol': break; - case 'PrintGrid': break; - case 'PrintSize': break; - - case 'XCT': break; - case 'CRN': break; - - case 'Scl': { - //console.log("Zoom Level:", val[0]/val[1],val); - } break; - case 'SheetExt': { - /* empty */ - } break; - case 'SheetExtOptional': { - /* empty */ - } break; - - /* VBA */ - case 'ObNoMacros': { - /* empty */ - } break; - case 'ObProj': { - /* empty */ - } break; - case 'CodeName': { - /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ - if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook"; - else wsprops.CodeName = val || wsprops.name; - } break; - case 'GUIDTypeLib': { - /* empty */ - } break; - - case 'WOpt': break; // TODO: WTF? - case 'PhoneticInfo': break; - - case 'OleObjectSize': break; - - /* Differential Formatting */ - case 'DXF': case 'DXFN': case 'DXFN12': case 'DXFN12List': case 'DXFN12NoCB': break; - - /* Data Validation */ - case 'Dv': case 'DVal': break; - - /* Data Series */ - case 'BRAI': case 'Series': case 'SeriesText': break; - - /* Data Connection */ - case 'DConn': break; - case 'DbOrParamQry': break; - case 'DBQueryExt': break; - - case 'OleDbConn': break; - case 'ExtString': break; - - /* Formatting */ - case 'IFmtRecord': break; - case 'CondFmt': case 'CF': case 'CF12': case 'CFEx': break; - - /* Explicitly Ignored */ - case 'Excel9File': break; - case 'Units': break; - case 'InterfaceHdr': case 'Mms': case 'InterfaceEnd': case 'DSF': break; - case 'BuiltInFnGroupCount': /* 2.4.30 0x0E or 0x10 but excel 2011 generates 0x11? */ break; - /* View Stuff */ - case 'Window1': case 'HideObj': case 'GridSet': case 'Guts': - case 'UserBView': case 'UserSViewBegin': case 'UserSViewEnd': break; - case 'Pane': break; - default: switch(R.n) { /* nested */ - /* Chart */ - case 'Dat': - case 'Begin': case 'End': - case 'StartBlock': case 'EndBlock': - case 'Frame': case 'Area': - case 'Axis': case 'AxisLine': case 'Tick': break; - case 'AxesUsed': - case 'CrtLayout12': case 'CrtLayout12A': case 'CrtLink': case 'CrtLine': case 'CrtMlFrt': case 'CrtMlFrtContinue': break; - case 'LineFormat': case 'AreaFormat': - case 'Chart': case 'Chart3d': case 'Chart3DBarShape': case 'ChartFormat': case 'ChartFrtInfo': break; - case 'PlotArea': case 'PlotGrowth': break; - case 'SeriesList': case 'SerParent': case 'SerAuxTrend': break; - case 'DataFormat': case 'SerToCrt': case 'FontX': break; - case 'CatSerRange': case 'AxcExt': case 'SerFmt': break; - case 'ShtProps': break; - case 'DefaultText': case 'Text': case 'CatLab': break; - case 'DataLabExtContents': break; - case 'Legend': case 'LegendException': break; - case 'Pie': case 'Scatter': break; - case 'PieFormat': case 'MarkerFormat': break; - case 'StartObject': case 'EndObject': break; - case 'AlRuns': case 'ObjectLink': break; - case 'SIIndex': break; - case 'AttachedLabel': case 'YMult': break; - - /* Chart Group */ - case 'Line': case 'Bar': break; - case 'Surf': break; - - /* Axis Group */ - case 'AxisParent': break; - case 'Pos': break; - case 'ValueRange': break; - - /* Pivot Chart */ - case 'SXViewEx9': break; // TODO - case 'SXViewLink': break; - case 'PivotChartBits': break; - case 'SBaseRef': break; - case 'TextPropsStream': break; - - /* Chart Misc */ - case 'LnExt': break; - case 'MkrExt': break; - case 'CrtCoopt': break; - - /* Query Table */ - case 'Qsi': case 'Qsif': case 'Qsir': case 'QsiSXTag': break; - case 'TxtQry': break; - - /* Filter */ - case 'FilterMode': break; - case 'AutoFilter': case 'AutoFilterInfo': break; - case 'AutoFilter12': break; - case 'DropDownObjIds': break; - case 'Sort': break; - case 'SortData': break; - - /* Drawing */ - case 'ShapePropsStream': break; - case 'MsoDrawing': case 'MsoDrawingGroup': case 'MsoDrawingSelection': break; - /* Pub Stuff */ - case 'WebPub': case 'AutoWebPub': break; - - /* Print Stuff */ - case 'HeaderFooter': case 'HFPicture': case 'PLV': - case 'HorizontalPageBreaks': case 'VerticalPageBreaks': break; - /* Behavioral */ - case 'Backup': case 'CompressPictures': case 'Compat12': break; - - /* Should not Happen */ - case 'Continue': case 'ContinueFrt12': break; - - /* Future Records */ - case 'FrtFontList': case 'FrtWrapper': break; - - default: switch(R.n) { /* nested */ - /* BIFF5 records */ - case 'TabIdConf': case 'Radar': case 'RadarArea': case 'DropBar': case 'Intl': case 'CoordList': case 'SerAuxErrBar': break; - - /* BIFF2-4 records */ - case 'BIFF2FONTCLR': case 'BIFF2FMTCNT': case 'BIFF2FONTXTRA': break; - case 'BIFF2XF': case 'BIFF3XF': case 'BIFF4XF': break; - case 'BIFF2XFINDEX': break; - case 'BIFF4FMTCNT': case 'BIFF2ROW': case 'BIFF2WINDOW2': break; - - /* Miscellaneous */ - case 'SCENARIO': case 'DConBin': case 'PicF': case 'DataLabExt': - case 'Lel': case 'BopPop': case 'BopPopCustom': case 'RealTimeData': - case 'Name': break; - case 'LHNGraph': case 'FnGroupName': case 'AddMenu': case 'LPr': break; - case 'ListObj': case 'ListField': break; - case 'RRSort': break; - case 'BigName': break; - case 'ToolbarHdr': case 'ToolbarEnd': break; - case 'DDEObjName': break; - case 'FRTArchId$': break; - default: if(options.WTF) throw 'Unrecognized Record ' + R.n; - }}}} - } else blob.l += length; - } - wb.SheetNames=keys(Directory).sort(function(a,b) { return Number(a) - Number(b); }).map(function(x){return Directory[x].name;}); - if(!options.bookSheets) wb.Sheets=Sheets; - if(!wb.SheetNames.length && Preamble["!ref"]) { - wb.SheetNames.push("Sheet1"); - /*jshint -W069 */ - if(wb.Sheets) wb.Sheets["Sheet1"] = Preamble; - /*jshint +W069 */ - } else wb.Preamble=Preamble; - if(wb.Sheets) FilterDatabases.forEach(function(r,i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] = r; }); - wb.Strings = sst; - wb.SSF = SSF.get_table(); - if(opts.enc) wb.Encryption = opts.enc; - if(themes) wb.Themes = themes; - wb.Metadata = {}; - if(country !== undefined) wb.Metadata.Country = country; - if(supbooks.names.length > 0) Workbook.Names = supbooks.names; - wb.Workbook = Workbook; - return wb; -} - -/* TODO: split props*/ -var PSCLSID = { - SI: "e0859ff2f94f6810ab9108002b27b3d9", - DSI: "02d5cdd59c2e1b10939708002b2cf9ae", - UDI: "05d5cdd59c2e1b10939708002b2cf9ae" -}; -function parse_xls_props(cfb/*:CFBContainer*/, props, o) { - /* [MS-OSHARED] 2.3.3.2.2 Document Summary Information Property Set */ - var DSI = CFB.find(cfb, '/!DocumentSummaryInformation'); - if(DSI && DSI.size > 0) try { - var DocSummary = parse_PropertySetStream(DSI, DocSummaryPIDDSI, PSCLSID.DSI); - for(var d in DocSummary) props[d] = DocSummary[d]; - } catch(e) {if(o.WTF) throw e;/* empty */} - - /* [MS-OSHARED] 2.3.3.2.1 Summary Information Property Set*/ - var SI = CFB.find(cfb, '/!SummaryInformation'); - if(SI && SI.size > 0) try { - var Summary = parse_PropertySetStream(SI, SummaryPIDSI, PSCLSID.SI); - for(var s in Summary) if(props[s] == null) props[s] = Summary[s]; - } catch(e) {if(o.WTF) throw e;/* empty */} - - if(props.HeadingPairs && props.TitlesOfParts) { - load_props_pairs(props.HeadingPairs, props.TitlesOfParts, props, o); - delete props.HeadingPairs; delete props.TitlesOfParts; - } -} -function write_xls_props(wb/*:Workbook*/, cfb/*:CFBContainer*/) { - var DSEntries = [], SEntries = [], CEntries = []; - var i = 0, Keys; - if(wb.Props) { - Keys = keys(wb.Props); - // $FlowIgnore - for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]); - } - if(wb.Custprops) { - Keys = keys(wb.Custprops); - // $FlowIgnore - for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]); - } - var CEntries2 = []; - for(i = 0; i < CEntries.length; ++i) { - if(XLSPSSkip.indexOf(CEntries[i][0]) > -1) continue; - if(CEntries[i][1] == null) continue; - CEntries2.push(CEntries[i]); - } - if(SEntries.length) CFB.utils.cfb_add(cfb, "/\u0005SummaryInformation", write_PropertySetStream(SEntries, PSCLSID.SI, SummaryRE, SummaryPIDSI)); - if(DSEntries.length || CEntries2.length) CFB.utils.cfb_add(cfb, "/\u0005DocumentSummaryInformation", write_PropertySetStream(DSEntries, PSCLSID.DSI, DocSummaryRE, DocSummaryPIDDSI, CEntries2.length ? CEntries2 : null, PSCLSID.UDI)); -} - -function parse_xlscfb(cfb/*:any*/, options/*:?ParseOpts*/)/*:Workbook*/ { -if(!options) options = {}; -fix_read_opts(options); -reset_cp(); -if(options.codepage) set_ansi(options.codepage); -var CompObj/*:?CFBEntry*/, WB/*:?any*/; -if(cfb.FullPaths) { - if(CFB.find(cfb, '/encryption')) throw new Error("File is password-protected"); - CompObj = CFB.find(cfb, '!CompObj'); - WB = CFB.find(cfb, '/Workbook') || CFB.find(cfb, '/Book'); -} else { - switch(options.type) { - case 'base64': cfb = s2a(Base64.decode(cfb)); break; - case 'binary': cfb = s2a(cfb); break; - case 'buffer': break; - case 'array': if(!Array.isArray(cfb)) cfb = Array.prototype.slice.call(cfb); break; - } - prep_blob(cfb, 0); - WB = ({content: cfb}/*:any*/); -} -var /*::CompObjP, */WorkbookP/*:: :Workbook = XLSX.utils.book_new(); */; - -var _data/*:?any*/; -if(CompObj) /*::CompObjP = */parse_compobj(CompObj); -if(options.bookProps && !options.bookSheets) WorkbookP = ({}/*:any*/); -else/*:: if(cfb instanceof CFBContainer) */ { - var T = has_buf ? 'buffer' : 'array'; - if(WB && WB.content) WorkbookP = parse_workbook(WB.content, options); - /* Quattro Pro 7-8 */ - else if((_data=CFB.find(cfb, 'PerfectOffice_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); - /* Quattro Pro 9 */ - else if((_data=CFB.find(cfb, 'NativeContent_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); - /* Works 4 for Mac */ - else if((_data=CFB.find(cfb, 'MN0')) && _data.content) throw new Error("Unsupported Works 4 for Mac file"); - else throw new Error("Cannot find Workbook stream"); - if(options.bookVBA && cfb.FullPaths && CFB.find(cfb, '/_VBA_PROJECT_CUR/VBA/dir')) WorkbookP.vbaraw = make_vba_xls(cfb); -} - -var props = {}; -if(cfb.FullPaths) parse_xls_props(/*::((*/cfb/*:: :any):CFBContainer)*/, props, options); - -WorkbookP.Props = WorkbookP.Custprops = props; /* TODO: split up properties */ -if(options.bookFiles) WorkbookP.cfb = cfb; -/*WorkbookP.CompObjP = CompObjP; // TODO: storage? */ -return WorkbookP; -} - - -function write_xlscfb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:CFBContainer*/ { - var o = opts || {}; - var cfb = CFB.utils.cfb_new({root:"R"}); - var wbpath = "/Workbook"; - switch(o.bookType || "xls") { - case "xls": o.bookType = "biff8"; - /* falls through */ - case "xla": if(!o.bookType) o.bookType = "xla"; - /* falls through */ - case "biff8": wbpath = "/Workbook"; o.biff = 8; break; - case "biff5": wbpath = "/Book"; o.biff = 5; break; - default: throw new Error("invalid type " + o.bookType + " for XLS CFB"); - } - CFB.utils.cfb_add(cfb, wbpath, write_biff_buf(wb, o)); - if(o.biff == 8 && (wb.Props || wb.Custprops)) write_xls_props(wb, cfb); - // TODO: SI, DSI, CO - if(o.biff == 8 && wb.vbaraw) fill_vba_xls(cfb, CFB.read(wb.vbaraw, {type: typeof wb.vbaraw == "string" ? "binary" : "buffer"})); - return cfb; -} -/* [MS-XLSB] 2.3 Record Enumeration */ -var XLSBRecordEnum = { - /*::[*/0x0000/*::]*/: { n:"BrtRowHdr", f:parse_BrtRowHdr }, - /*::[*/0x0001/*::]*/: { n:"BrtCellBlank", f:parse_BrtCellBlank }, - /*::[*/0x0002/*::]*/: { n:"BrtCellRk", f:parse_BrtCellRk }, - /*::[*/0x0003/*::]*/: { n:"BrtCellError", f:parse_BrtCellError }, - /*::[*/0x0004/*::]*/: { n:"BrtCellBool", f:parse_BrtCellBool }, - /*::[*/0x0005/*::]*/: { n:"BrtCellReal", f:parse_BrtCellReal }, - /*::[*/0x0006/*::]*/: { n:"BrtCellSt", f:parse_BrtCellSt }, - /*::[*/0x0007/*::]*/: { n:"BrtCellIsst", f:parse_BrtCellIsst }, - /*::[*/0x0008/*::]*/: { n:"BrtFmlaString", f:parse_BrtFmlaString }, - /*::[*/0x0009/*::]*/: { n:"BrtFmlaNum", f:parse_BrtFmlaNum }, - /*::[*/0x000A/*::]*/: { n:"BrtFmlaBool", f:parse_BrtFmlaBool }, - /*::[*/0x000B/*::]*/: { n:"BrtFmlaError", f:parse_BrtFmlaError }, - /*::[*/0x000C/*::]*/: { n:"BrtShortBlank", f:parse_BrtShortBlank }, - /*::[*/0x000D/*::]*/: { n:"BrtShortRk", f:parse_BrtShortRk }, - /*::[*/0x000E/*::]*/: { n:"BrtShortError", f:parse_BrtShortError }, - /*::[*/0x000F/*::]*/: { n:"BrtShortBool", f:parse_BrtShortBool }, - /*::[*/0x0010/*::]*/: { n:"BrtShortReal", f:parse_BrtShortReal }, - /*::[*/0x0011/*::]*/: { n:"BrtShortSt", f:parse_BrtShortSt }, - /*::[*/0x0012/*::]*/: { n:"BrtShortIsst", f:parse_BrtShortIsst }, - /*::[*/0x0013/*::]*/: { n:"BrtSSTItem", f:parse_RichStr }, - /*::[*/0x0014/*::]*/: { n:"BrtPCDIMissing" }, - /*::[*/0x0015/*::]*/: { n:"BrtPCDINumber" }, - /*::[*/0x0016/*::]*/: { n:"BrtPCDIBoolean" }, - /*::[*/0x0017/*::]*/: { n:"BrtPCDIError" }, - /*::[*/0x0018/*::]*/: { n:"BrtPCDIString" }, - /*::[*/0x0019/*::]*/: { n:"BrtPCDIDatetime" }, - /*::[*/0x001A/*::]*/: { n:"BrtPCDIIndex" }, - /*::[*/0x001B/*::]*/: { n:"BrtPCDIAMissing" }, - /*::[*/0x001C/*::]*/: { n:"BrtPCDIANumber" }, - /*::[*/0x001D/*::]*/: { n:"BrtPCDIABoolean" }, - /*::[*/0x001E/*::]*/: { n:"BrtPCDIAError" }, - /*::[*/0x001F/*::]*/: { n:"BrtPCDIAString" }, - /*::[*/0x0020/*::]*/: { n:"BrtPCDIADatetime" }, - /*::[*/0x0021/*::]*/: { n:"BrtPCRRecord" }, - /*::[*/0x0022/*::]*/: { n:"BrtPCRRecordDt" }, - /*::[*/0x0023/*::]*/: { n:"BrtFRTBegin" }, - /*::[*/0x0024/*::]*/: { n:"BrtFRTEnd" }, - /*::[*/0x0025/*::]*/: { n:"BrtACBegin" }, - /*::[*/0x0026/*::]*/: { n:"BrtACEnd" }, - /*::[*/0x0027/*::]*/: { n:"BrtName", f:parse_BrtName }, - /*::[*/0x0028/*::]*/: { n:"BrtIndexRowBlock" }, - /*::[*/0x002A/*::]*/: { n:"BrtIndexBlock" }, - /*::[*/0x002B/*::]*/: { n:"BrtFont", f:parse_BrtFont }, - /*::[*/0x002C/*::]*/: { n:"BrtFmt", f:parse_BrtFmt }, - /*::[*/0x002D/*::]*/: { n:"BrtFill", f:parse_BrtFill }, - /*::[*/0x002E/*::]*/: { n:"BrtBorder", f:parse_BrtBorder }, - /*::[*/0x002F/*::]*/: { n:"BrtXF", f:parse_BrtXF }, - /*::[*/0x0030/*::]*/: { n:"BrtStyle" }, - /*::[*/0x0031/*::]*/: { n:"BrtCellMeta" }, - /*::[*/0x0032/*::]*/: { n:"BrtValueMeta" }, - /*::[*/0x0033/*::]*/: { n:"BrtMdb" }, - /*::[*/0x0034/*::]*/: { n:"BrtBeginFmd" }, - /*::[*/0x0035/*::]*/: { n:"BrtEndFmd" }, - /*::[*/0x0036/*::]*/: { n:"BrtBeginMdx" }, - /*::[*/0x0037/*::]*/: { n:"BrtEndMdx" }, - /*::[*/0x0038/*::]*/: { n:"BrtBeginMdxTuple" }, - /*::[*/0x0039/*::]*/: { n:"BrtEndMdxTuple" }, - /*::[*/0x003A/*::]*/: { n:"BrtMdxMbrIstr" }, - /*::[*/0x003B/*::]*/: { n:"BrtStr" }, - /*::[*/0x003C/*::]*/: { n:"BrtColInfo", f:parse_ColInfo }, - /*::[*/0x003E/*::]*/: { n:"BrtCellRString", f:parse_BrtCellRString }, - /*::[*/0x003F/*::]*/: { n:"BrtCalcChainItem$", f:parse_BrtCalcChainItem$ }, - /*::[*/0x0040/*::]*/: { n:"BrtDVal", f:parse_BrtDVal }, - /*::[*/0x0041/*::]*/: { n:"BrtSxvcellNum" }, - /*::[*/0x0042/*::]*/: { n:"BrtSxvcellStr" }, - /*::[*/0x0043/*::]*/: { n:"BrtSxvcellBool" }, - /*::[*/0x0044/*::]*/: { n:"BrtSxvcellErr" }, - /*::[*/0x0045/*::]*/: { n:"BrtSxvcellDate" }, - /*::[*/0x0046/*::]*/: { n:"BrtSxvcellNil" }, - /*::[*/0x0080/*::]*/: { n:"BrtFileVersion" }, - /*::[*/0x0081/*::]*/: { n:"BrtBeginSheet" }, - /*::[*/0x0082/*::]*/: { n:"BrtEndSheet" }, - /*::[*/0x0083/*::]*/: { n:"BrtBeginBook", f:parsenoop, p:0 }, - /*::[*/0x0084/*::]*/: { n:"BrtEndBook" }, - /*::[*/0x0085/*::]*/: { n:"BrtBeginWsViews" }, - /*::[*/0x0086/*::]*/: { n:"BrtEndWsViews" }, - /*::[*/0x0087/*::]*/: { n:"BrtBeginBookViews" }, - /*::[*/0x0088/*::]*/: { n:"BrtEndBookViews" }, - /*::[*/0x0089/*::]*/: { n:"BrtBeginWsView", f:parse_BrtBeginWsView }, - /*::[*/0x008A/*::]*/: { n:"BrtEndWsView" }, - /*::[*/0x008B/*::]*/: { n:"BrtBeginCsViews" }, - /*::[*/0x008C/*::]*/: { n:"BrtEndCsViews" }, - /*::[*/0x008D/*::]*/: { n:"BrtBeginCsView" }, - /*::[*/0x008E/*::]*/: { n:"BrtEndCsView" }, - /*::[*/0x008F/*::]*/: { n:"BrtBeginBundleShs" }, - /*::[*/0x0090/*::]*/: { n:"BrtEndBundleShs" }, - /*::[*/0x0091/*::]*/: { n:"BrtBeginSheetData" }, - /*::[*/0x0092/*::]*/: { n:"BrtEndSheetData" }, - /*::[*/0x0093/*::]*/: { n:"BrtWsProp", f:parse_BrtWsProp }, - /*::[*/0x0094/*::]*/: { n:"BrtWsDim", f:parse_BrtWsDim, p:16 }, - /*::[*/0x0097/*::]*/: { n:"BrtPane", f:parse_BrtPane }, - /*::[*/0x0098/*::]*/: { n:"BrtSel" }, - /*::[*/0x0099/*::]*/: { n:"BrtWbProp", f:parse_BrtWbProp }, - /*::[*/0x009A/*::]*/: { n:"BrtWbFactoid" }, - /*::[*/0x009B/*::]*/: { n:"BrtFileRecover" }, - /*::[*/0x009C/*::]*/: { n:"BrtBundleSh", f:parse_BrtBundleSh }, - /*::[*/0x009D/*::]*/: { n:"BrtCalcProp" }, - /*::[*/0x009E/*::]*/: { n:"BrtBookView" }, - /*::[*/0x009F/*::]*/: { n:"BrtBeginSst", f:parse_BrtBeginSst }, - /*::[*/0x00A0/*::]*/: { n:"BrtEndSst" }, - /*::[*/0x00A1/*::]*/: { n:"BrtBeginAFilter", f:parse_UncheckedRfX }, - /*::[*/0x00A2/*::]*/: { n:"BrtEndAFilter" }, - /*::[*/0x00A3/*::]*/: { n:"BrtBeginFilterColumn" }, - /*::[*/0x00A4/*::]*/: { n:"BrtEndFilterColumn" }, - /*::[*/0x00A5/*::]*/: { n:"BrtBeginFilters" }, - /*::[*/0x00A6/*::]*/: { n:"BrtEndFilters" }, - /*::[*/0x00A7/*::]*/: { n:"BrtFilter" }, - /*::[*/0x00A8/*::]*/: { n:"BrtColorFilter" }, - /*::[*/0x00A9/*::]*/: { n:"BrtIconFilter" }, - /*::[*/0x00AA/*::]*/: { n:"BrtTop10Filter" }, - /*::[*/0x00AB/*::]*/: { n:"BrtDynamicFilter" }, - /*::[*/0x00AC/*::]*/: { n:"BrtBeginCustomFilters" }, - /*::[*/0x00AD/*::]*/: { n:"BrtEndCustomFilters" }, - /*::[*/0x00AE/*::]*/: { n:"BrtCustomFilter" }, - /*::[*/0x00AF/*::]*/: { n:"BrtAFilterDateGroupItem" }, - /*::[*/0x00B0/*::]*/: { n:"BrtMergeCell", f:parse_BrtMergeCell }, - /*::[*/0x00B1/*::]*/: { n:"BrtBeginMergeCells" }, - /*::[*/0x00B2/*::]*/: { n:"BrtEndMergeCells" }, - /*::[*/0x00B3/*::]*/: { n:"BrtBeginPivotCacheDef" }, - /*::[*/0x00B4/*::]*/: { n:"BrtEndPivotCacheDef" }, - /*::[*/0x00B5/*::]*/: { n:"BrtBeginPCDFields" }, - /*::[*/0x00B6/*::]*/: { n:"BrtEndPCDFields" }, - /*::[*/0x00B7/*::]*/: { n:"BrtBeginPCDField" }, - /*::[*/0x00B8/*::]*/: { n:"BrtEndPCDField" }, - /*::[*/0x00B9/*::]*/: { n:"BrtBeginPCDSource" }, - /*::[*/0x00BA/*::]*/: { n:"BrtEndPCDSource" }, - /*::[*/0x00BB/*::]*/: { n:"BrtBeginPCDSRange" }, - /*::[*/0x00BC/*::]*/: { n:"BrtEndPCDSRange" }, - /*::[*/0x00BD/*::]*/: { n:"BrtBeginPCDFAtbl" }, - /*::[*/0x00BE/*::]*/: { n:"BrtEndPCDFAtbl" }, - /*::[*/0x00BF/*::]*/: { n:"BrtBeginPCDIRun" }, - /*::[*/0x00C0/*::]*/: { n:"BrtEndPCDIRun" }, - /*::[*/0x00C1/*::]*/: { n:"BrtBeginPivotCacheRecords" }, - /*::[*/0x00C2/*::]*/: { n:"BrtEndPivotCacheRecords" }, - /*::[*/0x00C3/*::]*/: { n:"BrtBeginPCDHierarchies" }, - /*::[*/0x00C4/*::]*/: { n:"BrtEndPCDHierarchies" }, - /*::[*/0x00C5/*::]*/: { n:"BrtBeginPCDHierarchy" }, - /*::[*/0x00C6/*::]*/: { n:"BrtEndPCDHierarchy" }, - /*::[*/0x00C7/*::]*/: { n:"BrtBeginPCDHFieldsUsage" }, - /*::[*/0x00C8/*::]*/: { n:"BrtEndPCDHFieldsUsage" }, - /*::[*/0x00C9/*::]*/: { n:"BrtBeginExtConnection" }, - /*::[*/0x00CA/*::]*/: { n:"BrtEndExtConnection" }, - /*::[*/0x00CB/*::]*/: { n:"BrtBeginECDbProps" }, - /*::[*/0x00CC/*::]*/: { n:"BrtEndECDbProps" }, - /*::[*/0x00CD/*::]*/: { n:"BrtBeginECOlapProps" }, - /*::[*/0x00CE/*::]*/: { n:"BrtEndECOlapProps" }, - /*::[*/0x00CF/*::]*/: { n:"BrtBeginPCDSConsol" }, - /*::[*/0x00D0/*::]*/: { n:"BrtEndPCDSConsol" }, - /*::[*/0x00D1/*::]*/: { n:"BrtBeginPCDSCPages" }, - /*::[*/0x00D2/*::]*/: { n:"BrtEndPCDSCPages" }, - /*::[*/0x00D3/*::]*/: { n:"BrtBeginPCDSCPage" }, - /*::[*/0x00D4/*::]*/: { n:"BrtEndPCDSCPage" }, - /*::[*/0x00D5/*::]*/: { n:"BrtBeginPCDSCPItem" }, - /*::[*/0x00D6/*::]*/: { n:"BrtEndPCDSCPItem" }, - /*::[*/0x00D7/*::]*/: { n:"BrtBeginPCDSCSets" }, - /*::[*/0x00D8/*::]*/: { n:"BrtEndPCDSCSets" }, - /*::[*/0x00D9/*::]*/: { n:"BrtBeginPCDSCSet" }, - /*::[*/0x00DA/*::]*/: { n:"BrtEndPCDSCSet" }, - /*::[*/0x00DB/*::]*/: { n:"BrtBeginPCDFGroup" }, - /*::[*/0x00DC/*::]*/: { n:"BrtEndPCDFGroup" }, - /*::[*/0x00DD/*::]*/: { n:"BrtBeginPCDFGItems" }, - /*::[*/0x00DE/*::]*/: { n:"BrtEndPCDFGItems" }, - /*::[*/0x00DF/*::]*/: { n:"BrtBeginPCDFGRange" }, - /*::[*/0x00E0/*::]*/: { n:"BrtEndPCDFGRange" }, - /*::[*/0x00E1/*::]*/: { n:"BrtBeginPCDFGDiscrete" }, - /*::[*/0x00E2/*::]*/: { n:"BrtEndPCDFGDiscrete" }, - /*::[*/0x00E3/*::]*/: { n:"BrtBeginPCDSDTupleCache" }, - /*::[*/0x00E4/*::]*/: { n:"BrtEndPCDSDTupleCache" }, - /*::[*/0x00E5/*::]*/: { n:"BrtBeginPCDSDTCEntries" }, - /*::[*/0x00E6/*::]*/: { n:"BrtEndPCDSDTCEntries" }, - /*::[*/0x00E7/*::]*/: { n:"BrtBeginPCDSDTCEMembers" }, - /*::[*/0x00E8/*::]*/: { n:"BrtEndPCDSDTCEMembers" }, - /*::[*/0x00E9/*::]*/: { n:"BrtBeginPCDSDTCEMember" }, - /*::[*/0x00EA/*::]*/: { n:"BrtEndPCDSDTCEMember" }, - /*::[*/0x00EB/*::]*/: { n:"BrtBeginPCDSDTCQueries" }, - /*::[*/0x00EC/*::]*/: { n:"BrtEndPCDSDTCQueries" }, - /*::[*/0x00ED/*::]*/: { n:"BrtBeginPCDSDTCQuery" }, - /*::[*/0x00EE/*::]*/: { n:"BrtEndPCDSDTCQuery" }, - /*::[*/0x00EF/*::]*/: { n:"BrtBeginPCDSDTCSets" }, - /*::[*/0x00F0/*::]*/: { n:"BrtEndPCDSDTCSets" }, - /*::[*/0x00F1/*::]*/: { n:"BrtBeginPCDSDTCSet" }, - /*::[*/0x00F2/*::]*/: { n:"BrtEndPCDSDTCSet" }, - /*::[*/0x00F3/*::]*/: { n:"BrtBeginPCDCalcItems" }, - /*::[*/0x00F4/*::]*/: { n:"BrtEndPCDCalcItems" }, - /*::[*/0x00F5/*::]*/: { n:"BrtBeginPCDCalcItem" }, - /*::[*/0x00F6/*::]*/: { n:"BrtEndPCDCalcItem" }, - /*::[*/0x00F7/*::]*/: { n:"BrtBeginPRule" }, - /*::[*/0x00F8/*::]*/: { n:"BrtEndPRule" }, - /*::[*/0x00F9/*::]*/: { n:"BrtBeginPRFilters" }, - /*::[*/0x00FA/*::]*/: { n:"BrtEndPRFilters" }, - /*::[*/0x00FB/*::]*/: { n:"BrtBeginPRFilter" }, - /*::[*/0x00FC/*::]*/: { n:"BrtEndPRFilter" }, - /*::[*/0x00FD/*::]*/: { n:"BrtBeginPNames" }, - /*::[*/0x00FE/*::]*/: { n:"BrtEndPNames" }, - /*::[*/0x00FF/*::]*/: { n:"BrtBeginPName" }, - /*::[*/0x0100/*::]*/: { n:"BrtEndPName" }, - /*::[*/0x0101/*::]*/: { n:"BrtBeginPNPairs" }, - /*::[*/0x0102/*::]*/: { n:"BrtEndPNPairs" }, - /*::[*/0x0103/*::]*/: { n:"BrtBeginPNPair" }, - /*::[*/0x0104/*::]*/: { n:"BrtEndPNPair" }, - /*::[*/0x0105/*::]*/: { n:"BrtBeginECWebProps" }, - /*::[*/0x0106/*::]*/: { n:"BrtEndECWebProps" }, - /*::[*/0x0107/*::]*/: { n:"BrtBeginEcWpTables" }, - /*::[*/0x0108/*::]*/: { n:"BrtEndECWPTables" }, - /*::[*/0x0109/*::]*/: { n:"BrtBeginECParams" }, - /*::[*/0x010A/*::]*/: { n:"BrtEndECParams" }, - /*::[*/0x010B/*::]*/: { n:"BrtBeginECParam" }, - /*::[*/0x010C/*::]*/: { n:"BrtEndECParam" }, - /*::[*/0x010D/*::]*/: { n:"BrtBeginPCDKPIs" }, - /*::[*/0x010E/*::]*/: { n:"BrtEndPCDKPIs" }, - /*::[*/0x010F/*::]*/: { n:"BrtBeginPCDKPI" }, - /*::[*/0x0110/*::]*/: { n:"BrtEndPCDKPI" }, - /*::[*/0x0111/*::]*/: { n:"BrtBeginDims" }, - /*::[*/0x0112/*::]*/: { n:"BrtEndDims" }, - /*::[*/0x0113/*::]*/: { n:"BrtBeginDim" }, - /*::[*/0x0114/*::]*/: { n:"BrtEndDim" }, - /*::[*/0x0115/*::]*/: { n:"BrtIndexPartEnd" }, - /*::[*/0x0116/*::]*/: { n:"BrtBeginStyleSheet" }, - /*::[*/0x0117/*::]*/: { n:"BrtEndStyleSheet" }, - /*::[*/0x0118/*::]*/: { n:"BrtBeginSXView" }, - /*::[*/0x0119/*::]*/: { n:"BrtEndSXVI" }, - /*::[*/0x011A/*::]*/: { n:"BrtBeginSXVI" }, - /*::[*/0x011B/*::]*/: { n:"BrtBeginSXVIs" }, - /*::[*/0x011C/*::]*/: { n:"BrtEndSXVIs" }, - /*::[*/0x011D/*::]*/: { n:"BrtBeginSXVD" }, - /*::[*/0x011E/*::]*/: { n:"BrtEndSXVD" }, - /*::[*/0x011F/*::]*/: { n:"BrtBeginSXVDs" }, - /*::[*/0x0120/*::]*/: { n:"BrtEndSXVDs" }, - /*::[*/0x0121/*::]*/: { n:"BrtBeginSXPI" }, - /*::[*/0x0122/*::]*/: { n:"BrtEndSXPI" }, - /*::[*/0x0123/*::]*/: { n:"BrtBeginSXPIs" }, - /*::[*/0x0124/*::]*/: { n:"BrtEndSXPIs" }, - /*::[*/0x0125/*::]*/: { n:"BrtBeginSXDI" }, - /*::[*/0x0126/*::]*/: { n:"BrtEndSXDI" }, - /*::[*/0x0127/*::]*/: { n:"BrtBeginSXDIs" }, - /*::[*/0x0128/*::]*/: { n:"BrtEndSXDIs" }, - /*::[*/0x0129/*::]*/: { n:"BrtBeginSXLI" }, - /*::[*/0x012A/*::]*/: { n:"BrtEndSXLI" }, - /*::[*/0x012B/*::]*/: { n:"BrtBeginSXLIRws" }, - /*::[*/0x012C/*::]*/: { n:"BrtEndSXLIRws" }, - /*::[*/0x012D/*::]*/: { n:"BrtBeginSXLICols" }, - /*::[*/0x012E/*::]*/: { n:"BrtEndSXLICols" }, - /*::[*/0x012F/*::]*/: { n:"BrtBeginSXFormat" }, - /*::[*/0x0130/*::]*/: { n:"BrtEndSXFormat" }, - /*::[*/0x0131/*::]*/: { n:"BrtBeginSXFormats" }, - /*::[*/0x0132/*::]*/: { n:"BrtEndSxFormats" }, - /*::[*/0x0133/*::]*/: { n:"BrtBeginSxSelect" }, - /*::[*/0x0134/*::]*/: { n:"BrtEndSxSelect" }, - /*::[*/0x0135/*::]*/: { n:"BrtBeginISXVDRws" }, - /*::[*/0x0136/*::]*/: { n:"BrtEndISXVDRws" }, - /*::[*/0x0137/*::]*/: { n:"BrtBeginISXVDCols" }, - /*::[*/0x0138/*::]*/: { n:"BrtEndISXVDCols" }, - /*::[*/0x0139/*::]*/: { n:"BrtEndSXLocation" }, - /*::[*/0x013A/*::]*/: { n:"BrtBeginSXLocation" }, - /*::[*/0x013B/*::]*/: { n:"BrtEndSXView" }, - /*::[*/0x013C/*::]*/: { n:"BrtBeginSXTHs" }, - /*::[*/0x013D/*::]*/: { n:"BrtEndSXTHs" }, - /*::[*/0x013E/*::]*/: { n:"BrtBeginSXTH" }, - /*::[*/0x013F/*::]*/: { n:"BrtEndSXTH" }, - /*::[*/0x0140/*::]*/: { n:"BrtBeginISXTHRws" }, - /*::[*/0x0141/*::]*/: { n:"BrtEndISXTHRws" }, - /*::[*/0x0142/*::]*/: { n:"BrtBeginISXTHCols" }, - /*::[*/0x0143/*::]*/: { n:"BrtEndISXTHCols" }, - /*::[*/0x0144/*::]*/: { n:"BrtBeginSXTDMPS" }, - /*::[*/0x0145/*::]*/: { n:"BrtEndSXTDMPs" }, - /*::[*/0x0146/*::]*/: { n:"BrtBeginSXTDMP" }, - /*::[*/0x0147/*::]*/: { n:"BrtEndSXTDMP" }, - /*::[*/0x0148/*::]*/: { n:"BrtBeginSXTHItems" }, - /*::[*/0x0149/*::]*/: { n:"BrtEndSXTHItems" }, - /*::[*/0x014A/*::]*/: { n:"BrtBeginSXTHItem" }, - /*::[*/0x014B/*::]*/: { n:"BrtEndSXTHItem" }, - /*::[*/0x014C/*::]*/: { n:"BrtBeginMetadata" }, - /*::[*/0x014D/*::]*/: { n:"BrtEndMetadata" }, - /*::[*/0x014E/*::]*/: { n:"BrtBeginEsmdtinfo" }, - /*::[*/0x014F/*::]*/: { n:"BrtMdtinfo" }, - /*::[*/0x0150/*::]*/: { n:"BrtEndEsmdtinfo" }, - /*::[*/0x0151/*::]*/: { n:"BrtBeginEsmdb" }, - /*::[*/0x0152/*::]*/: { n:"BrtEndEsmdb" }, - /*::[*/0x0153/*::]*/: { n:"BrtBeginEsfmd" }, - /*::[*/0x0154/*::]*/: { n:"BrtEndEsfmd" }, - /*::[*/0x0155/*::]*/: { n:"BrtBeginSingleCells" }, - /*::[*/0x0156/*::]*/: { n:"BrtEndSingleCells" }, - /*::[*/0x0157/*::]*/: { n:"BrtBeginList" }, - /*::[*/0x0158/*::]*/: { n:"BrtEndList" }, - /*::[*/0x0159/*::]*/: { n:"BrtBeginListCols" }, - /*::[*/0x015A/*::]*/: { n:"BrtEndListCols" }, - /*::[*/0x015B/*::]*/: { n:"BrtBeginListCol" }, - /*::[*/0x015C/*::]*/: { n:"BrtEndListCol" }, - /*::[*/0x015D/*::]*/: { n:"BrtBeginListXmlCPr" }, - /*::[*/0x015E/*::]*/: { n:"BrtEndListXmlCPr" }, - /*::[*/0x015F/*::]*/: { n:"BrtListCCFmla" }, - /*::[*/0x0160/*::]*/: { n:"BrtListTrFmla" }, - /*::[*/0x0161/*::]*/: { n:"BrtBeginExternals" }, - /*::[*/0x0162/*::]*/: { n:"BrtEndExternals" }, - /*::[*/0x0163/*::]*/: { n:"BrtSupBookSrc", f:parse_RelID}, - /*::[*/0x0165/*::]*/: { n:"BrtSupSelf" }, - /*::[*/0x0166/*::]*/: { n:"BrtSupSame" }, - /*::[*/0x0167/*::]*/: { n:"BrtSupTabs" }, - /*::[*/0x0168/*::]*/: { n:"BrtBeginSupBook" }, - /*::[*/0x0169/*::]*/: { n:"BrtPlaceholderName" }, - /*::[*/0x016A/*::]*/: { n:"BrtExternSheet", f:parse_ExternSheet }, - /*::[*/0x016B/*::]*/: { n:"BrtExternTableStart" }, - /*::[*/0x016C/*::]*/: { n:"BrtExternTableEnd" }, - /*::[*/0x016E/*::]*/: { n:"BrtExternRowHdr" }, - /*::[*/0x016F/*::]*/: { n:"BrtExternCellBlank" }, - /*::[*/0x0170/*::]*/: { n:"BrtExternCellReal" }, - /*::[*/0x0171/*::]*/: { n:"BrtExternCellBool" }, - /*::[*/0x0172/*::]*/: { n:"BrtExternCellError" }, - /*::[*/0x0173/*::]*/: { n:"BrtExternCellString" }, - /*::[*/0x0174/*::]*/: { n:"BrtBeginEsmdx" }, - /*::[*/0x0175/*::]*/: { n:"BrtEndEsmdx" }, - /*::[*/0x0176/*::]*/: { n:"BrtBeginMdxSet" }, - /*::[*/0x0177/*::]*/: { n:"BrtEndMdxSet" }, - /*::[*/0x0178/*::]*/: { n:"BrtBeginMdxMbrProp" }, - /*::[*/0x0179/*::]*/: { n:"BrtEndMdxMbrProp" }, - /*::[*/0x017A/*::]*/: { n:"BrtBeginMdxKPI" }, - /*::[*/0x017B/*::]*/: { n:"BrtEndMdxKPI" }, - /*::[*/0x017C/*::]*/: { n:"BrtBeginEsstr" }, - /*::[*/0x017D/*::]*/: { n:"BrtEndEsstr" }, - /*::[*/0x017E/*::]*/: { n:"BrtBeginPRFItem" }, - /*::[*/0x017F/*::]*/: { n:"BrtEndPRFItem" }, - /*::[*/0x0180/*::]*/: { n:"BrtBeginPivotCacheIDs" }, - /*::[*/0x0181/*::]*/: { n:"BrtEndPivotCacheIDs" }, - /*::[*/0x0182/*::]*/: { n:"BrtBeginPivotCacheID" }, - /*::[*/0x0183/*::]*/: { n:"BrtEndPivotCacheID" }, - /*::[*/0x0184/*::]*/: { n:"BrtBeginISXVIs" }, - /*::[*/0x0185/*::]*/: { n:"BrtEndISXVIs" }, - /*::[*/0x0186/*::]*/: { n:"BrtBeginColInfos" }, - /*::[*/0x0187/*::]*/: { n:"BrtEndColInfos" }, - /*::[*/0x0188/*::]*/: { n:"BrtBeginRwBrk" }, - /*::[*/0x0189/*::]*/: { n:"BrtEndRwBrk" }, - /*::[*/0x018A/*::]*/: { n:"BrtBeginColBrk" }, - /*::[*/0x018B/*::]*/: { n:"BrtEndColBrk" }, - /*::[*/0x018C/*::]*/: { n:"BrtBrk" }, - /*::[*/0x018D/*::]*/: { n:"BrtUserBookView" }, - /*::[*/0x018E/*::]*/: { n:"BrtInfo" }, - /*::[*/0x018F/*::]*/: { n:"BrtCUsr" }, - /*::[*/0x0190/*::]*/: { n:"BrtUsr" }, - /*::[*/0x0191/*::]*/: { n:"BrtBeginUsers" }, - /*::[*/0x0193/*::]*/: { n:"BrtEOF" }, - /*::[*/0x0194/*::]*/: { n:"BrtUCR" }, - /*::[*/0x0195/*::]*/: { n:"BrtRRInsDel" }, - /*::[*/0x0196/*::]*/: { n:"BrtRREndInsDel" }, - /*::[*/0x0197/*::]*/: { n:"BrtRRMove" }, - /*::[*/0x0198/*::]*/: { n:"BrtRREndMove" }, - /*::[*/0x0199/*::]*/: { n:"BrtRRChgCell" }, - /*::[*/0x019A/*::]*/: { n:"BrtRREndChgCell" }, - /*::[*/0x019B/*::]*/: { n:"BrtRRHeader" }, - /*::[*/0x019C/*::]*/: { n:"BrtRRUserView" }, - /*::[*/0x019D/*::]*/: { n:"BrtRRRenSheet" }, - /*::[*/0x019E/*::]*/: { n:"BrtRRInsertSh" }, - /*::[*/0x019F/*::]*/: { n:"BrtRRDefName" }, - /*::[*/0x01A0/*::]*/: { n:"BrtRRNote" }, - /*::[*/0x01A1/*::]*/: { n:"BrtRRConflict" }, - /*::[*/0x01A2/*::]*/: { n:"BrtRRTQSIF" }, - /*::[*/0x01A3/*::]*/: { n:"BrtRRFormat" }, - /*::[*/0x01A4/*::]*/: { n:"BrtRREndFormat" }, - /*::[*/0x01A5/*::]*/: { n:"BrtRRAutoFmt" }, - /*::[*/0x01A6/*::]*/: { n:"BrtBeginUserShViews" }, - /*::[*/0x01A7/*::]*/: { n:"BrtBeginUserShView" }, - /*::[*/0x01A8/*::]*/: { n:"BrtEndUserShView" }, - /*::[*/0x01A9/*::]*/: { n:"BrtEndUserShViews" }, - /*::[*/0x01AA/*::]*/: { n:"BrtArrFmla", f:parse_BrtArrFmla }, - /*::[*/0x01AB/*::]*/: { n:"BrtShrFmla", f:parse_BrtShrFmla }, - /*::[*/0x01AC/*::]*/: { n:"BrtTable" }, - /*::[*/0x01AD/*::]*/: { n:"BrtBeginExtConnections" }, - /*::[*/0x01AE/*::]*/: { n:"BrtEndExtConnections" }, - /*::[*/0x01AF/*::]*/: { n:"BrtBeginPCDCalcMems" }, - /*::[*/0x01B0/*::]*/: { n:"BrtEndPCDCalcMems" }, - /*::[*/0x01B1/*::]*/: { n:"BrtBeginPCDCalcMem" }, - /*::[*/0x01B2/*::]*/: { n:"BrtEndPCDCalcMem" }, - /*::[*/0x01B3/*::]*/: { n:"BrtBeginPCDHGLevels" }, - /*::[*/0x01B4/*::]*/: { n:"BrtEndPCDHGLevels" }, - /*::[*/0x01B5/*::]*/: { n:"BrtBeginPCDHGLevel" }, - /*::[*/0x01B6/*::]*/: { n:"BrtEndPCDHGLevel" }, - /*::[*/0x01B7/*::]*/: { n:"BrtBeginPCDHGLGroups" }, - /*::[*/0x01B8/*::]*/: { n:"BrtEndPCDHGLGroups" }, - /*::[*/0x01B9/*::]*/: { n:"BrtBeginPCDHGLGroup" }, - /*::[*/0x01BA/*::]*/: { n:"BrtEndPCDHGLGroup" }, - /*::[*/0x01BB/*::]*/: { n:"BrtBeginPCDHGLGMembers" }, - /*::[*/0x01BC/*::]*/: { n:"BrtEndPCDHGLGMembers" }, - /*::[*/0x01BD/*::]*/: { n:"BrtBeginPCDHGLGMember" }, - /*::[*/0x01BE/*::]*/: { n:"BrtEndPCDHGLGMember" }, - /*::[*/0x01BF/*::]*/: { n:"BrtBeginQSI" }, - /*::[*/0x01C0/*::]*/: { n:"BrtEndQSI" }, - /*::[*/0x01C1/*::]*/: { n:"BrtBeginQSIR" }, - /*::[*/0x01C2/*::]*/: { n:"BrtEndQSIR" }, - /*::[*/0x01C3/*::]*/: { n:"BrtBeginDeletedNames" }, - /*::[*/0x01C4/*::]*/: { n:"BrtEndDeletedNames" }, - /*::[*/0x01C5/*::]*/: { n:"BrtBeginDeletedName" }, - /*::[*/0x01C6/*::]*/: { n:"BrtEndDeletedName" }, - /*::[*/0x01C7/*::]*/: { n:"BrtBeginQSIFs" }, - /*::[*/0x01C8/*::]*/: { n:"BrtEndQSIFs" }, - /*::[*/0x01C9/*::]*/: { n:"BrtBeginQSIF" }, - /*::[*/0x01CA/*::]*/: { n:"BrtEndQSIF" }, - /*::[*/0x01CB/*::]*/: { n:"BrtBeginAutoSortScope" }, - /*::[*/0x01CC/*::]*/: { n:"BrtEndAutoSortScope" }, - /*::[*/0x01CD/*::]*/: { n:"BrtBeginConditionalFormatting" }, - /*::[*/0x01CE/*::]*/: { n:"BrtEndConditionalFormatting" }, - /*::[*/0x01CF/*::]*/: { n:"BrtBeginCFRule" }, - /*::[*/0x01D0/*::]*/: { n:"BrtEndCFRule" }, - /*::[*/0x01D1/*::]*/: { n:"BrtBeginIconSet" }, - /*::[*/0x01D2/*::]*/: { n:"BrtEndIconSet" }, - /*::[*/0x01D3/*::]*/: { n:"BrtBeginDatabar" }, - /*::[*/0x01D4/*::]*/: { n:"BrtEndDatabar" }, - /*::[*/0x01D5/*::]*/: { n:"BrtBeginColorScale" }, - /*::[*/0x01D6/*::]*/: { n:"BrtEndColorScale" }, - /*::[*/0x01D7/*::]*/: { n:"BrtCFVO" }, - /*::[*/0x01D8/*::]*/: { n:"BrtExternValueMeta" }, - /*::[*/0x01D9/*::]*/: { n:"BrtBeginColorPalette" }, - /*::[*/0x01DA/*::]*/: { n:"BrtEndColorPalette" }, - /*::[*/0x01DB/*::]*/: { n:"BrtIndexedColor" }, - /*::[*/0x01DC/*::]*/: { n:"BrtMargins", f:parse_BrtMargins }, - /*::[*/0x01DD/*::]*/: { n:"BrtPrintOptions" }, - /*::[*/0x01DE/*::]*/: { n:"BrtPageSetup" }, - /*::[*/0x01DF/*::]*/: { n:"BrtBeginHeaderFooter" }, - /*::[*/0x01E0/*::]*/: { n:"BrtEndHeaderFooter" }, - /*::[*/0x01E1/*::]*/: { n:"BrtBeginSXCrtFormat" }, - /*::[*/0x01E2/*::]*/: { n:"BrtEndSXCrtFormat" }, - /*::[*/0x01E3/*::]*/: { n:"BrtBeginSXCrtFormats" }, - /*::[*/0x01E4/*::]*/: { n:"BrtEndSXCrtFormats" }, - /*::[*/0x01E5/*::]*/: { n:"BrtWsFmtInfo", f:parse_BrtWsFmtInfo }, - /*::[*/0x01E6/*::]*/: { n:"BrtBeginMgs" }, - /*::[*/0x01E7/*::]*/: { n:"BrtEndMGs" }, - /*::[*/0x01E8/*::]*/: { n:"BrtBeginMGMaps" }, - /*::[*/0x01E9/*::]*/: { n:"BrtEndMGMaps" }, - /*::[*/0x01EA/*::]*/: { n:"BrtBeginMG" }, - /*::[*/0x01EB/*::]*/: { n:"BrtEndMG" }, - /*::[*/0x01EC/*::]*/: { n:"BrtBeginMap" }, - /*::[*/0x01ED/*::]*/: { n:"BrtEndMap" }, - /*::[*/0x01EE/*::]*/: { n:"BrtHLink", f:parse_BrtHLink }, - /*::[*/0x01EF/*::]*/: { n:"BrtBeginDCon" }, - /*::[*/0x01F0/*::]*/: { n:"BrtEndDCon" }, - /*::[*/0x01F1/*::]*/: { n:"BrtBeginDRefs" }, - /*::[*/0x01F2/*::]*/: { n:"BrtEndDRefs" }, - /*::[*/0x01F3/*::]*/: { n:"BrtDRef" }, - /*::[*/0x01F4/*::]*/: { n:"BrtBeginScenMan" }, - /*::[*/0x01F5/*::]*/: { n:"BrtEndScenMan" }, - /*::[*/0x01F6/*::]*/: { n:"BrtBeginSct" }, - /*::[*/0x01F7/*::]*/: { n:"BrtEndSct" }, - /*::[*/0x01F8/*::]*/: { n:"BrtSlc" }, - /*::[*/0x01F9/*::]*/: { n:"BrtBeginDXFs" }, - /*::[*/0x01FA/*::]*/: { n:"BrtEndDXFs" }, - /*::[*/0x01FB/*::]*/: { n:"BrtDXF" }, - /*::[*/0x01FC/*::]*/: { n:"BrtBeginTableStyles" }, - /*::[*/0x01FD/*::]*/: { n:"BrtEndTableStyles" }, - /*::[*/0x01FE/*::]*/: { n:"BrtBeginTableStyle" }, - /*::[*/0x01FF/*::]*/: { n:"BrtEndTableStyle" }, - /*::[*/0x0200/*::]*/: { n:"BrtTableStyleElement" }, - /*::[*/0x0201/*::]*/: { n:"BrtTableStyleClient" }, - /*::[*/0x0202/*::]*/: { n:"BrtBeginVolDeps" }, - /*::[*/0x0203/*::]*/: { n:"BrtEndVolDeps" }, - /*::[*/0x0204/*::]*/: { n:"BrtBeginVolType" }, - /*::[*/0x0205/*::]*/: { n:"BrtEndVolType" }, - /*::[*/0x0206/*::]*/: { n:"BrtBeginVolMain" }, - /*::[*/0x0207/*::]*/: { n:"BrtEndVolMain" }, - /*::[*/0x0208/*::]*/: { n:"BrtBeginVolTopic" }, - /*::[*/0x0209/*::]*/: { n:"BrtEndVolTopic" }, - /*::[*/0x020A/*::]*/: { n:"BrtVolSubtopic" }, - /*::[*/0x020B/*::]*/: { n:"BrtVolRef" }, - /*::[*/0x020C/*::]*/: { n:"BrtVolNum" }, - /*::[*/0x020D/*::]*/: { n:"BrtVolErr" }, - /*::[*/0x020E/*::]*/: { n:"BrtVolStr" }, - /*::[*/0x020F/*::]*/: { n:"BrtVolBool" }, - /*::[*/0x0210/*::]*/: { n:"BrtBeginCalcChain$" }, - /*::[*/0x0211/*::]*/: { n:"BrtEndCalcChain$" }, - /*::[*/0x0212/*::]*/: { n:"BrtBeginSortState" }, - /*::[*/0x0213/*::]*/: { n:"BrtEndSortState" }, - /*::[*/0x0214/*::]*/: { n:"BrtBeginSortCond" }, - /*::[*/0x0215/*::]*/: { n:"BrtEndSortCond" }, - /*::[*/0x0216/*::]*/: { n:"BrtBookProtection" }, - /*::[*/0x0217/*::]*/: { n:"BrtSheetProtection" }, - /*::[*/0x0218/*::]*/: { n:"BrtRangeProtection" }, - /*::[*/0x0219/*::]*/: { n:"BrtPhoneticInfo" }, - /*::[*/0x021A/*::]*/: { n:"BrtBeginECTxtWiz" }, - /*::[*/0x021B/*::]*/: { n:"BrtEndECTxtWiz" }, - /*::[*/0x021C/*::]*/: { n:"BrtBeginECTWFldInfoLst" }, - /*::[*/0x021D/*::]*/: { n:"BrtEndECTWFldInfoLst" }, - /*::[*/0x021E/*::]*/: { n:"BrtBeginECTwFldInfo" }, - /*::[*/0x0224/*::]*/: { n:"BrtFileSharing" }, - /*::[*/0x0225/*::]*/: { n:"BrtOleSize" }, - /*::[*/0x0226/*::]*/: { n:"BrtDrawing", f:parse_RelID }, - /*::[*/0x0227/*::]*/: { n:"BrtLegacyDrawing" }, - /*::[*/0x0228/*::]*/: { n:"BrtLegacyDrawingHF" }, - /*::[*/0x0229/*::]*/: { n:"BrtWebOpt" }, - /*::[*/0x022A/*::]*/: { n:"BrtBeginWebPubItems" }, - /*::[*/0x022B/*::]*/: { n:"BrtEndWebPubItems" }, - /*::[*/0x022C/*::]*/: { n:"BrtBeginWebPubItem" }, - /*::[*/0x022D/*::]*/: { n:"BrtEndWebPubItem" }, - /*::[*/0x022E/*::]*/: { n:"BrtBeginSXCondFmt" }, - /*::[*/0x022F/*::]*/: { n:"BrtEndSXCondFmt" }, - /*::[*/0x0230/*::]*/: { n:"BrtBeginSXCondFmts" }, - /*::[*/0x0231/*::]*/: { n:"BrtEndSXCondFmts" }, - /*::[*/0x0232/*::]*/: { n:"BrtBkHim" }, - /*::[*/0x0234/*::]*/: { n:"BrtColor" }, - /*::[*/0x0235/*::]*/: { n:"BrtBeginIndexedColors" }, - /*::[*/0x0236/*::]*/: { n:"BrtEndIndexedColors" }, - /*::[*/0x0239/*::]*/: { n:"BrtBeginMRUColors" }, - /*::[*/0x023A/*::]*/: { n:"BrtEndMRUColors" }, - /*::[*/0x023C/*::]*/: { n:"BrtMRUColor" }, - /*::[*/0x023D/*::]*/: { n:"BrtBeginDVals" }, - /*::[*/0x023E/*::]*/: { n:"BrtEndDVals" }, - /*::[*/0x0241/*::]*/: { n:"BrtSupNameStart" }, - /*::[*/0x0242/*::]*/: { n:"BrtSupNameValueStart" }, - /*::[*/0x0243/*::]*/: { n:"BrtSupNameValueEnd" }, - /*::[*/0x0244/*::]*/: { n:"BrtSupNameNum" }, - /*::[*/0x0245/*::]*/: { n:"BrtSupNameErr" }, - /*::[*/0x0246/*::]*/: { n:"BrtSupNameSt" }, - /*::[*/0x0247/*::]*/: { n:"BrtSupNameNil" }, - /*::[*/0x0248/*::]*/: { n:"BrtSupNameBool" }, - /*::[*/0x0249/*::]*/: { n:"BrtSupNameFmla" }, - /*::[*/0x024A/*::]*/: { n:"BrtSupNameBits" }, - /*::[*/0x024B/*::]*/: { n:"BrtSupNameEnd" }, - /*::[*/0x024C/*::]*/: { n:"BrtEndSupBook" }, - /*::[*/0x024D/*::]*/: { n:"BrtCellSmartTagProperty" }, - /*::[*/0x024E/*::]*/: { n:"BrtBeginCellSmartTag" }, - /*::[*/0x024F/*::]*/: { n:"BrtEndCellSmartTag" }, - /*::[*/0x0250/*::]*/: { n:"BrtBeginCellSmartTags" }, - /*::[*/0x0251/*::]*/: { n:"BrtEndCellSmartTags" }, - /*::[*/0x0252/*::]*/: { n:"BrtBeginSmartTags" }, - /*::[*/0x0253/*::]*/: { n:"BrtEndSmartTags" }, - /*::[*/0x0254/*::]*/: { n:"BrtSmartTagType" }, - /*::[*/0x0255/*::]*/: { n:"BrtBeginSmartTagTypes" }, - /*::[*/0x0256/*::]*/: { n:"BrtEndSmartTagTypes" }, - /*::[*/0x0257/*::]*/: { n:"BrtBeginSXFilters" }, - /*::[*/0x0258/*::]*/: { n:"BrtEndSXFilters" }, - /*::[*/0x0259/*::]*/: { n:"BrtBeginSXFILTER" }, - /*::[*/0x025A/*::]*/: { n:"BrtEndSXFilter" }, - /*::[*/0x025B/*::]*/: { n:"BrtBeginFills" }, - /*::[*/0x025C/*::]*/: { n:"BrtEndFills" }, - /*::[*/0x025D/*::]*/: { n:"BrtBeginCellWatches" }, - /*::[*/0x025E/*::]*/: { n:"BrtEndCellWatches" }, - /*::[*/0x025F/*::]*/: { n:"BrtCellWatch" }, - /*::[*/0x0260/*::]*/: { n:"BrtBeginCRErrs" }, - /*::[*/0x0261/*::]*/: { n:"BrtEndCRErrs" }, - /*::[*/0x0262/*::]*/: { n:"BrtCrashRecErr" }, - /*::[*/0x0263/*::]*/: { n:"BrtBeginFonts" }, - /*::[*/0x0264/*::]*/: { n:"BrtEndFonts" }, - /*::[*/0x0265/*::]*/: { n:"BrtBeginBorders" }, - /*::[*/0x0266/*::]*/: { n:"BrtEndBorders" }, - /*::[*/0x0267/*::]*/: { n:"BrtBeginFmts" }, - /*::[*/0x0268/*::]*/: { n:"BrtEndFmts" }, - /*::[*/0x0269/*::]*/: { n:"BrtBeginCellXFs" }, - /*::[*/0x026A/*::]*/: { n:"BrtEndCellXFs" }, - /*::[*/0x026B/*::]*/: { n:"BrtBeginStyles" }, - /*::[*/0x026C/*::]*/: { n:"BrtEndStyles" }, - /*::[*/0x0271/*::]*/: { n:"BrtBigName" }, - /*::[*/0x0272/*::]*/: { n:"BrtBeginCellStyleXFs" }, - /*::[*/0x0273/*::]*/: { n:"BrtEndCellStyleXFs" }, - /*::[*/0x0274/*::]*/: { n:"BrtBeginComments" }, - /*::[*/0x0275/*::]*/: { n:"BrtEndComments" }, - /*::[*/0x0276/*::]*/: { n:"BrtBeginCommentAuthors" }, - /*::[*/0x0277/*::]*/: { n:"BrtEndCommentAuthors" }, - /*::[*/0x0278/*::]*/: { n:"BrtCommentAuthor", f:parse_BrtCommentAuthor }, - /*::[*/0x0279/*::]*/: { n:"BrtBeginCommentList" }, - /*::[*/0x027A/*::]*/: { n:"BrtEndCommentList" }, - /*::[*/0x027B/*::]*/: { n:"BrtBeginComment", f:parse_BrtBeginComment}, - /*::[*/0x027C/*::]*/: { n:"BrtEndComment" }, - /*::[*/0x027D/*::]*/: { n:"BrtCommentText", f:parse_BrtCommentText }, - /*::[*/0x027E/*::]*/: { n:"BrtBeginOleObjects" }, - /*::[*/0x027F/*::]*/: { n:"BrtOleObject" }, - /*::[*/0x0280/*::]*/: { n:"BrtEndOleObjects" }, - /*::[*/0x0281/*::]*/: { n:"BrtBeginSxrules" }, - /*::[*/0x0282/*::]*/: { n:"BrtEndSxRules" }, - /*::[*/0x0283/*::]*/: { n:"BrtBeginActiveXControls" }, - /*::[*/0x0284/*::]*/: { n:"BrtActiveX" }, - /*::[*/0x0285/*::]*/: { n:"BrtEndActiveXControls" }, - /*::[*/0x0286/*::]*/: { n:"BrtBeginPCDSDTCEMembersSortBy" }, - /*::[*/0x0288/*::]*/: { n:"BrtBeginCellIgnoreECs" }, - /*::[*/0x0289/*::]*/: { n:"BrtCellIgnoreEC" }, - /*::[*/0x028A/*::]*/: { n:"BrtEndCellIgnoreECs" }, - /*::[*/0x028B/*::]*/: { n:"BrtCsProp", f:parse_BrtCsProp }, - /*::[*/0x028C/*::]*/: { n:"BrtCsPageSetup" }, - /*::[*/0x028D/*::]*/: { n:"BrtBeginUserCsViews" }, - /*::[*/0x028E/*::]*/: { n:"BrtEndUserCsViews" }, - /*::[*/0x028F/*::]*/: { n:"BrtBeginUserCsView" }, - /*::[*/0x0290/*::]*/: { n:"BrtEndUserCsView" }, - /*::[*/0x0291/*::]*/: { n:"BrtBeginPcdSFCIEntries" }, - /*::[*/0x0292/*::]*/: { n:"BrtEndPCDSFCIEntries" }, - /*::[*/0x0293/*::]*/: { n:"BrtPCDSFCIEntry" }, - /*::[*/0x0294/*::]*/: { n:"BrtBeginListParts" }, - /*::[*/0x0295/*::]*/: { n:"BrtListPart" }, - /*::[*/0x0296/*::]*/: { n:"BrtEndListParts" }, - /*::[*/0x0297/*::]*/: { n:"BrtSheetCalcProp" }, - /*::[*/0x0298/*::]*/: { n:"BrtBeginFnGroup" }, - /*::[*/0x0299/*::]*/: { n:"BrtFnGroup" }, - /*::[*/0x029A/*::]*/: { n:"BrtEndFnGroup" }, - /*::[*/0x029B/*::]*/: { n:"BrtSupAddin" }, - /*::[*/0x029C/*::]*/: { n:"BrtSXTDMPOrder" }, - /*::[*/0x029D/*::]*/: { n:"BrtCsProtection" }, - /*::[*/0x029F/*::]*/: { n:"BrtBeginWsSortMap" }, - /*::[*/0x02A0/*::]*/: { n:"BrtEndWsSortMap" }, - /*::[*/0x02A1/*::]*/: { n:"BrtBeginRRSort" }, - /*::[*/0x02A2/*::]*/: { n:"BrtEndRRSort" }, - /*::[*/0x02A3/*::]*/: { n:"BrtRRSortItem" }, - /*::[*/0x02A4/*::]*/: { n:"BrtFileSharingIso" }, - /*::[*/0x02A5/*::]*/: { n:"BrtBookProtectionIso" }, - /*::[*/0x02A6/*::]*/: { n:"BrtSheetProtectionIso" }, - /*::[*/0x02A7/*::]*/: { n:"BrtCsProtectionIso" }, - /*::[*/0x02A8/*::]*/: { n:"BrtRangeProtectionIso" }, - /*::[*/0x02A9/*::]*/: { n:"BrtDValList" }, - /*::[*/0x0400/*::]*/: { n:"BrtRwDescent" }, - /*::[*/0x0401/*::]*/: { n:"BrtKnownFonts" }, - /*::[*/0x0402/*::]*/: { n:"BrtBeginSXTupleSet" }, - /*::[*/0x0403/*::]*/: { n:"BrtEndSXTupleSet" }, - /*::[*/0x0404/*::]*/: { n:"BrtBeginSXTupleSetHeader" }, - /*::[*/0x0405/*::]*/: { n:"BrtEndSXTupleSetHeader" }, - /*::[*/0x0406/*::]*/: { n:"BrtSXTupleSetHeaderItem" }, - /*::[*/0x0407/*::]*/: { n:"BrtBeginSXTupleSetData" }, - /*::[*/0x0408/*::]*/: { n:"BrtEndSXTupleSetData" }, - /*::[*/0x0409/*::]*/: { n:"BrtBeginSXTupleSetRow" }, - /*::[*/0x040A/*::]*/: { n:"BrtEndSXTupleSetRow" }, - /*::[*/0x040B/*::]*/: { n:"BrtSXTupleSetRowItem" }, - /*::[*/0x040C/*::]*/: { n:"BrtNameExt" }, - /*::[*/0x040D/*::]*/: { n:"BrtPCDH14" }, - /*::[*/0x040E/*::]*/: { n:"BrtBeginPCDCalcMem14" }, - /*::[*/0x040F/*::]*/: { n:"BrtEndPCDCalcMem14" }, - /*::[*/0x0410/*::]*/: { n:"BrtSXTH14" }, - /*::[*/0x0411/*::]*/: { n:"BrtBeginSparklineGroup" }, - /*::[*/0x0412/*::]*/: { n:"BrtEndSparklineGroup" }, - /*::[*/0x0413/*::]*/: { n:"BrtSparkline" }, - /*::[*/0x0414/*::]*/: { n:"BrtSXDI14" }, - /*::[*/0x0415/*::]*/: { n:"BrtWsFmtInfoEx14" }, - /*::[*/0x0416/*::]*/: { n:"BrtBeginConditionalFormatting14" }, - /*::[*/0x0417/*::]*/: { n:"BrtEndConditionalFormatting14" }, - /*::[*/0x0418/*::]*/: { n:"BrtBeginCFRule14" }, - /*::[*/0x0419/*::]*/: { n:"BrtEndCFRule14" }, - /*::[*/0x041A/*::]*/: { n:"BrtCFVO14" }, - /*::[*/0x041B/*::]*/: { n:"BrtBeginDatabar14" }, - /*::[*/0x041C/*::]*/: { n:"BrtBeginIconSet14" }, - /*::[*/0x041D/*::]*/: { n:"BrtDVal14", f: parse_BrtDVal14 }, - /*::[*/0x041E/*::]*/: { n:"BrtBeginDVals14" }, - /*::[*/0x041F/*::]*/: { n:"BrtColor14" }, - /*::[*/0x0420/*::]*/: { n:"BrtBeginSparklines" }, - /*::[*/0x0421/*::]*/: { n:"BrtEndSparklines" }, - /*::[*/0x0422/*::]*/: { n:"BrtBeginSparklineGroups" }, - /*::[*/0x0423/*::]*/: { n:"BrtEndSparklineGroups" }, - /*::[*/0x0425/*::]*/: { n:"BrtSXVD14" }, - /*::[*/0x0426/*::]*/: { n:"BrtBeginSXView14" }, - /*::[*/0x0427/*::]*/: { n:"BrtEndSXView14" }, - /*::[*/0x0428/*::]*/: { n:"BrtBeginSXView16" }, - /*::[*/0x0429/*::]*/: { n:"BrtEndSXView16" }, - /*::[*/0x042A/*::]*/: { n:"BrtBeginPCD14" }, - /*::[*/0x042B/*::]*/: { n:"BrtEndPCD14" }, - /*::[*/0x042C/*::]*/: { n:"BrtBeginExtConn14" }, - /*::[*/0x042D/*::]*/: { n:"BrtEndExtConn14" }, - /*::[*/0x042E/*::]*/: { n:"BrtBeginSlicerCacheIDs" }, - /*::[*/0x042F/*::]*/: { n:"BrtEndSlicerCacheIDs" }, - /*::[*/0x0430/*::]*/: { n:"BrtBeginSlicerCacheID" }, - /*::[*/0x0431/*::]*/: { n:"BrtEndSlicerCacheID" }, - /*::[*/0x0433/*::]*/: { n:"BrtBeginSlicerCache" }, - /*::[*/0x0434/*::]*/: { n:"BrtEndSlicerCache" }, - /*::[*/0x0435/*::]*/: { n:"BrtBeginSlicerCacheDef" }, - /*::[*/0x0436/*::]*/: { n:"BrtEndSlicerCacheDef" }, - /*::[*/0x0437/*::]*/: { n:"BrtBeginSlicersEx" }, - /*::[*/0x0438/*::]*/: { n:"BrtEndSlicersEx" }, - /*::[*/0x0439/*::]*/: { n:"BrtBeginSlicerEx" }, - /*::[*/0x043A/*::]*/: { n:"BrtEndSlicerEx" }, - /*::[*/0x043B/*::]*/: { n:"BrtBeginSlicer" }, - /*::[*/0x043C/*::]*/: { n:"BrtEndSlicer" }, - /*::[*/0x043D/*::]*/: { n:"BrtSlicerCachePivotTables" }, - /*::[*/0x043E/*::]*/: { n:"BrtBeginSlicerCacheOlapImpl" }, - /*::[*/0x043F/*::]*/: { n:"BrtEndSlicerCacheOlapImpl" }, - /*::[*/0x0440/*::]*/: { n:"BrtBeginSlicerCacheLevelsData" }, - /*::[*/0x0441/*::]*/: { n:"BrtEndSlicerCacheLevelsData" }, - /*::[*/0x0442/*::]*/: { n:"BrtBeginSlicerCacheLevelData" }, - /*::[*/0x0443/*::]*/: { n:"BrtEndSlicerCacheLevelData" }, - /*::[*/0x0444/*::]*/: { n:"BrtBeginSlicerCacheSiRanges" }, - /*::[*/0x0445/*::]*/: { n:"BrtEndSlicerCacheSiRanges" }, - /*::[*/0x0446/*::]*/: { n:"BrtBeginSlicerCacheSiRange" }, - /*::[*/0x0447/*::]*/: { n:"BrtEndSlicerCacheSiRange" }, - /*::[*/0x0448/*::]*/: { n:"BrtSlicerCacheOlapItem" }, - /*::[*/0x0449/*::]*/: { n:"BrtBeginSlicerCacheSelections" }, - /*::[*/0x044A/*::]*/: { n:"BrtSlicerCacheSelection" }, - /*::[*/0x044B/*::]*/: { n:"BrtEndSlicerCacheSelections" }, - /*::[*/0x044C/*::]*/: { n:"BrtBeginSlicerCacheNative" }, - /*::[*/0x044D/*::]*/: { n:"BrtEndSlicerCacheNative" }, - /*::[*/0x044E/*::]*/: { n:"BrtSlicerCacheNativeItem" }, - /*::[*/0x044F/*::]*/: { n:"BrtRangeProtection14" }, - /*::[*/0x0450/*::]*/: { n:"BrtRangeProtectionIso14" }, - /*::[*/0x0451/*::]*/: { n:"BrtCellIgnoreEC14" }, - /*::[*/0x0457/*::]*/: { n:"BrtList14" }, - /*::[*/0x0458/*::]*/: { n:"BrtCFIcon" }, - /*::[*/0x0459/*::]*/: { n:"BrtBeginSlicerCachesPivotCacheIDs" }, - /*::[*/0x045A/*::]*/: { n:"BrtEndSlicerCachesPivotCacheIDs" }, - /*::[*/0x045B/*::]*/: { n:"BrtBeginSlicers" }, - /*::[*/0x045C/*::]*/: { n:"BrtEndSlicers" }, - /*::[*/0x045D/*::]*/: { n:"BrtWbProp14" }, - /*::[*/0x045E/*::]*/: { n:"BrtBeginSXEdit" }, - /*::[*/0x045F/*::]*/: { n:"BrtEndSXEdit" }, - /*::[*/0x0460/*::]*/: { n:"BrtBeginSXEdits" }, - /*::[*/0x0461/*::]*/: { n:"BrtEndSXEdits" }, - /*::[*/0x0462/*::]*/: { n:"BrtBeginSXChange" }, - /*::[*/0x0463/*::]*/: { n:"BrtEndSXChange" }, - /*::[*/0x0464/*::]*/: { n:"BrtBeginSXChanges" }, - /*::[*/0x0465/*::]*/: { n:"BrtEndSXChanges" }, - /*::[*/0x0466/*::]*/: { n:"BrtSXTupleItems" }, - /*::[*/0x0468/*::]*/: { n:"BrtBeginSlicerStyle" }, - /*::[*/0x0469/*::]*/: { n:"BrtEndSlicerStyle" }, - /*::[*/0x046A/*::]*/: { n:"BrtSlicerStyleElement" }, - /*::[*/0x046B/*::]*/: { n:"BrtBeginStyleSheetExt14" }, - /*::[*/0x046C/*::]*/: { n:"BrtEndStyleSheetExt14" }, - /*::[*/0x046D/*::]*/: { n:"BrtBeginSlicerCachesPivotCacheID" }, - /*::[*/0x046E/*::]*/: { n:"BrtEndSlicerCachesPivotCacheID" }, - /*::[*/0x046F/*::]*/: { n:"BrtBeginConditionalFormattings" }, - /*::[*/0x0470/*::]*/: { n:"BrtEndConditionalFormattings" }, - /*::[*/0x0471/*::]*/: { n:"BrtBeginPCDCalcMemExt" }, - /*::[*/0x0472/*::]*/: { n:"BrtEndPCDCalcMemExt" }, - /*::[*/0x0473/*::]*/: { n:"BrtBeginPCDCalcMemsExt" }, - /*::[*/0x0474/*::]*/: { n:"BrtEndPCDCalcMemsExt" }, - /*::[*/0x0475/*::]*/: { n:"BrtPCDField14" }, - /*::[*/0x0476/*::]*/: { n:"BrtBeginSlicerStyles" }, - /*::[*/0x0477/*::]*/: { n:"BrtEndSlicerStyles" }, - /*::[*/0x0478/*::]*/: { n:"BrtBeginSlicerStyleElements" }, - /*::[*/0x0479/*::]*/: { n:"BrtEndSlicerStyleElements" }, - /*::[*/0x047A/*::]*/: { n:"BrtCFRuleExt" }, - /*::[*/0x047B/*::]*/: { n:"BrtBeginSXCondFmt14" }, - /*::[*/0x047C/*::]*/: { n:"BrtEndSXCondFmt14" }, - /*::[*/0x047D/*::]*/: { n:"BrtBeginSXCondFmts14" }, - /*::[*/0x047E/*::]*/: { n:"BrtEndSXCondFmts14" }, - /*::[*/0x0480/*::]*/: { n:"BrtBeginSortCond14" }, - /*::[*/0x0481/*::]*/: { n:"BrtEndSortCond14" }, - /*::[*/0x0482/*::]*/: { n:"BrtEndDVals14" }, - /*::[*/0x0483/*::]*/: { n:"BrtEndIconSet14" }, - /*::[*/0x0484/*::]*/: { n:"BrtEndDatabar14" }, - /*::[*/0x0485/*::]*/: { n:"BrtBeginColorScale14" }, - /*::[*/0x0486/*::]*/: { n:"BrtEndColorScale14" }, - /*::[*/0x0487/*::]*/: { n:"BrtBeginSxrules14" }, - /*::[*/0x0488/*::]*/: { n:"BrtEndSxrules14" }, - /*::[*/0x0489/*::]*/: { n:"BrtBeginPRule14" }, - /*::[*/0x048A/*::]*/: { n:"BrtEndPRule14" }, - /*::[*/0x048B/*::]*/: { n:"BrtBeginPRFilters14" }, - /*::[*/0x048C/*::]*/: { n:"BrtEndPRFilters14" }, - /*::[*/0x048D/*::]*/: { n:"BrtBeginPRFilter14" }, - /*::[*/0x048E/*::]*/: { n:"BrtEndPRFilter14" }, - /*::[*/0x048F/*::]*/: { n:"BrtBeginPRFItem14" }, - /*::[*/0x0490/*::]*/: { n:"BrtEndPRFItem14" }, - /*::[*/0x0491/*::]*/: { n:"BrtBeginCellIgnoreECs14" }, - /*::[*/0x0492/*::]*/: { n:"BrtEndCellIgnoreECs14" }, - /*::[*/0x0493/*::]*/: { n:"BrtDxf14" }, - /*::[*/0x0494/*::]*/: { n:"BrtBeginDxF14s" }, - /*::[*/0x0495/*::]*/: { n:"BrtEndDxf14s" }, - /*::[*/0x0499/*::]*/: { n:"BrtFilter14" }, - /*::[*/0x049A/*::]*/: { n:"BrtBeginCustomFilters14" }, - /*::[*/0x049C/*::]*/: { n:"BrtCustomFilter14" }, - /*::[*/0x049D/*::]*/: { n:"BrtIconFilter14" }, - /*::[*/0x049E/*::]*/: { n:"BrtPivotCacheConnectionName" }, - /*::[*/0x0800/*::]*/: { n:"BrtBeginDecoupledPivotCacheIDs" }, - /*::[*/0x0801/*::]*/: { n:"BrtEndDecoupledPivotCacheIDs" }, - /*::[*/0x0802/*::]*/: { n:"BrtDecoupledPivotCacheID" }, - /*::[*/0x0803/*::]*/: { n:"BrtBeginPivotTableRefs" }, - /*::[*/0x0804/*::]*/: { n:"BrtEndPivotTableRefs" }, - /*::[*/0x0805/*::]*/: { n:"BrtPivotTableRef" }, - /*::[*/0x0806/*::]*/: { n:"BrtSlicerCacheBookPivotTables" }, - /*::[*/0x0807/*::]*/: { n:"BrtBeginSxvcells" }, - /*::[*/0x0808/*::]*/: { n:"BrtEndSxvcells" }, - /*::[*/0x0809/*::]*/: { n:"BrtBeginSxRow" }, - /*::[*/0x080A/*::]*/: { n:"BrtEndSxRow" }, - /*::[*/0x080C/*::]*/: { n:"BrtPcdCalcMem15" }, - /*::[*/0x0813/*::]*/: { n:"BrtQsi15" }, - /*::[*/0x0814/*::]*/: { n:"BrtBeginWebExtensions" }, - /*::[*/0x0815/*::]*/: { n:"BrtEndWebExtensions" }, - /*::[*/0x0816/*::]*/: { n:"BrtWebExtension" }, - /*::[*/0x0817/*::]*/: { n:"BrtAbsPath15" }, - /*::[*/0x0818/*::]*/: { n:"BrtBeginPivotTableUISettings" }, - /*::[*/0x0819/*::]*/: { n:"BrtEndPivotTableUISettings" }, - /*::[*/0x081B/*::]*/: { n:"BrtTableSlicerCacheIDs" }, - /*::[*/0x081C/*::]*/: { n:"BrtTableSlicerCacheID" }, - /*::[*/0x081D/*::]*/: { n:"BrtBeginTableSlicerCache" }, - /*::[*/0x081E/*::]*/: { n:"BrtEndTableSlicerCache" }, - /*::[*/0x081F/*::]*/: { n:"BrtSxFilter15" }, - /*::[*/0x0820/*::]*/: { n:"BrtBeginTimelineCachePivotCacheIDs" }, - /*::[*/0x0821/*::]*/: { n:"BrtEndTimelineCachePivotCacheIDs" }, - /*::[*/0x0822/*::]*/: { n:"BrtTimelineCachePivotCacheID" }, - /*::[*/0x0823/*::]*/: { n:"BrtBeginTimelineCacheIDs" }, - /*::[*/0x0824/*::]*/: { n:"BrtEndTimelineCacheIDs" }, - /*::[*/0x0825/*::]*/: { n:"BrtBeginTimelineCacheID" }, - /*::[*/0x0826/*::]*/: { n:"BrtEndTimelineCacheID" }, - /*::[*/0x0827/*::]*/: { n:"BrtBeginTimelinesEx" }, - /*::[*/0x0828/*::]*/: { n:"BrtEndTimelinesEx" }, - /*::[*/0x0829/*::]*/: { n:"BrtBeginTimelineEx" }, - /*::[*/0x082A/*::]*/: { n:"BrtEndTimelineEx" }, - /*::[*/0x082B/*::]*/: { n:"BrtWorkBookPr15" }, - /*::[*/0x082C/*::]*/: { n:"BrtPCDH15" }, - /*::[*/0x082D/*::]*/: { n:"BrtBeginTimelineStyle" }, - /*::[*/0x082E/*::]*/: { n:"BrtEndTimelineStyle" }, - /*::[*/0x082F/*::]*/: { n:"BrtTimelineStyleElement" }, - /*::[*/0x0830/*::]*/: { n:"BrtBeginTimelineStylesheetExt15" }, - /*::[*/0x0831/*::]*/: { n:"BrtEndTimelineStylesheetExt15" }, - /*::[*/0x0832/*::]*/: { n:"BrtBeginTimelineStyles" }, - /*::[*/0x0833/*::]*/: { n:"BrtEndTimelineStyles" }, - /*::[*/0x0834/*::]*/: { n:"BrtBeginTimelineStyleElements" }, - /*::[*/0x0835/*::]*/: { n:"BrtEndTimelineStyleElements" }, - /*::[*/0x0836/*::]*/: { n:"BrtDxf15" }, - /*::[*/0x0837/*::]*/: { n:"BrtBeginDxfs15" }, - /*::[*/0x0838/*::]*/: { n:"brtEndDxfs15" }, - /*::[*/0x0839/*::]*/: { n:"BrtSlicerCacheHideItemsWithNoData" }, - /*::[*/0x083A/*::]*/: { n:"BrtBeginItemUniqueNames" }, - /*::[*/0x083B/*::]*/: { n:"BrtEndItemUniqueNames" }, - /*::[*/0x083C/*::]*/: { n:"BrtItemUniqueName" }, - /*::[*/0x083D/*::]*/: { n:"BrtBeginExtConn15" }, - /*::[*/0x083E/*::]*/: { n:"BrtEndExtConn15" }, - /*::[*/0x083F/*::]*/: { n:"BrtBeginOledbPr15" }, - /*::[*/0x0840/*::]*/: { n:"BrtEndOledbPr15" }, - /*::[*/0x0841/*::]*/: { n:"BrtBeginDataFeedPr15" }, - /*::[*/0x0842/*::]*/: { n:"BrtEndDataFeedPr15" }, - /*::[*/0x0843/*::]*/: { n:"BrtTextPr15" }, - /*::[*/0x0844/*::]*/: { n:"BrtRangePr15" }, - /*::[*/0x0845/*::]*/: { n:"BrtDbCommand15" }, - /*::[*/0x0846/*::]*/: { n:"BrtBeginDbTables15" }, - /*::[*/0x0847/*::]*/: { n:"BrtEndDbTables15" }, - /*::[*/0x0848/*::]*/: { n:"BrtDbTable15" }, - /*::[*/0x0849/*::]*/: { n:"BrtBeginDataModel" }, - /*::[*/0x084A/*::]*/: { n:"BrtEndDataModel" }, - /*::[*/0x084B/*::]*/: { n:"BrtBeginModelTables" }, - /*::[*/0x084C/*::]*/: { n:"BrtEndModelTables" }, - /*::[*/0x084D/*::]*/: { n:"BrtModelTable" }, - /*::[*/0x084E/*::]*/: { n:"BrtBeginModelRelationships" }, - /*::[*/0x084F/*::]*/: { n:"BrtEndModelRelationships" }, - /*::[*/0x0850/*::]*/: { n:"BrtModelRelationship" }, - /*::[*/0x0851/*::]*/: { n:"BrtBeginECTxtWiz15" }, - /*::[*/0x0852/*::]*/: { n:"BrtEndECTxtWiz15" }, - /*::[*/0x0853/*::]*/: { n:"BrtBeginECTWFldInfoLst15" }, - /*::[*/0x0854/*::]*/: { n:"BrtEndECTWFldInfoLst15" }, - /*::[*/0x0855/*::]*/: { n:"BrtBeginECTWFldInfo15" }, - /*::[*/0x0856/*::]*/: { n:"BrtFieldListActiveItem" }, - /*::[*/0x0857/*::]*/: { n:"BrtPivotCacheIdVersion" }, - /*::[*/0x0858/*::]*/: { n:"BrtSXDI15" }, - /*::[*/0x0859/*::]*/: { n:"BrtBeginModelTimeGroupings" }, - /*::[*/0x085A/*::]*/: { n:"BrtEndModelTimeGroupings" }, - /*::[*/0x085B/*::]*/: { n:"BrtBeginModelTimeGrouping" }, - /*::[*/0x085C/*::]*/: { n:"BrtEndModelTimeGrouping" }, - /*::[*/0x085D/*::]*/: { n:"BrtModelTimeGroupingCalcCol" }, - /*::[*/0x0C00/*::]*/: { n:"BrtUid" }, - /*::[*/0x0C01/*::]*/: { n:"BrtRevisionPtr" }, - /*::[*/0x13e7/*::]*/: { n:"BrtBeginCalcFeatures" }, - /*::[*/0x13e8/*::]*/: { n:"BrtEndCalcFeatures" }, - /*::[*/0x13e9/*::]*/: { n:"BrtCalcFeature" }, - /*::[*/0xFFFF/*::]*/: { n:"" } -}; - -var XLSBRE = evert_key(XLSBRecordEnum, 'n'); -/*jshint -W069 */ -XLSBRE["BrtFRTArchID$"] = 0x0010; -/*jshint +W069 */ - -/* [MS-XLS] 2.3 Record Enumeration (and other sources) */ -var XLSRecordEnum = { - /* [MS-XLS] 2.3 Record Enumeration 2021-08-17 */ - /*::[*/0x0006/*::]*/: { n:"Formula", f:parse_Formula }, - /*::[*/0x000a/*::]*/: { n:'EOF', f:parsenoop2 }, - /*::[*/0x000c/*::]*/: { n:"CalcCount", f:parseuint16 }, - /*::[*/0x000d/*::]*/: { n:"CalcMode", f:parseuint16 }, - /*::[*/0x000e/*::]*/: { n:"CalcPrecision", f:parsebool }, - /*::[*/0x000f/*::]*/: { n:"CalcRefMode", f:parsebool }, - /*::[*/0x0010/*::]*/: { n:"CalcDelta", f:parse_Xnum }, - /*::[*/0x0011/*::]*/: { n:"CalcIter", f:parsebool }, - /*::[*/0x0012/*::]*/: { n:"Protect", f:parsebool }, - /*::[*/0x0013/*::]*/: { n:"Password", f:parseuint16 }, - /*::[*/0x0014/*::]*/: { n:"Header", f:parse_XLHeaderFooter }, - /*::[*/0x0015/*::]*/: { n:"Footer", f:parse_XLHeaderFooter }, - /*::[*/0x0017/*::]*/: { n:"ExternSheet", f:parse_ExternSheet }, - /*::[*/0x0018/*::]*/: { n:"Lbl", f:parse_Lbl }, - /*::[*/0x0019/*::]*/: { n:"WinProtect", f:parsebool }, - /*::[*/0x001a/*::]*/: { n:"VerticalPageBreaks" }, - /*::[*/0x001b/*::]*/: { n:"HorizontalPageBreaks" }, - /*::[*/0x001c/*::]*/: { n:"Note", f:parse_Note }, - /*::[*/0x001d/*::]*/: { n:"Selection" }, - /*::[*/0x0022/*::]*/: { n:"Date1904", f:parsebool }, - /*::[*/0x0023/*::]*/: { n:"ExternName", f:parse_ExternName }, - /*::[*/0x0026/*::]*/: { n:"LeftMargin", f:parse_Xnum }, - /*::[*/0x0027/*::]*/: { n:"RightMargin", f:parse_Xnum }, - /*::[*/0x0028/*::]*/: { n:"TopMargin", f:parse_Xnum }, - /*::[*/0x0029/*::]*/: { n:"BottomMargin", f:parse_Xnum }, - /*::[*/0x002a/*::]*/: { n:"PrintRowCol", f:parsebool }, - /*::[*/0x002b/*::]*/: { n:"PrintGrid", f:parsebool }, - /*::[*/0x002f/*::]*/: { n:"FilePass", f:parse_FilePass }, - /*::[*/0x0031/*::]*/: { n:"Font", f:parse_Font }, - /*::[*/0x0033/*::]*/: { n:"PrintSize", f:parseuint16 }, - /*::[*/0x003c/*::]*/: { n:"Continue" }, - /*::[*/0x003d/*::]*/: { n:"Window1", f:parse_Window1 }, - /*::[*/0x0040/*::]*/: { n:"Backup", f:parsebool }, - /*::[*/0x0041/*::]*/: { n:"Pane", f:parse_Pane }, - /*::[*/0x0042/*::]*/: { n:'CodePage', f:parseuint16 }, - /*::[*/0x004d/*::]*/: { n:"Pls" }, - /*::[*/0x0050/*::]*/: { n:"DCon" }, - /*::[*/0x0051/*::]*/: { n:"DConRef" }, - /*::[*/0x0052/*::]*/: { n:"DConName" }, - /*::[*/0x0055/*::]*/: { n:"DefColWidth", f:parseuint16 }, - /*::[*/0x0059/*::]*/: { n:"XCT" }, - /*::[*/0x005a/*::]*/: { n:"CRN" }, - /*::[*/0x005b/*::]*/: { n:"FileSharing" }, - /*::[*/0x005c/*::]*/: { n:'WriteAccess', f:parse_WriteAccess }, - /*::[*/0x005d/*::]*/: { n:"Obj", f:parse_Obj }, - /*::[*/0x005e/*::]*/: { n:"Uncalced" }, - /*::[*/0x005f/*::]*/: { n:"CalcSaveRecalc", f:parsebool }, - /*::[*/0x0060/*::]*/: { n:"Template" }, - /*::[*/0x0061/*::]*/: { n:"Intl" }, - /*::[*/0x0063/*::]*/: { n:"ObjProtect", f:parsebool }, - /*::[*/0x007d/*::]*/: { n:"ColInfo", f:parse_ColInfo }, - /*::[*/0x0080/*::]*/: { n:"Guts", f:parse_Guts }, - /*::[*/0x0081/*::]*/: { n:"WsBool", f:parse_WsBool }, - /*::[*/0x0082/*::]*/: { n:"GridSet", f:parseuint16 }, - /*::[*/0x0083/*::]*/: { n:"HCenter", f:parsebool }, - /*::[*/0x0084/*::]*/: { n:"VCenter", f:parsebool }, - /*::[*/0x0085/*::]*/: { n:'BoundSheet8', f:parse_BoundSheet8 }, - /*::[*/0x0086/*::]*/: { n:"WriteProtect" }, - /*::[*/0x008c/*::]*/: { n:"Country", f:parse_Country }, - /*::[*/0x008d/*::]*/: { n:"HideObj", f:parseuint16 }, - /*::[*/0x0090/*::]*/: { n:"Sort" }, - /*::[*/0x0092/*::]*/: { n:"Palette", f:parse_Palette }, - /*::[*/0x0097/*::]*/: { n:"Sync" }, - /*::[*/0x0098/*::]*/: { n:"LPr" }, - /*::[*/0x0099/*::]*/: { n:"DxGCol" }, - /*::[*/0x009a/*::]*/: { n:"FnGroupName" }, - /*::[*/0x009b/*::]*/: { n:"FilterMode" }, - /*::[*/0x009c/*::]*/: { n:"BuiltInFnGroupCount", f:parseuint16 }, - /*::[*/0x009d/*::]*/: { n:"AutoFilterInfo" }, - /*::[*/0x009e/*::]*/: { n:"AutoFilter" }, - /*::[*/0x00a0/*::]*/: { n:"Scl", f:parse_Scl }, - /*::[*/0x00a1/*::]*/: { n:"Setup", f:parse_Setup }, - /*::[*/0x00ae/*::]*/: { n:"ScenMan" }, - /*::[*/0x00af/*::]*/: { n:"SCENARIO" }, - /*::[*/0x00b0/*::]*/: { n:"SxView" }, - /*::[*/0x00b1/*::]*/: { n:"Sxvd" }, - /*::[*/0x00b2/*::]*/: { n:"SXVI" }, - /*::[*/0x00b4/*::]*/: { n:"SxIvd" }, - /*::[*/0x00b5/*::]*/: { n:"SXLI" }, - /*::[*/0x00b6/*::]*/: { n:"SXPI" }, - /*::[*/0x00b8/*::]*/: { n:"DocRoute" }, - /*::[*/0x00b9/*::]*/: { n:"RecipName" }, - /*::[*/0x00bd/*::]*/: { n:"MulRk", f:parse_MulRk }, - /*::[*/0x00be/*::]*/: { n:"MulBlank", f:parse_MulBlank }, - /*::[*/0x00c1/*::]*/: { n:'Mms', f:parsenoop2 }, - /*::[*/0x00c5/*::]*/: { n:"SXDI" }, - /*::[*/0x00c6/*::]*/: { n:"SXDB" }, - /*::[*/0x00c7/*::]*/: { n:"SXFDB" }, - /*::[*/0x00c8/*::]*/: { n:"SXDBB" }, - /*::[*/0x00c9/*::]*/: { n:"SXNum" }, - /*::[*/0x00ca/*::]*/: { n:"SxBool", f:parsebool }, - /*::[*/0x00cb/*::]*/: { n:"SxErr" }, - /*::[*/0x00cc/*::]*/: { n:"SXInt" }, - /*::[*/0x00cd/*::]*/: { n:"SXString" }, - /*::[*/0x00ce/*::]*/: { n:"SXDtr" }, - /*::[*/0x00cf/*::]*/: { n:"SxNil" }, - /*::[*/0x00d0/*::]*/: { n:"SXTbl" }, - /*::[*/0x00d1/*::]*/: { n:"SXTBRGIITM" }, - /*::[*/0x00d2/*::]*/: { n:"SxTbpg" }, - /*::[*/0x00d3/*::]*/: { n:"ObProj" }, - /*::[*/0x00d5/*::]*/: { n:"SXStreamID" }, - /*::[*/0x00d7/*::]*/: { n:"DBCell" }, - /*::[*/0x00d8/*::]*/: { n:"SXRng" }, - /*::[*/0x00d9/*::]*/: { n:"SxIsxoper" }, - /*::[*/0x00da/*::]*/: { n:"BookBool", f:parseuint16 }, - /*::[*/0x00dc/*::]*/: { n:"DbOrParamQry" }, - /*::[*/0x00dd/*::]*/: { n:"ScenarioProtect", f:parsebool }, - /*::[*/0x00de/*::]*/: { n:"OleObjectSize" }, - /*::[*/0x00e0/*::]*/: { n:"XF", f:parse_XF }, - /*::[*/0x00e1/*::]*/: { n:'InterfaceHdr', f:parse_InterfaceHdr }, - /*::[*/0x00e2/*::]*/: { n:'InterfaceEnd', f:parsenoop2 }, - /*::[*/0x00e3/*::]*/: { n:"SXVS" }, - /*::[*/0x00e5/*::]*/: { n:"MergeCells", f:parse_MergeCells }, - /*::[*/0x00e9/*::]*/: { n:"BkHim" }, - /*::[*/0x00eb/*::]*/: { n:"MsoDrawingGroup" }, - /*::[*/0x00ec/*::]*/: { n:"MsoDrawing" }, - /*::[*/0x00ed/*::]*/: { n:"MsoDrawingSelection" }, - /*::[*/0x00ef/*::]*/: { n:"PhoneticInfo" }, - /*::[*/0x00f0/*::]*/: { n:"SxRule" }, - /*::[*/0x00f1/*::]*/: { n:"SXEx" }, - /*::[*/0x00f2/*::]*/: { n:"SxFilt" }, - /*::[*/0x00f4/*::]*/: { n:"SxDXF" }, - /*::[*/0x00f5/*::]*/: { n:"SxItm" }, - /*::[*/0x00f6/*::]*/: { n:"SxName" }, - /*::[*/0x00f7/*::]*/: { n:"SxSelect" }, - /*::[*/0x00f8/*::]*/: { n:"SXPair" }, - /*::[*/0x00f9/*::]*/: { n:"SxFmla" }, - /*::[*/0x00fb/*::]*/: { n:"SxFormat" }, - /*::[*/0x00fc/*::]*/: { n:"SST", f:parse_SST }, - /*::[*/0x00fd/*::]*/: { n:"LabelSst", f:parse_LabelSst }, - /*::[*/0x00ff/*::]*/: { n:"ExtSST", f:parse_ExtSST }, - /*::[*/0x0100/*::]*/: { n:"SXVDEx" }, - /*::[*/0x0103/*::]*/: { n:"SXFormula" }, - /*::[*/0x0122/*::]*/: { n:"SXDBEx" }, - /*::[*/0x0137/*::]*/: { n:"RRDInsDel" }, - /*::[*/0x0138/*::]*/: { n:"RRDHead" }, - /*::[*/0x013b/*::]*/: { n:"RRDChgCell" }, - /*::[*/0x013d/*::]*/: { n:"RRTabId", f:parseuint16a }, - /*::[*/0x013e/*::]*/: { n:"RRDRenSheet" }, - /*::[*/0x013f/*::]*/: { n:"RRSort" }, - /*::[*/0x0140/*::]*/: { n:"RRDMove" }, - /*::[*/0x014a/*::]*/: { n:"RRFormat" }, - /*::[*/0x014b/*::]*/: { n:"RRAutoFmt" }, - /*::[*/0x014d/*::]*/: { n:"RRInsertSh" }, - /*::[*/0x014e/*::]*/: { n:"RRDMoveBegin" }, - /*::[*/0x014f/*::]*/: { n:"RRDMoveEnd" }, - /*::[*/0x0150/*::]*/: { n:"RRDInsDelBegin" }, - /*::[*/0x0151/*::]*/: { n:"RRDInsDelEnd" }, - /*::[*/0x0152/*::]*/: { n:"RRDConflict" }, - /*::[*/0x0153/*::]*/: { n:"RRDDefName" }, - /*::[*/0x0154/*::]*/: { n:"RRDRstEtxp" }, - /*::[*/0x015f/*::]*/: { n:"LRng" }, - /*::[*/0x0160/*::]*/: { n:"UsesELFs", f:parsebool }, - /*::[*/0x0161/*::]*/: { n:"DSF", f:parsenoop2 }, - /*::[*/0x0191/*::]*/: { n:"CUsr" }, - /*::[*/0x0192/*::]*/: { n:"CbUsr" }, - /*::[*/0x0193/*::]*/: { n:"UsrInfo" }, - /*::[*/0x0194/*::]*/: { n:"UsrExcl" }, - /*::[*/0x0195/*::]*/: { n:"FileLock" }, - /*::[*/0x0196/*::]*/: { n:"RRDInfo" }, - /*::[*/0x0197/*::]*/: { n:"BCUsrs" }, - /*::[*/0x0198/*::]*/: { n:"UsrChk" }, - /*::[*/0x01a9/*::]*/: { n:"UserBView" }, - /*::[*/0x01aa/*::]*/: { n:"UserSViewBegin" }, - /*::[*/0x01ab/*::]*/: { n:"UserSViewEnd" }, - /*::[*/0x01ac/*::]*/: { n:"RRDUserView" }, - /*::[*/0x01ad/*::]*/: { n:"Qsi" }, - /*::[*/0x01ae/*::]*/: { n:"SupBook", f:parse_SupBook }, - /*::[*/0x01af/*::]*/: { n:"Prot4Rev", f:parsebool }, - /*::[*/0x01b0/*::]*/: { n:"CondFmt" }, - /*::[*/0x01b1/*::]*/: { n:"CF" }, - /*::[*/0x01b2/*::]*/: { n:"DVal" }, - /*::[*/0x01b5/*::]*/: { n:"DConBin" }, - /*::[*/0x01b6/*::]*/: { n:"TxO", f:parse_TxO }, - /*::[*/0x01b7/*::]*/: { n:"RefreshAll", f:parsebool }, - /*::[*/0x01b8/*::]*/: { n:"HLink", f:parse_HLink }, - /*::[*/0x01b9/*::]*/: { n:"Lel" }, - /*::[*/0x01ba/*::]*/: { n:"CodeName", f:parse_XLUnicodeString }, - /*::[*/0x01bb/*::]*/: { n:"SXFDBType" }, - /*::[*/0x01bc/*::]*/: { n:"Prot4RevPass", f:parseuint16 }, - /*::[*/0x01bd/*::]*/: { n:"ObNoMacros" }, - /*::[*/0x01be/*::]*/: { n:"Dv" }, - /*::[*/0x01c0/*::]*/: { n:"Excel9File", f:parsenoop2 }, - /*::[*/0x01c1/*::]*/: { n:"RecalcId", f:parse_RecalcId, r:2}, - /*::[*/0x01c2/*::]*/: { n:"EntExU2", f:parsenoop2 }, - /*::[*/0x0200/*::]*/: { n:"Dimensions", f:parse_Dimensions }, - /*::[*/0x0201/*::]*/: { n:"Blank", f:parse_Blank }, - /*::[*/0x0203/*::]*/: { n:"Number", f:parse_Number }, - /*::[*/0x0204/*::]*/: { n:"Label", f:parse_Label }, - /*::[*/0x0205/*::]*/: { n:"BoolErr", f:parse_BoolErr }, - /*::[*/0x0207/*::]*/: { n:"String", f:parse_String }, - /*::[*/0x0208/*::]*/: { n:'Row', f:parse_Row }, - /*::[*/0x020b/*::]*/: { n:"Index" }, - /*::[*/0x0221/*::]*/: { n:"Array", f:parse_Array }, - /*::[*/0x0225/*::]*/: { n:"DefaultRowHeight", f:parse_DefaultRowHeight }, - /*::[*/0x0236/*::]*/: { n:"Table" }, - /*::[*/0x023e/*::]*/: { n:"Window2", f:parse_Window2 }, - /*::[*/0x027e/*::]*/: { n:"RK", f:parse_RK }, - /*::[*/0x0293/*::]*/: { n:"Style" }, - /*::[*/0x0418/*::]*/: { n:"BigName" }, - /*::[*/0x041e/*::]*/: { n:"Format", f:parse_Format }, - /*::[*/0x043c/*::]*/: { n:"ContinueBigName" }, - /*::[*/0x04bc/*::]*/: { n:"ShrFmla", f:parse_ShrFmla }, - /*::[*/0x0800/*::]*/: { n:"HLinkTooltip", f:parse_HLinkTooltip }, - /*::[*/0x0801/*::]*/: { n:"WebPub" }, - /*::[*/0x0802/*::]*/: { n:"QsiSXTag" }, - /*::[*/0x0803/*::]*/: { n:"DBQueryExt" }, - /*::[*/0x0804/*::]*/: { n:"ExtString" }, - /*::[*/0x0805/*::]*/: { n:"TxtQry" }, - /*::[*/0x0806/*::]*/: { n:"Qsir" }, - /*::[*/0x0807/*::]*/: { n:"Qsif" }, - /*::[*/0x0808/*::]*/: { n:"RRDTQSIF" }, - /*::[*/0x0809/*::]*/: { n:'BOF', f:parse_BOF }, - /*::[*/0x080a/*::]*/: { n:"OleDbConn" }, - /*::[*/0x080b/*::]*/: { n:"WOpt" }, - /*::[*/0x080c/*::]*/: { n:"SXViewEx" }, - /*::[*/0x080d/*::]*/: { n:"SXTH" }, - /*::[*/0x080e/*::]*/: { n:"SXPIEx" }, - /*::[*/0x080f/*::]*/: { n:"SXVDTEx" }, - /*::[*/0x0810/*::]*/: { n:"SXViewEx9" }, - /*::[*/0x0812/*::]*/: { n:"ContinueFrt" }, - /*::[*/0x0813/*::]*/: { n:"RealTimeData" }, - /*::[*/0x0850/*::]*/: { n:"ChartFrtInfo" }, - /*::[*/0x0851/*::]*/: { n:"FrtWrapper" }, - /*::[*/0x0852/*::]*/: { n:"StartBlock" }, - /*::[*/0x0853/*::]*/: { n:"EndBlock" }, - /*::[*/0x0854/*::]*/: { n:"StartObject" }, - /*::[*/0x0855/*::]*/: { n:"EndObject" }, - /*::[*/0x0856/*::]*/: { n:"CatLab" }, - /*::[*/0x0857/*::]*/: { n:"YMult" }, - /*::[*/0x0858/*::]*/: { n:"SXViewLink" }, - /*::[*/0x0859/*::]*/: { n:"PivotChartBits" }, - /*::[*/0x085a/*::]*/: { n:"FrtFontList" }, - /*::[*/0x0862/*::]*/: { n:"SheetExt" }, - /*::[*/0x0863/*::]*/: { n:"BookExt", r:12}, - /*::[*/0x0864/*::]*/: { n:"SXAddl" }, - /*::[*/0x0865/*::]*/: { n:"CrErr" }, - /*::[*/0x0866/*::]*/: { n:"HFPicture" }, - /*::[*/0x0867/*::]*/: { n:'FeatHdr', f:parsenoop2 }, - /*::[*/0x0868/*::]*/: { n:"Feat" }, - /*::[*/0x086a/*::]*/: { n:"DataLabExt" }, - /*::[*/0x086b/*::]*/: { n:"DataLabExtContents" }, - /*::[*/0x086c/*::]*/: { n:"CellWatch" }, - /*::[*/0x0871/*::]*/: { n:"FeatHdr11" }, - /*::[*/0x0872/*::]*/: { n:"Feature11" }, - /*::[*/0x0874/*::]*/: { n:"DropDownObjIds" }, - /*::[*/0x0875/*::]*/: { n:"ContinueFrt11" }, - /*::[*/0x0876/*::]*/: { n:"DConn" }, - /*::[*/0x0877/*::]*/: { n:"List12" }, - /*::[*/0x0878/*::]*/: { n:"Feature12" }, - /*::[*/0x0879/*::]*/: { n:"CondFmt12" }, - /*::[*/0x087a/*::]*/: { n:"CF12" }, - /*::[*/0x087b/*::]*/: { n:"CFEx" }, - /*::[*/0x087c/*::]*/: { n:"XFCRC", f:parse_XFCRC, r:12 }, - /*::[*/0x087d/*::]*/: { n:"XFExt", f:parse_XFExt, r:12 }, - /*::[*/0x087e/*::]*/: { n:"AutoFilter12" }, - /*::[*/0x087f/*::]*/: { n:"ContinueFrt12" }, - /*::[*/0x0884/*::]*/: { n:"MDTInfo" }, - /*::[*/0x0885/*::]*/: { n:"MDXStr" }, - /*::[*/0x0886/*::]*/: { n:"MDXTuple" }, - /*::[*/0x0887/*::]*/: { n:"MDXSet" }, - /*::[*/0x0888/*::]*/: { n:"MDXProp" }, - /*::[*/0x0889/*::]*/: { n:"MDXKPI" }, - /*::[*/0x088a/*::]*/: { n:"MDB" }, - /*::[*/0x088b/*::]*/: { n:"PLV" }, - /*::[*/0x088c/*::]*/: { n:"Compat12", f:parsebool, r:12 }, - /*::[*/0x088d/*::]*/: { n:"DXF" }, - /*::[*/0x088e/*::]*/: { n:"TableStyles", r:12 }, - /*::[*/0x088f/*::]*/: { n:"TableStyle" }, - /*::[*/0x0890/*::]*/: { n:"TableStyleElement" }, - /*::[*/0x0892/*::]*/: { n:"StyleExt" }, - /*::[*/0x0893/*::]*/: { n:"NamePublish" }, - /*::[*/0x0894/*::]*/: { n:"NameCmt", f:parse_NameCmt, r:12 }, - /*::[*/0x0895/*::]*/: { n:"SortData" }, - /*::[*/0x0896/*::]*/: { n:"Theme", f:parse_Theme, r:12 }, - /*::[*/0x0897/*::]*/: { n:"GUIDTypeLib" }, - /*::[*/0x0898/*::]*/: { n:"FnGrp12" }, - /*::[*/0x0899/*::]*/: { n:"NameFnGrp12" }, - /*::[*/0x089a/*::]*/: { n:"MTRSettings", f:parse_MTRSettings, r:12 }, - /*::[*/0x089b/*::]*/: { n:"CompressPictures", f:parsenoop2 }, - /*::[*/0x089c/*::]*/: { n:"HeaderFooter" }, - /*::[*/0x089d/*::]*/: { n:"CrtLayout12" }, - /*::[*/0x089e/*::]*/: { n:"CrtMlFrt" }, - /*::[*/0x089f/*::]*/: { n:"CrtMlFrtContinue" }, - /*::[*/0x08a3/*::]*/: { n:"ForceFullCalculation", f:parse_ForceFullCalculation }, - /*::[*/0x08a4/*::]*/: { n:"ShapePropsStream" }, - /*::[*/0x08a5/*::]*/: { n:"TextPropsStream" }, - /*::[*/0x08a6/*::]*/: { n:"RichTextStream" }, - /*::[*/0x08a7/*::]*/: { n:"CrtLayout12A" }, - /*::[*/0x1001/*::]*/: { n:"Units" }, - /*::[*/0x1002/*::]*/: { n:"Chart" }, - /*::[*/0x1003/*::]*/: { n:"Series" }, - /*::[*/0x1006/*::]*/: { n:"DataFormat" }, - /*::[*/0x1007/*::]*/: { n:"LineFormat" }, - /*::[*/0x1009/*::]*/: { n:"MarkerFormat" }, - /*::[*/0x100a/*::]*/: { n:"AreaFormat" }, - /*::[*/0x100b/*::]*/: { n:"PieFormat" }, - /*::[*/0x100c/*::]*/: { n:"AttachedLabel" }, - /*::[*/0x100d/*::]*/: { n:"SeriesText" }, - /*::[*/0x1014/*::]*/: { n:"ChartFormat" }, - /*::[*/0x1015/*::]*/: { n:"Legend" }, - /*::[*/0x1016/*::]*/: { n:"SeriesList" }, - /*::[*/0x1017/*::]*/: { n:"Bar" }, - /*::[*/0x1018/*::]*/: { n:"Line" }, - /*::[*/0x1019/*::]*/: { n:"Pie" }, - /*::[*/0x101a/*::]*/: { n:"Area" }, - /*::[*/0x101b/*::]*/: { n:"Scatter" }, - /*::[*/0x101c/*::]*/: { n:"CrtLine" }, - /*::[*/0x101d/*::]*/: { n:"Axis" }, - /*::[*/0x101e/*::]*/: { n:"Tick" }, - /*::[*/0x101f/*::]*/: { n:"ValueRange" }, - /*::[*/0x1020/*::]*/: { n:"CatSerRange" }, - /*::[*/0x1021/*::]*/: { n:"AxisLine" }, - /*::[*/0x1022/*::]*/: { n:"CrtLink" }, - /*::[*/0x1024/*::]*/: { n:"DefaultText" }, - /*::[*/0x1025/*::]*/: { n:"Text" }, - /*::[*/0x1026/*::]*/: { n:"FontX", f:parseuint16 }, - /*::[*/0x1027/*::]*/: { n:"ObjectLink" }, - /*::[*/0x1032/*::]*/: { n:"Frame" }, - /*::[*/0x1033/*::]*/: { n:"Begin" }, - /*::[*/0x1034/*::]*/: { n:"End" }, - /*::[*/0x1035/*::]*/: { n:"PlotArea" }, - /*::[*/0x103a/*::]*/: { n:"Chart3d" }, - /*::[*/0x103c/*::]*/: { n:"PicF" }, - /*::[*/0x103d/*::]*/: { n:"DropBar" }, - /*::[*/0x103e/*::]*/: { n:"Radar" }, - /*::[*/0x103f/*::]*/: { n:"Surf" }, - /*::[*/0x1040/*::]*/: { n:"RadarArea" }, - /*::[*/0x1041/*::]*/: { n:"AxisParent" }, - /*::[*/0x1043/*::]*/: { n:"LegendException" }, - /*::[*/0x1044/*::]*/: { n:"ShtProps", f:parse_ShtProps }, - /*::[*/0x1045/*::]*/: { n:"SerToCrt" }, - /*::[*/0x1046/*::]*/: { n:"AxesUsed" }, - /*::[*/0x1048/*::]*/: { n:"SBaseRef" }, - /*::[*/0x104a/*::]*/: { n:"SerParent" }, - /*::[*/0x104b/*::]*/: { n:"SerAuxTrend" }, - /*::[*/0x104e/*::]*/: { n:"IFmtRecord" }, - /*::[*/0x104f/*::]*/: { n:"Pos" }, - /*::[*/0x1050/*::]*/: { n:"AlRuns" }, - /*::[*/0x1051/*::]*/: { n:"BRAI" }, - /*::[*/0x105b/*::]*/: { n:"SerAuxErrBar" }, - /*::[*/0x105c/*::]*/: { n:"ClrtClient", f:parse_ClrtClient }, - /*::[*/0x105d/*::]*/: { n:"SerFmt" }, - /*::[*/0x105f/*::]*/: { n:"Chart3DBarShape" }, - /*::[*/0x1060/*::]*/: { n:"Fbi" }, - /*::[*/0x1061/*::]*/: { n:"BopPop" }, - /*::[*/0x1062/*::]*/: { n:"AxcExt" }, - /*::[*/0x1063/*::]*/: { n:"Dat" }, - /*::[*/0x1064/*::]*/: { n:"PlotGrowth" }, - /*::[*/0x1065/*::]*/: { n:"SIIndex" }, - /*::[*/0x1066/*::]*/: { n:"GelFrame" }, - /*::[*/0x1067/*::]*/: { n:"BopPopCustom" }, - /*::[*/0x1068/*::]*/: { n:"Fbi2" }, - - /*::[*/0x0000/*::]*/: { n:"Dimensions", f:parse_Dimensions }, - /*::[*/0x0001/*::]*/: { n:"BIFF2BLANK" }, - /*::[*/0x0002/*::]*/: { n:"BIFF2INT", f:parse_BIFF2INT }, - /*::[*/0x0003/*::]*/: { n:"BIFF2NUM", f:parse_BIFF2NUM }, - /*::[*/0x0004/*::]*/: { n:"BIFF2STR", f:parse_BIFF2STR }, - /*::[*/0x0005/*::]*/: { n:"BoolErr", f:parse_BoolErr }, - /*::[*/0x0007/*::]*/: { n:"String", f:parse_BIFF2STRING }, - /*::[*/0x0008/*::]*/: { n:"BIFF2ROW" }, - /*::[*/0x0009/*::]*/: { n:'BOF', f:parse_BOF }, - /*::[*/0x000b/*::]*/: { n:"Index" }, - /*::[*/0x0016/*::]*/: { n:"ExternCount", f:parseuint16 }, - /*::[*/0x001e/*::]*/: { n:"BIFF2FORMAT", f:parse_BIFF2Format }, - /*::[*/0x001f/*::]*/: { n:"BIFF2FMTCNT" }, /* 16-bit cnt of BIFF2FORMAT records */ - /*::[*/0x0020/*::]*/: { n:"BIFF2COLINFO" }, - /*::[*/0x0021/*::]*/: { n:"Array", f:parse_Array }, - /*::[*/0x0024/*::]*/: { n:"COLWIDTH" }, - /*::[*/0x0025/*::]*/: { n:"DefaultRowHeight", f:parse_DefaultRowHeight }, - // 0x2c ?? - // 0x2d ?? - // 0x2e ?? - // 0x30 FONTCOUNT: number of fonts - /*::[*/0x0032/*::]*/: { n:"BIFF2FONTXTRA", f:parse_BIFF2FONTXTRA }, - // 0x35: INFOOPTS - // 0x36: TABLE (BIFF2 only) - // 0x37: TABLE2 (BIFF2 only) - // 0x38: WNDESK - // 0x39 ?? - // 0x3a: BEGINPREF - // 0x3b: ENDPREF - /*::[*/0x003e/*::]*/: { n:"BIFF2WINDOW2" }, - // 0x3f ?? - // 0x46: SHOWSCROLL - // 0x47: SHOWFORMULA - // 0x48: STATUSBAR - // 0x49: SHORTMENUS - // 0x4A: - // 0x4B: - // 0x4C: - // 0x4E: - // 0x4F: - // 0x58: TOOLBAR (BIFF3) - - /* - - - */ - /*::[*/0x0034/*::]*/: { n:"DDEObjName" }, - /*::[*/0x0043/*::]*/: { n:"BIFF2XF" }, - /*::[*/0x0044/*::]*/: { n:"BIFF2XFINDEX", f:parseuint16 }, - /*::[*/0x0045/*::]*/: { n:"BIFF2FONTCLR" }, - /*::[*/0x0056/*::]*/: { n:"BIFF4FMTCNT" }, /* 16-bit cnt, similar to BIFF2 */ - /*::[*/0x007e/*::]*/: { n:"RK" }, /* Not necessarily same as 0x027e */ - /*::[*/0x007f/*::]*/: { n:"ImData", f:parse_ImData }, - /*::[*/0x0087/*::]*/: { n:"Addin" }, - /*::[*/0x0088/*::]*/: { n:"Edg" }, - /*::[*/0x0089/*::]*/: { n:"Pub" }, - // 0x8A - // 0x8B LH: alternate menu key flag (BIFF3/4) - // 0x8E - // 0x8F - /*::[*/0x0091/*::]*/: { n:"Sub" }, - // 0x93 STYLE - /*::[*/0x0094/*::]*/: { n:"LHRecord" }, - /*::[*/0x0095/*::]*/: { n:"LHNGraph" }, - /*::[*/0x0096/*::]*/: { n:"Sound" }, - // 0xA2 FNPROTO: function prototypes (BIFF4) - // 0xA3 - // 0xA8 - /*::[*/0x00a9/*::]*/: { n:"CoordList" }, - /*::[*/0x00ab/*::]*/: { n:"GCW" }, - /*::[*/0x00bc/*::]*/: { n:"ShrFmla" }, /* Not necessarily same as 0x04bc */ - /*::[*/0x00bf/*::]*/: { n:"ToolbarHdr" }, - /*::[*/0x00c0/*::]*/: { n:"ToolbarEnd" }, - /*::[*/0x00c2/*::]*/: { n:"AddMenu" }, - /*::[*/0x00c3/*::]*/: { n:"DelMenu" }, - /*::[*/0x00d6/*::]*/: { n:"RString", f:parse_RString }, - /*::[*/0x00df/*::]*/: { n:"UDDesc" }, - /*::[*/0x00ea/*::]*/: { n:"TabIdConf" }, - /*::[*/0x0162/*::]*/: { n:"XL5Modify" }, - /*::[*/0x01a5/*::]*/: { n:"FileSharing2" }, - /*::[*/0x0206/*::]*/: { n:"Formula", f:parse_Formula }, - /*::[*/0x0209/*::]*/: { n:'BOF', f:parse_BOF }, - /*::[*/0x0218/*::]*/: { n:"Lbl", f:parse_Lbl }, - /*::[*/0x0223/*::]*/: { n:"ExternName", f:parse_ExternName }, - /*::[*/0x0231/*::]*/: { n:"Font" }, - /*::[*/0x0243/*::]*/: { n:"BIFF3XF" }, - /*::[*/0x0406/*::]*/: { n:"Formula", f:parse_Formula }, - /*::[*/0x0409/*::]*/: { n:'BOF', f:parse_BOF }, - /*::[*/0x0443/*::]*/: { n:"BIFF4XF" }, - /*::[*/0x086d/*::]*/: { n:"FeatInfo" }, - /*::[*/0x0873/*::]*/: { n:"FeatInfo11" }, - /*::[*/0x0881/*::]*/: { n:"SXAddl12" }, - /*::[*/0x08c0/*::]*/: { n:"AutoWebPub" }, - /*::[*/0x08c1/*::]*/: { n:"ListObj" }, - /*::[*/0x08c2/*::]*/: { n:"ListField" }, - /*::[*/0x08c3/*::]*/: { n:"ListDV" }, - /*::[*/0x08c4/*::]*/: { n:"ListCondFmt" }, - /*::[*/0x08c5/*::]*/: { n:"ListCF" }, - /*::[*/0x08c6/*::]*/: { n:"FMQry" }, - /*::[*/0x08c7/*::]*/: { n:"FMSQry" }, - /*::[*/0x08c8/*::]*/: { n:"PLV" }, - /*::[*/0x08c9/*::]*/: { n:"LnExt" }, - /*::[*/0x08ca/*::]*/: { n:"MkrExt" }, - /*::[*/0x08cb/*::]*/: { n:"CrtCoopt" }, - /*::[*/0x08d6/*::]*/: { n:"FRTArchId$", r:12 }, - - /*::[*/0x7262/*::]*/: {} -}; - -var XLSRE = evert_key(XLSRecordEnum, 'n'); -function write_biff_rec(ba/*:BufArray*/, type/*:number|string*/, payload, length/*:?number*/)/*:void*/ { - var t/*:number*/ = typeof type == "number" ? type : (+type || +XLSRE[/*::String(*/type/*::)*/]); - if(isNaN(t)) return; - var len = length || (payload||[]).length || 0; - var o = ba.next(4); - o.write_shift(2, t); - o.write_shift(2, len); - if(/*:: len != null &&*/len > 0 && is_buf(payload)) ba.push(payload); -} - -function write_biff_continue(ba/*:BufArray*/, type/*:number|string*/, payload, length/*:?number*/)/*:void*/ { - var len = length || (payload||[]).length || 0; - if(len <= 8224) return write_biff_rec(ba, type, payload, len); - var t/*:number*/ = +type || +XLSRE[/*::String(*/type/*::)*/]; - if(isNaN(t)) return; - var parts = payload.parts || [], sidx = 0; - var i = 0, w = 0; - while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; } - var o = ba.next(4); - o.write_shift(2, t); - o.write_shift(2, w); - ba.push(payload.slice(i, i + w)); - i += w; - while(i < len) { - o = ba.next(4); - o.write_shift(2, 0x3c); // TODO: figure out correct continue type - w = 0; - while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; } - o.write_shift(2, w); - ba.push(payload.slice(i, i+w)); i+= w; - } -} - -function write_BIFF2Cell(out, r/*:number*/, c/*:number*/) { - if(!out) out = new_buf(7); - out.write_shift(2, r); - out.write_shift(2, c); - out.write_shift(2, 0); - out.write_shift(1, 0); - return out; -} - -function write_BIFF2BERR(r/*:number*/, c/*:number*/, val, t/*:?string*/) { - var out = new_buf(9); - write_BIFF2Cell(out, r, c); - write_Bes(val, t || 'b', out); - return out; -} - -/* TODO: codepage, large strings */ -function write_BIFF2LABEL(r/*:number*/, c/*:number*/, val) { - var out = new_buf(8 + 2*val.length); - write_BIFF2Cell(out, r, c); - out.write_shift(1, val.length); - out.write_shift(val.length, val, 'sbcs'); - return out.l < out.length ? out.slice(0, out.l) : out; -} - -function write_ws_biff2_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:number*//*::, opts*/) { - if(cell.v != null) switch(cell.t) { - case 'd': case 'n': - var v = cell.t == 'd' ? datenum(parseDate(cell.v)) : cell.v; - if((v == (v|0)) && (v >= 0) && (v < 65536)) - write_biff_rec(ba, 0x0002, write_BIFF2INT(R, C, v)); - else - write_biff_rec(ba, 0x0003, write_BIFF2NUM(R,C, v)); - return; - case 'b': case 'e': write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, cell.v, cell.t)); return; - /* TODO: codepage, sst */ - case 's': case 'str': - write_biff_rec(ba, 0x0004, write_BIFF2LABEL(R, C, (cell.v||"").slice(0,255))); - return; - } - write_biff_rec(ba, 0x0001, write_BIFF2Cell(null, R, C)); -} - -function write_ws_biff2(ba/*:BufArray*/, ws/*:Worksheet*/, idx/*:number*/, opts/*::, wb:Workbook*/) { - var dense = Array.isArray(ws); - var range = safe_decode_range(ws['!ref'] || "A1"), ref/*:string*/, rr = "", cols/*:Array*/ = []; - if(range.e.c > 0xFF || range.e.r > 0x3FFF) { - if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); - range.e.c = Math.min(range.e.c, 0xFF); - range.e.r = Math.min(range.e.c, 0x3FFF); - ref = encode_range(range); - } - for(var R = range.s.r; R <= range.e.r; ++R) { - rr = encode_row(R); - for(var C = range.s.c; C <= range.e.c; ++C) { - if(R === range.s.r) cols[C] = encode_col(C); - ref = cols[C] + rr; - var cell = dense ? (ws[R]||[])[C] : ws[ref]; - if(!cell) continue; - /* write cell */ - write_ws_biff2_cell(ba, cell, R, C, opts); - } - } -} - -/* Based on test files */ -function write_biff2_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { - var o = opts || {}; - if(DENSE != null && o.dense == null) o.dense = DENSE; - var ba = buf_array(); - var idx = 0; - for(var i=0;i*/ = []; - var range = safe_decode_range(ws['!ref'] || "A1"); - var MAX_ROWS = b8 ? 65536 : 16384; - if(range.e.c > 0xFF || range.e.r >= MAX_ROWS) { - if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); - range.e.c = Math.min(range.e.c, 0xFF); - range.e.r = Math.min(range.e.c, MAX_ROWS-1); - } - - write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts)); - /* [Uncalced] Index */ - write_biff_rec(ba, "CalcMode", writeuint16(1)); - write_biff_rec(ba, "CalcCount", writeuint16(100)); - write_biff_rec(ba, "CalcRefMode", writebool(true)); - write_biff_rec(ba, "CalcIter", writebool(false)); - write_biff_rec(ba, "CalcDelta", write_Xnum(0.001)); - write_biff_rec(ba, "CalcSaveRecalc", writebool(true)); - write_biff_rec(ba, "PrintRowCol", writebool(false)); - write_biff_rec(ba, "PrintGrid", writebool(false)); - write_biff_rec(ba, "GridSet", writeuint16(1)); - write_biff_rec(ba, "Guts", write_Guts([0,0])); - /* DefaultRowHeight WsBool [Sync] [LPr] [HorizontalPageBreaks] [VerticalPageBreaks] */ - /* Header (string) */ - /* Footer (string) */ - write_biff_rec(ba, "HCenter", writebool(false)); - write_biff_rec(ba, "VCenter", writebool(false)); - /* ... */ - if(b8) write_ws_cols_biff8(ba, ws["!cols"], ws); - /* ... */ - write_biff_rec(ba, 0x200, write_Dimensions(range, opts)); - /* ... */ - - if(b8) ws['!links'] = []; - for(var R = range.s.r; R <= range.e.r; ++R) { - rr = encode_row(R); - for(var C = range.s.c; C <= range.e.c; ++C) { - if(R === range.s.r) cols[C] = encode_col(C); - ref = cols[C] + rr; - var cell = dense ? (ws[R]||[])[C] : ws[ref]; - if(!cell) continue; - /* write cell */ - write_ws_biff8_cell(ba, cell, R, C, opts); - if(b8 && cell.l) ws['!links'].push([ref, cell.l]); - } - } - var cname/*:string*/ = _sheet.CodeName || _sheet.name || s; - /* ... */ - if(b8) write_biff_rec(ba, "Window2", write_Window2((_WB.Views||[])[0])); - /* ... */ - if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, "MergeCells", write_MergeCells(ws['!merges'])); - /* [LRng] *QUERYTABLE [PHONETICINFO] CONDFMTS */ - if(b8) write_ws_biff8_hlinks(ba, ws); - /* [DVAL] */ - write_biff_rec(ba, "CodeName", write_XLUnicodeString(cname, opts)); - /* *WebPub *CellWatch [SheetExt] */ - if(b8) write_FEAT(ba, ws); - /* *FEAT11 *RECORD12 */ - write_biff_rec(ba, "EOF"); - return ba.end(); -} - -/* [MS-XLS] 2.1.7.20.3 */ -function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) { - var A = buf_array(); - var _WB/*:WBWBProps*/ = ((wb||{}).Workbook||{}/*:any*/); - var _sheets/*:Array*/ = (_WB.Sheets||[]); - var _wb/*:WBProps*/ = /*::((*/_WB.WBProps||{/*::CodeName:"ThisWorkbook"*/}/*:: ):any)*/; - var b8 = opts.biff == 8, b5 = opts.biff == 5; - write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts)); - if(opts.bookType == "xla") write_biff_rec(A, "Addin"); - write_biff_rec(A, "InterfaceHdr", b8 ? writeuint16(0x04b0) : null); - write_biff_rec(A, "Mms", writezeroes(2)); - if(b5) write_biff_rec(A, "ToolbarHdr"); - if(b5) write_biff_rec(A, "ToolbarEnd"); - write_biff_rec(A, "InterfaceEnd"); - write_biff_rec(A, "WriteAccess", write_WriteAccess("SheetJS", opts)); - /* [FileSharing] */ - write_biff_rec(A, "CodePage", writeuint16(b8 ? 0x04b0 : 0x04E4)); - /* *2047 Lel */ - if(b8) write_biff_rec(A, "DSF", writeuint16(0)); - if(b8) write_biff_rec(A, "Excel9File"); - write_biff_rec(A, "RRTabId", write_RRTabId(wb.SheetNames.length)); - if(b8 && wb.vbaraw) write_biff_rec(A, "ObProj"); - /* [ObNoMacros] */ - if(b8 && wb.vbaraw) { - var cname/*:string*/ = _wb.CodeName || "ThisWorkbook"; - write_biff_rec(A, "CodeName", write_XLUnicodeString(cname, opts)); - } - write_biff_rec(A, "BuiltInFnGroupCount", writeuint16(0x11)); - /* *FnGroupName *FnGrp12 */ - /* *Lbl */ - /* [OleObjectSize] */ - write_biff_rec(A, "WinProtect", writebool(false)); - write_biff_rec(A, "Protect", writebool(false)); - write_biff_rec(A, "Password", writeuint16(0)); - if(b8) write_biff_rec(A, "Prot4Rev", writebool(false)); - if(b8) write_biff_rec(A, "Prot4RevPass", writeuint16(0)); - write_biff_rec(A, "Window1", write_Window1(opts)); - write_biff_rec(A, "Backup", writebool(false)); - write_biff_rec(A, "HideObj", writeuint16(0)); - write_biff_rec(A, "Date1904", writebool(safe1904(wb)=="true")); - write_biff_rec(A, "CalcPrecision", writebool(true)); - if(b8) write_biff_rec(A, "RefreshAll", writebool(false)); - write_biff_rec(A, "BookBool", writeuint16(0)); - /* ... */ - write_FONTS_biff8(A, wb, opts); - write_FMTS_biff8(A, wb.SSF, opts); - write_CELLXFS_biff8(A, opts); - /* ... */ - if(b8) write_biff_rec(A, "UsesELFs", writebool(false)); - var a = A.end(); - - var C = buf_array(); - /* METADATA [MTRSettings] [ForceFullCalculation] */ - if(b8) write_biff_rec(C, "Country", write_Country()); - /* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture *MSODRAWINGGROUP */ - - /* BIFF8: [SST *Continue] ExtSST */ - if(b8 && opts.Strings) write_biff_continue(C, "SST", write_SST(opts.Strings, opts)); - - /* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */ - write_biff_rec(C, "EOF"); - var c = C.end(); - - var B = buf_array(); - var blen = 0, j = 0; - for(j = 0; j < wb.SheetNames.length; ++j) blen += (b8 ? 12 : 11) + (b8 ? 2 : 1) * wb.SheetNames[j].length; - var start = a.length + blen + c.length; - for(j = 0; j < wb.SheetNames.length; ++j) { - var _sheet/*:WBWSProp*/ = _sheets[j] || ({}/*:any*/); - write_biff_rec(B, "BoundSheet8", write_BoundSheet8({pos:start, hs:_sheet.Hidden||0, dt:0, name:wb.SheetNames[j]}, opts)); - start += bufs[j].length; - } - /* 1*BoundSheet8 */ - var b = B.end(); - if(blen != b.length) throw new Error("BS8 " + blen + " != " + b.length); - - var out = []; - if(a.length) out.push(a); - if(b.length) out.push(b); - if(c.length) out.push(c); - return bconcat(out); -} - -/* [MS-XLS] 2.1.7.20 Workbook Stream */ -function write_biff8_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { - var o = opts || {}; - var bufs = []; - - if(wb && !wb.SSF) { - wb.SSF = SSF.get_table(); - } - if(wb && wb.SSF) { - make_ssf(SSF); SSF.load_table(wb.SSF); - // $FlowIgnore - o.revssf = evert_num(wb.SSF); o.revssf[wb.SSF[65535]] = 0; - o.ssf = wb.SSF; - } - - o.Strings = /*::((*/[]/*:: :any):SST)*/; o.Strings.Count = 0; o.Strings.Unique = 0; - fix_write_opts(o); - - o.cellXfs = []; - get_cell_style(o.cellXfs, {}, {revssf:{"General":0}}); - - if(!wb.Props) wb.Props = {}; - - for(var i = 0; i < wb.SheetNames.length; ++i) bufs[bufs.length] = write_ws_biff8(i, o, wb); - bufs.unshift(write_biff8_global(wb, bufs, o)); - return bconcat(bufs); -} - -function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { - for(var i = 0; i <= wb.SheetNames.length; ++i) { - var ws = wb.Sheets[wb.SheetNames[i]]; - if(!ws || !ws["!ref"]) continue; - var range = decode_range(ws["!ref"]); - if(range.e.c > 255) { // note: 255 is IV - if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost."); - } - } - - var o = opts || {}; - switch(o.biff || 2) { - case 8: case 5: return write_biff8_buf(wb, opts); - case 4: case 3: case 2: return write_biff2_buf(wb, opts); - } - throw new Error("invalid type " + o.bookType + " for BIFF"); -} -/* note: browser DOM element cannot see mso- style attrs, must parse */ -var HTML_ = (function() { - function html_to_sheet(str/*:string*/, _opts)/*:Workbook*/ { - var opts = _opts || {}; - if(DENSE != null && opts.dense == null) opts.dense = DENSE; - var ws/*:Worksheet*/ = opts.dense ? ([]/*:any*/) : ({}/*:any*/); - str = str.replace(//g, ""); - var mtch/*:any*/ = str.match(/"); - var mtch2/*:any*/ = str.match(/<\/table/i); - var i/*:number*/ = mtch.index, j/*:number*/ = mtch2 && mtch2.index || str.length; - var rows = split_regex(str.slice(i, j), /(:?]*>)/i, ""); - var R = -1, C = 0, RS = 0, CS = 0; - var range/*:Range*/ = {s:{r:10000000, c:10000000},e:{r:0,c:0}}; - var merges/*:Array*/ = []; - for(i = 0; i < rows.length; ++i) { - var row = rows[i].trim(); - var hd = row.slice(0,3).toLowerCase(); - if(hd == "/i); - for(j = 0; j < cells.length; ++j) { - var cell = cells[j].trim(); - if(!cell.match(/")) > -1) m = m.slice(cc+1); - for(var midx = 0; midx < merges.length; ++midx) { - var _merge/*:Range*/ = merges[midx]; - if(_merge.s.c == C && _merge.s.r < R && R <= _merge.e.r) { C = _merge.e.c + 1; midx = -1; } - } - var tag = parsexmltag(cell.slice(0, cell.indexOf(">"))); - CS = tag.colspan ? +tag.colspan : 1; - if((RS = +tag.rowspan)>1 || CS>1) merges.push({s:{r:R,c:C},e:{r:R + (RS||1) - 1, c:C + CS - 1}}); - var _t/*:string*/ = tag.t || tag["data-t"] || ""; - /* TODO: generate stub cells */ - if(!m.length) { C += CS; continue; } - m = htmldecode(m); - if(range.s.r > R) range.s.r = R; if(range.e.r < R) range.e.r = R; - if(range.s.c > C) range.s.c = C; if(range.e.c < C) range.e.c = C; - if(!m.length) continue; - var o/*:Cell*/ = {t:'s', v:m}; - if(opts.raw || !m.trim().length || _t == 's'){} - else if(m === 'TRUE') o = {t:'b', v:true}; - else if(m === 'FALSE') o = {t:'b', v:false}; - else if(!isNaN(fuzzynum(m))) o = {t:'n', v:fuzzynum(m)}; - else if(!isNaN(fuzzydate(m).getDate())) { - o = ({t:'d', v:parseDate(m)}/*:any*/); - if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}/*:any*/); - o.z = opts.dateNF || SSF._table[14]; - } - if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = o; } - else ws[encode_cell({r:R, c:C})] = o; - C += CS; - } - } - ws['!ref'] = encode_range(range); - if(merges.length) ws["!merges"] = merges; - return ws; - } - function html_to_book(str/*:string*/, opts)/*:Workbook*/ { - var mtch = str.match(/[\s\S]*?<\/table>/gi); - if(!mtch || mtch.length == 0) throw new Error("Invalid HTML: could not find
"); - if(mtch.length == 1) return sheet_to_workbook(html_to_sheet(mtch[0], opts), opts); - var wb = utils.book_new(); - mtch.forEach(function(s, idx) { utils.book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx+1)); }); - return wb; - } - function make_html_row(ws/*:Worksheet*/, r/*:Range*/, R/*:number*/, o/*:Sheet2HTMLOpts*/)/*:string*/ { - var M/*:Array*/ = (ws['!merges'] ||[]); - var oo/*:Array*/ = []; - for(var C = r.s.c; C <= r.e.c; ++C) { - var RS = 0, CS = 0; - for(var j = 0; j < M.length; ++j) { - if(M[j].s.r > R || M[j].s.c > C) continue; - if(M[j].e.r < R || M[j].e.c < C) continue; - if(M[j].s.r < R || M[j].s.c < C) { RS = -1; break; } - RS = M[j].e.r - M[j].s.r + 1; CS = M[j].e.c - M[j].s.c + 1; break; - } - if(RS < 0) continue; - var coord = encode_cell({r:R,c:C}); - var cell = o.dense ? (ws[R]||[])[C] : ws[coord]; - /* TODO: html entities */ - var w = (cell && cell.v != null) && (cell.h || escapehtml(cell.w || (format_cell(cell), cell.w) || "")) || ""; - var sp = ({}/*:any*/); - if(RS > 1) sp.rowspan = RS; - if(CS > 1) sp.colspan = CS; - if(o.editable) w = '' + w + ''; - else if(cell) { - sp["data-t"] = cell && cell.t || 'z'; - if(cell.v != null) sp["data-v"] = cell.v; - if(cell.z != null) sp["data-z"] = cell.z; - if(cell.l && (cell.l.Target || "#").charAt(0) != "#") w = '' + w + ''; - } - sp.id = (o.id || "sjs") + "-" + coord; - oo.push(writextag('td', w, sp)); - } - var preamble = ""; - return preamble + oo.join("") + ""; - } - function make_html_preamble(ws/*:Worksheet*/, R/*:Range*/, o/*:Sheet2HTMLOpts*/)/*:string*/ { - var out/*:Array*/ = []; - return out.join("") + ''; - } - var _BEGIN = 'SheetJS Table Export'; - var _END = ''; - function sheet_to_html(ws/*:Worksheet*/, opts/*:?Sheet2HTMLOpts*//*, wb:?Workbook*/)/*:string*/ { - var o = opts || {}; - var header = o.header != null ? o.header : _BEGIN; - var footer = o.footer != null ? o.footer : _END; - var out/*:Array*/ = [header]; - var r = decode_range(ws['!ref']); - o.dense = Array.isArray(ws); - out.push(make_html_preamble(ws, r, o)); - for(var R = r.s.r; R <= r.e.r; ++R) out.push(make_html_row(ws, r, R, o)); - out.push("
" + footer); - return out.join(""); - - } - return { - to_workbook: html_to_book, - to_sheet: html_to_sheet, - _row: make_html_row, - BEGIN: _BEGIN, - END: _END, - _preamble: make_html_preamble, - from_sheet: sheet_to_html - }; -})(); - -function sheet_add_dom(ws/*:Worksheet*/, table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ { - var opts = _opts || {}; - if(DENSE != null) opts.dense = DENSE; - var or_R = 0, or_C = 0; - if(opts.origin != null) { - if(typeof opts.origin == 'number') or_R = opts.origin; - else { - var _origin/*:CellAddress*/ = typeof opts.origin == "string" ? decode_cell(opts.origin) : opts.origin; - or_R = _origin.r; or_C = _origin.c; - } - } - - var rows/*:HTMLCollection*/ = table.getElementsByTagName('tr'); - var sheetRows = Math.min(opts.sheetRows||10000000, rows.length); - var range/*:Range*/ = {s:{r:0,c:0},e:{r:or_R,c:or_C}}; - if(ws["!ref"]) { - var _range/*:Range*/ = decode_range(ws["!ref"]); - range.s.r = Math.min(range.s.r, _range.s.r); - range.s.c = Math.min(range.s.c, _range.s.c); - range.e.r = Math.max(range.e.r, _range.e.r); - range.e.c = Math.max(range.e.c, _range.e.c); - if(or_R == -1) range.e.r = or_R = _range.e.r + 1; - } - var merges/*:Array*/ = [], midx = 0; - var rowinfo/*:Array*/ = ws["!rows"] || (ws["!rows"] = []); - var _R = 0, R = 0, _C = 0, C = 0, RS = 0, CS = 0; - if(!ws["!cols"]) ws['!cols'] = []; - for(; _R < rows.length && R < sheetRows; ++_R) { - var row/*:HTMLTableRowElement*/ = rows[_R]; - if (is_dom_element_hidden(row)) { - if (opts.display) continue; - rowinfo[R] = {hidden: true}; - } - var elts/*:HTMLCollection*/ = (row.children/*:any*/); - for(_C = C = 0; _C < elts.length; ++_C) { - var elt/*:HTMLTableCellElement*/ = elts[_C]; - if (opts.display && is_dom_element_hidden(elt)) continue; - var v/*:?string*/ = elt.hasAttribute('data-v') ? elt.getAttribute('data-v') : elt.hasAttribute('v') ? elt.getAttribute('v') : htmldecode(elt.innerHTML); - var z/*:?string*/ = elt.getAttribute('data-z') || elt.getAttribute('z'); - for(midx = 0; midx < merges.length; ++midx) { - var m/*:Range*/ = merges[midx]; - if(m.s.c == C + or_C && m.s.r < R + or_R && R + or_R <= m.e.r) { C = m.e.c+1 - or_C; midx = -1; } - } - /* TODO: figure out how to extract nonstandard mso- style */ - CS = +elt.getAttribute("colspan") || 1; - if( ((RS = (+elt.getAttribute("rowspan") || 1)))>1 || CS>1) merges.push({s:{r:R + or_R,c:C + or_C},e:{r:R + or_R + (RS||1) - 1, c:C + or_C + (CS||1) - 1}}); - var o/*:Cell*/ = {t:'s', v:v}; - var _t/*:string*/ = elt.getAttribute("data-t") || elt.getAttribute("t") || ""; - if(v != null) { - if(v.length == 0) o.t = _t || 'z'; - else if(opts.raw || v.trim().length == 0 || _t == "s"){} - else if(v === 'TRUE') o = {t:'b', v:true}; - else if(v === 'FALSE') o = {t:'b', v:false}; - else if(!isNaN(fuzzynum(v))) o = {t:'n', v:fuzzynum(v)}; - else if(!isNaN(fuzzydate(v).getDate())) { - o = ({t:'d', v:parseDate(v)}/*:any*/); - if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}/*:any*/); - o.z = opts.dateNF || SSF._table[14]; - } - } - if(o.z === undefined && z != null) o.z = z; - /* The first link is used. Links are assumed to be fully specified. - * TODO: The right way to process relative links is to make a new */ - var l = "", Aelts = elt.getElementsByTagName("A"); - if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) { - l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break; - } - if(l && l.charAt(0) != "#") o.l = ({ Target: l }); - if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; } - else ws[encode_cell({c:C + or_C, r:R + or_R})] = o; - if(range.e.c < C + or_C) range.e.c = C + or_C; - C += CS; - } - ++R; - } - if(merges.length) ws['!merges'] = (ws["!merges"] || []).concat(merges); - range.e.r = Math.max(range.e.r, R - 1 + or_R); - ws['!ref'] = encode_range(range); - if(R >= sheetRows) ws['!fullref'] = encode_range((range.e.r = rows.length-_R+R-1 + or_R,range)); // We can count the real number of rows to parse but we don't to improve the performance - return ws; -} - -function parse_dom_table(table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ { - var opts = _opts || {}; - var ws/*:Worksheet*/ = opts.dense ? ([]/*:any*/) : ({}/*:any*/); - return sheet_add_dom(ws, table, _opts); -} - -function table_to_book(table/*:HTMLElement*/, opts/*:?any*/)/*:Workbook*/ { - return sheet_to_workbook(parse_dom_table(table, opts), opts); -} - -function is_dom_element_hidden(element/*:HTMLElement*/)/*:boolean*/ { - var display/*:string*/ = ''; - var get_computed_style/*:?function*/ = get_get_computed_style_function(element); - if(get_computed_style) display = get_computed_style(element).getPropertyValue('display'); - if(!display) display = element.style && element.style.display; - return display === 'none'; -} - -/* global getComputedStyle */ -function get_get_computed_style_function(element/*:HTMLElement*/)/*:?function*/ { - // The proper getComputedStyle implementation is the one defined in the element window - if(element.ownerDocument.defaultView && typeof element.ownerDocument.defaultView.getComputedStyle === 'function') return element.ownerDocument.defaultView.getComputedStyle; - // If it is not available, try to get one from the global namespace - if(typeof getComputedStyle === 'function') return getComputedStyle; - return null; -} -/* OpenDocument */ -var parse_content_xml = (function() { - - var parse_text_p = function(text/*:string*//*::, tag*/)/*:Array*/ { - /* 6.1.2 White Space Characters */ - var fixed = text - .replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ") - .replace(//g," ") - .replace(//g, function($$,$1) { return Array(parseInt($1,10)+1).join(" "); }) - .replace(/]*\/>/g,"\t") - .replace(//g,"\n"); - var v = unescapexml(fixed.replace(/<[^>]*>/g,"")); - - return [v]; - }; - - var number_formats = { - /* ods name: [short ssf fmt, long ssf fmt] */ - day: ["d", "dd"], - month: ["m", "mm"], - year: ["y", "yy"], - hours: ["h", "hh"], - minutes: ["m", "mm"], - seconds: ["s", "ss"], - "am-pm": ["A/P", "AM/PM"], - "day-of-week": ["ddd", "dddd"], - era: ["e", "ee"], - /* there is no native representation of LO "Q" format */ - quarter: ["\\Qm", "m\\\"th quarter\""] - }; - - return function pcx(d/*:string*/, _opts)/*:Workbook*/ { - var opts = _opts || {}; - if(DENSE != null && opts.dense == null) opts.dense = DENSE; - var str = xlml_normalize(d); - var state/*:Array*/ = [], tmp; - var tag/*:: = {}*/; - var NFtag = {name:""}, NF = "", pidx = 0; - var sheetag/*:: = {name:"", '名称':""}*/; - var rowtag/*:: = {'行号':""}*/; - var Sheets = {}, SheetNames/*:Array*/ = []; - var ws = opts.dense ? ([]/*:any*/) : ({}/*:any*/); - var Rn, q/*:: :any = ({t:"", v:null, z:null, w:"",c:[],}:any)*/; - var ctag = ({value:""}/*:any*/); - var textp = "", textpidx = 0, textptag/*:: = {}*/; - var textR = []; - var R = -1, C = -1, range = {s: {r:1000000,c:10000000}, e: {r:0, c:0}}; - var row_ol = 0; - var number_format_map = {}; - var merges/*:Array*/ = [], mrange = {}, mR = 0, mC = 0; - var rowinfo/*:Array*/ = [], rowpeat = 1, colpeat = 1; - var arrayf/*:Array<[Range, string]>*/ = []; - var WB = {Names:[]}; - var atag = ({}/*:any*/); - var _Ref/*:[string, string]*/ = ["", ""]; - var comments/*:Array*/ = [], comment/*:Comment*/ = ({}/*:any*/); - var creator = "", creatoridx = 0; - var isstub = false, intable = false; - var i = 0; - xlmlregex.lastIndex = 0; - str = str.replace(//mg,"").replace(//gm,""); - while((Rn = xlmlregex.exec(str))) switch((Rn[3]=Rn[3].replace(/_.*$/,""))) { - - case 'table': case '工作表': // 9.1.2 - if(Rn[1]==='/') { - if(range.e.c >= range.s.c && range.e.r >= range.s.r) ws['!ref'] = encode_range(range); - else ws['!ref'] = "A1:A1"; - if(opts.sheetRows > 0 && opts.sheetRows <= range.e.r) { - ws['!fullref'] = ws['!ref']; - range.e.r = opts.sheetRows - 1; - ws['!ref'] = encode_range(range); - } - if(merges.length) ws['!merges'] = merges; - if(rowinfo.length) ws["!rows"] = rowinfo; - sheetag.name = sheetag['名称'] || sheetag.name; - if(typeof JSON !== 'undefined') JSON.stringify(sheetag); - SheetNames.push(sheetag.name); - Sheets[sheetag.name] = ws; - intable = false; - } - else if(Rn[0].charAt(Rn[0].length-2) !== '/') { - sheetag = parsexmltag(Rn[0], false); - R = C = -1; - range.s.r = range.s.c = 10000000; range.e.r = range.e.c = 0; - ws = opts.dense ? ([]/*:any*/) : ({}/*:any*/); merges = []; - rowinfo = []; - intable = true; - } - break; - - case 'table-row-group': // 9.1.9 - if(Rn[1] === "/") --row_ol; else ++row_ol; - break; - case 'table-row': case '行': // 9.1.3 - if(Rn[1] === '/') { R+=rowpeat; rowpeat = 1; break; } - rowtag = parsexmltag(Rn[0], false); - if(rowtag['行号']) R = rowtag['行号'] - 1; else if(R == -1) R = 0; - rowpeat = +rowtag['number-rows-repeated'] || 1; - /* TODO: remove magic */ - if(rowpeat < 10) for(i = 0; i < rowpeat; ++i) if(row_ol > 0) rowinfo[R + i] = {level: row_ol}; - C = -1; break; - case 'covered-table-cell': // 9.1.5 - if(Rn[1] !== '/') ++C; - if(opts.sheetStubs) { - if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = {t:'z'}; } - else ws[encode_cell({r:R,c:C})] = {t:'z'}; - } - textp = ""; textR = []; - break; /* stub */ - case 'table-cell': case '数据': - if(Rn[0].charAt(Rn[0].length-2) === '/') { - ++C; - ctag = parsexmltag(Rn[0], false); - colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); - q = ({t:'z', v:null/*:: , z:null, w:"",c:[]*/}/*:any*/); - if(ctag.formula && opts.cellFormula != false) q.f = ods_to_csf_formula(unescapexml(ctag.formula)); - if((ctag['数据类型'] || ctag['value-type']) == "string") { - q.t = "s"; q.v = unescapexml(ctag['string-value'] || ""); - if(opts.dense) { - if(!ws[R]) ws[R] = []; - ws[R][C] = q; - } else { - ws[encode_cell({r:R,c:C})] = q; - } - } - C+= colpeat-1; - } else if(Rn[1]!=='/') { - ++C; - textp = ""; textpidx = 0; textR = []; - colpeat = 1; - var rptR = rowpeat ? R + rowpeat - 1 : R; - if(C > range.e.c) range.e.c = C; - if(C < range.s.c) range.s.c = C; - if(R < range.s.r) range.s.r = R; - if(rptR > range.e.r) range.e.r = rptR; - ctag = parsexmltag(Rn[0], false); - comments = []; comment = ({}/*:any*/); - q = ({t:ctag['数据类型'] || ctag['value-type'], v:null/*:: , z:null, w:"",c:[]*/}/*:any*/); - if(opts.cellFormula) { - if(ctag.formula) ctag.formula = unescapexml(ctag.formula); - if(ctag['number-matrix-columns-spanned'] && ctag['number-matrix-rows-spanned']) { - mR = parseInt(ctag['number-matrix-rows-spanned'],10) || 0; - mC = parseInt(ctag['number-matrix-columns-spanned'],10) || 0; - mrange = {s: {r:R,c:C}, e:{r:R + mR-1,c:C + mC-1}}; - q.F = encode_range(mrange); - arrayf.push([mrange, q.F]); - } - if(ctag.formula) q.f = ods_to_csf_formula(ctag.formula); - else for(i = 0; i < arrayf.length; ++i) - if(R >= arrayf[i][0].s.r && R <= arrayf[i][0].e.r) - if(C >= arrayf[i][0].s.c && C <= arrayf[i][0].e.c) - q.F = arrayf[i][1]; - } - if(ctag['number-columns-spanned'] || ctag['number-rows-spanned']) { - mR = parseInt(ctag['number-rows-spanned'],10) || 0; - mC = parseInt(ctag['number-columns-spanned'],10) || 0; - mrange = {s: {r:R,c:C}, e:{r:R + mR-1,c:C + mC-1}}; - merges.push(mrange); - } - - /* 19.675.2 table:number-columns-repeated */ - if(ctag['number-columns-repeated']) colpeat = parseInt(ctag['number-columns-repeated'], 10); - - /* 19.385 office:value-type */ - switch(q.t) { - case 'boolean': q.t = 'b'; q.v = parsexmlbool(ctag['boolean-value']); break; - case 'float': q.t = 'n'; q.v = parseFloat(ctag.value); break; - case 'percentage': q.t = 'n'; q.v = parseFloat(ctag.value); break; - case 'currency': q.t = 'n'; q.v = parseFloat(ctag.value); break; - case 'date': q.t = 'd'; q.v = parseDate(ctag['date-value']); - if(!opts.cellDates) { q.t = 'n'; q.v = datenum(q.v); } - q.z = 'm/d/yy'; break; - case 'time': q.t = 'n'; q.v = parse_isodur(ctag['time-value'])/86400; - if(opts.cellDates) { q.t = 'd'; q.v = numdate(q.v); } - q.z = 'HH:MM:SS'; break; - case 'number': q.t = 'n'; q.v = parseFloat(ctag['数据数值']); break; - default: - if(q.t === 'string' || q.t === 'text' || !q.t) { - q.t = 's'; - if(ctag['string-value'] != null) { textp = unescapexml(ctag['string-value']); textR = []; } - } else throw new Error('Unsupported value type ' + q.t); - } - } else { - isstub = false; - if(q.t === 's') { - q.v = textp || ''; - if(textR.length) q.R = textR; - isstub = textpidx == 0; - } - if(atag.Target) q.l = atag; - if(comments.length > 0) { q.c = comments; comments = []; } - if(textp && opts.cellText !== false) q.w = textp; - if(isstub) { q.t = "z"; delete q.v; } - if(!isstub || opts.sheetStubs) { - if(!(opts.sheetRows && opts.sheetRows <= R)) { - for(var rpt = 0; rpt < rowpeat; ++rpt) { - colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); - if(opts.dense) { - if(!ws[R + rpt]) ws[R + rpt] = []; - ws[R + rpt][C] = rpt == 0 ? q : dup(q); - while(--colpeat > 0) ws[R + rpt][C + colpeat] = dup(q); - } else { - ws[encode_cell({r:R + rpt,c:C})] = q; - while(--colpeat > 0) ws[encode_cell({r:R + rpt,c:C + colpeat})] = dup(q); - } - if(range.e.c <= C) range.e.c = C; - } - } - } - colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); - C += colpeat-1; colpeat = 0; - q = {/*:: t:"", v:null, z:null, w:"",c:[]*/}; - textp = ""; textR = []; - } - atag = ({}/*:any*/); - break; // 9.1.4 - - /* pure state */ - case 'document': // TODO: is the root for FODS - case 'document-content': case '电子表格文档': // 3.1.3.2 - case 'spreadsheet': case '主体': // 3.7 - case 'scripts': // 3.12 - case 'styles': // TODO - case 'font-face-decls': // 3.14 - case 'master-styles': // 3.15.4 -- relevant for FODS - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;} - else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); - break; - - case 'annotation': // 14.1 - if(Rn[1]==='/'){ - if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp; - comment.t = textp; - if(textR.length) /*::(*/comment/*:: :any)*/.R = textR; - comment.a = creator; - comments.push(comment); - } - else if(Rn[0].charAt(Rn[0].length-2) !== '/') {state.push([Rn[3], false]);} - creator = ""; creatoridx = 0; - textp = ""; textpidx = 0; textR = []; - break; - - case 'creator': // 4.3.2.7 - if(Rn[1]==='/') { creator = str.slice(creatoridx,Rn.index); } - else creatoridx = Rn.index + Rn[0].length; - break; - - /* ignore state */ - case 'meta': case '元数据': // TODO: FODS/UOF - case 'settings': // TODO: - case 'config-item-set': // TODO: - case 'config-item-map-indexed': // TODO: - case 'config-item-map-entry': // TODO: - case 'config-item-map-named': // TODO: - case 'shapes': // 9.2.8 - case 'frame': // 10.4.2 - case 'text-box': // 10.4.3 - case 'image': // 10.4.4 - case 'data-pilot-tables': // 9.6.2 - case 'list-style': // 16.30 - case 'form': // 13.13 - case 'dde-links': // 9.8 - case 'event-listeners': // TODO - case 'chart': // TODO - if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;} - else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], false]); - textp = ""; textpidx = 0; textR = []; - break; - - case 'scientific-number': // TODO: - break; - case 'currency-symbol': // TODO: - break; - case 'currency-style': // TODO: - break; - case 'number-style': // 16.27.2 - case 'percentage-style': // 16.27.9 - case 'date-style': // 16.27.10 - case 'time-style': // 16.27.18 - if(Rn[1]==='/'){ - number_format_map[NFtag.name] = NF; - if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp; - } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { - NF = ""; - NFtag = parsexmltag(Rn[0], false); - state.push([Rn[3], true]); - } break; - - case 'script': break; // 3.13 - case 'libraries': break; // TODO: - case 'automatic-styles': break; // 3.15.3 - - case 'default-style': // TODO: - case 'page-layout': break; // TODO: - case 'style': // 16.2 - break; - case 'map': break; // 16.3 - case 'font-face': break; // 16.21 - - case 'paragraph-properties': break; // 17.6 - case 'table-properties': break; // 17.15 - case 'table-column-properties': break; // 17.16 - case 'table-row-properties': break; // 17.17 - case 'table-cell-properties': break; // 17.18 - - case 'number': // 16.27.3 - switch(state[state.length-1][0]) { - case 'time-style': - case 'date-style': - tag = parsexmltag(Rn[0], false); - NF += number_formats[Rn[3]][tag.style==='long'?1:0]; break; - } break; - - case 'fraction': break; // TODO 16.27.6 - - case 'day': // 16.27.11 - case 'month': // 16.27.12 - case 'year': // 16.27.13 - case 'era': // 16.27.14 - case 'day-of-week': // 16.27.15 - case 'week-of-year': // 16.27.16 - case 'quarter': // 16.27.17 - case 'hours': // 16.27.19 - case 'minutes': // 16.27.20 - case 'seconds': // 16.27.21 - case 'am-pm': // 16.27.22 - switch(state[state.length-1][0]) { - case 'time-style': - case 'date-style': - tag = parsexmltag(Rn[0], false); - NF += number_formats[Rn[3]][tag.style==='long'?1:0]; break; - } break; - - case 'boolean-style': break; // 16.27.23 - case 'boolean': break; // 16.27.24 - case 'text-style': break; // 16.27.25 - case 'text': // 16.27.26 - if(Rn[0].slice(-2) === "/>") break; - else if(Rn[1]==="/") switch(state[state.length-1][0]) { - case 'number-style': - case 'date-style': - case 'time-style': - NF += str.slice(pidx, Rn.index); - break; - } - else pidx = Rn.index + Rn[0].length; - break; - - case 'named-range': // 9.4.12 - tag = parsexmltag(Rn[0], false); - _Ref = ods_to_csf_3D(tag['cell-range-address']); - var nrange = ({Name:tag.name, Ref:_Ref[0] + '!' + _Ref[1]}/*:any*/); - if(intable) nrange.Sheet = SheetNames.length; - WB.Names.push(nrange); - break; - - case 'text-content': break; // 16.27.27 - case 'text-properties': break; // 16.27.27 - case 'embedded-text': break; // 16.27.4 - - case 'body': case '电子表格': break; // 3.3 16.9.6 19.726.3 - - case 'forms': break; // 12.25.2 13.2 - case 'table-column': break; // 9.1.6 - case 'table-header-rows': break; // 9.1.7 - case 'table-rows': break; // 9.1.12 - /* TODO: outline levels */ - case 'table-column-group': break; // 9.1.10 - case 'table-header-columns': break; // 9.1.11 - case 'table-columns': break; // 9.1.12 - - case 'null-date': break; // 9.4.2 TODO: date1904 - - case 'graphic-properties': break; // 17.21 - case 'calculation-settings': break; // 9.4.1 - case 'named-expressions': break; // 9.4.11 - case 'label-range': break; // 9.4.9 - case 'label-ranges': break; // 9.4.10 - case 'named-expression': break; // 9.4.13 - case 'sort': break; // 9.4.19 - case 'sort-by': break; // 9.4.20 - case 'sort-groups': break; // 9.4.22 - - case 'tab': break; // 6.1.4 - case 'line-break': break; // 6.1.5 - case 'span': break; // 6.1.7 - case 'p': case '文本串': // 5.1.3 - if(['master-styles'].indexOf(state[state.length-1][0]) > -1) break; - if(Rn[1]==='/' && (!ctag || !ctag['string-value'])) { - var ptp = parse_text_p(str.slice(textpidx,Rn.index), textptag); - textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0]; - } else { textptag = parsexmltag(Rn[0], false); textpidx = Rn.index + Rn[0].length; } - break; // - case 's': break; // - - case 'database-range': // 9.4.15 - if(Rn[1]==='/') break; - try { - _Ref = ods_to_csf_3D(parsexmltag(Rn[0])['target-range-address']); - Sheets[_Ref[0]]['!autofilter'] = { ref:_Ref[1] }; - } catch(e) {/* empty */} - break; - - case 'date': break; // <*:date> - - case 'object': break; // 10.4.6.2 - case 'title': case '标题': break; // <*:title> OR - case 'desc': break; // <*:desc> - case 'binary-data': break; // 10.4.5 TODO: b64 blob - - /* 9.2 Advanced Tables */ - case 'table-source': break; // 9.2.6 - case 'scenario': break; // 9.2.6 - - case 'iteration': break; // 9.4.3 - case 'content-validations': break; // 9.4.4 - case 'filter': break; // 9.5.2 - case 'filter-and': break; // 9.5.3 - case 'filter-or': break; // 9.5.4 - case 'filter-condition': break; // 9.5.5 - - case 'list-level-style-bullet': break; // 16.31 - case 'page-count': break; // TODO - case 'time': break; // TODO - - /* 9.3 Advanced Table Cells */ - case 'cell-range-source': break; // 9.3.1 - case 'property': break; // 13.8 - - case 'a': // 6.1.8 hyperlink - if(Rn[1]!== '/') { - atag = parsexmltag(Rn[0], false); - if(!atag.href) break; - atag.Target = unescapexml(atag.href); delete atag.href; - if(atag.Target.charAt(0) == "#" && atag.Target.indexOf(".") > -1) { - _Ref = ods_to_csf_3D(atag.Target.slice(1)); - atag.Target = "#" + _Ref[0] + "!" + _Ref[1]; - } else if(atag.Target.match(/^\.\.[\\\/]/)) atag.Target = atag.Target.slice(3); - } - break; - - /* non-standard */ - case 'table-protection': break; - case 'data-pilot-grand-total': break; // ', - '', - '', - '', - '', - '', - '', - '' - ].join(""); - - var payload = '' + master_styles + ''; - - return function wso(/*::wb, opts*/) { - return XML_HEADER + payload; - }; -})(); -var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() { - /* 6.1.2 White Space Characters */ - var write_text_p = function(text/*:string*/)/*:string*/ { - return escapexml(text) - .replace(/ +/g, function($$){return '';}) - .replace(/\t/g, "") - .replace(/\n/g, "") - .replace(/^ /, "").replace(/ $/, ""); - }; - - var null_cell_xml = ' \n'; - var covered_cell_xml = ' \n'; - var write_ws = function(ws, wb/*:Workbook*/, i/*:number*//*::, opts*/)/*:string*/ { - /* Section 9 Tables */ - var o/*:Array*/ = []; - o.push(' \n'); - var R=0,C=0, range = decode_range(ws['!ref']||"A1"); - var marr/*:Array*/ = ws['!merges'] || [], mi = 0; - var dense = Array.isArray(ws); - if(ws["!cols"]) { - for(C = 0; C <= range.e.c; ++C) o.push(' \n'); - } - var H = "", ROWS = ws["!rows"]||[]; - for(R = 0; R < range.s.r; ++R) { - H = ROWS[R] ? ' table:style-name="ro' + ROWS[R].ods + '"' : ""; - o.push(' \n'); - } - for(; R <= range.e.r; ++R) { - H = ROWS[R] ? ' table:style-name="ro' + ROWS[R].ods + '"' : ""; - o.push(' \n'); - for(C=0; C < range.s.c; ++C) o.push(null_cell_xml); - for(; C <= range.e.c; ++C) { - var skip = false, ct = {}, textp = ""; - for(mi = 0; mi != marr.length; ++mi) { - if(marr[mi].s.c > C) continue; - if(marr[mi].s.r > R) continue; - if(marr[mi].e.c < C) continue; - if(marr[mi].e.r < R) continue; - if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; - ct['table:number-columns-spanned'] = (marr[mi].e.c - marr[mi].s.c + 1); - ct['table:number-rows-spanned'] = (marr[mi].e.r - marr[mi].s.r + 1); - break; - } - if(skip) { o.push(covered_cell_xml); continue; } - var ref = encode_cell({r:R, c:C}), cell = dense ? (ws[R]||[])[C]: ws[ref]; - if(cell && cell.f) { - ct['table:formula'] = escapexml(csf_to_ods_formula(cell.f)); - if(cell.F) { - if(cell.F.slice(0, ref.length) == ref) { - var _Fref = decode_range(cell.F); - ct['table:number-matrix-columns-spanned'] = (_Fref.e.c - _Fref.s.c + 1); - ct['table:number-matrix-rows-spanned'] = (_Fref.e.r - _Fref.s.r + 1); - } - } - } - if(!cell) { o.push(null_cell_xml); continue; } - switch(cell.t) { - case 'b': - textp = (cell.v ? 'TRUE' : 'FALSE'); - ct['office:value-type'] = "boolean"; - ct['office:boolean-value'] = (cell.v ? 'true' : 'false'); - break; - case 'n': - textp = (cell.w||String(cell.v||0)); - ct['office:value-type'] = "float"; - ct['office:value'] = (cell.v||0); - break; - case 's': case 'str': - textp = cell.v == null ? "" : cell.v; - ct['office:value-type'] = "string"; - break; - case 'd': - textp = (cell.w||(parseDate(cell.v).toISOString())); - ct['office:value-type'] = "date"; - ct['office:date-value'] = (parseDate(cell.v).toISOString()); - ct['table:style-name'] = "ce1"; - break; - //case 'e': - default: o.push(null_cell_xml); continue; - } - var text_p = write_text_p(textp); - if(cell.l && cell.l.Target) { - var _tgt = cell.l.Target; - _tgt = _tgt.charAt(0) == "#" ? "#" + csf_to_ods_3D(_tgt.slice(1)) : _tgt; - // TODO: choose correct parent path format based on link delimiters - if(_tgt.charAt(0) != "#" && !_tgt.match(/^\w+:/)) _tgt = '../' + _tgt; - text_p = writextag('text:a', text_p, {'xlink:href': _tgt.replace(/&/g, "&")}); - } - o.push(' ' + writextag('table:table-cell', writextag('text:p', text_p, {}), ct) + '\n'); - } - o.push(' \n'); - } - o.push(' \n'); - return o.join(""); - }; - - var write_automatic_styles_ods = function(o/*:Array*/, wb) { - o.push(' \n'); - - o.push(' \n'); - o.push(' \n'); - o.push(' /\n'); - o.push(' \n'); - o.push(' /\n'); - o.push(' \n'); - o.push(' \n'); - - /* column styles */ - var cidx = 0; - wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) { - if(!ws) return; - if(ws["!cols"]) { - for(var C = 0; C < ws["!cols"].length; ++C) if(ws["!cols"][C]) { - var colobj = ws["!cols"][C]; - if(colobj.width == null && colobj.wpx == null && colobj.wch == null) continue; - process_col(colobj); - colobj.ods = cidx; - var w = ws["!cols"][C].wpx + "px"; - o.push(' \n'); - o.push(' \n'); - o.push(' \n'); - ++cidx; - } - } - }); - - /* row styles */ - var ridx = 0; - wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) { - if(!ws) return; - if(ws["!rows"]) { - for(var R = 0; R < ws["!rows"].length; ++R) if(ws["!rows"][R]) { - ws["!rows"][R].ods = ridx; - var h = ws["!rows"][R].hpx + "px"; - o.push(' \n'); - o.push(' \n'); - o.push(' \n'); - ++ridx; - } - } - }); - - /* table */ - o.push(' \n'); - o.push(' \n'); - o.push(' \n'); - - /* table cells, text */ - o.push(' \n'); - - /* page-layout */ - - o.push(' \n'); - }; - - return function wcx(wb, opts) { - var o = [XML_HEADER]; - /* 3.1.3.2 */ - var attr = wxt_helper({ - 'xmlns:office': "urn:oasis:names:tc:opendocument:xmlns:office:1.0", - 'xmlns:table': "urn:oasis:names:tc:opendocument:xmlns:table:1.0", - 'xmlns:style': "urn:oasis:names:tc:opendocument:xmlns:style:1.0", - 'xmlns:text': "urn:oasis:names:tc:opendocument:xmlns:text:1.0", - 'xmlns:draw': "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", - 'xmlns:fo': "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", - 'xmlns:xlink': "http://www.w3.org/1999/xlink", - 'xmlns:dc': "http://purl.org/dc/elements/1.1/", - 'xmlns:meta': "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", - 'xmlns:number': "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", - 'xmlns:presentation': "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", - 'xmlns:svg': "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", - 'xmlns:chart': "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", - 'xmlns:dr3d': "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", - 'xmlns:math': "http://www.w3.org/1998/Math/MathML", - 'xmlns:form': "urn:oasis:names:tc:opendocument:xmlns:form:1.0", - 'xmlns:script': "urn:oasis:names:tc:opendocument:xmlns:script:1.0", - 'xmlns:ooo': "http://openoffice.org/2004/office", - 'xmlns:ooow': "http://openoffice.org/2004/writer", - 'xmlns:oooc': "http://openoffice.org/2004/calc", - 'xmlns:dom': "http://www.w3.org/2001/xml-events", - 'xmlns:xforms': "http://www.w3.org/2002/xforms", - 'xmlns:xsd': "http://www.w3.org/2001/XMLSchema", - 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", - 'xmlns:sheet': "urn:oasis:names:tc:opendocument:sh33tjs:1.0", - 'xmlns:rpt': "http://openoffice.org/2005/report", - 'xmlns:of': "urn:oasis:names:tc:opendocument:xmlns:of:1.2", - 'xmlns:xhtml': "http://www.w3.org/1999/xhtml", - 'xmlns:grddl': "http://www.w3.org/2003/g/data-view#", - 'xmlns:tableooo': "http://openoffice.org/2009/table", - 'xmlns:drawooo': "http://openoffice.org/2010/draw", - 'xmlns:calcext': "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", - 'xmlns:loext': "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", - 'xmlns:field': "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", - 'xmlns:formx': "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", - 'xmlns:css3t': "http://www.w3.org/TR/css3-text/", - 'office:version': "1.2" - }); - - var fods = wxt_helper({ - 'xmlns:config': "urn:oasis:names:tc:opendocument:xmlns:config:1.0", - 'office:mimetype': "application/vnd.oasis.opendocument.spreadsheet" - }); - - if(opts.bookType == "fods") { - o.push('\n'); - o.push(write_meta_ods().replace(/office:document-meta/g, "office:meta")); - // TODO: settings (equiv of settings.xml for ODS) - } else o.push('\n'); - // o.push(' \n'); - write_automatic_styles_ods(o, wb); - o.push(' \n'); - o.push(' \n'); - for(var i = 0; i != wb.SheetNames.length; ++i) o.push(write_ws(wb.Sheets[wb.SheetNames[i]], wb, i, opts)); - o.push(' \n'); - o.push(' \n'); - if(opts.bookType == "fods") o.push('
'); - else o.push(''); - return o.join(""); - }; -})(); - -function write_ods(wb/*:any*/, opts/*:any*/) { - if(opts.bookType == "fods") return write_content_ods(wb, opts); - - var zip = zip_new(); - var f = ""; - - var manifest/*:Array >*/ = []; - var rdf/*:Array<[string, string]>*/ = []; - - /* Part 3 Section 3.3 MIME Media Type */ - f = "mimetype"; - zip_add_file(zip, f, "application/vnd.oasis.opendocument.spreadsheet"); - - /* Part 1 Section 2.2 Documents */ - f = "content.xml"; - zip_add_file(zip, f, write_content_ods(wb, opts)); - manifest.push([f, "text/xml"]); - rdf.push([f, "ContentFile"]); - - /* TODO: these are hard-coded styles to satiate excel */ - f = "styles.xml"; - zip_add_file(zip, f, write_styles_ods(wb, opts)); - manifest.push([f, "text/xml"]); - rdf.push([f, "StylesFile"]); - - /* TODO: this is hard-coded to satiate excel */ - f = "meta.xml"; - zip_add_file(zip, f, XML_HEADER + write_meta_ods(/*::wb, opts*/)); - manifest.push([f, "text/xml"]); - rdf.push([f, "MetadataFile"]); - - /* Part 3 Section 6 Metadata Manifest File */ - f = "manifest.rdf"; - zip_add_file(zip, f, write_rdf(rdf/*, opts*/)); - manifest.push([f, "application/rdf+xml"]); - - /* Part 3 Section 4 Manifest File */ - f = "META-INF/manifest.xml"; - zip_add_file(zip, f, write_manifest(manifest/*, opts*/)); - - return zip; -} - -var NUMBERS = !Object.defineProperty ? (void 0) :(function() { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __markAsModule = function(target) { - return __defProp(target, "__esModule", { value: true }); - }; - var __export = function(target, all) { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __reExport = function(target, module, copyDefault, desc) { - if (module && typeof module === "object" || typeof module === "function") - for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) { - key = keys[i]; - if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) - __defProp(target, key, { get: function(k) { - return module[k]; - }.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); - } - return target; - }; - var __toCommonJS = /* @__PURE__ */ function(cache) { - return function(module, temp) { - return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp); - }; - }(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); - - // 83_numbers.ts - var numbers_exports = {}; - __export(numbers_exports, { - parse_numbers: function() { - return numbers_default; - } - }); - - // src/util.ts - var u8_to_dataview = function(array) { - return new DataView(array.buffer, array.byteOffset, array.byteLength); - }; - var u8str = function(u8) { - return typeof TextDecoder != "undefined" ? new TextDecoder().decode(u8) : utf8read(a2s(u8)); - }; - var u8concat = function(u8a) { - var len = u8a.reduce(function(acc, x) { - return acc + x.length; - }, 0); - var out = new Uint8Array(len); - var off = 0; - u8a.forEach(function(u8) { - out.set(u8, off); - off += u8.length; - }); - return out; - }; - var popcnt = function(x) { - x -= x >> 1 & 1431655765; - x = (x & 858993459) + (x >> 2 & 858993459); - return (x + (x >> 4) & 252645135) * 16843009 >>> 24; - }; - var readDecimal128LE = function(buf, offset) { - var exp = (buf[offset + 15] & 127) << 7 | buf[offset + 14] >> 1; - var mantissa = buf[offset + 14] & 1; - for (var j = offset + 13; j >= offset; --j) - mantissa = mantissa * 256 + buf[j]; - return (buf[offset + 15] & 128 ? -mantissa : mantissa) * Math.pow(10, exp - 6176); - }; - - // src/proto.ts - function parse_varint49(buf, ptr) { - var l = ptr ? ptr[0] : 0; - var usz = buf[l] & 127; - varint: - if (buf[l++] >= 128) { - usz |= (buf[l] & 127) << 7; - if (buf[l++] < 128) - break varint; - usz |= (buf[l] & 127) << 14; - if (buf[l++] < 128) - break varint; - usz |= (buf[l] & 127) << 21; - if (buf[l++] < 128) - break varint; - usz += (buf[l] & 127) * Math.pow(2, 28); - ++l; - if (buf[l++] < 128) - break varint; - usz += (buf[l] & 127) * Math.pow(2, 35); - ++l; - if (buf[l++] < 128) - break varint; - usz += (buf[l] & 127) * Math.pow(2, 42); - ++l; - if (buf[l++] < 128) - break varint; - } - if (ptr) - ptr[0] = l; - return usz; - } - function varint_to_i32(buf) { - var l = 0, i32 = buf[l] & 127; - varint: - if (buf[l++] >= 128) { - i32 |= (buf[l] & 127) << 7; - if (buf[l++] < 128) - break varint; - i32 |= (buf[l] & 127) << 14; - if (buf[l++] < 128) - break varint; - i32 |= (buf[l] & 127) << 21; - if (buf[l++] < 128) - break varint; - i32 |= (buf[l] & 127) << 28; - } - return i32; - } - function parse_shallow(buf) { - var out = [], ptr = [0]; - while (ptr[0] < buf.length) { - var off = ptr[0]; - var num = parse_varint49(buf, ptr); - var type = num & 7; - num = Math.floor(num / 8); - var len = 0; - var res; - if (num == 0) - break; - switch (type) { - case 0: - { - var l = ptr[0]; - while (buf[ptr[0]++] >= 128) - ; - res = buf.slice(l, ptr[0]); - } - break; - case 5: - len = 4; - res = buf.slice(ptr[0], ptr[0] + len); - ptr[0] += len; - break; - case 1: - len = 8; - res = buf.slice(ptr[0], ptr[0] + len); - ptr[0] += len; - break; - case 2: - len = parse_varint49(buf, ptr); - res = buf.slice(ptr[0], ptr[0] + len); - ptr[0] += len; - break; - case 3: - case 4: - default: - throw new Error("PB Type ".concat(type, " for Field ").concat(num, " at offset ").concat(off)); - } - var v = { offset: off, data: res, type: type }; - if (out[num] == null) - out[num] = [v]; - else - out[num].push(v); - } - return out; - } - function mappa(data, cb) { - if (!data) - return []; - return data.map(function(d) { - var _a; - try { - return cb(d.data); - } catch (e) { - var m = (_a = e.message) == null ? void 0 : _a.match(/at offset (\d+)/); - if (m) - e.message = e.message.replace(/at offset (\d+)/, "at offset " + (+m[1] + d.offset)); - throw e; - } - }); - } - - // src/frame.ts - function deframe(buf) { - var out = []; - var l = 0; - while (l < buf.length) { - var t = buf[l++]; - var len = buf[l] | buf[l + 1] << 8 | buf[l + 2] << 16; - l += 3; - out.push(parse_snappy_chunk(t, buf.slice(l, l + len))); - l += len; - } - if (l !== buf.length) - throw new Error("data is not a valid framed stream!"); - return u8concat(out); - } - function parse_snappy_chunk(type, buf) { - if (type != 0) - throw new Error("Unexpected Snappy chunk type ".concat(type)); - var ptr = [0]; - var usz = parse_varint49(buf, ptr); - var chunks = []; - while (ptr[0] < buf.length) { - var tag = buf[ptr[0]] & 3; - if (tag == 0) { - var len = buf[ptr[0]++] >> 2; - if (len < 60) - ++len; - else { - var c = len - 59; - len = buf[ptr[0]]; - if (c > 1) - len |= buf[ptr[0] + 1] << 8; - if (c > 2) - len |= buf[ptr[0] + 2] << 16; - if (c > 3) - len |= buf[ptr[0] + 3] << 24; - len >>>= 0; - len++; - ptr[0] += c; - } - chunks.push(buf.slice(ptr[0], ptr[0] + len)); - ptr[0] += len; - continue; - } else { - var offset = 0, length = 0; - if (tag == 1) { - length = (buf[ptr[0]] >> 2 & 7) + 4; - offset = (buf[ptr[0]++] & 224) << 3; - offset |= buf[ptr[0]++]; - } else { - length = (buf[ptr[0]++] >> 2) + 1; - if (tag == 2) { - offset = buf[ptr[0]] | buf[ptr[0] + 1] << 8; - ptr[0] += 2; - } else { - offset = (buf[ptr[0]] | buf[ptr[0] + 1] << 8 | buf[ptr[0] + 2] << 16 | buf[ptr[0] + 3] << 24) >>> 0; - ptr[0] += 4; - } - } - chunks = [u8concat(chunks)]; - if (offset == 0) - throw new Error("Invalid offset 0"); - if (offset > chunks[0].length) - throw new Error("Invalid offset beyond length"); - if (length >= offset) { - chunks.push(chunks[0].slice(-offset)); - length -= offset; - while (length >= chunks[chunks.length - 1].length) { - chunks.push(chunks[chunks.length - 1]); - length -= chunks[chunks.length - 1].length; - } - } - chunks.push(chunks[0].slice(-offset, -offset + length)); - } - } - var o = u8concat(chunks); - if (o.length != usz) - throw new Error("Unexpected length: ".concat(o.length, " != ").concat(usz)); - return o; - } - - // src/iwa.ts - function parse_iwa(buf) { - var out = [], ptr = [0]; - while (ptr[0] < buf.length) { - var len = parse_varint49(buf, ptr); - var ai = parse_shallow(buf.slice(ptr[0], ptr[0] + len)); - ptr[0] += len; - var res = { - id: varint_to_i32(ai[1][0].data), - messages: [] - }; - ai[2].forEach(function(b) { - var mi = parse_shallow(b.data); - var fl = varint_to_i32(mi[3][0].data); - res.messages.push({ - meta: mi, - data: buf.slice(ptr[0], ptr[0] + fl) - }); - ptr[0] += fl; - }); - out.push(res); - } - return out; - } - - // src/cell.ts - function parse_old_storage(buf, sst, rsst) { - var dv = u8_to_dataview(buf); - var ctype = buf[buf[0] == 4 ? 1 : 2]; - var flags = dv.getUint32(4, true); - var data_offset = 12 + popcnt(flags & 3470) * 4; - var ridx = -1, sidx = -1, ieee = NaN, dt = new Date(2001, 0, 1); - if (flags & 512) { - ridx = dv.getUint32(data_offset, true); - data_offset += 4; - } - data_offset += popcnt(flags & 12288) * 4; - if (flags & 16) { - sidx = dv.getUint32(data_offset, true); - data_offset += 4; - } - if (flags & 32) { - ieee = dv.getFloat64(data_offset, true); - data_offset += 8; - } - if (flags & 64) { - dt.setTime(dt.getTime() + dv.getFloat64(data_offset, true) * 1e3); - data_offset += 8; - } - var ret; - switch (ctype) { - case 0: - break; - case 2: - ret = { t: "n", v: ieee }; - break; - case 3: - ret = { t: "s", v: sst[sidx] }; - break; - case 5: - ret = { t: "d", v: dt }; - break; - case 6: - ret = { t: "b", v: ieee > 0 }; - break; - case 7: - ret = { t: "n", v: ieee }; - break; - case 8: - ret = { t: "e", v: 0 }; - break; - case 9: - { - if (ridx > -1) - ret = { t: "s", v: rsst[ridx] }; - else if (sidx > -1) - ret = { t: "s", v: sst[sidx] }; - else if (!isNaN(ieee)) - ret = { t: "n", v: ieee }; - else - throw new Error("Unsupported cell type ".concat(buf.slice(0, 4))); - } - break; - default: - throw new Error("Unsupported cell type ".concat(buf.slice(0, 4))); - } - return ret; - } - function parse_storage(buf, sst, rsst) { - var dv = u8_to_dataview(buf); - var ctype = buf[1]; - var flags = dv.getUint32(8, true); - var data_offset = 12; - var ridx = -1, sidx = -1, d128 = NaN, ieee = NaN, dt = new Date(2001, 0, 1); - if (flags & 1) { - d128 = readDecimal128LE(buf, data_offset); - data_offset += 16; - } - if (flags & 2) { - ieee = dv.getFloat64(data_offset, true); - data_offset += 8; - } - if (flags & 4) { - dt.setTime(dt.getTime() + dv.getFloat64(data_offset, true) * 1e3); - data_offset += 8; - } - if (flags & 8) { - sidx = dv.getUint32(data_offset, true); - data_offset += 4; - } - if (flags & 16) { - ridx = dv.getUint32(data_offset, true); - data_offset += 4; - } - var ret; - switch (ctype) { - case 0: - break; - case 2: - ret = { t: "n", v: d128 }; - break; - case 3: - ret = { t: "s", v: sst[sidx] }; - break; - case 5: - ret = { t: "d", v: dt }; - break; - case 6: - ret = { t: "b", v: ieee > 0 }; - break; - case 7: - ret = { t: "n", v: ieee }; - break; - case 8: - ret = { t: "e", v: 0 }; - break; - case 9: - { - if (ridx > -1) - ret = { t: "s", v: rsst[ridx] }; - else - throw new Error("Unsupported cell type ".concat(ctype, " : ").concat(flags & 31, " : ").concat(buf.slice(0, 4))); - } - break; - case 10: - ret = { t: "n", v: d128 }; - break; - default: - throw new Error("Unsupported cell type ".concat(ctype, " : ").concat(flags & 31, " : ").concat(buf.slice(0, 4))); - } - return ret; - } - function parse(buf, sst, rsst) { - switch (buf[0]) { - case 3: - case 4: - return parse_old_storage(buf, sst, rsst); - case 5: - return parse_storage(buf, sst, rsst); - default: - throw new Error("Unsupported payload version ".concat(buf[0])); - } - } - - // src/numbers.ts - var encode_col = function(C) { - var s = ""; - for (++C; C; C = Math.floor((C - 1) / 26)) - s = String.fromCharCode((C - 1) % 26 + 65) + s; - return s; - }; - var encode_cell = function(c) { - return "".concat(encode_col(c.c)).concat(c.r + 1); - }; - var encode_range = function(r) { - return encode_cell(r.s) + ":" + encode_cell(r.e); - }; - var book_new = function() { - return { Sheets: {}, SheetNames: [] }; - }; - var book_append_sheet = function(wb, ws, name) { - if (!name) - for (var i = 1; i < 9999; ++i) { - if (wb.SheetNames.indexOf(name = "Sheet ".concat(i)) == -1) - break; - } - else if (wb.SheetNames.indexOf(name) > -1) - for (var i = 1; i < 9999; ++i) { - if (wb.SheetNames.indexOf("".concat(name, "_").concat(i)) == -1) { - name = "".concat(name, "_").concat(i); - break; - } - } - wb.SheetNames.push(name); - wb.Sheets[name] = ws; - }; - function parse_numbers(cfb) { - var out = []; - cfb.FullPaths.forEach(function(p) { - if (p.match(/\.iwpv2/)) - throw new Error("Unsupported password protection"); - }); - cfb.FileIndex.forEach(function(s) { - if (!s.name.match(/\.iwa$/)) - return; - var o; - try { - o = deframe(s.content); - } catch (e) { - return console.log("?? " + s.content.length + " " + (e.message || e)); - } - var packets; - try { - packets = parse_iwa(o); - } catch (e) { - return console.log("## " + (e.message || e)); - } - packets.forEach(function(packet) { - out[+packet.id] = packet.messages; - }); - }); - if (!out.length) - throw new Error("File has no messages"); - var docroot; - out.forEach(function(iwams) { - iwams.forEach(function(iwam) { - var mtype = varint_to_i32(iwam.meta[1][0].data) >>> 0; - if (mtype == 1) { - if (!docroot) - docroot = iwam; - else - throw new Error("Document has multiple roots"); - } - }); - }); - if (!docroot) - throw new Error("Cannot find Document root"); - return parse_docroot(out, docroot); - } - var numbers_default = parse_numbers; - function parse_Reference(buf) { - var pb = parse_shallow(buf); - return parse_varint49(pb[1][0].data); - } - function parse_TST_TableDataList(M, root) { - var pb = parse_shallow(root.data); - var type = varint_to_i32(pb[1][0].data); - var entries = pb[3]; - var data = []; - (entries || []).forEach(function(entry) { - var le = parse_shallow(entry.data); - var key = varint_to_i32(le[1][0].data) >>> 0; - switch (type) { - case 1: - data[key] = u8str(le[3][0].data); - break; - case 8: - { - var rt = M[parse_Reference(le[9][0].data)][0]; - var rtp = parse_shallow(rt.data); - var rtpref = M[parse_Reference(rtp[1][0].data)][0]; - var mtype = varint_to_i32(rtpref.meta[1][0].data); - if (mtype != 2001) - throw new Error("2000 unexpected reference to ".concat(mtype)); - var tswpsa = parse_shallow(rtpref.data); - data[key] = tswpsa[3].map(function(x) { - return u8str(x.data); - }).join(""); - } - break; - } - }); - return data; - } - function parse_TST_TileRowInfo(u8) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; - var pb = parse_shallow(u8); - var R = varint_to_i32(pb[1][0].data) >>> 0; - var pre_bnc = (_b = (_a = pb[3]) == null ? void 0 : _a[0]) == null ? void 0 : _b.data; - var pre_bnc_offsets = ((_d = (_c = pb[4]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) && u8_to_dataview(pb[4][0].data); - var storage = (_f = (_e = pb[6]) == null ? void 0 : _e[0]) == null ? void 0 : _f.data; - var storage_offsets = ((_h = (_g = pb[7]) == null ? void 0 : _g[0]) == null ? void 0 : _h.data) && u8_to_dataview(pb[7][0].data); - var wide_offsets = ((_j = (_i = pb[8]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) && varint_to_i32(pb[8][0].data) > 0 || false; - var width = wide_offsets ? 4 : 1; - var cells = []; - var off = 0; - for (var C = 0; C < pre_bnc_offsets.byteLength / 2; ++C) { - if (storage && storage_offsets) { - off = storage_offsets.getUint16(C * 2, true) * width; - if (off < storage.length) { - cells[C] = storage.subarray(off, storage_offsets.getUint16(C * 2 + 2, true) * width); - continue; - } - } - if (pre_bnc && pre_bnc_offsets) { - off = pre_bnc_offsets.getUint16(C * 2, true) * width; - if (off < pre_bnc.length) - cells[C] = pre_bnc.subarray(off, pre_bnc_offsets.getUint16(C * 2 + 2, true) * width); - } - } - return { R: R, cells: cells }; - } - function parse_TST_Tile(M, root) { - var pb = parse_shallow(root.data); - var ri = mappa(pb[5], parse_TST_TileRowInfo); - return ri.reduce(function(acc, x) { - if (!acc[x.R]) - acc[x.R] = []; - x.cells.forEach(function(cell, C) { - if (acc[x.R][C]) - throw new Error("Duplicate cell r=".concat(x.R, " c=").concat(C)); - acc[x.R][C] = cell; - }); - return acc; - }, []); - } - function parse_TST_TableModelArchive(M, root, ws) { - var _a; - var pb = parse_shallow(root.data); - var range = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; - range.e.r = (varint_to_i32(pb[6][0].data) >>> 0) - 1; - if (range.e.r < 0) - throw new Error("Invalid row varint ".concat(pb[6][0].data)); - range.e.c = (varint_to_i32(pb[7][0].data) >>> 0) - 1; - if (range.e.c < 0) - throw new Error("Invalid col varint ".concat(pb[7][0].data)); - ws["!ref"] = encode_range(range); - { - var store = parse_shallow(pb[4][0].data); - var sst = parse_TST_TableDataList(M, M[parse_Reference(store[4][0].data)][0]); - var rsst = ((_a = store[17]) == null ? void 0 : _a[0]) ? parse_TST_TableDataList(M, M[parse_Reference(store[17][0].data)][0]) : []; - { - var tile = parse_shallow(store[3][0].data); - var tiles = []; - tile[1].forEach(function(t) { - var tl = parse_shallow(t.data); - var ref = M[parse_Reference(tl[2][0].data)][0]; - var mtype = varint_to_i32(ref.meta[1][0].data); - if (mtype != 6002) - throw new Error("6001 unexpected reference to ".concat(mtype)); - tiles.push({ id: varint_to_i32(tl[1][0].data), ref: parse_TST_Tile(M, ref) }); - }); - tiles.forEach(function(tile2) { - tile2.ref.forEach(function(row, R) { - row.forEach(function(buf, C) { - var addr = encode_cell({ r: R, c: C }); - var res = parse(buf, sst, rsst); - if (res) - ws[addr] = res; - }); - }); - }); - } - } - } - function parse_TST_TableInfoArchive(M, root) { - var pb = parse_shallow(root.data); - var out = { "!ref": "A1" }; - var tableref = M[parse_Reference(pb[2][0].data)]; - var mtype = varint_to_i32(tableref[0].meta[1][0].data); - if (mtype != 6001) - throw new Error("6000 unexpected reference to ".concat(mtype)); - parse_TST_TableModelArchive(M, tableref[0], out); - return out; - } - function parse_sheetroot(M, root) { - var _a; - var pb = parse_shallow(root.data); - var out = { - name: ((_a = pb[1]) == null ? void 0 : _a[0]) ? u8str(pb[1][0].data) : "", - sheets: [] - }; - var shapeoffs = mappa(pb[2], parse_Reference); - shapeoffs.forEach(function(off) { - M[off].forEach(function(m) { - var mtype = varint_to_i32(m.meta[1][0].data); - if (mtype == 6e3) - out.sheets.push(parse_TST_TableInfoArchive(M, m)); - }); - }); - return out; - } - function parse_docroot(M, root) { - var out = book_new(); - var pb = parse_shallow(root.data); - var sheetoffs = mappa(pb[1], parse_Reference); - sheetoffs.forEach(function(off) { - M[off].forEach(function(m) { - var mtype = varint_to_i32(m.meta[1][0].data); - if (mtype == 2) { - var root2 = parse_sheetroot(M, m); - root2.sheets.forEach(function(sheet) { - book_append_sheet(out, sheet, root2.name); - }); - } - }); - }); - if (out.SheetNames.length == 0) - throw new Error("Empty NUMBERS file"); - return out; - } - return __toCommonJS(numbers_exports); -})(); -/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */ -function fix_opts_func(defaults/*:Array >*/)/*:{(o:any):void}*/ { - return function fix_opts(opts) { - for(var i = 0; i != defaults.length; ++i) { - var d = defaults[i]; - if(opts[d[0]] === undefined) opts[d[0]] = d[1]; - if(d[2] === 'n') opts[d[0]] = Number(opts[d[0]]); - } - }; -} - -var fix_read_opts = function(opts) { -fix_opts_func([ - ['cellNF', false], /* emit cell number format string as .z */ - ['cellHTML', true], /* emit html string as .h */ - ['cellFormula', true], /* emit formulae as .f */ - ['cellStyles', false], /* emits style/theme as .s */ - ['cellText', true], /* emit formatted text as .w */ - ['cellDates', false], /* emit date cells with type `d` */ - - ['sheetStubs', false], /* emit empty cells */ - ['sheetRows', 0, 'n'], /* read n rows (0 = read all rows) */ - - ['bookDeps', false], /* parse calculation chains */ - ['bookSheets', false], /* only try to get sheet names (no Sheets) */ - ['bookProps', false], /* only try to get properties (no Sheets) */ - ['bookFiles', false], /* include raw file structure (keys, files, cfb) */ - ['bookVBA', false], /* include vba raw data (vbaraw) */ - - ['password',''], /* password */ - ['WTF', false] /* WTF mode (throws errors) */ -])(opts); -}; - -var fix_write_opts = fix_opts_func([ - ['cellDates', false], /* write date cells with type `d` */ - - ['bookSST', false], /* Generate Shared String Table */ - - ['bookType', 'xlsx'], /* Type of workbook (xlsx/m/b) */ - - ['compression', false], /* Use file compression */ - - ['WTF', false] /* WTF mode (throws errors) */ -]); -function get_sheet_type(n/*:string*/)/*:string*/ { - if(RELS.WS.indexOf(n) > -1) return "sheet"; - if(RELS.CS && n == RELS.CS) return "chart"; - if(RELS.DS && n == RELS.DS) return "dialog"; - if(RELS.MS && n == RELS.MS) return "macro"; - return (n && n.length) ? n : "sheet"; -} -function safe_parse_wbrels(wbrels, sheets) { - if(!wbrels) return 0; - try { - wbrels = sheets.map(function pwbr(w) { if(!w.id) w.id = w.strRelID; return [w.name, wbrels['!id'][w.id].Target, get_sheet_type(wbrels['!id'][w.id].Type)]; }); - } catch(e) { return null; } - return !wbrels || wbrels.length === 0 ? null : wbrels; -} - -function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, idx/*:number*/, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles) { - try { - sheetRels[sheet]=parse_rels(getzipstr(zip, relsPath, true), path); - var data = getzipdata(zip, path); - var _ws; - switch(stype) { - case 'sheet': _ws = parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; - case 'chart': _ws = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); - if(!_ws || !_ws['!drawel']) break; - var dfile = resolve_path(_ws['!drawel'].Target, path); - var drelsp = get_rels_path(dfile); - var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip, drelsp, true), dfile)); - var chartp = resolve_path(draw, dfile); - var crelsp = get_rels_path(chartp); - _ws = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, _ws); - break; - case 'macro': _ws = parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; - case 'dialog': _ws = parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; - default: throw new Error("Unrecognized sheet type " + stype); - } - sheets[sheet] = _ws; - - /* scan rels for comments */ - var comments = []; - if(sheetRels && sheetRels[sheet]) keys(sheetRels[sheet]).forEach(function(n) { - if(sheetRels[sheet][n].Type == RELS.CMNT) { - var dfile = resolve_path(sheetRels[sheet][n].Target, path); - comments = parse_cmnt(getzipdata(zip, dfile, true), dfile, opts); - if(!comments || !comments.length) return; - sheet_insert_comments(_ws, comments); - } - }); - } catch(e) { if(opts.WTF) throw e; } -} - -function strip_front_slash(x/*:string*/)/*:string*/ { return x.charAt(0) == '/' ? x.slice(1) : x; } - -function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ { - make_ssf(SSF); - opts = opts || {}; - fix_read_opts(opts); - - /* OpenDocument Part 3 Section 2.2.1 OpenDocument Package */ - if(safegetzipfile(zip, 'META-INF/manifest.xml')) return parse_ods(zip, opts); - /* UOC */ - if(safegetzipfile(zip, 'objectdata.xml')) return parse_ods(zip, opts); - /* Numbers */ - if(safegetzipfile(zip, 'Index/Document.iwa')) { - if(typeof Uint8Array == "undefined") throw new Error('NUMBERS file parsing requires Uint8Array support'); - if(typeof NUMBERS != "undefined") { - if(zip.FileIndex) return NUMBERS.parse_numbers(zip); - var _zip = CFB.utils.cfb_new(); - zipentries(zip).forEach(function(e) { zip_add_file(_zip, e, getzipbin(zip, e)); }); - return NUMBERS.parse_numbers(_zip); - } - throw new Error('Unsupported NUMBERS file'); - } - if(!safegetzipfile(zip, '[Content_Types].xml')) { - if(safegetzipfile(zip, 'index.xml.gz')) throw new Error('Unsupported NUMBERS 08 file'); - if(safegetzipfile(zip, 'index.xml')) throw new Error('Unsupported NUMBERS 09 file'); - throw new Error('Unsupported ZIP file'); - } - - var entries = zipentries(zip); - var dir = parse_ct((getzipstr(zip, '[Content_Types].xml')/*:?any*/)); - var xlsb = false; - var sheets, binname; - if(dir.workbooks.length === 0) { - binname = "xl/workbook.xml"; - if(getzipdata(zip,binname, true)) dir.workbooks.push(binname); - } - if(dir.workbooks.length === 0) { - binname = "xl/workbook.bin"; - if(!getzipdata(zip,binname,true)) throw new Error("Could not find workbook"); - dir.workbooks.push(binname); - xlsb = true; - } - if(dir.workbooks[0].slice(-3) == "bin") xlsb = true; - - var themes = ({}/*:any*/); - var styles = ({}/*:any*/); - if(!opts.bookSheets && !opts.bookProps) { - strs = []; - if(dir.sst) try { strs=parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts); } catch(e) { if(opts.WTF) throw e; } - - if(opts.cellStyles && dir.themes.length) themes = parse_theme(getzipstr(zip, dir.themes[0].replace(/^\//,''), true)||"",dir.themes[0], opts); - - if(dir.style) styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes, opts); - } - - /*var externbooks = */dir.links.map(function(link) { - try { - var rels = parse_rels(getzipstr(zip, get_rels_path(strip_front_slash(link))), link); - return parse_xlink(getzipdata(zip, strip_front_slash(link)), rels, link, opts); - } catch(e) {} - }); - - var wb = parse_wb(getzipdata(zip, strip_front_slash(dir.workbooks[0])), dir.workbooks[0], opts); - - var props = {}, propdata = ""; - - if(dir.coreprops.length) { - propdata = getzipdata(zip, strip_front_slash(dir.coreprops[0]), true); - if(propdata) props = parse_core_props(propdata); - if(dir.extprops.length !== 0) { - propdata = getzipdata(zip, strip_front_slash(dir.extprops[0]), true); - if(propdata) parse_ext_props(propdata, props, opts); - } - } - - var custprops = {}; - if(!opts.bookSheets || opts.bookProps) { - if (dir.custprops.length !== 0) { - propdata = getzipstr(zip, strip_front_slash(dir.custprops[0]), true); - if(propdata) custprops = parse_cust_props(propdata, opts); - } - } - - var out = ({}/*:any*/); - if(opts.bookSheets || opts.bookProps) { - if(wb.Sheets) sheets = wb.Sheets.map(function pluck(x){ return x.name; }); - else if(props.Worksheets && props.SheetNames.length > 0) sheets=props.SheetNames; - if(opts.bookProps) { out.Props = props; out.Custprops = custprops; } - if(opts.bookSheets && typeof sheets !== 'undefined') out.SheetNames = sheets; - if(opts.bookSheets ? out.SheetNames : opts.bookProps) return out; - } - sheets = {}; - - var deps = {}; - if(opts.bookDeps && dir.calcchain) deps=parse_cc(getzipdata(zip, strip_front_slash(dir.calcchain)),dir.calcchain,opts); - - var i=0; - var sheetRels = ({}/*:any*/); - var path, relsPath; - - { - var wbsheets = wb.Sheets; - props.Worksheets = wbsheets.length; - props.SheetNames = []; - for(var j = 0; j != wbsheets.length; ++j) { - props.SheetNames[j] = wbsheets[j].name; - } - } - - var wbext = xlsb ? "bin" : "xml"; - var wbrelsi = dir.workbooks[0].lastIndexOf("/"); - var wbrelsfile = (dir.workbooks[0].slice(0, wbrelsi+1) + "_rels/" + dir.workbooks[0].slice(wbrelsi+1) + ".rels").replace(/^\//,""); - if(!safegetzipfile(zip, wbrelsfile)) wbrelsfile = 'xl/_rels/workbook.' + wbext + '.rels'; - var wbrels = parse_rels(getzipstr(zip, wbrelsfile, true), wbrelsfile); - if(wbrels) wbrels = safe_parse_wbrels(wbrels, wb.Sheets); - - /* Numbers iOS hack */ - var nmode = (getzipdata(zip,"xl/worksheets/sheet.xml",true))?1:0; - wsloop: for(i = 0; i != props.Worksheets; ++i) { - var stype = "sheet"; - if(wbrels && wbrels[i]) { - path = 'xl/' + (wbrels[i][1]).replace(/[\/]?xl\//, ""); - if(!safegetzipfile(zip, path)) path = wbrels[i][1]; - if(!safegetzipfile(zip, path)) path = wbrelsfile.replace(/_rels\/.*$/,"") + wbrels[i][1]; - stype = wbrels[i][2]; - } else { - path = 'xl/worksheets/sheet'+(i+1-nmode)+"." + wbext; - path = path.replace(/sheet0\./,"sheet."); - } - relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); - if(opts && opts.sheets != null) switch(typeof opts.sheets) { - case "number": if(i != opts.sheets) continue wsloop; break; - case "string": if(props.SheetNames[i].toLowerCase() != opts.sheets.toLowerCase()) continue wsloop; break; - default: if(Array.isArray && Array.isArray(opts.sheets)) { - var snjseen = false; - for(var snj = 0; snj != opts.sheets.length; ++snj) { - if(typeof opts.sheets[snj] == "number" && opts.sheets[snj] == i) snjseen=1; - if(typeof opts.sheets[snj] == "string" && opts.sheets[snj].toLowerCase() == props.SheetNames[i].toLowerCase()) snjseen = 1; - } - if(!snjseen) continue wsloop; - } - } - safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, themes, styles); - } - - out = ({ - Directory: dir, - Workbook: wb, - Props: props, - Custprops: custprops, - Deps: deps, - Sheets: sheets, - SheetNames: props.SheetNames, - Strings: strs, - Styles: styles, - Themes: themes, - SSF: SSF.get_table() - }/*:any*/); - if(opts && opts.bookFiles) { - if(zip.files) { - out.keys = entries; - out.files = zip.files; - } else { - out.keys = []; - out.files = {}; - zip.FullPaths.forEach(function(p, idx) { - p = p.replace(/^Root Entry[\/]/, ""); - out.keys.push(p); - out.files[p] = zip.FileIndex[idx]; - }); - } - } - if(opts && opts.bookVBA) { - if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true); - else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true); - } - return out; -} - -/* [MS-OFFCRYPTO] 2.1.1 */ -function parse_xlsxcfb(cfb, _opts/*:?ParseOpts*/)/*:Workbook*/ { - var opts = _opts || {}; - var f = 'Workbook', data = CFB.find(cfb, f); - try { - f = '/!DataSpaces/Version'; - data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); - /*var version = */parse_DataSpaceVersionInfo(data.content); - - /* 2.3.4.1 */ - f = '/!DataSpaces/DataSpaceMap'; - data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); - var dsm = parse_DataSpaceMap(data.content); - if(dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage") - throw new Error("ECMA-376 Encrypted file bad " + f); - - /* 2.3.4.2 */ - f = '/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace'; - data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); - var seds = parse_DataSpaceDefinition(data.content); - if(seds.length != 1 || seds[0] != "StrongEncryptionTransform") - throw new Error("ECMA-376 Encrypted file bad " + f); - - /* 2.3.4.3 */ - f = '/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary'; - data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); - /*var hdr = */parse_Primary(data.content); - } catch(e) {} - - f = '/EncryptionInfo'; - data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); - var einfo = parse_EncryptionInfo(data.content); - - /* 2.3.4.4 */ - f = '/EncryptedPackage'; - data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); - -/*global decrypt_agile */ -/*:: declare var decrypt_agile:any; */ - if(einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') return decrypt_agile(einfo[1], data.content, opts.password || "", opts); -/*global decrypt_std76 */ -/*:: declare var decrypt_std76:any; */ - if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std76(einfo[1], data.content, opts.password || "", opts); - throw new Error("File is password-protected"); -} - -function write_zip(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { - _shapeid = 1024; - if(opts.bookType == "ods") return write_ods(wb, opts); - if(wb && !wb.SSF) { - wb.SSF = SSF.get_table(); - } - if(wb && wb.SSF) { - make_ssf(SSF); SSF.load_table(wb.SSF); - // $FlowIgnore - opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; - opts.ssf = wb.SSF; - } - opts.rels = {}; opts.wbrels = {}; - opts.Strings = /*::((*/[]/*:: :any):SST)*/; opts.Strings.Count = 0; opts.Strings.Unique = 0; - if(browser_has_Map) opts.revStrings = new Map(); - else { opts.revStrings = {}; opts.revStrings.foo = []; delete opts.revStrings.foo; } - var wbext = opts.bookType == "xlsb" ? "bin" : "xml"; - var vbafmt = VBAFMTS.indexOf(opts.bookType) > -1; - var ct = new_ct(); - fix_write_opts(opts = opts || {}); - var zip = zip_new(); - var f = "", rId = 0; - - opts.cellXfs = []; - get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); - - if(!wb.Props) wb.Props = {}; - - f = "docProps/core.xml"; - zip_add_file(zip, f, write_core_props(wb.Props, opts)); - ct.coreprops.push(f); - add_rels(opts.rels, 2, f, RELS.CORE_PROPS); - - /*::if(!wb.Props) throw "unreachable"; */ - f = "docProps/app.xml"; - if(wb.Props && wb.Props.SheetNames){/* empty */} - else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames; - else { - var _sn = []; - for(var _i = 0; _i < wb.SheetNames.length; ++_i) - if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]); - wb.Props.SheetNames = _sn; - } - wb.Props.Worksheets = wb.Props.SheetNames.length; - zip_add_file(zip, f, write_ext_props(wb.Props, opts)); - ct.extprops.push(f); - add_rels(opts.rels, 3, f, RELS.EXT_PROPS); - - if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) { - f = "docProps/custom.xml"; - zip_add_file(zip, f, write_cust_props(wb.Custprops, opts)); - ct.custprops.push(f); - add_rels(opts.rels, 4, f, RELS.CUST_PROPS); - } - - for(rId=1;rId <= wb.SheetNames.length; ++rId) { - var wsrels = {'!id':{}}; - var ws = wb.Sheets[wb.SheetNames[rId-1]]; - var _type = (ws || {})["!type"] || "sheet"; - switch(_type) { - case "chart": - /* falls through */ - default: - f = "xl/worksheets/sheet" + rId + "." + wbext; - zip_add_file(zip, f, write_ws(rId-1, f, opts, wb, wsrels)); - ct.sheets.push(f); - add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]); - } - - if(ws) { - var comments = ws['!comments']; - var need_vml = false; - if(comments && comments.length > 0) { - var cf = "xl/comments" + rId + "." + wbext; - zip_add_file(zip, cf, write_cmnt(comments, cf, opts)); - ct.comments.push(cf); - add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT); - need_vml = true; - } - if(ws['!legacy']) { - if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments'])); - } - delete ws['!comments']; - delete ws['!legacy']; - } - - if(wsrels['!id'].rId1) zip_add_file(zip, get_rels_path(f), write_rels(wsrels)); - } - - if(opts.Strings != null && opts.Strings.length > 0) { - f = "xl/sharedStrings." + wbext; - zip_add_file(zip, f, write_sst(opts.Strings, f, opts)); - ct.strs.push(f); - add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST); - } - - f = "xl/workbook." + wbext; - zip_add_file(zip, f, write_wb(wb, f, opts)); - ct.workbooks.push(f); - add_rels(opts.rels, 1, f, RELS.WB); - - /* TODO: something more intelligent with themes */ - - f = "xl/theme/theme1.xml"; - zip_add_file(zip, f, write_theme(wb.Themes, opts)); - ct.themes.push(f); - add_rels(opts.wbrels, -1, "theme/theme1.xml", RELS.THEME); - - /* TODO: something more intelligent with styles */ - - f = "xl/styles." + wbext; - zip_add_file(zip, f, write_sty(wb, f, opts)); - ct.styles.push(f); - add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY); - - if(wb.vbaraw && vbafmt) { - f = "xl/vbaProject.bin"; - zip_add_file(zip, f, wb.vbaraw); - ct.vba.push(f); - add_rels(opts.wbrels, -1, "vbaProject.bin", RELS.VBA); - } - - zip_add_file(zip, "[Content_Types].xml", write_ct(ct, opts)); - zip_add_file(zip, '_rels/.rels', write_rels(opts.rels)); - zip_add_file(zip, 'xl/_rels/workbook.' + wbext + '.rels', write_rels(opts.wbrels)); - - delete opts.revssf; delete opts.ssf; - return zip; -} -function firstbyte(f/*:RawData*/,o/*:?TypeOpts*/)/*:Array*/ { - var x = ""; - switch((o||{}).type || "base64") { - case 'buffer': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; - case 'base64': x = Base64.decode(f.slice(0,12)); break; - case 'binary': x = f; break; - case 'array': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; - default: throw new Error("Unrecognized type " + (o && o.type || "undefined")); - } - return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3), x.charCodeAt(4), x.charCodeAt(5), x.charCodeAt(6), x.charCodeAt(7)]; -} - -function read_cfb(cfb/*:CFBContainer*/, opts/*:?ParseOpts*/)/*:Workbook*/ { - if(CFB.find(cfb, "EncryptedPackage")) return parse_xlsxcfb(cfb, opts); - return parse_xlscfb(cfb, opts); -} - -function read_zip(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ { - var zip, d = data; - var o = opts||{}; - if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; - zip = zip_read(d, o); - return parse_zip(zip, o); -} - -function read_plaintext(data/*:string*/, o/*:ParseOpts*/)/*:Workbook*/ { - var i = 0; - main: while(i < data.length) switch(data.charCodeAt(i)) { - case 0x0A: case 0x0D: case 0x20: ++i; break; - case 0x3C: return parse_xlml(data.slice(i),o); - default: break main; - } - return PRN.to_workbook(data, o); -} - -function read_plaintext_raw(data/*:RawData*/, o/*:ParseOpts*/)/*:Workbook*/ { - var str = "", bytes = firstbyte(data, o); - switch(o.type) { - case 'base64': str = Base64.decode(data); break; - case 'binary': str = data; break; - case 'buffer': str = data.toString('binary'); break; - case 'array': str = cc2str(data); break; - default: throw new Error("Unrecognized type " + o.type); - } - if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str); - return read_plaintext(str, o); -} - -function read_utf16(data/*:RawData*/, o/*:ParseOpts*/)/*:Workbook*/ { - var d = data; - if(o.type == 'base64') d = Base64.decode(d); - d = cptable.utils.decode(1200, d.slice(2), 'str'); - o.type = "binary"; - return read_plaintext(d, o); -} - -function bstrify(data/*:string*/)/*:string*/ { - return !data.match(/[^\x00-\x7F]/) ? data : utf8write(data); -} - -function read_prn(data, d, o, str) { - if(str) { o.type = "string"; return PRN.to_workbook(data, o); } - return PRN.to_workbook(d, o); -} - -function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ { - reset_cp(); - var o = opts||{}; - if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), (o = dup(o), o.type = "array", o)); - var d = data, n = [0,0,0,0], str = false; - if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; } - _ssfopts = {}; - if(o.dateNF) _ssfopts.dateNF = o.dateNF; - if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; - if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); } - if(o.type == "string") { str = true; o.type = "binary"; o.codepage = 65001; d = bstrify(data); } - if(o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof ArrayBuffer !== 'undefined') { - // $FlowIgnore - var ab=new ArrayBuffer(3), vu=new Uint8Array(ab); vu.foo="bar"; - // $FlowIgnore - if(!vu.foo) {o=dup(o); o.type='array'; return readSync(ab2a(d), o);} - } - switch((n = firstbyte(d, o))[0]) { - case 0xD0: if(n[1] === 0xCF && n[2] === 0x11 && n[3] === 0xE0 && n[4] === 0xA1 && n[5] === 0xB1 && n[6] === 0x1A && n[7] === 0xE1) return read_cfb(CFB.read(d, o), o); break; - case 0x09: if(n[1] <= 0x08) return parse_xlscfb(d, o); break; - case 0x3C: return parse_xlml(d, o); - case 0x49: - if(n[1] === 0x49 && n[2] === 0x2a && n[3] === 0x00) throw new Error("TIFF Image File is not a spreadsheet"); - if(n[1] === 0x44) return read_wb_ID(d, o); - break; - case 0x54: if(n[1] === 0x41 && n[2] === 0x42 && n[3] === 0x4C) return DIF.to_workbook(d, o); break; - case 0x50: return (n[1] === 0x4B && n[2] < 0x09 && n[3] < 0x09) ? read_zip(d, o) : read_prn(data, d, o, str); - case 0xEF: return n[3] === 0x3C ? parse_xlml(d, o) : read_prn(data, d, o, str); - case 0xFF: - if(n[1] === 0xFE) { return read_utf16(d, o); } - else if(n[1] === 0x00 && n[2] === 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o); - break; - case 0x00: - if(n[1] === 0x00) { - if(n[2] >= 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o); - if(n[2] === 0x00 && (n[3] === 0x08 || n[3] === 0x09)) return WK_.to_workbook(d, o); - } - break; - case 0x03: case 0x83: case 0x8B: case 0x8C: return DBF.to_workbook(d, o); - case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break; - case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o); - case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break; - } - if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o); - return read_prn(data, d, o, str); -} - -function readFileSync(filename/*:string*/, opts/*:?ParseOpts*/)/*:Workbook*/ { - var o = opts||{}; o.type = 'file'; - return readSync(filename, o); -} -function write_obj_str(factory/*:WriteObjStrFactory*/) { - return function write_str(wb/*:Workbook*/, o/*:WriteOpts*/)/*:string*/ { - var idx = 0; - if(o.sheet) { - if(typeof o.sheet == "number") idx = o.sheet; - else idx = wb.SheetNames.indexOf(o.sheet); - if(!wb.SheetNames[idx]) throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet)); - } - return factory.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb); - }; -} - -var write_htm_str = write_obj_str(HTML_); -var write_csv_str = write_obj_str({from_sheet:sheet_to_csv}); -var write_slk_str = write_obj_str(typeof SYLK !== "undefined" ? SYLK : {}); -var write_dif_str = write_obj_str(typeof DIF !== "undefined" ? DIF : {}); -var write_prn_str = write_obj_str(typeof PRN !== "undefined" ? PRN : {}); -var write_rtf_str = write_obj_str(typeof RTF !== "undefined" ? RTF : {}); -var write_txt_str = write_obj_str({from_sheet:sheet_to_txt}); -var write_dbf_buf = write_obj_str(typeof DBF !== "undefined" ? DBF : {}); -var write_eth_str = write_obj_str(typeof ETH !== "undefined" ? ETH : {}); -var write_wk1_buf = write_obj_str(typeof WK_ !== "undefined" ? {from_sheet:WK_.sheet_to_wk1} : {}); - -function write_cfb_ctr(cfb/*:CFBContainer*/, o/*:WriteOpts*/)/*:any*/ { - switch(o.type) { - case "base64": case "binary": break; - case "buffer": case "array": o.type = ""; break; - case "file": return write_dl(o.file, CFB.write(cfb, {type:has_buf ? 'buffer' : ""})); - case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); - default: throw new Error("Unrecognized type " + o.type); - } - return CFB.write(cfb, o); -} - -/*:: declare var encrypt_agile:any; */ -function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { - var o = dup(opts||{}); - var z = write_zip(wb, o); - var oopts = {}; - if(o.compression) oopts.compression = 'DEFLATE'; - if(o.password) oopts.type = has_buf ? "nodebuffer" : "string"; - else switch(o.type) { - case "base64": oopts.type = "base64"; break; - case "binary": oopts.type = "string"; break; - case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); - case "buffer": - case "file": oopts.type = has_buf ? "nodebuffer" : "string"; break; - default: throw new Error("Unrecognized type " + o.type); - } - var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts); -/*jshint -W083 */ - if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef -/*jshint +W083 */ - if(o.type === "file") return write_dl(o.file, out); - return o.type == "string" ? utf8read(/*::(*/out/*:: :any)*/) : out; -} - -function write_cfb_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { - var o = opts||{}; - var cfb/*:CFBContainer*/ = write_xlscfb(wb, o); - return write_cfb_ctr(cfb, o); -} - -function write_string_type(out/*:string*/, opts/*:WriteOpts*/, bom/*:?string*/)/*:any*/ { - if(!bom) bom = ""; - var o = bom + out; - switch(opts.type) { - case "base64": return Base64.encode(utf8write(o)); - case "binary": return utf8write(o); - case "string": return out; - case "file": return write_dl(opts.file, o, 'utf8'); - case "buffer": { - if(has_buf) return Buffer_from(o, 'utf8'); - else return write_string_type(o, {type:'binary'}).split("").map(function(c) { return c.charCodeAt(0); }); - } - } - throw new Error("Unrecognized type " + opts.type); -} - -function write_stxt_type(out/*:string*/, opts/*:WriteOpts*/)/*:any*/ { - switch(opts.type) { - case "base64": return Base64.encode(out); - case "binary": return out; - case "string": return out; /* override in sheet_to_txt */ - case "file": return write_dl(opts.file, out, 'binary'); - case "buffer": { - if(has_buf) return Buffer_from(out, 'binary'); - else return out.split("").map(function(c) { return c.charCodeAt(0); }); - } - } - throw new Error("Unrecognized type " + opts.type); -} - -/* TODO: test consistency */ -function write_binary_type(out, opts/*:WriteOpts*/)/*:any*/ { - switch(opts.type) { - case "string": - case "base64": - case "binary": - var bstr = ""; - // $FlowIgnore - for(var i = 0; i < out.length; ++i) bstr += String.fromCharCode(out[i]); - return opts.type == 'base64' ? Base64.encode(bstr) : opts.type == 'string' ? utf8read(bstr) : bstr; - case "file": return write_dl(opts.file, out); - case "buffer": return out; - default: throw new Error("Unrecognized type " + opts.type); - } -} - -function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) { - reset_cp(); - check_wb(wb); - var o = dup(opts||{}); - if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; } - if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); } - switch(o.bookType || 'xlsb') { - case 'xml': - case 'xlml': return write_string_type(write_xlml(wb, o), o); - case 'slk': - case 'sylk': return write_string_type(write_slk_str(wb, o), o); - case 'htm': - case 'html': return write_string_type(write_htm_str(wb, o), o); - case 'txt': return write_stxt_type(write_txt_str(wb, o), o); - case 'csv': return write_string_type(write_csv_str(wb, o), o, "\ufeff"); - case 'dif': return write_string_type(write_dif_str(wb, o), o); - case 'dbf': return write_binary_type(write_dbf_buf(wb, o), o); - case 'prn': return write_string_type(write_prn_str(wb, o), o); - case 'rtf': return write_string_type(write_rtf_str(wb, o), o); - case 'eth': return write_string_type(write_eth_str(wb, o), o); - case 'fods': return write_string_type(write_ods(wb, o), o); - case 'wk1': return write_binary_type(write_wk1_buf(wb, o), o); - case 'wk3': return write_binary_type(WK_.book_to_wk3(wb, o), o); - case 'biff2': if(!o.biff) o.biff = 2; /* falls through */ - case 'biff3': if(!o.biff) o.biff = 3; /* falls through */ - case 'biff4': if(!o.biff) o.biff = 4; return write_binary_type(write_biff_buf(wb, o), o); - case 'biff5': if(!o.biff) o.biff = 5; /* falls through */ - case 'biff8': - case 'xla': - case 'xls': if(!o.biff) o.biff = 8; return write_cfb_type(wb, o); - case 'xlsx': - case 'xlsm': - case 'xlam': - case 'xlsb': - case 'ods': return write_zip_type(wb, o); - default: throw new Error ("Unrecognized bookType |" + o.bookType + "|"); - } -} - -function resolve_book_type(o/*:WriteFileOpts*/) { - if(o.bookType) return; - var _BT = { - "xls": "biff8", - "htm": "html", - "slk": "sylk", - "socialcalc": "eth", - "Sh33tJS": "WTF" - }; - var ext = o.file.slice(o.file.lastIndexOf(".")).toLowerCase(); - if(ext.match(/^\.[a-z]+$/)) o.bookType = ext.slice(1); - o.bookType = _BT[o.bookType] || o.bookType; -} - -function writeFileSync(wb/*:Workbook*/, filename/*:string*/, opts/*:?WriteFileOpts*/) { - var o = opts||{}; o.type = 'file'; - o.file = filename; - resolve_book_type(o); - return writeSync(wb, o); -} - -function writeFileAsync(filename/*:string*/, wb/*:Workbook*/, opts/*:?WriteFileOpts*/, cb/*:?(e?:ErrnoError)=>void*/) { - var o = opts||{}; o.type = 'file'; - o.file = filename; - resolve_book_type(o); - o.type = 'buffer'; - var _cb = cb; if(!(_cb instanceof Function)) _cb = (opts/*:any*/); - return _fs.writeFile(filename, writeSync(wb, o), _cb); -} -/*:: -type MJRObject = { - row: any; - isempty: boolean; -}; -*/ -function make_json_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array*/, header/*:number*/, hdr/*:Array*/, dense/*:boolean*/, o/*:Sheet2JSONOpts*/)/*:MJRObject*/ { - var rr = encode_row(R); - var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw"); - var isempty = true; - var row/*:any*/ = (header === 1) ? [] : {}; - if(header !== 1) { - if(Object.defineProperty) try { Object.defineProperty(row, '__rowNum__', {value:R, enumerable:false}); } catch(e) { row.__rowNum__ = R; } - else row.__rowNum__ = R; - } - if(!dense || sheet[R]) for (var C = r.s.c; C <= r.e.c; ++C) { - var val = dense ? sheet[R][C] : sheet[cols[C] + rr]; - if(val === undefined || val.t === undefined) { - if(defval === undefined) continue; - if(hdr[C] != null) { row[hdr[C]] = defval; } - continue; - } - var v = val.v; - switch(val.t){ - case 'z': if(v == null) break; continue; - case 'e': v = (v == 0 ? null : void 0); break; - case 's': case 'd': case 'b': case 'n': break; - default: throw new Error('unrecognized type ' + val.t); - } - if(hdr[C] != null) { - if(v == null) { - if(val.t == "e" && v === null) row[hdr[C]] = null; - else if(defval !== undefined) row[hdr[C]] = defval; - else if(raw && v === null) row[hdr[C]] = null; - else continue; - } else { - row[hdr[C]] = raw || (o.rawNumbers && val.t == "n") ? v : format_cell(val,v,o); - } - if(v != null) isempty = false; - } - } - return { row: row, isempty: isempty }; -} - - -function sheet_to_json(sheet/*:Worksheet*/, opts/*:?Sheet2JSONOpts*/) { - if(sheet == null || sheet["!ref"] == null) return []; - var val = {t:'n',v:0}, header = 0, offset = 1, hdr/*:Array*/ = [], v=0, vv=""; - var r = {s:{r:0,c:0},e:{r:0,c:0}}; - var o = opts || {}; - var range = o.range != null ? o.range : sheet["!ref"]; - if(o.header === 1) header = 1; - else if(o.header === "A") header = 2; - else if(Array.isArray(o.header)) header = 3; - else if(o.header == null) header = 0; - switch(typeof range) { - case 'string': r = safe_decode_range(range); break; - case 'number': r = safe_decode_range(sheet["!ref"]); r.s.r = range; break; - default: r = range; - } - if(header > 0) offset = 0; - var rr = encode_row(r.s.r); - var cols/*:Array*/ = []; - var out/*:Array*/ = []; - var outi = 0, counter = 0; - var dense = Array.isArray(sheet); - var R = r.s.r, C = 0, CC = 0; - if(dense && !sheet[R]) sheet[R] = []; - for(C = r.s.c; C <= r.e.c; ++C) { - cols[C] = encode_col(C); - val = dense ? sheet[R][C] : sheet[cols[C] + rr]; - switch(header) { - case 1: hdr[C] = C - r.s.c; break; - case 2: hdr[C] = cols[C]; break; - case 3: hdr[C] = o.header[C - r.s.c]; break; - default: - if(val == null) val = {w: "__EMPTY", t: "s"}; - vv = v = format_cell(val, null, o); - counter = 0; - for(CC = 0; CC < hdr.length; ++CC) if(hdr[CC] == vv) vv = v + "_" + (++counter); - hdr[C] = vv; - } - } - for (R = r.s.r + offset; R <= r.e.r; ++R) { - var row = make_json_row(sheet, r, R, cols, header, hdr, dense, o); - if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) out[outi++] = row.row; - } - out.length = outi; - return out; -} - -var qreg = /"/g; -function make_csv_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array*/, fs/*:number*/, rs/*:number*/, FS/*:string*/, o/*:Sheet2CSVOpts*/)/*:?string*/ { - var isempty = true; - var row/*:Array*/ = [], txt = "", rr = encode_row(R); - for(var C = r.s.c; C <= r.e.c; ++C) { - if (!cols[C]) continue; - var val = o.dense ? (sheet[R]||[])[C]: sheet[cols[C] + rr]; - if(val == null) txt = ""; - else if(val.v != null) { - isempty = false; - txt = ''+(o.rawNumbers && val.t == "n" ? val.v : format_cell(val, null, o)); - for(var i = 0, cc = 0; i !== txt.length; ++i) if((cc = txt.charCodeAt(i)) === fs || cc === rs || cc === 34 || o.forceQuotes) {txt = "\"" + txt.replace(qreg, '""') + "\""; break; } - if(txt == "ID") txt = '"ID"'; - } else if(val.f != null && !val.F) { - isempty = false; - txt = '=' + val.f; if(txt.indexOf(",") >= 0) txt = '"' + txt.replace(qreg, '""') + '"'; - } else txt = ""; - /* NOTE: Excel CSV does not support array formulae */ - row.push(txt); - } - if(o.blankrows === false && isempty) return null; - return row.join(FS); -} - -function sheet_to_csv(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/)/*:string*/ { - var out/*:Array*/ = []; - var o = opts == null ? {} : opts; - if(sheet == null || sheet["!ref"] == null) return ""; - var r = safe_decode_range(sheet["!ref"]); - var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); - var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); - var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$"); - var row = "", cols/*:Array*/ = []; - o.dense = Array.isArray(sheet); - var colinfo/*:Array*/ = o.skipHidden && sheet["!cols"] || []; - var rowinfo/*:Array*/ = o.skipHidden && sheet["!rows"] || []; - for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C); - for(var R = r.s.r; R <= r.e.r; ++R) { - if ((rowinfo[R]||{}).hidden) continue; - row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o); - if(row == null) { continue; } - if(o.strip) row = row.replace(endregex,""); - out.push(row + RS); - } - delete o.dense; - return out.join(""); -} - -function sheet_to_txt(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/) { - if(!opts) opts = {}; opts.FS = "\t"; opts.RS = "\n"; - var s = sheet_to_csv(sheet, opts); - if(typeof cptable == 'undefined' || opts.type == 'string') return s; - var o = cptable.utils.encode(1200, s, 'str'); - return String.fromCharCode(255) + String.fromCharCode(254) + o; -} - -function sheet_to_formulae(sheet/*:Worksheet*/)/*:Array*/ { - var y = "", x, val=""; - if(sheet == null || sheet["!ref"] == null) return []; - var r = safe_decode_range(sheet['!ref']), rr = "", cols/*:Array*/ = [], C; - var cmds/*:Array*/ = []; - var dense = Array.isArray(sheet); - for(C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C); - for(var R = r.s.r; R <= r.e.r; ++R) { - rr = encode_row(R); - for(C = r.s.c; C <= r.e.c; ++C) { - y = cols[C] + rr; - x = dense ? (sheet[R]||[])[C] : sheet[y]; - val = ""; - if(x === undefined) continue; - else if(x.F != null) { - y = x.F; - if(!x.f) continue; - val = x.f; - if(y.indexOf(":") == -1) y = y + ":" + y; - } - if(x.f != null) val = x.f; - else if(x.t == 'z') continue; - else if(x.t == 'n' && x.v != null) val = "" + x.v; - else if(x.t == 'b') val = x.v ? "TRUE" : "FALSE"; - else if(x.w !== undefined) val = "'" + x.w; - else if(x.v === undefined) continue; - else if(x.t == 's') val = "'" + x.v; - else val = ""+x.v; - cmds[cmds.length] = y + "=" + val; - } - } - return cmds; -} - -function sheet_add_json(_ws/*:?Worksheet*/, js/*:Array*/, opts)/*:Worksheet*/ { - var o = opts || {}; - var offset = +!o.skipHeader; - var ws/*:Worksheet*/ = _ws || ({}/*:any*/); - var _R = 0, _C = 0; - if(ws && o.origin != null) { - if(typeof o.origin == 'number') _R = o.origin; - else { - var _origin/*:CellAddress*/ = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; - _R = _origin.r; _C = _origin.c; - } - } - var cell/*:Cell*/; - var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:_C, r:_R + js.length - 1 + offset}}/*:any*/); - if(ws['!ref']) { - var _range = safe_decode_range(ws['!ref']); - range.e.c = Math.max(range.e.c, _range.e.c); - range.e.r = Math.max(range.e.r, _range.e.r); - if(_R == -1) { _R = _range.e.r + 1; range.e.r = _R + js.length - 1 + offset; } - } else { - if(_R == -1) { _R = 0; range.e.r = js.length - 1 + offset; } - } - var hdr/*:Array*/ = o.header || [], C = 0; - - js.forEach(function (JS, R/*:number*/) { - keys(JS).forEach(function(k) { - if((C=hdr.indexOf(k)) == -1) hdr[C=hdr.length] = k; - var v = JS[k]; - var t = 'z'; - var z = ""; - var ref = encode_cell({c:_C + C,r:_R + R + offset}); - cell = utils.sheet_get_cell(ws, ref); - if(v && typeof v === 'object' && !(v instanceof Date)){ - ws[ref] = v; - } else { - if(typeof v == 'number') t = 'n'; - else if(typeof v == 'boolean') t = 'b'; - else if(typeof v == 'string') t = 's'; - else if(v instanceof Date) { - t = 'd'; - if(!o.cellDates) { t = 'n'; v = datenum(v); } - z = (o.dateNF || SSF._table[14]); - } - else if(v === null && o.nullError) { t = 'e'; v = 0; } - if(!cell) ws[ref] = cell = ({t:t, v:v}/*:any*/); - else { - cell.t = t; cell.v = v; - delete cell.w; delete cell.R; - if(z) cell.z = z; - } - if(z) cell.z = z; - } - }); - }); - range.e.c = Math.max(range.e.c, _C + hdr.length - 1); - var __R = encode_row(_R); - if(offset) for(C = 0; C < hdr.length; ++C) ws[encode_col(C + _C) + __R] = {t:'s', v:hdr[C]}; - ws['!ref'] = encode_range(range); - return ws; -} -function json_to_sheet(js/*:Array*/, opts)/*:Worksheet*/ { return sheet_add_json(null, js, opts); } - -var utils/*:any*/ = { - encode_col: encode_col, - encode_row: encode_row, - encode_cell: encode_cell, - encode_range: encode_range, - decode_col: decode_col, - decode_row: decode_row, - split_cell: split_cell, - decode_cell: decode_cell, - decode_range: decode_range, - format_cell: format_cell, - get_formulae: sheet_to_formulae, - make_csv: sheet_to_csv, - make_json: sheet_to_json, - make_formulae: sheet_to_formulae, - sheet_add_aoa: sheet_add_aoa, - sheet_add_json: sheet_add_json, - sheet_add_dom: sheet_add_dom, - aoa_to_sheet: aoa_to_sheet, - json_to_sheet: json_to_sheet, - table_to_sheet: parse_dom_table, - table_to_book: table_to_book, - sheet_to_csv: sheet_to_csv, - sheet_to_txt: sheet_to_txt, - sheet_to_json: sheet_to_json, - sheet_to_html: HTML_.from_sheet, - sheet_to_formulae: sheet_to_formulae, - sheet_to_row_object_array: sheet_to_json -}; - -(function(utils) { -utils.consts = utils.consts || {}; -function add_consts(R/*Array*/) { R.forEach(function(a){ utils.consts[a[0]] = a[1]; }); } - -function get_default(x/*:any*/, y/*:any*/, z/*:any*/)/*:any*/ { return x[y] != null ? x[y] : (x[y] = z); } - -/* get cell, creating a stub if necessary */ -function ws_get_cell_stub(ws/*:Worksheet*/, R, C/*:?number*/)/*:Cell*/ { - /* A1 cell address */ - if(typeof R == "string") { - /* dense */ - if(Array.isArray(ws)) { - var RC = decode_cell(R); - if(!ws[RC.r]) ws[RC.r] = []; - return ws[RC.r][RC.c] || (ws[RC.r][RC.c] = {t:'z'}); - } - return ws[R] || (ws[R] = {t:'z'}); - } - /* cell address object */ - if(typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R)); - /* R and C are 0-based indices */ - return ws_get_cell_stub(ws, encode_cell({r:R,c:C||0})); -} -utils.sheet_get_cell = ws_get_cell_stub; - -/* find sheet index for given name / validate index */ -function wb_sheet_idx(wb/*:Workbook*/, sh/*:number|string*/) { - if(typeof sh == "number") { - if(sh >= 0 && wb.SheetNames.length > sh) return sh; - throw new Error("Cannot find sheet # " + sh); - } else if(typeof sh == "string") { - var idx = wb.SheetNames.indexOf(sh); - if(idx > -1) return idx; - throw new Error("Cannot find sheet name |" + sh + "|"); - } else throw new Error("Cannot find sheet |" + sh + "|"); -} - -/* simple blank workbook object */ -utils.book_new = function()/*:Workbook*/ { - return { SheetNames: [], Sheets: {} }; -}; - -/* add a worksheet to the end of a given workbook */ -utils.book_append_sheet = function(wb/*:Workbook*/, ws/*:Worksheet*/, name/*:?string*/) { - if(!name) for(var i = 1; i <= 0xFFFF; ++i, name = undefined) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break; - if(!name || wb.SheetNames.length >= 0xFFFF) throw new Error("Too many worksheets"); - check_ws_name(name); - if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already exists!"); - - wb.SheetNames.push(name); - wb.Sheets[name] = ws; -}; - -/* set sheet visibility (visible/hidden/very hidden) */ -utils.book_set_sheet_visibility = function(wb/*:Workbook*/, sh/*:number|string*/, vis/*:number*/) { - get_default(wb,"Workbook",{}); - get_default(wb.Workbook,"Sheets",[]); - - var idx = wb_sheet_idx(wb, sh); - // $FlowIgnore - get_default(wb.Workbook.Sheets,idx, {}); - - switch(vis) { - case 0: case 1: case 2: break; - default: throw new Error("Bad sheet visibility setting " + vis); - } - // $FlowIgnore - wb.Workbook.Sheets[idx].Hidden = vis; -}; -add_consts([ - ["SHEET_VISIBLE", 0], - ["SHEET_HIDDEN", 1], - ["SHEET_VERY_HIDDEN", 2] -]); - -/* set number format */ -utils.cell_set_number_format = function(cell/*:Cell*/, fmt/*:string|number*/) { - cell.z = fmt; - return cell; -}; - -/* set cell hyperlink */ -utils.cell_set_hyperlink = function(cell/*:Cell*/, target/*:string*/, tooltip/*:?string*/) { - if(!target) { - delete cell.l; - } else { - cell.l = ({ Target: target }/*:Hyperlink*/); - if(tooltip) cell.l.Tooltip = tooltip; - } - return cell; -}; -utils.cell_set_internal_link = function(cell/*:Cell*/, range/*:string*/, tooltip/*:?string*/) { return utils.cell_set_hyperlink(cell, "#" + range, tooltip); }; - -/* add to cell comments */ -utils.cell_add_comment = function(cell/*:Cell*/, text/*:string*/, author/*:?string*/) { - if(!cell.c) cell.c = []; - cell.c.push({t:text, a:author||"SheetJS"}); -}; - -/* set array formula and flush related cells */ -utils.sheet_set_array_formula = function(ws/*:Worksheet*/, range, formula/*:string*/) { - var rng = typeof range != "string" ? range : safe_decode_range(range); - var rngstr = typeof range == "string" ? range : encode_range(range); - for(var R = rng.s.r; R <= rng.e.r; ++R) for(var C = rng.s.c; C <= rng.e.c; ++C) { - var cell = ws_get_cell_stub(ws, R, C); - cell.t = 'n'; - cell.F = rngstr; - delete cell.v; - if(R == rng.s.r && C == rng.s.c) cell.f = formula; - } - return ws; -}; - -return utils; -})(utils); - -export const version = XLSX.version; -export { - parse_xlscfb, - parse_zip, - readSync as read, - readFileSync as readFile, - readFileSync, - writeSync as write, - writeFileSync as writeFile, - writeFileSync, - writeFileAsync, - utils, - SSF, - CFB -}; diff --git a/xlsx.mjs b/xlsx.mjs index 276319b..5c028a4 100644 --- a/xlsx.mjs +++ b/xlsx.mjs @@ -6,7 +6,7 @@ var XLSX = {}; XLSX.version = '0.18.0'; var current_codepage = 1200, current_ansi = 1252; -var VALID_ANSI = [ 874, 932, 936, 949, 950 ]; +var VALID_ANSI = [ 874, 932, 936, 949, 950, 10000 ]; for(var i = 0; i <= 8; ++i) VALID_ANSI.push(1250 + i); /* ECMA-376 Part I 18.4.1 charset to codepage mapping */ var CS2CP = ({ @@ -61,6 +61,24 @@ var debom = function(data/*:string*/)/*:string*/ { var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; + +var cptable; +function set_cptable(_cptable) { + cptable = _cptable; + set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); }; + debom = function(data/*:string*/) { + if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return cptable.utils.decode(1200, char_codes(data.slice(2))); } + return data; + }; + _getchar = function _gc2(x/*:number*/)/*:string*/ { + if(current_codepage === 1200) return String.fromCharCode(x); + return cptable.utils.decode(current_codepage, [x&255,x>>8])[0]; + }; + _getansi = function _ga2(x/*:number*/)/*:string*/ { + return cptable.utils.decode(current_ansi, [x])[0]; + }; +} +export { set_cptable }; var DENSE = null; var DIF_XL = true; var Base64 = function() { @@ -2793,6 +2811,16 @@ function blobify(data) { function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); + if(typeof Deno !== 'undefined') { + /* in this spot, it's safe to assume typed arrays and TextEncoder/TextDecoder exist */ + if(enc) switch(enc) { + case "utf8": payload = new TextEncoder(enc).encode(payload); break; + case "binary": payload = s2ab(payload); break; + /* TODO: binary equivalent */ + default: throw new Error("Unsupported encoding " + enc); + } + return Deno.writeFileSync(fname, payload); + } var data = (enc == "utf8") ? utf8write(payload) : payload; /*:: declare var IE_SaveFile: any; */ if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); @@ -2832,6 +2860,7 @@ function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { /* read binary data from file */ function read_binary(path/*:string*/) { if(typeof _fs !== 'undefined') return _fs.readFileSync(path); + if(typeof Deno !== 'undefined') return Deno.readFileSync(path); // $FlowIgnore if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript // $FlowIgnore @@ -2982,13 +3011,18 @@ function fuzzynum(s/*:string*/)/*:number*/ { if(!isNaN(v = Number(ss))) return v / wt; return v; } +var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; function fuzzydate(s/*:string*/)/*:Date*/ { var o = new Date(s), n = new Date(NaN); var y = o.getYear(), m = o.getMonth(), d = o.getDate(); if(isNaN(d)) return n; + var lower = s.toLowerCase(); + if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) { + lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""); + if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n; + } else if(lower.match(/[a-z]/)) return n; if(y < 0 || y > 8099) return n; if((m > 0 || d > 1) && y != 101) return o; - if(s.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) return o; if(s.match(/[^-0-9:,\/\\]/)) return n; return o; } @@ -7540,7 +7574,7 @@ var SYLK = (function() { case 'b': o += cell.v ? "TRUE" : "FALSE"; break; case 'e': o += cell.w || cell.v; break; case 'd': o += '"' + (cell.w || cell.v) + '"'; break; - case 's': o += '"' + cell.v.replace(/"/g,"") + '"'; break; + case 's': o += '"' + cell.v.replace(/"/g,"").replace(/;/g, ";;") + '"'; break; } return o; } @@ -22590,7 +22624,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ { _ssfopts = {}; if(o.dateNF) _ssfopts.dateNF = o.dateNF; if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; - if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); } + if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); if(typeof Uint8Array !== 'undefined' && !has_buf) o.type = "array"; } if(o.type == "string") { str = true; o.type = "binary"; o.codepage = 65001; d = bstrify(data); } if(o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof ArrayBuffer !== 'undefined') { // $FlowIgnore @@ -22682,6 +22716,7 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { default: throw new Error("Unrecognized type " + o.type); } var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts); + if(typeof Deno !== "undefined" && typeof out == "string") out = new Uint8Array(s2ab(out)); /*jshint -W083 */ if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef /*jshint +W083 */