diff --git a/CHANGELOG.md b/CHANGELOG.md index 13cb1ca2f4..bdf59d25f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog * Check https://trello.com/b/qxz65pVi/alasql-roadmap for roadmap + +### 0.2.4 "Exogi" (xx.xx.2016) +* ... -### 0.2.3-pre "Spetses" (xx.xx.2016) +### 0.2.3 "Spetses" (02.01.2016) * Changed: New fast way to calculate aggregators (some parameters changed) * Added: User defined aggregators * Fixed: Remove empty Last line in TXT and XLSX diff --git a/README.md b/README.md index b1283f1d44..9776f6feda 100644 --- a/README.md +++ b/README.md @@ -466,25 +466,25 @@ You can use JSON objects in your databases (do not forget use == and !== operato ```sql -alasql> SELECT VALUE {a:'1',b:'2'} +alasql> SELECT VALUE @{a:'1',b:'2'} {a:1,b:2} -alasql> SELECT VALUE {a:'1',b:'2'} == {a:'1',b:'2'} +alasql> SELECT VALUE @{a:'1',b:'2'} == @{a:'1',b:'2'} true -alasql> SELECT VALUE {a:'1',b:'2'}->b +alasql> SELECT VALUE @{a:'1',b:'2'}->b 2 -alasql> SELECT VALUE {a:'1',b:(2*2)}->b +alasql> SELECT VALUE @{a:'1',b:(2*2)}->b 4 ``` -Try AlaSQL JSON objects in Console [sample](http://alasql.org/console?drop table if exists one;create table one;insert into one values {a:@[1,2,3],c:{e:23}}, {a:@[{b:@[1,2,3]}]};select * from one) +Try AlaSQL JSON objects in Console [sample](http://alasql.org/console?drop table if exists one;create table one;insert into one values @{a:@[1,2,3],c:{e:23}}, @{a:@[{b:@[1,2,3]}]};select * from one) @@ -535,7 +535,7 @@ Please be aware that AlaSQL ~~may~~ have [bugs](https://github.com/agershun/alas 0. Limited functionality for transactions (supports only for localStorage) - Sorry, transactions are limited, because AlaSQL started to use more complex approach for PRIMARY KEYS / FOREIGN KEYS. Transactions will be fully turned on again in future version. -0. A `(FULL) OUTER JOIN` and `RIGHT JOIM` on more than 2 tables will not give the expected results. `INNER JOIN` and `LEFT JOIN` are ok. +0. A `(FULL) OUTER JOIN` on more than 2 tables will not give the expected results Probably, there are many of others. Please, help us to fix them by [submitting it as an issue](https://github.com/agershun/alasql/issues). Thank you! @@ -609,4 +609,4 @@ and other people for useful tools, which make our work much easier. ---- -© 2014-2015, Andrey Gershun (agershun@gmail.com) & M. Rangel Wulff (m@rawu.dk) +© 2014-2015, Andrey Gershun (agershun@gmail.com) & M. Rangel Wulff (m@rawu.dk) \ No newline at end of file diff --git a/bower.json b/bower.json index a9eb7fb94d..6ffa88517e 100644 --- a/bower.json +++ b/bower.json @@ -58,5 +58,5 @@ "bin", "lib" ], - "version": "0.2.2" + "version": "0.2.3" } diff --git a/dist/alasql-worker.js b/dist/alasql-worker.js old mode 100644 new mode 100755 index 0979561c6b..05846e1b6b --- a/dist/alasql-worker.js +++ b/dist/alasql-worker.js @@ -1,7 +1,7 @@ -/*! AlaSQL v0.2.2-develop-1153 © 2014-2015 Andrey Gershun & M. Rangel Wulff | alasql.org/license */ +/*! AlaSQL v0.2.3-develop-1164 © 2014-2015 Andrey Gershun & M. Rangel Wulff | alasql.org/license */ /* @module alasql -@version 0.2.2-develop-1153 +@version 0.2.3-develop-1164 AlaSQL - JavaScript SQL database © 2014-2015 Andrey Gershun & M. Rangel Wulff diff --git a/dist/alasql-worker.min.js b/dist/alasql-worker.min.js old mode 100644 new mode 100755 diff --git a/dist/alasql.js b/dist/alasql.js old mode 100755 new mode 100644 index 8b18fee578..3588d1d9da --- a/dist/alasql.js +++ b/dist/alasql.js @@ -1,185 +1,185 @@ -/*! AlaSQL v0.2.2-fix-delete-where-1156 © 2014-2015 Andrey Gershun & M. Rangel Wulff | alasql.org/license */ -/* -@module alasql -@version 0.2.2-fix-delete-where-1156 - -AlaSQL - JavaScript SQL database -© 2014-2015 Andrey Gershun & M. Rangel Wulff - -@license -The MIT License (MIT) - -Copyright © 2014-2015 Andrey Gershun (agershun@gmail.com) & M. Rangel Wulff (m@rawu.dk) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -/** - @fileoverview AlaSQL JavaScript SQL library - @see http://github.com/agershun/alasql -*/ - -/** - Callback from statement - @callback statement-callback - @param {object} data Result data -*/ - -/** - UMD envelope for AlaSQL -*/ - -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - define([], factory); - } else if (typeof exports === 'object') { - /** alasql main function */ - module.exports = factory(); - } else { - root.alasql = factory(); - } -}(this, function () { - -/** - AlaSQL - Main Alasql class - @function - @param {string|function|object} sql - SQL-statement or data object for fuent interface - @param {object} params - SQL parameters - @param {function} cb - callback function - @param {object} scope - Scope for nested queries - @return {any} - Result data object - - @example - Standard sync call: - alasql('CREATE TABLE one'); - Query: - var res = alasql('SELECT * FROM one'); - Call with parameters: - var res = alasql('SELECT * FROM ?',[data]); - Standard async call with callback function: - alasql('SELECT * FROM ?',[data],function(res){ - console.log(data); - }); - Call with scope for subquery (to pass common values): - var scope = {one:{a:2,b;20}} - alasql('SELECT * FROM ? two WHERE two.a = one.a',[data],null,scope); - Call for fluent interface with data object: - alasql(data).Where(function(x){return x.a == 10}).exec(); - Call for fluent interface without data object: - alasql().From(data).Where(function(x){return x.a == 10}).exec(); - */ - -var alasql = function alasql(sql, params, cb, scope) { - if(typeof importScripts !== 'function' && alasql.webworker) { - var id = alasql.lastid++; - alasql.buffer[id] = cb; - alasql.webworker.postMessage({id:id,sql:sql,params:params}); - } else { - if(arguments.length === 0) { - // Without arguments - Fluent interface - return new yy.Select({ - columns:[new yy.Column({columnid:'*'})], - from: [new yy.ParamValue({param:0})] - }); - } else if (arguments.length === 1 && typeof sql === "object" && sql instanceof Array) { - // One argument data object - fluent interface - var select = new yy.Select({ - columns:[new yy.Column({columnid:'*'})], - from: [new yy.ParamValue({param:0})] - }); - select.preparams = [sql]; - return select; - } else { - // Standard interface - // alasql('#sql'); - if(typeof sql === 'string' && sql[0]==='#' && typeof document === "object") { - sql = document.querySelector(sql).textContent; - } else if(typeof sql === 'object' && sql instanceof HTMLElement) { - sql = sql.textContent; - } else if(typeof sql === 'function') { - // to run multiline functions - sql = sql.toString().slice(14,-3); - } - // Run SQL - return alasql.exec(sql, params, cb, scope); - } - } -}; - -/** - Current version of alasql - @constant {string} -*/ -alasql.version = '0.2.2-fix-delete-where-1156'; - -/** - Debug flag - @type {boolean} -*/ -alasql.debug = undefined; // Initial debug variable - -/** - Get path of alasql.js - @function - @todo Rewrite and simplify the code. Review, is this function is required separately -*/ -function getAlaSQLPath() { - /** type {string} Path to alasql library and plugins */ - alasql.path = ''; - - if (typeof importScripts === 'function') { - alasql.path = ''; - /** @todo Check how to get path in worker */ - } else if(typeof exports !== 'undefined') { - alasql.path = __dirname; +/*! AlaSQL v0.2.3-develop-1164 © 2014-2015 Andrey Gershun & M. Rangel Wulff | alasql.org/license */ +/* +@module alasql +@version 0.2.3-develop-1164 + +AlaSQL - JavaScript SQL database +© 2014-2015 Andrey Gershun & M. Rangel Wulff + +@license +The MIT License (MIT) + +Copyright © 2014-2015 Andrey Gershun (agershun@gmail.com) & M. Rangel Wulff (m@rawu.dk) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ - } else if(typeof Meteor === 'object' && Meteor.isClient) { - alasql.path = '/packages/dist/'; +/** + @fileoverview AlaSQL JavaScript SQL library + @see http://github.com/agershun/alasql +*/ - } else if(typeof Meteor === 'object' && Meteor.isServer) { - alasql.path = 'assets/packages/dist/'; +/** + Callback from statement + @callback statement-callback + @param {object} data Result data +*/ - } else if(typeof document !== 'undefined') { - var sc = document.getElementsByTagName('script'); +/** + UMD envelope for AlaSQL +*/ - for(var i=0;i-1; }; -/** - Strip all comments. - @function - @param {string} str - @return {string} - Based om the https://github.com/lehni/uncomment.js/blob/master/uncomment.js - I just replaced JavaScript's '//' to SQL's '--' and remove other stuff - - @todo Fixed [aaa/*bbb] for column names - @todo Bug if -- comments in the last line - @todo Check if it possible to model it with Jison parser - @todo Remove unused code - */ - -alasql.utils.uncomment = function uncomment(str) { - // Add some padding so we can always look ahead and behind by two chars - str = ('__' + str + '__').split(''); - var quote = false, - quoteSign, - // regularExpression = false, - // characterClass = false, - blockComment = false, - lineComment = false; - // preserveComment = false; - - for (var i = 0, l = str.length; i < l; i++) { - - // When checking for quote escaping, we also need to check that the - // escape sign itself is not escaped, as otherwise '\\' would cause - // the wrong impression of an unclosed string: - var unescaped = str[i - 1] !== '\\' || str[i - 2] === '\\'; - - if (quote) { - if (str[i] === quoteSign && unescaped){ - quote = false; - } - - } else if (blockComment) { - // Is the block comment closing? - if (str[i] === '*' && str[i + 1] === '/') { - // if (!preserveComment) - str[i] = str[i + 1] = ''; - blockComment /* = preserveComment*/ = false; - // Increase by 1 to skip closing '/', as it would be mistaken - // for a regexp otherwise - i++; - } else { //if (!preserveComment) { - str[i] = ''; - } - } else if (lineComment) { - // One-line comments end with the line-break - if (str[i + 1] === '\n' || str[i + 1] === '\r'){ - lineComment = false; - } - str[i] = ''; - } else { - if (str[i] === '"' || str[i] === "'") { - quote = true; - quoteSign = str[i]; - } else if (str[i] === '[' && str[i-1] !== "@") { - quote = true; - quoteSign = ']'; - // } else if (str[i] === '-' && str[i + 1] === '-') { - // str[i] = ''; - // lineComment = true; - } else if (str[i] === '/' && str[i + 1] === '*') { - // Do not filter out conditional comments /*@ ... */ - // and comments marked as protected /*! ... */ - - str[i] = ''; - blockComment = true; - - } - } - } - // Remove padding again. - str = str.join('').slice(2, -2); - - return str; -}; +/** + Strip all comments. + @function + @param {string} str + @return {string} + Based om the https://github.com/lehni/uncomment.js/blob/master/uncomment.js + I just replaced JavaScript's '//' to SQL's '--' and remove other stuff + + @todo Fixed [aaa/*bbb] for column names + @todo Bug if -- comments in the last line + @todo Check if it possible to model it with Jison parser + @todo Remove unused code + */ + +alasql.utils.uncomment = function uncomment(str) { + // Add some padding so we can always look ahead and behind by two chars + str = ('__' + str + '__').split(''); + var quote = false, + quoteSign, + // regularExpression = false, + // characterClass = false, + blockComment = false, + lineComment = false; + // preserveComment = false; + + for (var i = 0, l = str.length; i < l; i++) { + + // When checking for quote escaping, we also need to check that the + // escape sign itself is not escaped, as otherwise '\\' would cause + // the wrong impression of an unclosed string: + var unescaped = str[i - 1] !== '\\' || str[i - 2] === '\\'; + + if (quote) { + if (str[i] === quoteSign && unescaped){ + quote = false; + } + + } else if (blockComment) { + // Is the block comment closing? + if (str[i] === '*' && str[i + 1] === '/') { + // if (!preserveComment) + str[i] = str[i + 1] = ''; + blockComment /* = preserveComment*/ = false; + // Increase by 1 to skip closing '/', as it would be mistaken + // for a regexp otherwise + i++; + } else { //if (!preserveComment) { + str[i] = ''; + } + } else if (lineComment) { + // One-line comments end with the line-break + if (str[i + 1] === '\n' || str[i + 1] === '\r'){ + lineComment = false; + } + str[i] = ''; + } else { + if (str[i] === '"' || str[i] === "'") { + quote = true; + quoteSign = str[i]; + } else if (str[i] === '[' && str[i-1] !== "@") { + quote = true; + quoteSign = ']'; + // } else if (str[i] === '-' && str[i + 1] === '-') { + // str[i] = ''; + // lineComment = true; + } else if (str[i] === '/' && str[i + 1] === '*') { + // Do not filter out conditional comments /*@ ... */ + // and comments marked as protected /*! ... */ + + str[i] = ''; + blockComment = true; + + } + } + } + // Remove padding again. + str = str.join('').slice(2, -2); + + return str; +}; /** Database class for Alasql.js @@ -4280,116 +4280,116 @@ alasql.compile = function(sql, databaseid) { } }; -// -// Promises for AlaSQL -// +// +// Promises for AlaSQL +// -if(typeof exports === 'object') { - var Promise = require('es6-promise').Promise; -} else if(typeof window === 'object') { - var Promise = window.Promise; -} +if(typeof exports === 'object') { + var Promise = require('es6-promise').Promise; +} else if(typeof window === 'object') { + var Promise = window.Promise; +} -// -// Only for browsers with Promise support -// -//if(typeof window !== 'undefined' && typeof window.Promise === 'function') { -alasql.promise = function(sql, params) { - return new Promise(function(resolve, reject){ - alasql(sql, params, function(data,err) { - if(err) { - reject(err); - } else { - resolve(data); - } - }); - }); -}; +// +// Only for browsers with Promise support +// +//if(typeof window !== 'undefined' && typeof window.Promise === 'function') { +alasql.promise = function(sql, params) { + return new Promise(function(resolve, reject){ + alasql(sql, params, function(data,err) { + if(err) { + reject(err); + } else { + resolve(data); + } + }); + }); +}; //} -/* -// -// Database class for Alasql.js -// Date: 03.11.2014 -// (c) 2014, Andrey Gershun -// -*/ +/* +// +// Database class for Alasql.js +// Date: 03.11.2014 +// (c) 2014, Andrey Gershun +// +*/ -// Main Database class +// Main Database class -/** - @class Database - */ +/** + @class Database + */ -var Database = alasql.Database = function (databaseid) { - var self = this; +var Database = alasql.Database = function (databaseid) { + var self = this; - if(self === alasql) { - if(databaseid) { + if(self === alasql) { + if(databaseid) { - self = alasql.databases[databaseid]; + self = alasql.databases[databaseid]; - alasql.databases[databaseid] = self; + alasql.databases[databaseid] = self; - if(!self) { - throw new Error('Database "'+databaseid+'" not found'); - } - } else { - // Create new database (or get alasql?) - self = alasql.databases.alasql; - // For SQL Server examples, USE tempdb - if(alasql.options.tsql){ - alasql.databases.tempdb = alasql.databases.alasql; - } + if(!self) { + throw new Error('Database "'+databaseid+'" not found'); + } + } else { + // Create new database (or get alasql?) + self = alasql.databases.alasql; + // For SQL Server examples, USE tempdb + if(alasql.options.tsql){ + alasql.databases.tempdb = alasql.databases.alasql; + } - } - } - if(!databaseid) { - databaseid = "db"+(alasql.databasenum++); // Random name - } + } + } + if(!databaseid) { + databaseid = "db"+(alasql.databasenum++); // Random name + } - // Step 1 - self.databaseid = databaseid; - alasql.databases[databaseid] = self; - self.dbversion = 0; + // Step 1 + self.databaseid = databaseid; + alasql.databases[databaseid] = self; + self.dbversion = 0; - //Steps 2-5 - self.tables = {}; - self.views = {}; - self.triggers = {}; - self.indices = {}; + //Steps 2-5 + self.tables = {}; + self.views = {}; + self.triggers = {}; + self.indices = {}; - // Step 6: Objects storage - self.objects = {}; - self.counter = 0; + // Step 6: Objects storage + self.objects = {}; + self.counter = 0; - self.resetSqlCache(); - return self; -}; + self.resetSqlCache(); + return self; +}; -/** - Reset SQL statements cache - */ +/** + Reset SQL statements cache + */ -Database.prototype.resetSqlCache = function () { - this.sqlCache = {}; // Cache for compiled SQL statements - this.sqlCacheSize = 0; -} +Database.prototype.resetSqlCache = function () { + this.sqlCache = {}; // Cache for compiled SQL statements + this.sqlCacheSize = 0; +} -// Main SQL function +// Main SQL function -/** - Run SQL statement on database - @param {string} sql SQL statement - @param [object] params Parameters - @param {function} cb callback - */ +/** + Run SQL statement on database + @param {string} sql SQL statement + @param [object] params Parameters + @param {function} cb callback + */ -Database.prototype.exec = function(sql, params, cb) { - return alasql.dexec(this.databaseid, sql, params, cb); -}; +Database.prototype.exec = function(sql, params, cb) { + return alasql.dexec(this.databaseid, sql, params, cb); +}; -// Aliases like MS SQL +// Aliases like MS SQL /* // @@ -7584,102 +7584,102 @@ yy.Select.prototype.compileJoins = function(query) { } -yy.Select.prototype.compileWhere = function(query) { - if(this.where) { - if(typeof this.where == "function") { - return this.where; - } else { - s = this.where.toJS('p',query.defaultTableid,query.defcols); - query.wherefns = s; - - return new Function('p,params,alasql','var y;return '+s); - } - } else return function(){return true}; -}; - -yy.Select.prototype.compileWhereJoins = function(query) { - return; - - // TODO Fix Where optimization - - optimizeWhereJoin(query, this.where.expression); - - //for sources compile wherefs - query.sources.forEach(function(source) { - if(source.srcwherefns) { - source.srcwherefn = new Function('p,params,alasql','var y;return '+source.srcwherefns); - }; - if(source.wxleftfns) { - source.wxleftfn = new Function('p,params,alasql','var y;return '+source.wxleftfns); - }; - if(source.wxrightfns) { - source.wxrightfn = new Function('p,params,alasql','var y;return '+source.wxrightfns); - }; - - }); -}; +yy.Select.prototype.compileWhere = function(query) { + if(this.where) { + if(typeof this.where == "function") { + return this.where; + } else { + s = this.where.toJS('p',query.defaultTableid,query.defcols); + query.wherefns = s; + + return new Function('p,params,alasql','var y;return '+s); + } + } else return function(){return true}; +}; -function optimizeWhereJoin (query, ast) { - if(!ast) return false; - if(!(ast instanceof yy.Op)) return; - if(ast.op != '=' && ast.op != 'AND') return; - if(ast.allsome) return; - - var s = ast.toJS('p',query.defaultTableid,query.defcols); - var fsrc = []; - query.sources.forEach(function(source,idx) { - // Optimization allowed only for tables only - if(source.tableid) { - // This is a good place to remove all unnecessary optimizations - if(s.indexOf('p[\''+source.alias+'\']')>-1) fsrc.push(source); - }; - }); +yy.Select.prototype.compileWhereJoins = function(query) { + return; -// if(fsrc.length < query.sources.length) return; + // TODO Fix Where optimization - if(fsrc.length == 0) { + optimizeWhereJoin(query, this.where.expression); - return; - } else if (fsrc.length == 1) { - - if(!(s.match(/p\[\'.*?\'\]/g)||[]) - .every(function(s){ - return s == "p['"+fsrc[0].alias+"']"})) { - return; - // This is means, that we have column from parent query - // So we return without optimization - } + //for sources compile wherefs + query.sources.forEach(function(source) { + if(source.srcwherefns) { + source.srcwherefn = new Function('p,params,alasql','var y;return '+source.srcwherefns); + }; + if(source.wxleftfns) { + source.wxleftfn = new Function('p,params,alasql','var y;return '+source.wxleftfns); + }; + if(source.wxrightfns) { + source.wxrightfn = new Function('p,params,alasql','var y;return '+source.wxrightfns); + }; - var src = fsrc[0]; // optmiization source - src.srcwherefns = src.srcwherefns ? src.srcwherefns+'&&'+s : s; + }); +}; - if((ast instanceof yy.Op) && (ast.op == '=' && !ast.allsome)) { - if(ast.left instanceof yy.Column) { - var ls = ast.left.toJS('p',query.defaultTableid,query.defcols); - var rs = ast.right.toJS('p',query.defaultTableid,query.defcols); - if(rs.indexOf('p[\''+fsrc[0].alias+'\']') == -1) { - fsrc[0].wxleftfns = ls; - fsrc[0].wxrightfns = rs; - } - } if(ast.right instanceof yy.Column) { - var ls = ast.left.toJS('p',query.defaultTableid,query.defcols); - var rs = ast.right.toJS('p',query.defaultTableid,query.defcols); - if(ls.indexOf('p[\''+fsrc[0].alias+'\']') == -1) { - fsrc[0].wxleftfns = rs; - fsrc[0].wxrightfns = ls; - } - } - } - ast.reduced = true; // To do not duplicate wherefn and srcwherefn - return; - } else { - if(ast.op = 'AND') { - optimizeWhereJoin(query,ast.left); - optimizeWhereJoin(query,ast.right); - } - } +function optimizeWhereJoin (query, ast) { + if(!ast) return false; + if(!(ast instanceof yy.Op)) return; + if(ast.op != '=' && ast.op != 'AND') return; + if(ast.allsome) return; + + var s = ast.toJS('p',query.defaultTableid,query.defcols); + var fsrc = []; + query.sources.forEach(function(source,idx) { + // Optimization allowed only for tables only + if(source.tableid) { + // This is a good place to remove all unnecessary optimizations + if(s.indexOf('p[\''+source.alias+'\']')>-1) fsrc.push(source); + }; + }); + +// if(fsrc.length < query.sources.length) return; + + if(fsrc.length == 0) { + + return; + } else if (fsrc.length == 1) { + + if(!(s.match(/p\[\'.*?\'\]/g)||[]) + .every(function(s){ + return s == "p['"+fsrc[0].alias+"']"})) { + return; + // This is means, that we have column from parent query + // So we return without optimization + } + + var src = fsrc[0]; // optmiization source + src.srcwherefns = src.srcwherefns ? src.srcwherefns+'&&'+s : s; + + if((ast instanceof yy.Op) && (ast.op == '=' && !ast.allsome)) { + if(ast.left instanceof yy.Column) { + var ls = ast.left.toJS('p',query.defaultTableid,query.defcols); + var rs = ast.right.toJS('p',query.defaultTableid,query.defcols); + if(rs.indexOf('p[\''+fsrc[0].alias+'\']') == -1) { + fsrc[0].wxleftfns = ls; + fsrc[0].wxrightfns = rs; + } + } if(ast.right instanceof yy.Column) { + var ls = ast.left.toJS('p',query.defaultTableid,query.defcols); + var rs = ast.right.toJS('p',query.defaultTableid,query.defcols); + if(ls.indexOf('p[\''+fsrc[0].alias+'\']') == -1) { + fsrc[0].wxleftfns = rs; + fsrc[0].wxrightfns = ls; + } + } + } + ast.reduced = true; // To do not duplicate wherefn and srcwherefn + return; + } else { + if(ast.op = 'AND') { + optimizeWhereJoin(query,ast.left); + optimizeWhereJoin(query,ast.right); + } + } -}; +}; /* // @@ -8297,332 +8297,332 @@ yy.Select.prototype.compileRemoveColumns = function(query) { } }; -yy.Select.prototype.compileHaving = function(query) { - if(this.having) { - s = this.having.toJS('g',-1); - query.havingfns = s; - - return new Function('g,params,alasql','var y;return '+s); - } else return function(){return true}; -}; +yy.Select.prototype.compileHaving = function(query) { + if(this.having) { + s = this.having.toJS('g',-1); + query.havingfns = s; -yy.Select.prototype.compileOrder = function (query) { - var self = this; - self.orderColumns = []; - if(this.order) { + return new Function('g,params,alasql','var y;return '+s); + } else return function(){return true}; +}; - if(this.order && this.order.length == 1 && this.order[0].expression - && typeof this.order[0].expression == "function") { +yy.Select.prototype.compileOrder = function (query) { + var self = this; + self.orderColumns = []; + if(this.order) { + + if(this.order && this.order.length == 1 && this.order[0].expression + && typeof this.order[0].expression == "function") { + + var func = this.order[0].expression; + + return function(a,b){ + var ra = func(a),rb = func(b); + if(ra>rb) return 1; + if(ra==rb) return 0; + return -1; + } + }; + + var s = ''; + var sk = ''; + this.order.forEach(function(ord,idx){ + + if(ord.expression instanceof yy.NumValue) { + var v = self.columns[ord.expression.value-1]; + } else { + var v = ord.expression; + } + self.orderColumns.push(v); + + var key = '$$$'+idx; + + // Date conversion + var dg = ''; + //if(alasql.options.valueof) + if(ord.expression instanceof yy.Column) { + var columnid = ord.expression.columnid; + if(query.xcolumns[columnid]) { + var dbtypeid = query.xcolumns[columnid].dbtypeid; + if( dbtypeid == 'DATE' || dbtypeid == 'DATETIME' || dbtypeid == 'DATETIME2') dg = '.valueOf()'; + // TODO Add other types mapping + } else { + if(alasql.options.valueof) dg = '.valueOf()'; // TODO Check + } + + } + // COLLATE NOCASE + if(ord.nocase) dg += '.toUpperCase()'; + s += "if((a['"+key+"']||'')"+dg+(ord.direction == 'ASC'?'>':"<")+"(b['"+key+"']||'')"+dg+')return 1;'; + s += "if((a['"+key+"']||'')"+dg+"==(b['"+key+"']||'')"+dg+'){'; - var func = this.order[0].expression; +/* +if(false) { + + if(ord.expression instanceof yy.NumValue) { + ord.expression = self.columns[ord.expression.value-1]; + + ord.expression = new yy.Column({columnid:ord.expression.nick}); + }; + + if(ord.expression instanceof yy.Column) { + var columnid = ord.expression.columnid; + if(query.xcolumns[columnid]) { + var dbtypeid = query.xcolumns[columnid].dbtypeid; + if( dbtypeid == 'DATE' || dbtypeid == 'DATETIME' || dbtypeid == 'DATETIME2') dg = '.valueOf()'; + // TODO Add other types mapping + } else { + if(alasql.options.valueof) dg = '.valueOf()'; // TODO Check + } + // COLLATE NOCASE + if(ord.nocase) dg += '.toUpperCase()'; + + s += 'if((a[\''+columnid+"']||'')"+dg+(ord.direction == 'ASC'?'>':'<')+'(b[\''+columnid+"']||'')"+dg+')return 1;'; + s += 'if((a[\''+columnid+"']||'')"+dg+'==(b[\''+columnid+"']||'')"+dg+'){'; + + } else { + dg = '.valueOf()'; + // COLLATE NOCASE + if(ord.nocase) dg += '.toUpperCase()'; + s += 'if(('+ord.toJS('a','')+"||'')"+dg+(ord.direction == 'ASC'?'>(':'<(')+ord.toJS('b','')+"||'')"+dg+')return 1;'; + s += 'if(('+ord.toJS('a','')+"||'')"+dg+'==('+ord.toJS('b','')+"||'')"+dg+'){'; + } + + // TODO Add date comparision - return function(a,b){ - var ra = func(a),rb = func(b); - if(ra>rb) return 1; - if(ra==rb) return 0; - return -1; - } - }; +} +*/ + sk += '}'; + }); + s += 'return 0;'; + s += sk+'return -1'; + query.orderfns = s; + + return new Function('a,b','var y;'+s); + }; +}; - var s = ''; - var sk = ''; - this.order.forEach(function(ord,idx){ +// Pivot functions +/** + Compile Pivot functions + @param {object} query Source query + @return {function} Pivoting functions +*/ +yy.Select.prototype.compilePivot = function (query) { + var self = this; + /** @type {string} Main pivoting column */ + + var columnid = self.pivot.columnid; + var exprcolid = self.pivot.expr.expression.columnid; + var aggr = self.pivot.expr.aggregatorid; + var inlist = self.pivot.inlist; + + if(inlist) { + inlist = inlist.map(function(l){return l.expr.columnid}); + } + + // Function for PIVOT post production + return function() { + var query = this; + var cols = query.columns.filter(function(col){ + return (col.columnid != columnid) && (col.columnid != exprcolid); + }).map(function(col){ + return col.columnid; + }); + + var newcols = []; + var gnewcols = {}; + var gr = {}; + var ga = {}; + var data = []; + query.data.forEach(function(d){ + if(!inlist || inlist.indexOf(d[columnid])>-1 ) { + var gx = cols.map(function(colid){return d[colid]}).join('`'); + var g = gr[gx]; + if(!g) { + g = {}; + gr[gx] = g; + data.push(g); + cols.forEach(function(colid){ + g[colid] = d[colid]; + }); + }; + + if(!ga[gx]) { + ga[gx] = {}; + } + + if(ga[gx][d[columnid]]) { + ga[gx][d[columnid]]++; + } else { + ga[gx][d[columnid]] = 1; + } + + if(!gnewcols[d[columnid]]) { + gnewcols[d[columnid]] = true; + newcols.push(d[columnid]); + }; + + if(aggr=='SUM' || aggr=='AVG' ) { + if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = 0; + g[d[columnid]] += d[exprcolid]; + } else if(aggr=='COUNT') { + if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = 0; + g[d[columnid]]++; + } else if(aggr=='MIN') { + if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = Infinity; + if(d[exprcolid] < g[d[columnid]]) g[d[columnid]] = d[exprcolid]; + } else if(aggr=='MAX') { + if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = -Infinity; + if(d[exprcolid] > g[d[columnid]]) g[d[columnid]] = d[exprcolid]; + } else if(aggr=='FIRST') { + if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = d[exprcolid]; + } else if(aggr=='LAST') { + g[d[columnid]] = d[exprcolid]; + } else if(alasql.aggr[aggr]) { // Custom aggregator + alasql.aggr[aggr](g[d[columnid]],d[exprcolid]); + } else { + throw new Error('Wrong aggregator in PIVOT clause'); + } + } + }); + + if(aggr=='AVG') { + for(var gx in gr){ + var d = gr[gx]; + for(var colid in d) { + if((cols.indexOf(colid) == -1) && (colid != exprcolid)) { + d[colid] = d[colid]/ga[gx][colid]; + } + } + }; + }; + +// columns + query.data = data; + + if(inlist) newcols = inlist; + + var ncol = query.columns.filter(function(col){return col.columnid == exprcolid})[0]; + query.columns = query.columns.filter(function(col){ + return !(col.columnid == columnid || col.columnid == exprcolid); + }); + newcols.forEach(function(colid){ + var nc = cloneDeep(ncol); + nc.columnid = colid; + query.columns.push(nc); + }); + }; +}; - if(ord.expression instanceof yy.NumValue) { - var v = self.columns[ord.expression.value-1]; - } else { - var v = ord.expression; - } - self.orderColumns.push(v); + // var columnid = this.pivot.columnid; - var key = '$$$'+idx; + // return function(data){ + // * @type {object} Collection of grouped records + // var gx = {}; + // /** @type {array} Array of grouped records */ + // var gr = []; - // Date conversion - var dg = ''; - //if(alasql.options.valueof) - if(ord.expression instanceof yy.Column) { - var columnid = ord.expression.columnid; - if(query.xcolumns[columnid]) { - var dbtypeid = query.xcolumns[columnid].dbtypeid; - if( dbtypeid == 'DATE' || dbtypeid == 'DATETIME' || dbtypeid == 'DATETIME2') dg = '.valueOf()'; - // TODO Add other types mapping - } else { - if(alasql.options.valueof) dg = '.valueOf()'; // TODO Check - } +// if(false) { - } - // COLLATE NOCASE - if(ord.nocase) dg += '.toUpperCase()'; - s += "if((a['"+key+"']||'')"+dg+(ord.direction == 'ASC'?'>':"<")+"(b['"+key+"']||'')"+dg+')return 1;'; - s += "if((a['"+key+"']||'')"+dg+"==(b['"+key+"']||'')"+dg+'){'; +// } -/* -if(false) { +// if(false) { - if(ord.expression instanceof yy.NumValue) { - ord.expression = self.columns[ord.expression.value-1]; +// } +// }; - ord.expression = new yy.Column({columnid:ord.expression.nick}); - }; +/** + Compile UNPIVOT clause + @param {object} query Query object + @return {function} Function for unpivoting +*/ +yy.Select.prototype.compileUnpivot = function (query) { + var self = this; + var tocolumnid = self.unpivot.tocolumnid; + var forcolumnid = self.unpivot.forcolumnid; + var inlist = self.unpivot.inlist.map(function(l){return l.columnid}); + + return function() { + var data = []; + + var xcols = query.columns + .map(function(col){return col.columnid}) + .filter(function(colid){ + return inlist.indexOf(colid)==-1 && colid != forcolumnid && colid != tocolumnid; + }); + + query.data.forEach(function(d){ + inlist.forEach(function(colid){ + var nd = {}; + xcols.forEach(function(xcolid){ nd[xcolid] = d[xcolid]}); + nd[forcolumnid] = colid; + nd[tocolumnid] = d[colid]; + data.push(nd); + }); + }); + + query.data = data; + + }; - if(ord.expression instanceof yy.Column) { - var columnid = ord.expression.columnid; - if(query.xcolumns[columnid]) { - var dbtypeid = query.xcolumns[columnid].dbtypeid; - if( dbtypeid == 'DATE' || dbtypeid == 'DATETIME' || dbtypeid == 'DATETIME2') dg = '.valueOf()'; - // TODO Add other types mapping - } else { - if(alasql.options.valueof) dg = '.valueOf()'; // TODO Check - } - // COLLATE NOCASE - if(ord.nocase) dg += '.toUpperCase()'; +}; - s += 'if((a[\''+columnid+"']||'')"+dg+(ord.direction == 'ASC'?'>':'<')+'(b[\''+columnid+"']||'')"+dg+')return 1;'; - s += 'if((a[\''+columnid+"']||'')"+dg+'==(b[\''+columnid+"']||'')"+dg+'){'; +/* +// +// ROLLUP(), CUBE(), GROUPING SETS() for Alasql.js +// Date: 03.11.2014 +// (c) 2014, Andrey Gershun +// +*/ - } else { - dg = '.valueOf()'; - // COLLATE NOCASE - if(ord.nocase) dg += '.toUpperCase()'; - s += 'if(('+ord.toJS('a','')+"||'')"+dg+(ord.direction == 'ASC'?'>(':'<(')+ord.toJS('b','')+"||'')"+dg+')return 1;'; - s += 'if(('+ord.toJS('a','')+"||'')"+dg+'==('+ord.toJS('b','')+"||'')"+dg+'){'; - } +/** + Calculate ROLLUP() combination + */ - // TODO Add date comparision +var rollup = function (a,query) { + var rr = []; + var mask = 0; + var glen = a.length; + for(var g=0;g-1 ) { - var gx = cols.map(function(colid){return d[colid]}).join('`'); - var g = gr[gx]; - if(!g) { - g = {}; - gr[gx] = g; - data.push(g); - cols.forEach(function(colid){ - g[colid] = d[colid]; - }); - }; - - if(!ga[gx]) { - ga[gx] = {}; - } - - if(ga[gx][d[columnid]]) { - ga[gx][d[columnid]]++; - } else { - ga[gx][d[columnid]] = 1; - } - - if(!gnewcols[d[columnid]]) { - gnewcols[d[columnid]] = true; - newcols.push(d[columnid]); - }; - - if(aggr=='SUM' || aggr=='AVG' ) { - if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = 0; - g[d[columnid]] += d[exprcolid]; - } else if(aggr=='COUNT') { - if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = 0; - g[d[columnid]]++; - } else if(aggr=='MIN') { - if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = Infinity; - if(d[exprcolid] < g[d[columnid]]) g[d[columnid]] = d[exprcolid]; - } else if(aggr=='MAX') { - if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = -Infinity; - if(d[exprcolid] > g[d[columnid]]) g[d[columnid]] = d[exprcolid]; - } else if(aggr=='FIRST') { - if(typeof g[d[columnid]] == 'undefined') g[d[columnid]] = d[exprcolid]; - } else if(aggr=='LAST') { - g[d[columnid]] = d[exprcolid]; - } else if(alasql.aggr[aggr]) { // Custom aggregator - alasql.aggr[aggr](g[d[columnid]],d[exprcolid]); - } else { - throw new Error('Wrong aggregator in PIVOT clause'); - } - } - }); - - if(aggr=='AVG') { - for(var gx in gr){ - var d = gr[gx]; - for(var colid in d) { - if((cols.indexOf(colid) == -1) && (colid != exprcolid)) { - d[colid] = d[colid]/ga[gx][colid]; - } - } - }; - }; - -// columns - query.data = data; - - if(inlist) newcols = inlist; - - var ncol = query.columns.filter(function(col){return col.columnid == exprcolid})[0]; - query.columns = query.columns.filter(function(col){ - return !(col.columnid == columnid || col.columnid == exprcolid); - }); - newcols.forEach(function(colid){ - var nc = cloneDeep(ncol); - nc.columnid = colid; - query.columns.push(nc); - }); - }; -}; - - // var columnid = this.pivot.columnid; - - // return function(data){ - // * @type {object} Collection of grouped records - // var gx = {}; - // /** @type {array} Array of grouped records */ - // var gr = []; - -// if(false) { - -// } - -// if(false) { - -// } -// }; - -/** - Compile UNPIVOT clause - @param {object} query Query object - @return {function} Function for unpivoting -*/ -yy.Select.prototype.compileUnpivot = function (query) { - var self = this; - var tocolumnid = self.unpivot.tocolumnid; - var forcolumnid = self.unpivot.forcolumnid; - var inlist = self.unpivot.inlist.map(function(l){return l.columnid}); - - return function() { - var data = []; - - var xcols = query.columns - .map(function(col){return col.columnid}) - .filter(function(colid){ - return inlist.indexOf(colid)==-1 && colid != forcolumnid && colid != tocolumnid; - }); - - query.data.forEach(function(d){ - inlist.forEach(function(colid){ - var nd = {}; - xcols.forEach(function(xcolid){ nd[xcolid] = d[xcolid]}); - nd[forcolumnid] = colid; - nd[tocolumnid] = d[colid]; - data.push(nd); - }); - }); - - query.data = data; - - }; - -}; - -/* -// -// ROLLUP(), CUBE(), GROUPING SETS() for Alasql.js -// Date: 03.11.2014 -// (c) 2014, Andrey Gershun -// -*/ - -/** - Calculate ROLLUP() combination - */ - -var rollup = function (a,query) { - var rr = []; - var mask = 0; - var glen = a.length; - for(var g=0;g=0) { + //q += '' + q += "(x="+values[idx].toJS()+",x==undefined?undefined:+x)"; + } else if (alasql.fn[table.xcolumns[col.columnid].dbtypeid]) { + q += "(new "+table.xcolumns[col.columnid].dbtypeid+"("; + q += values[idx].toJS(); + q += "))"; + } else { + q += values[idx].toJS(); + }; + } else { + q += values[idx].toJS(); + } + ss.push(q); + + }); + } else { + + if((values instanceof Array) && table.columns && table.columns.length > 0) { + table.columns.forEach(function(col, idx){ + + var q = '\''+col.columnid +'\':'; + + if(["INT","FLOAT","NUMBER","MONEY"].indexOf(col.dbtypeid) >=0) { + q += "+"+values[idx].toJS(); + } else if (alasql.fn[col.dbtypeid]) { + q += "(new "+col.dbtypeid+"("; + q += values[idx].toJS(); + q += "))"; + } else { + q += values[idx].toJS(); + } + + ss.push(q); + + }); + } else { + + sw = JSONtoJS(values); + } + } + + if(db.tables[tableid].defaultfns) { + ss.unshift(db.tables[tableid].defaultfns); + }; + if(sw) { + s += 'a='+sw+';'; + } else { + s += 'a={'+ss.join(',')+'};'; + } + + // If this is a class + if(db.tables[tableid].isclass) { + s += 'var db=alasql.databases[\''+databaseid+'\'];'; + s+= 'a.$class="'+tableid+'";'; + s+= 'a.$id=db.counter++;'; + s+= 'db.objects[a.$id]=a;'; + }; + + if(db.tables[tableid].insert) { + s += 'var db=alasql.databases[\''+databaseid+'\'];'; + s += 'db.tables[\''+tableid+'\'].insert(a,'+(self.orreplace?"true":"false")+');'; + } else { + s += 'aa.push(a);'; + } + }); + + s33 = s3+s; + + if(db.tables[tableid].insert) { - var s33; + } else { + s += 'alasql.databases[\''+databaseid+'\'].tables[\''+tableid+'\'].data='+ + 'alasql.databases[\''+databaseid+'\'].tables[\''+tableid+'\'].data.concat(aa);'; + } -// INSERT INTO table VALUES - if(this.values) { + if(db.tables[tableid].insert) { + if(db.tables[tableid].isclass) { + s += 'return a.$id;'; + } else { + s += 'return '+self.values.length; + } + } else { + s += 'return '+self.values.length; + } - if(this.exists) { - this.existsfn = this.exists.map(function(ex) { - var nq = ex.compile(databaseid); - nq.query.modifier='RECORDSET'; - return nq; - }); - } - if(this.queries) { - this.queriesfn = this.queries.map(function(q) { - var nq = q.compile(databaseid); - nq.query.modifier='RECORDSET'; - return nq; - }); - } + var insertfn = new Function('db, params, alasql','var y;'+s3+s).bind(this); + +// INSERT INTO table SELECT + + } else if(this.select) { + this.select.modifier = 'RECORDSET'; + selectfn = this.select.compile(databaseid); + if(db.engineid && alasql.engines[db.engineid].intoTable) { + var statement = function(params, cb) { + var aa = selectfn(params); + var res = alasql.engines[db.engineid].intoTable(db.databaseid,tableid,aa.data,null, cb); + return res; + }; + return statement; + } else { + + var defaultfns = 'return alasql.utils.extend(r,{'+table.defaultfns+'})'; + var defaultfn = new Function('r,db,params,alasql',defaultfns); + var insertfn = function(db, params, alasql) { + var res = selectfn(params).data; + if(db.tables[tableid].insert) { + // If insert() function exists (issue #92) + for(var i=0,ilen=res.length;i=0) { - //q += '' - q += "(x="+values[idx].toJS()+",x==undefined?undefined:+x)"; - } else if (alasql.fn[table.xcolumns[col.columnid].dbtypeid]) { - q += "(new "+table.xcolumns[col.columnid].dbtypeid+"("; - q += values[idx].toJS(); - q += "))"; - } else { - q += values[idx].toJS(); - }; - } else { - q += values[idx].toJS(); - } - ss.push(q); + var res = alasql.engines[db.engineid].intoTable(db.databaseid,tableid,aa, null, cb); - }); - } else { + return res; + }; - if((values instanceof Array) && table.columns && table.columns.length > 0) { - table.columns.forEach(function(col, idx){ + } else { - var q = '\''+col.columnid +'\':'; + var statement = function(params, cb) { - if(["INT","FLOAT","NUMBER","MONEY"].indexOf(col.dbtypeid) >=0) { - q += "+"+values[idx].toJS(); - } else if (alasql.fn[col.dbtypeid]) { - q += "(new "+col.dbtypeid+"("; - q += values[idx].toJS(); - q += "))"; - } else { - q += values[idx].toJS(); - } + var db = alasql.databases[databaseid]; - ss.push(q); + if(alasql.options.autocommit && db.engineid) { + alasql.engines[db.engineid].loadTableData(databaseid,tableid); + } - }); - } else { + var res = insertfn(db,params,alasql); - sw = JSONtoJS(values); - } - } + if(alasql.options.autocommit && db.engineid) { + alasql.engines[db.engineid].saveTableData(databaseid,tableid); + } + // var res = insertfn(db, params); + if(alasql.options.nocount) res = undefined; + if(cb) cb(res); + return res; + }; + }; - if(db.tables[tableid].defaultfns) { - ss.unshift(db.tables[tableid].defaultfns); - }; - if(sw) { - s += 'a='+sw+';'; - } else { - s += 'a={'+ss.join(',')+'};'; - } + return statement; +}; - // If this is a class - if(db.tables[tableid].isclass) { - s += 'var db=alasql.databases[\''+databaseid+'\'];'; - s+= 'a.$class="'+tableid+'";'; - s+= 'a.$id=db.counter++;'; - s+= 'db.objects[a.$id]=a;'; - }; +yy.Insert.prototype.execute = function (databaseid, params, cb) { + return this.compile(databaseid)(params,cb); +// throw new Error('Insert statement is should be compiled') +} - if(db.tables[tableid].insert) { - s += 'var db=alasql.databases[\''+databaseid+'\'];'; - s += 'db.tables[\''+tableid+'\'].insert(a,'+(self.orreplace?"true":"false")+');'; - } else { - s += 'aa.push(a);'; - } - }); +/* +// +// TRIGGER for Alasql.js +// Date: 29.12.2015 +// +*/ - s33 = s3+s; +yy.CreateTrigger = function (params) { return yy.extend(this, params); }; +yy.CreateTrigger.prototype.toString = function() { + var s = 'CREATE TRIGGER '+this.trigger +' '; + if(this.when) s += this.when+' '; + s += this.action+' ON '; + if(this.table.databaseid) s += this.table.databaseid+'.'; + s += this.table.tableid+' '; + s += this.statement.toString(); + return s; +}; - if(db.tables[tableid].insert) { +yy.CreateTrigger.prototype.execute = function (databaseid, params, cb) { + var res = 1; // No tables removed + var triggerid = this.trigger; + databaseid = this.table.databaseid || databaseid; + var db = alasql.databases[databaseid]; + var tableid = this.table.tableid; - } else { - s += 'alasql.databases[\''+databaseid+'\'].tables[\''+tableid+'\'].data='+ - 'alasql.databases[\''+databaseid+'\'].tables[\''+tableid+'\'].data.concat(aa);'; - } - - if(db.tables[tableid].insert) { - if(db.tables[tableid].isclass) { - s += 'return a.$id;'; - } else { - s += 'return '+self.values.length; - } - } else { - s += 'return '+self.values.length; - } - - var insertfn = new Function('db, params, alasql','var y;'+s3+s).bind(this); - -// INSERT INTO table SELECT - - } else if(this.select) { - this.select.modifier = 'RECORDSET'; - selectfn = this.select.compile(databaseid); - if(db.engineid && alasql.engines[db.engineid].intoTable) { - var statement = function(params, cb) { - var aa = selectfn(params); - var res = alasql.engines[db.engineid].intoTable(db.databaseid,tableid,aa.data,null, cb); - return res; - }; - return statement; - } else { - - var defaultfns = 'return alasql.utils.extend(r,{'+table.defaultfns+'})'; - var defaultfn = new Function('r,db,params,alasql',defaultfns); - var insertfn = function(db, params, alasql) { - var res = selectfn(params).data; - if(db.tables[tableid].insert) { - // If insert() function exists (issue #92) - for(var i=0,ilen=res.length;i 0) { + columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); + }; + // If one parameter + if(typeof filename == 'object') { + opts = filename; + filename = undefined; + }; + + var res = data.length; + var s = ''; + if(data.length > 0) { + var key = columns[0].columnid; + s += data.map(function(d){ + return d[key]; + }).join('\n'); + } + + res = alasql.utils.saveFile(filename,s); + if(cb) res = cb(res); + return res; +}; -// } else { +alasql.into.TAB = alasql.into.TSV = function(filename, opts, data, columns, cb) { + var opt = {}; + alasql.utils.extend(opt, opts); + opt.separator = '\t'; + return alasql.into.CSV(filename, opt, data, columns, cb); +} - res = alasql.utils.saveFile(filename,s); - if(cb) res = cb(res); - return res; -}; +alasql.into.CSV = function(filename, opts, data, columns, cb) { + if(columns.length == 0 && data.length > 0) { + columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); + } + if(typeof filename == 'object') { + opts = filename; + filename = undefined; + } + + var opt = {}; + //opt.separator = ','; + opt.separator = ';'; + opt.quote = '"'; + alasql.utils.extend(opt, opts); + var res = data.length; + var s = ''; + if(opt.headers) { + s += opt.quote+columns.map(function(col){ + return col.columnid.trim(); + }).join(opt.quote+opt.separator+opt.quote)+opt.quote+'\r\n'; + } + + data.forEach(function(d, idx){ + s += columns.map(function(col){ + var s = d[col.columnid]; + s = (s+"").replace(new RegExp('\\'+opt.quote,"g"),'""'); + + //Excel 2013 needs quotes around strings - thanks for _not_ complying with RFC for CSV + if(+s!=s){ // jshint ignore:line + s = opt.quote + s + opt.quote; + } + + return s; + }).join(opt.separator)+'\r\n'; + }); + + res = alasql.utils.saveFile(filename,s); + if(cb) res = cb(res); + return res; +}; -alasql.into.HTML = function(selector, opts, data, columns, cb) { - var res = 1; - if(typeof exports != 'object') { - var opt = {}; - alasql.utils.extend(opt, opts); - - var sel = document.querySelector(selector); - if(!sel) { - throw new Error('Selected HTML element is not found'); - }; - - if(columns.length == 0) { - if(typeof data[0] == "object") { - columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); - } else { - // What should I do? - // columns = [{columnid:"_"}]; - } - } +// +// 831xl.js - Coloring Excel +// 18.04.2015 +// Generate XLS file with colors and styles +// with Excel + +alasql.into.XLS = function(filename, opts, data, columns, cb) { + // If filename is not defined then output to the result + if(typeof filename == 'object') { + opts = filename; + filename = undefined; + } + + // Set sheets + var sheets = {}; + if(opts && opts.sheets) { + sheets = opts.sheets; + }; + + // Default sheet + var sheet = {}; + if(typeof sheets['Sheet1'] != 'undefined') { + sheet = sheets[0]; + } else { + if(typeof opts != 'undefined') { + sheet = opts; + } + }; + + // Set sheet name and default is 'Sheet1' + if(typeof sheet.sheetid == 'undefined') { + sheet.sheetid = 'Sheet1'; + }; + + var s = toHTML(); + + // File is ready to save + var res = alasql.utils.saveFile(filename,s); + if(cb) res = cb(res); + return res; + + function toHTML() { + // Generate prologue + var s = ' \ + \ + '; + + // Generate body + s += ' 0) { + if(typeof data[0] == 'object') { + if(data[0] instanceof Array) { + columns = data[0].map(function(d,columnidx){ + return {columnid:columnidx}; + }); + } else { + columns = Object.keys(data[0]).map(function(columnid){ + return {columnid:columnid}; + }); + } + } + } + }; + + // Prepare columns + columns.forEach(function(column,columnidx){ + if(typeof sheet.column != 'undefined') { + extend(column,sheet.column); + } + + if(typeof column.width == 'undefined') { + if(sheet.column && sheet.column.width !='undefined') { + column.width = sheet.column.width; + + } else { + column.width = "120px"; + } + } + if(typeof column.width == 'number') column.width = column.width + "px"; + if(typeof column.columnid == 'undefined') column.columnid = columnidx; + if(typeof column.title == 'undefined') column.title = ""+column.columnid.trim(); + if(sheet.headers && sheet.headers instanceof Array) column.title = sheet.headers[columnidx]; + }); + + // Set columns widths + s += ''; + columns.forEach(function (column) { + s += ''; + }); + s += ''; + + // Headers + if(sheet.headers) { + s += ''; + s += ''; + + // TODO: Skip columns to body + + // Headers + columns.forEach(function (column,columnidx) { + + s += ' 0) { + + // TODO: Skip columns to body + + // Loop over data rows + data.forEach(function(row,rowidx){ + // Limit number of rows on the sheet + if(rowidx>sheet.limit) return; + // Create row + s += ''; + s2 += s; + s2 += ''; + stylesn++; + } + return 's'+styles[hh].styleid; + } + + for (var sheetid in sheets) { + var sheet = sheets[sheetid]; + + // If columns defined in sheet, then take them + if(typeof sheet.columns != 'undefined') { + columns = sheet.columns; + } else { + // Autogenerate columns if they are passed as parameters + if(columns.length == 0 && data.length > 0) { + if(typeof data[0] == 'object') { + if(data[0] instanceof Array) { + columns = data[0].map(function(d,columnidx){ + return {columnid:columnidx}; + }); + } else { + columns = Object.keys(data[0]).map(function(columnid){ + return {columnid:columnid}; + }); + } + } + } + }; + + // Prepare columns + columns.forEach(function(column,columnidx){ + if(typeof sheet.column != 'undefined') { + extend(column,sheet.column); + } + + if(typeof column.width == 'undefined') { + if(sheet.column && (typeof sheet.column.width !='undefined')) { + column.width = sheet.column.width; + } else { + column.width = 120; + } + } + if(typeof column.width == 'number') column.width = column.width; + if(typeof column.columnid == 'undefined') column.columnid = columnidx; + if(typeof column.title == 'undefined') column.title = ""+column.columnid.trim(); + if(sheet.headers && sheet.headers instanceof Array) column.title = sheet.headers[idx]; + }); + + // Header + s3 +=' \ + '; + + columns.forEach(function (column,columnidx) { + + s3 += '' + }); + + // Headers + if(sheet.headers) { + s3 += ''; + + // TODO: Skip columns to body + + // Headers + columns.forEach(function (column,columnidx) { + + s3 += ' 0) { + // Loop over data rows + data.forEach(function(row,rowidx){ + // Limit number of rows on the sheet + if(rowidx>sheet.limit) return; + + // Extend row properties + var srow = {}; + extend(srow,sheet.row); + if(sheet.rows && sheet.rows[rowidx]) { + extend(srow,sheet.rows[rowidx]); + } + + s3 += '' + + // Data + columns.forEach(function (column,columnidx) { + + // Parameters + var cell = {}; + extend(cell,sheet.cell); + extend(cell,srow.cell); + if(typeof sheet.column != 'undefined') { + extend(cell,sheet.column.cell); + } + extend(cell,column.cell); + if(sheet.cells && sheet.cells[rowidx] && sheet.cells[rowidx][columnidx]) { + extend(cell,sheet.cells[rowidx][columnidx]); + }; + + // Create value + var value = row[column.columnid]; + if(typeof cell.value == 'function') { + value = cell.value(value,sheet,row,column,cell,rowidx,columnidx); + } + + // Define cell type + var typeid = cell.typeid; + if(typeof typeid == 'function') { + typeid = typeid(value,sheet,row,column,cell,rowidx,columnidx); + } + + if(typeof typeid == 'undefined') { + if(typeof value == 'number') typeid = 'number'; + else if(typeof value == 'string') typeid = 'string'; + else if(typeof value == 'boolean') typeid = 'boolean'; + else if(typeof value == 'object') { + if(value instanceof Date) typeid = 'date'; + } + }; + + var Type = 'String'; + if(typeid == 'number') Type = 'Number'; + else if(typeid == 'date') Type = 'Date'; + // TODO: What else? + + // Prepare Data types styles + var typestyle = ''; + + if(typeid == 'money') { + typestyle = 'mso-number-format:\"\\#\\,\\#\\#0\\\\ _р_\\.\";white-space:normal;'; + } else if(typeid == 'number') { + typestyle = ' '; + } else if (typeid == 'date') { + typestyle = 'mso-number-format:\"Short Date\";'; + } else { + // For other types is saved + if( opts.types && opts.types[typeid] && opts.types[typeid].typestyle) { + typestyle = opts.types[typeid].typestyle; + } + } + + // TODO Replace with extend... + typestyle = typestyle || 'mso-number-format:\"\\@\";'; // Default type style + + s3 += ''; + + // TODO Replace with extend... + var format = cell.format; + if(typeof value == 'undefined') { + s3 += ''; + } else if(typeof format != 'undefined') { + if(typeof format == 'function') { + s3 += format(value); + } else if(typeof format == 'string') { + s3 += value; // TODO - add string format + } else { + throw new Error('Unknown format type. Should be function or string'); + } + } else { + if(typeid == 'number' || typeid == 'date') { + s3 += value.toString(); + } else if(typeid == 'money') { + s3 += (+value).toFixed(2); + } else { + s3 += value; + } + } + + s3 += ''; + }); + + s3 += ''; + }); + + } + // Finish + s3 += '
'; + }; + + s3 +=''; + + return s1+s2+s3; + }; - var tbody = document.createElement('tbody'); - tbe.appendChild(tbody); - for(var j=0;j 0) { + data.forEach(function(dat,idx){ + prepareSheet(opts[idx],dat,undefined,idx+1) + }); + } + } else { + prepareSheet(opts,data,columns,1); + } + + saveWorkbook(cb); + + } + + /** + Prepare sheet + @params {object} opts + @params {array} data + @params {array} columns Columns + */ + function prepareSheet(opts, data, columns, idx) { + + /** Default options for sheet */ + var opt = {sheetid:'Sheet '+idx,headers:true}; + alasql.utils.extend(opt, opts); + + // Generate columns if they are not defined + if((!columns || columns.length == 0) && data.length > 0) { + columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); + } + + var cells = {}; + + if(wb.SheetNames.indexOf(opt.sheetid) > -1) { + cells = wb.Sheets[opt.sheetid]; + } else { + wb.SheetNames.push(opt.sheetid); + wb.Sheets[opt.sheetid] = {}; + cells = wb.Sheets[opt.sheetid]; + } + + var range = "A1"; + if(opt.range) range = opt.range; + + var col0 = alasql.utils.xlscn(range.match(/[A-Z]+/)[0]); + var row0 = +range.match(/[0-9]+/)[0]-1; + + if(wb.Sheets[opt.sheetid]['!ref']) { + var rangem = wb.Sheets[opt.sheetid]['!ref']; + var colm = alasql.utils.xlscn(rangem.match(/[A-Z]+/)[0]); + var rowm = +rangem.match(/[0-9]+/)[0]-1; + } else { + var colm = 1, rowm = 1; + } + var colmax = Math.max(col0+columns.length,colm); + var rowmax = Math.max(row0+data.length+2,rowm); + + var i = row0+1; + + wb.Sheets[opt.sheetid]['!ref'] = 'A1:'+alasql.utils.xlsnc(colmax)+(rowmax); + + if(opt.headers) { + columns.forEach(function(col, idx){ + cells[alasql.utils.xlsnc(col0+idx)+""+i] = {v:col.columnid.trim()}; + }); + i++; + } + + for(var j=0;j 0) { - columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); - }; - // If one parameter - if(typeof filename == 'object') { - opts = filename; - filename = undefined; - }; +alasql.from.METEOR = function(filename, opts, cb, idx, query) { + var res = filename.find(opts).fetch(); + if(cb){ + res = cb(res, idx, query); + } + return res; + }; + +/** + Google Spreadsheet reader + */ +alasql.from.TABLETOP = function(key, opts, cb, idx, query) { + var res = []; + + var opt = {headers:true, simpleSheet:true, key:key}; + alasql.utils.extend(opt, opts); + opt.callback = function(data){ + res = data; + if(cb){ + res = cb(res, idx, query); + } + }; + + Tabletop.init(opt); + return res; +}; - var res = data.length; - var s = ''; - if(data.length > 0) { - var key = columns[0].columnid; - s += data.map(function(d){ - return d[key]; - }).join('\n'); - } +alasql.from.HTML = function(selector, opts, cb, idx, query) { + var opt = {}; + alasql.utils.extend(opt, opts); + + var sel = document.querySelector(selector); + if(!sel && sel.tagName !== "TABLE") { + throw new Error('Selected HTML element is not a TABLE'); + } + + var res = []; + var headers = opt.headers; + + if(headers && !(headers instanceof Array)) { + headers = []; + var ths = sel.querySelector("thead tr").children; + for(var i=0;i 0) { - columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); - } - if(typeof filename == 'object') { - opts = filename; - filename = undefined; - } + } else if(filename instanceof Event) { + fname = filename.target.files[0].name; - var opt = {}; - //opt.separator = ','; - opt.separator = ';'; - opt.quote = '"'; - alasql.utils.extend(opt, opts); - var res = data.length; - var s = ''; - if(opt.headers) { - s += opt.quote+columns.map(function(col){ - return col.columnid.trim(); - }).join(opt.quote+opt.separator+opt.quote)+opt.quote+'\r\n'; - } + } else { + throw new Error("Wrong usage of FILE() function"); + } - data.forEach(function(d, idx){ - s += columns.map(function(col){ - var s = d[col.columnid]; - s = (s+"").replace(new RegExp('\\'+opt.quote,"g"),'""'); + var parts = fname.split('.'); - //Excel 2013 needs quotes around strings - thanks for _not_ complying with RFC for CSV - if(+s!=s){ // jshint ignore:line - s = opt.quote + s + opt.quote; - } + var ext = parts[parts.length-1].toUpperCase(); - return s; - }).join(opt.separator)+'\r\n'; - }); + if(alasql.from[ext]) { - res = alasql.utils.saveFile(filename,s); - if(cb) res = cb(res); - return res; -}; + return alasql.from[ext](filename, opts, cb, idx, query); + } else { + throw new Error('Cannot recognize file type for loading'); + } +}; -// -// 831xl.js - Coloring Excel -// 18.04.2015 -// Generate XLS file with colors and styles -// with Excel - -alasql.into.XLS = function(filename, opts, data, columns, cb) { - // If filename is not defined then output to the result - if(typeof filename == 'object') { - opts = filename; - filename = undefined; - } +// Read JSON file - // Set sheets - var sheets = {}; - if(opts && opts.sheets) { - sheets = opts.sheets; - }; +alasql.from.JSON = function(filename, opts, cb, idx, query) { + var res; - // Default sheet - var sheet = {}; - if(typeof sheets['Sheet1'] != 'undefined') { - sheet = sheets[0]; - } else { - if(typeof opts != 'undefined') { - sheet = opts; - } - }; + alasql.utils.loadFile(filename,!!cb,function(data){ - // Set sheet name and default is 'Sheet1' - if(typeof sheet.sheetid == 'undefined') { - sheet.sheetid = 'Sheet1'; - }; + res = JSON.parse(data); + if(cb){ + res = cb(res, idx, query); + } + }); + return res; +}; - var s = toHTML(); +alasql.from.TXT = function(filename, opts, cb, idx, query) { + var res; + alasql.utils.loadFile(filename,!!cb,function(data){ + res = data.split(/\r?\n/); + if(res[res.length-1] === '') res.pop(); // Remove last line if empty + for(var i=0, ilen=res.length; i \ - '; - - s += ''; - - // Generate body - s += '= N){ + return EOF; + } + if (eol){ + return eol = false, EOL; + } + var j = I; + if (text.charCodeAt(j) === quoteCode) { + var i = j; + while (i++ < N) { + if (text.charCodeAt(i) === quoteCode) { + if (text.charCodeAt(i + 1) !== quoteCode){ + break; + } + ++i; + } + } + I = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10){ + ++I; + } + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, '"'); + } + while (I < N) { + var c = text.charCodeAt(I++), k = 1; + if(c === 10){ + eol = true; + } else if (c === 13) { + eol = true; + if (text.charCodeAt(I) === 10){ + ++I; + ++k; + } + } else if(c !== delimiterCode){ + continue; + } + return text.substring(j, I - k); + } + return text.substring(j); + } + + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + + if(opt.headers) { + if(n === 0) { + if(typeof opt.headers === 'boolean') { + hs = a; + } else if(opt.headers instanceof Array) { + hs = opt.headers; + var r = {}; + hs.forEach(function(h,idx){ + r[h] = a[idx]; + // Please avoid === here + if((typeof r[h] !== 'undefined') && r[h].length !== 0 && (r[h]).trim() == +r[h]){ // jshint ignore:line + r[h] = +r[h]; + } + }); + rows.push(r); + } + + } else { + var r = {}; + hs.forEach(function(h,idx){ + r[h] = a[idx]; + if((typeof r[h] !== 'undefined') && r[h].length !== 0 && r[h].trim() == +r[h]){ // jshint ignore:line + r[h] = +r[h]; + } + }); + rows.push(r); + } + n++; + } else { + rows.push(a); + } + } + + res = rows; + + if(opt.headers) { + if(query && query.sources && query.sources[idx]) { + var columns = query.sources[idx].columns = []; + hs.forEach(function(h){ + columns.push({columnid:h}); + }); + } + } + + if(cb){ + res = cb(res, idx, query); + } + }); + return res; +}; - // Columns +function XLSXLSX(X,filename, opts, cb, idx, query) { + var opt = {}; + opts = opts || {}; + alasql.utils.extend(opt, opts); + if(typeof opt.headers == 'undefined') opt.headers = true; + var res; + + alasql.utils.loadBinaryFile(filename,!!cb,function(data){ + +// function processData(data) { + var workbook = X.read(data,{type:'binary'}); + + var sheetid; + if(typeof opt.sheetid === 'undefined') { + sheetid = workbook.SheetNames[0]; + } else { + sheetid = opt.sheetid; + } + var range; + if(typeof opt.range === 'undefined') { + range = workbook.Sheets[sheetid]['!ref']; + } else { + range = opt.range; + if(workbook.Sheets[sheetid][range]){ + range = workbook.Sheets[sheetid][range]; + } + } + var rg = range.split(':'); + var col0 = rg[0].match(/[A-Z]+/)[0]; + var row0 = +rg[0].match(/[0-9]+/)[0]; + var col1 = rg[1].match(/[A-Z]+/)[0]; + var row1 = +rg[1].match(/[0-9]+/)[0]; + + var hh = {}; + for(var j=alasql.utils.xlscn(col0);j<=alasql.utils.xlscn(col1);j++){ + var col = alasql.utils.xlsnc(j); + if(opt.headers) { + if(workbook.Sheets[sheetid][col+""+row0]) { + hh[col] = workbook.Sheets[sheetid][col+""+row0].v; + } else { + hh[col] = col; + } + } else { + hh[col] = col; + } + } + var res = []; + if(opt.headers){ + row0++; + } + for(var i=row0;i<=row1;i++) { + var row = {}; + for(var j=alasql.utils.xlscn(col0);j<=alasql.utils.xlscn(col1);j++){ + var col = alasql.utils.xlsnc(j); + if(workbook.Sheets[sheetid][col+""+i]) { + row[hh[col]] = workbook.Sheets[sheetid][col+""+i].v; + } + } + res.push(row); + } + + // Remove last empty line (issue #548) + if(res.length > 0 && res[res.length-1] && Object.keys(res[res.length-1]).length == 0) { + res.pop(); + } + + if(cb){ + res = cb(res, idx, query); + } + }, function(err){ + throw err; + }); + + return res; +} - // If columns defined in sheet, then take them - if(typeof sheet.columns != 'undefined') { - columns = sheet.columns; - } else { - // Autogenerate columns if they are passed as parameters - if(columns.length == 0 && data.length > 0) { - if(typeof data[0] == 'object') { - if(data[0] instanceof Array) { - columns = data[0].map(function(d,columnidx){ - return {columnid:columnidx}; - }); - } else { - columns = Object.keys(data[0]).map(function(columnid){ - return {columnid:columnid}; - }); - } - } - } - }; - - // Prepare columns - columns.forEach(function(column,columnidx){ - if(typeof sheet.column != 'undefined') { - extend(column,sheet.column); - } - - if(typeof column.width == 'undefined') { - if(sheet.column && sheet.column.width !='undefined') { - column.width = sheet.column.width; - - } else { - column.width = "120px"; - } - } - if(typeof column.width == 'number') column.width = column.width + "px"; - if(typeof column.columnid == 'undefined') column.columnid = columnidx; - if(typeof column.title == 'undefined') column.title = ""+column.columnid.trim(); - if(sheet.headers && sheet.headers instanceof Array) column.title = sheet.headers[columnidx]; - }); - - // Set columns widths - s += ''; - columns.forEach(function (column) { - s += ''; - }); - s += ''; - - // Headers - if(sheet.headers) { - s += ''; - s += ''; - - // TODO: Skip columns to body - - // Headers - columns.forEach(function (column,columnidx) { - - s += ' 0) { - - // TODO: Skip columns to body - - // Loop over data rows - data.forEach(function(row,rowidx){ - // Limit number of rows on the sheet - if(rowidx>sheet.limit) return; - // Create row - s += ''; - s2 += s; - s2 += ''; - stylesn++; - } - return 's'+styles[hh].styleid; - } - - for (var sheetid in sheets) { - var sheet = sheets[sheetid]; - - // If columns defined in sheet, then take them - if(typeof sheet.columns != 'undefined') { - columns = sheet.columns; - } else { - // Autogenerate columns if they are passed as parameters - if(columns.length == 0 && data.length > 0) { - if(typeof data[0] == 'object') { - if(data[0] instanceof Array) { - columns = data[0].map(function(d,columnidx){ - return {columnid:columnidx}; - }); - } else { - columns = Object.keys(data[0]).map(function(columnid){ - return {columnid:columnid}; - }); - } - } - } - }; - - // Prepare columns - columns.forEach(function(column,columnidx){ - if(typeof sheet.column != 'undefined') { - extend(column,sheet.column); - } - - if(typeof column.width == 'undefined') { - if(sheet.column && (typeof sheet.column.width !='undefined')) { - column.width = sheet.column.width; - } else { - column.width = 120; - } - } - if(typeof column.width == 'number') column.width = column.width; - if(typeof column.columnid == 'undefined') column.columnid = columnidx; - if(typeof column.title == 'undefined') column.title = ""+column.columnid.trim(); - if(sheet.headers && sheet.headers instanceof Array) column.title = sheet.headers[idx]; - }); - - // Header - s3 +=' \ - '; - - columns.forEach(function (column,columnidx) { - - s3 += '' - }); - - // Headers - if(sheet.headers) { - s3 += ''; - - // TODO: Skip columns to body - - // Headers - columns.forEach(function (column,columnidx) { - - s3 += ' 0) { - // Loop over data rows - data.forEach(function(row,rowidx){ - // Limit number of rows on the sheet - if(rowidx>sheet.limit) return; - - // Extend row properties - var srow = {}; - extend(srow,sheet.row); - if(sheet.rows && sheet.rows[rowidx]) { - extend(srow,sheet.rows[rowidx]); - } - - s3 += '' - - // Data - columns.forEach(function (column,columnidx) { - - // Parameters - var cell = {}; - extend(cell,sheet.cell); - extend(cell,srow.cell); - if(typeof sheet.column != 'undefined') { - extend(cell,sheet.column.cell); - } - extend(cell,column.cell); - if(sheet.cells && sheet.cells[rowidx] && sheet.cells[rowidx][columnidx]) { - extend(cell,sheet.cells[rowidx][columnidx]); - }; - - // Create value - var value = row[column.columnid]; - if(typeof cell.value == 'function') { - value = cell.value(value,sheet,row,column,cell,rowidx,columnidx); - } - - // Define cell type - var typeid = cell.typeid; - if(typeof typeid == 'function') { - typeid = typeid(value,sheet,row,column,cell,rowidx,columnidx); - } - - if(typeof typeid == 'undefined') { - if(typeof value == 'number') typeid = 'number'; - else if(typeof value == 'string') typeid = 'string'; - else if(typeof value == 'boolean') typeid = 'boolean'; - else if(typeof value == 'object') { - if(value instanceof Date) typeid = 'date'; - } - }; - - var Type = 'String'; - if(typeid == 'number') Type = 'Number'; - else if(typeid == 'date') Type = 'Date'; - // TODO: What else? - - // Prepare Data types styles - var typestyle = ''; - - if(typeid == 'money') { - typestyle = 'mso-number-format:\"\\#\\,\\#\\#0\\\\ _р_\\.\";white-space:normal;'; - } else if(typeid == 'number') { - typestyle = ' '; - } else if (typeid == 'date') { - typestyle = 'mso-number-format:\"Short Date\";'; - } else { - // For other types is saved - if( opts.types && opts.types[typeid] && opts.types[typeid].typestyle) { - typestyle = opts.types[typeid].typestyle; - } - } - - // TODO Replace with extend... - typestyle = typestyle || 'mso-number-format:\"\\@\";'; // Default type style - - s3 += ''; - - // TODO Replace with extend... - var format = cell.format; - if(typeof value == 'undefined') { - s3 += ''; - } else if(typeof format != 'undefined') { - if(typeof format == 'function') { - s3 += format(value); - } else if(typeof format == 'string') { - s3 += value; // TODO - add string format - } else { - throw new Error('Unknown format type. Should be function or string'); - } - } else { - if(typeid == 'number' || typeid == 'date') { - s3 += value.toString(); - } else if(typeid == 'money') { - s3 += (+value).toFixed(2); - } else { - s3 += value; - } - } - - s3 += ''; - }); - - s3 += ''; - }); - - } - // Finish - s3 += '
'; - }; - - s3 +=''; - - return s1+s2+s3; - }; - -}; - -/** - Export to XLSX function - @function - @param {string|object} filename Filename or options - @param {object|undefined} opts Options or undefined - @param {array} data Data - @param {array} columns Columns - @parab {callback} cb Callback function - @return {number} Number of files processed -*/ - -alasql.into.XLSX = function(filename, opts, data, columns, cb) { - - /** @type {number} result */ - var res = 1; - - if(deepEqual(columns,[{columnid:'_'}])) { - data = data.map(function(dat){return dat._;}); - columns = undefined; - - } else { - - } - - /* If Node.js then require() else in browser take a global */ - if(typeof exports == 'object') { - var XLSX = require('xlsx'); - } else { - var XLSX = window.XLSX; - }; - - /* If called without filename, use opts */ - if(typeof filename == 'object') { - opts = filename; - filename = undefined; - }; - - /** @type {object} Workbook */ - var wb = {SheetNames:[], Sheets:{}}; - - // Check overwrite flag - if(opts.sourcefilename) { - alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){ - wb = XLSX.read(data,{type:'binary'}); - doExport(); - }); - } else { - doExport(); - }; - - /* Return result */ - if(cb) res = cb(res); - return res; - - /** - Export workbook - @function - */ - function doExport() { - - /* - If opts is array of arrays then this is a - multisheet workboook, else it is a singlesheet - */ - if(typeof opts == 'object' && opts instanceof Array) { - if(data && data.length > 0) { - data.forEach(function(dat,idx){ - prepareSheet(opts[idx],dat,undefined,idx+1) - }); - } - } else { - prepareSheet(opts,data,columns,1); - } - - saveWorkbook(cb); - - } - - /** - Prepare sheet - @params {object} opts - @params {array} data - @params {array} columns Columns - */ - function prepareSheet(opts, data, columns, idx) { - - /** Default options for sheet */ - var opt = {sheetid:'Sheet '+idx,headers:true}; - alasql.utils.extend(opt, opts); - - // Generate columns if they are not defined - if((!columns || columns.length == 0) && data.length > 0) { - columns = Object.keys(data[0]).map(function(columnid){return {columnid:columnid}}); - } - - var cells = {}; - - if(wb.SheetNames.indexOf(opt.sheetid) > -1) { - cells = wb.Sheets[opt.sheetid]; - } else { - wb.SheetNames.push(opt.sheetid); - wb.Sheets[opt.sheetid] = {}; - cells = wb.Sheets[opt.sheetid]; - } - - var range = "A1"; - if(opt.range) range = opt.range; - - var col0 = alasql.utils.xlscn(range.match(/[A-Z]+/)[0]); - var row0 = +range.match(/[0-9]+/)[0]-1; - - if(wb.Sheets[opt.sheetid]['!ref']) { - var rangem = wb.Sheets[opt.sheetid]['!ref']; - var colm = alasql.utils.xlscn(rangem.match(/[A-Z]+/)[0]); - var rowm = +rangem.match(/[0-9]+/)[0]-1; - } else { - var colm = 1, rowm = 1; - } - var colmax = Math.max(col0+columns.length,colm); - var rowmax = Math.max(row0+data.length+2,rowm); - - var i = row0+1; - - wb.Sheets[opt.sheetid]['!ref'] = 'A1:'+alasql.utils.xlsnc(colmax)+(rowmax); - - if(opt.headers) { - columns.forEach(function(col, idx){ - cells[alasql.utils.xlsnc(col0+idx)+""+i] = {v:col.columnid.trim()}; - }); - i++; - } - - for(var j=0;j= N){ - return EOF; - } - if (eol){ - return eol = false, EOL; - } - var j = I; - if (text.charCodeAt(j) === quoteCode) { - var i = j; - while (i++ < N) { - if (text.charCodeAt(i) === quoteCode) { - if (text.charCodeAt(i + 1) !== quoteCode){ - break; - } - ++i; - } - } - I = i + 2; - var c = text.charCodeAt(i + 1); - if (c === 13) { - eol = true; - if (text.charCodeAt(i + 2) === 10){ - ++I; - } - } else if (c === 10) { - eol = true; - } - return text.substring(j + 1, i).replace(/""/g, '"'); - } - while (I < N) { - var c = text.charCodeAt(I++), k = 1; - if(c === 10){ - eol = true; - } else if (c === 13) { - eol = true; - if (text.charCodeAt(I) === 10){ - ++I; - ++k; - } - } else if(c !== delimiterCode){ - continue; - } - return text.substring(j, I - k); - } - return text.substring(j); - } - - while ((t = token()) !== EOF) { - var a = []; - while (t !== EOL && t !== EOF) { - a.push(t); - t = token(); - } - - if(opt.headers) { - if(n === 0) { - if(typeof opt.headers === 'boolean') { - hs = a; - } else if(opt.headers instanceof Array) { - hs = opt.headers; - var r = {}; - hs.forEach(function(h,idx){ - r[h] = a[idx]; - // Please avoid === here - if((typeof r[h] !== 'undefined') && r[h].length !== 0 && (r[h]).trim() == +r[h]){ // jshint ignore:line - r[h] = +r[h]; - } - }); - rows.push(r); - } - - } else { - var r = {}; - hs.forEach(function(h,idx){ - r[h] = a[idx]; - if((typeof r[h] !== 'undefined') && r[h].length !== 0 && r[h].trim() == +r[h]){ // jshint ignore:line - r[h] = +r[h]; - } - }); - rows.push(r); - } - n++; - } else { - rows.push(a); - } - } - - res = rows; - - if(opt.headers) { - if(query && query.sources && query.sources[idx]) { - var columns = query.sources[idx].columns = []; - hs.forEach(function(h){ - columns.push({columnid:h}); - }); - } - } - - if(cb){ - res = cb(res, idx, query); - } - }); - return res; -}; - -function XLSXLSX(X,filename, opts, cb, idx, query) { - var opt = {}; - opts = opts || {}; - alasql.utils.extend(opt, opts); - if(typeof opt.headers == 'undefined') opt.headers = true; - var res; - - alasql.utils.loadBinaryFile(filename,!!cb,function(data){ - -// function processData(data) { - var workbook = X.read(data,{type:'binary'}); - - var sheetid; - if(typeof opt.sheetid === 'undefined') { - sheetid = workbook.SheetNames[0]; - } else { - sheetid = opt.sheetid; - } - var range; - if(typeof opt.range === 'undefined') { - range = workbook.Sheets[sheetid]['!ref']; - } else { - range = opt.range; - if(workbook.Sheets[sheetid][range]){ - range = workbook.Sheets[sheetid][range]; - } - } - var rg = range.split(':'); - var col0 = rg[0].match(/[A-Z]+/)[0]; - var row0 = +rg[0].match(/[0-9]+/)[0]; - var col1 = rg[1].match(/[A-Z]+/)[0]; - var row1 = +rg[1].match(/[0-9]+/)[0]; - - var hh = {}; - for(var j=alasql.utils.xlscn(col0);j<=alasql.utils.xlscn(col1);j++){ - var col = alasql.utils.xlsnc(j); - if(opt.headers) { - if(workbook.Sheets[sheetid][col+""+row0]) { - hh[col] = workbook.Sheets[sheetid][col+""+row0].v; - } else { - hh[col] = col; - } - } else { - hh[col] = col; - } - } - var res = []; - if(opt.headers){ - row0++; - } - for(var i=row0;i<=row1;i++) { - var row = {}; - for(var j=alasql.utils.xlscn(col0);j<=alasql.utils.xlscn(col1);j++){ - var col = alasql.utils.xlsnc(j); - if(workbook.Sheets[sheetid][col+""+i]) { - row[hh[col]] = workbook.Sheets[sheetid][col+""+i].v; - } - } - res.push(row); - } - - // Remove last empty line (issue #548) - if(res.length > 0 && res[res.length-1] && Object.keys(res[res.length-1]).length == 0) { - res.pop(); - } - - if(cb){ - res = cb(res, idx, query); - } - }, function(err){ - throw err; - }); - - return res; -} - -alasql.from.XLS = function(filename, opts, cb, idx, query) { - var X; - if(typeof exports === 'object') { - X = require('xlsjs'); - } else { - X = window.XLS; - if(!X) { - throw new Error('XLS library is not attached'); - } - } - return XLSXLSX(X,filename, opts, cb, idx, query); -} - -alasql.from.XLSX = function(filename, opts, cb, idx, query) { - var X; - if(typeof exports === 'object') { - X = require('xlsx'); - } else { - X = window.XLSX; - if(!X) { - throw new Error('XLSX library is not attached'); - } - } - return XLSXLSX(X,filename, opts, cb, idx, query); -}; - -alasql.from.XML = function(filename, opts, cb, idx, query) { - var res; - - alasql.utils.loadFile(filename,!!cb,function(data){ - - res = xmlparse(data).root; - - if(cb) res = cb(res, idx, query); - }); - return res; -}; + if(cb) res = cb(res, idx, query); + }); + return res; +}; -/** - * Parse the given string of `xml`. - * - * @param {String} xml - * @return {Object} - * @api public - */ +/** + * Parse the given string of `xml`. + * + * @param {String} xml + * @return {Object} + * @api public + */ -function xmlparse(xml) { - xml = xml.trim(); +function xmlparse(xml) { + xml = xml.trim(); - // strip comments - xml = xml.replace(//g, ''); + // strip comments + xml = xml.replace(//g, ''); - return document(); + return document(); - /** - * XML document. - */ + /** + * XML document. + */ - function document() { - return { - declaration: declaration(), - root: tag() - } - } + function document() { + return { + declaration: declaration(), + root: tag() + } + } - /** - * Declaration. - */ + /** + * Declaration. + */ - function declaration() { - var m = match(/^<\?xml\s*/); - if (!m) return; + function declaration() { + var m = match(/^<\?xml\s*/); + if (!m) return; - // tag - var node = { - attributes: {} - }; + // tag + var node = { + attributes: {} + }; - // attributes - while (!(eos() || is('?>'))) { - var attr = attribute(); - if (!attr) return node; - node.attributes[attr.name] = attr.value; - } + // attributes + while (!(eos() || is('?>'))) { + var attr = attribute(); + if (!attr) return node; + node.attributes[attr.name] = attr.value; + } - match(/\?>\s*/); + match(/\?>\s*/); - return node; - } + return node; + } - /** - * Tag. - */ - - function tag() { - var m = match(/^<([\w-:.]+)\s*/); - if (!m) return; - - // name - var node = { - name: m[1], - attributes: {}, - children: [] - }; - - // attributes - while (!(eos() || is('>') || is('?>') || is('/>'))) { - var attr = attribute(); - if (!attr) return node; - node.attributes[attr.name] = attr.value; - } + /** + * Tag. + */ + + function tag() { + var m = match(/^<([\w-:.]+)\s*/); + if (!m) return; + + // name + var node = { + name: m[1], + attributes: {}, + children: [] + }; + + // attributes + while (!(eos() || is('>') || is('?>') || is('/>'))) { + var attr = attribute(); + if (!attr) return node; + node.attributes[attr.name] = attr.value; + } - // self closing tag - if (match(/^\s*\/>\s*/)) { - return node; - } + // self closing tag + if (match(/^\s*\/>\s*/)) { + return node; + } - match(/\??>\s*/); + match(/\??>\s*/); - // content - node.content = content(); + // content + node.content = content(); - // children - var child; - while (child = tag()) { - node.children.push(child); - } + // children + var child; + while (child = tag()) { + node.children.push(child); + } - // closing - match(/^<\/[\w-:.]+>\s*/); + // closing + match(/^<\/[\w-:.]+>\s*/); - return node; - } + return node; + } - /** - * Text content. - */ + /** + * Text content. + */ - function content() { - var m = match(/^([^<]*)/); - if (m) return m[1]; - return ''; - } + function content() { + var m = match(/^([^<]*)/); + if (m) return m[1]; + return ''; + } - /** - * Attribute. - */ + /** + * Attribute. + */ - function attribute() { - var m = match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/); - if (!m) return; - return { name: m[1], value: strip(m[2]) } - } + function attribute() { + var m = match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/); + if (!m) return; + return { name: m[1], value: strip(m[2]) } + } - /** - * Strip quotes from `val`. - */ + /** + * Strip quotes from `val`. + */ - function strip(val) { - return val.replace(/^['"]|['"]$/g, ''); - } + function strip(val) { + return val.replace(/^['"]|['"]$/g, ''); + } - /** - * Match `re` and advance the string. - */ + /** + * Match `re` and advance the string. + */ - function match(re) { - var m = xml.match(re); - if (!m) return; - xml = xml.slice(m[0].length); - return m; - } + function match(re) { + var m = xml.match(re); + if (!m) return; + xml = xml.slice(m[0].length); + return m; + } - /** - * End-of-source. - */ + /** + * End-of-source. + */ - function eos() { - return 0 == xml.length; - } + function eos() { + return 0 == xml.length; + } - /** - * Check for `prefix`. - */ + /** + * Check for `prefix`. + */ - function is(prefix) { - return 0 == xml.indexOf(prefix); - } -}; + function is(prefix) { + return 0 == xml.indexOf(prefix); + } +}; -alasql.from.GEXF = function(filename, opts, cb, idx, query) { +alasql.from.GEXF = function(filename, opts, cb, idx, query) { - var res; - alasql('SEARCH FROM XML('+filename+')',[],function(data){ - res = data; - console.log(res); - if(cb) res=cb(res); - }); - return res; -}; + var res; + alasql('SEARCH FROM XML('+filename+')',[],function(data){ + res = data; + console.log(res); + if(cb) res=cb(res); + }); + return res; +}; /* // @@ -15543,1431 +15543,1431 @@ yy.Assert.prototype.execute = function (databaseid) { return 1; }; -// -// 91websql.js -// WebSQL database support -// (c) 2014, Andrey Gershun -// - -var WEBSQL = alasql.engines.WEBSQL = function (){}; - -WEBSQL.createDatabase = function(wdbid, args, dbid, cb){ - var res = 1; - var wdb = openDatabase(wdbid, args[0], args[1], args[2]); - if(this.dbid) { - var db = alasql.createDatabase(this.dbid); - db.engineid = 'WEBSQL'; - db.wdbid = wdbid; - sb.wdb = db; - } - if(!wdb) { - throw new Error('Cannot create WebSQL database "'+databaseid+'"') - } - if(cb) cb(res); - return res; -}; - -WEBSQL.dropDatabase = function(databaseid){ - throw new Error('This is impossible to drop WebSQL database.'); -}; - -WEBSQL.attachDatabase = function(databaseid, dbid, args, params, cb){ - var res = 1; - if(alasql.databases[dbid]) { - throw new Error('Unable to attach database as "'+dbid+'" because it already exists'); - }; - alasqlopenDatabase(databaseid, args[0], args[1], args[2]); - return res; -} - -// -// 91indexeddb.js -// AlaSQL IndexedDB module -// Date: 18.04.2015 -// (c) Andrey Gershun -// - - if(typeof(window) != 'undefined' && window.indexedDB) { - -var IDB = alasql.engines.INDEXEDDB = function (){}; - -// For Chrome it work normally, for Firefox - simple shim -if(typeof window.indexedDB.webkitGetDatabaseNames == 'function') { - IDB.getDatabaseNames = window.indexedDB.webkitGetDatabaseNames.bind(window.indexedDB); -} else { - IDB.getDatabaseNames = function () { - var request = {}; - var result = { - contains:function(name){ - return true; // Always return true - }, - notsupported: true - }; - setTimeout(function(){ - var event = {target:{result:result}} - request.onsuccess(event); - },0); - return request; - }; - IDB.getDatabaseNamesNotSupported = true; -} - -// -// SHOW DATABASES -// work only in chrome -// -IDB.showDatabases = function(like,cb) { - - var request = IDB.getDatabaseNames(); - request.onsuccess = function(event) { - var dblist = event.target.result; - if(IDB.getDatabaseNamesNotSupported) { - throw new Error('SHOW DATABASE is not supported in this browser'); - } - var res = []; - if(like) { - var relike = new RegExp((like.value).replace(/\%/g,'.*'),'g'); - } - for(var i=0;i 0) { - res = res.filter(function(d){ - return d.databaseid.match(relike); - }); - } - }; - if(cb) cb(res); - return res; -}; + var cursor = event.target.result; -/** - Create table in localStorage database - @param databaseid {string} AlaSQL database id - @param tableid {string} Table id - @param ifnotexists {boolean} If not exists flag - @param cb {function} Callback -*/ + if(cursor) { + if((!wherefn) || wherefn(cursor.value,params)) { -LS.createTable = function(databaseid, tableid, ifnotexists, cb) { - var res = 1; - var lsdbid = alasql.databases[databaseid].lsdbid; - var tb = LS.get(lsdbid+'.'+tableid); - // Check if such record exists - if(tb && !ifnotexists) { - throw new Error('Table "'+tableid+'" alsready exists in localStorage database "'+lsdbid+'"'); - }; - var lsdb = LS.get(lsdbid); - var table = alasql.databases[databaseid].tables[tableid]; + cursor.delete(); + num++; + } + cursor.continue(); + } else { - // TODO: Check if required - lsdb.tables[tableid] = true; + ixdb.close(); + if(cb) cb(num); + } + } + } +} - LS.set(lsdbid, lsdb); - LS.storeTable(databaseid,tableid); +IDB.updateTable = function(databaseid, tableid, assignfn, wherefn, params, cb){ - if(cb) cb(res); - return res; -} + // console.trace(); + var ixdbid = alasql.databases[databaseid].ixdbid; + var request = window.indexedDB.open(ixdbid); + request.onsuccess = function(event) { + var res = []; + var ixdb = event.target.result; -/** - Create table in localStorage database - @param databaseid {string} AlaSQL database id - @param tableid {string} Table id - @param ifexists {boolean} If exists flag - @param cb {function} Callback -*/ + var tx = ixdb.transaction([tableid], 'readwrite'); + var store = tx.objectStore(tableid); + var cur = store.openCursor(); + var num = 0; -LS.dropTable = function (databaseid, tableid, ifexists, cb) { - var res = 1; - var lsdbid = alasql.databases[databaseid].lsdbid; - if(alasql.options.autocommit) { - var lsdb = LS.get(lsdbid); - } else { - var lsdb = alasql.databases[databaseid]; - } - if(!ifexists && !lsdb.tables[tableid]) { - throw new Error('Cannot drop table "'+tableid+'" in localStorage, because it does not exist'); - }; - delete lsdb.tables[tableid]; - LS.set(lsdbid, lsdb); -// localStorage.removeItem(lsdbid+'.'+tableid); - LS.removeTable(databaseid,tableid); - if(cb) cb(res); - return res; -} + cur.onblocked = function(event) { -/** - Read all data from table -*/ + } + cur.onerror = function(event) { -LS.fromTable = function(databaseid, tableid, cb, idx, query) { + } + cur.onsuccess = function(event) { - var lsdbid = alasql.databases[databaseid].lsdbid; -// var res = LS.get(lsdbid+'.'+tableid); + var cursor = event.target.result; - var res = LS.restoreTable(databaseid,tableid).data; + if(cursor) { + if((!wherefn) || wherefn(cursor.value,params)) { - if(cb) res = cb(res, idx, query); - return res; -}; + var r = cursor.value; + assignfn(r,params); -/** - Insert data into the table - @param databaseid {string} Database id - @param tableid {string} Table id - @param value {array} Array of values - @param columns {array} Columns (not used) - @param cb {function} Callback -*/ + cursor.update(r); + num++; + } + cursor.continue(); + } else { -LS.intoTable = function(databaseid, tableid, value, columns, cb) { + ixdb.close(); + if(cb) cb(num); + } + } + } +} - var lsdbid = alasql.databases[databaseid].lsdbid; - var res = value.length; -// var tb = LS.get(lsdbid+'.'+tableid); - var tb = LS.restoreTable(databaseid,tableid); - if(!tb.data) tb.data = []; - tb.data = tb.data.concat(value); -// LS.set(lsdbid+'.'+tableid, tb); - LS.storeTable(databaseid,tableid); +// Skip +} - if(cb) cb(res); +// +// 91localstorage.js +// localStorage and DOM-Storage engine +// Date: 09.12.2014 +// (c) Andrey Gershun +// - return res; -}; +var LS = alasql.engines.LOCALSTORAGE = function (){}; -/** - Laad data from table -*/ -LS.loadTableData = function(databaseid, tableid){ - var db = alasql.databases[databaseid]; - var lsdbid = alasql.databases[databaseid].lsdbid; - LS.restoreTable(databaseid,tableid); -// db.tables[tableid].data = LS.get(lsdbid+'.'+tableid); -} +/** + Read data from localStorage with security breaks + @param key {string} Address in localStorage + @return {object} JSON object +*/ +LS.get = function(key) { + var s = localStorage.getItem(key); + if(typeof s === "undefined") return; + var v = undefined; + try { + v = JSON.parse(s); + } catch(err) { + throw new Error('Cannot parse JSON object from localStorage'+s); + } + return v; +}; -/** - Save data to the table -*/ +/** + Store data into localStorage with security breaks + @param key {string} Address in localStorage + @return {object} JSON object +*/ +LS.set = function(key, value){ + if(typeof value === 'undefined') localStorage.removeItem(key); + else localStorage.setItem(key,JSON.stringify(value)); +}; -LS.saveTableData = function(databaseid, tableid){ - var db = alasql.databases[databaseid]; - var lsdbid = alasql.databases[databaseid].lsdbid; - LS.storeTable(lsdbid,tableid); -// LS.set(lsdbid+'.'+tableid,db.tables[tableid].data); - db.tables[tableid].data = undefined; -} +/** + Store table structure and data into localStorage + @param databaseid {string} AlaSQL database id (not external localStorage) + @param tableid {string} Table name + @return Nothing +*/ +LS.storeTable = function(databaseid,tableid) { + var db = alasql.databases[databaseid]; + var table = db.tables[tableid]; + // Create empty structure for table + var tbl = {}; + tbl.columns = table.columns; + tbl.data = table.data; + tbl.identities = table.identities; + // TODO: May be add indexes, objects and other fields? + LS.set(db.lsdbid+'.'+tableid,tbl); +}; -/** - Commit -*/ +/** + Restore table structure and data + @param databaseid {string} AlaSQL database id (not external localStorage) + @param tableid {string} Table name + @return Nothing +*/ +LS.restoreTable = function(databaseid,tableid) { + var db = alasql.databases[databaseid]; + var tbl = LS.get(db.lsdbid+'.'+tableid); + var table = new alasql.Table(); + for(var f in tbl) { + table[f] = tbl[f]; + } + db.tables[tableid] = table; + table.indexColumns(); + // We need to add other things here + return table; +}; -LS.commit = function(databaseid, cb) { +/** + Remove table from localStorage + @param databaseid {string} AlaSQL database id (not external localStorage) + @param tableid {string} Table name +*/ - var db = alasql.databases[databaseid]; - var lsdbid = alasql.databases[databaseid].lsdbid; - var lsdb = {databaseid:lsdbid, tables:{}}; - if(db.tables) { - for(var tbid in db.tables) { - // TODO: Question - do we need this line - lsdb.tables[tbid] = true; - LS.storeTable(databaseid,tbid); +LS.removeTable = function(databaseid,tableid) { + var db = alasql.databases[databaseid]; + localStorage.removeItem(db.lsdbid+'.'+tableid); +}; - }; - } - LS.set(lsdbid,lsdb); - return 1; -}; +/** + Create database in localStorage + @param lsdbid {string} localStorage database id + @param args {array} List of parameters (not used in localStorage) + @param ifnotexists {boolean} Check if database does not exist + @param databaseid {string} AlaSQL database id (not external localStorage) + @param cb {function} Callback +*/ -/** - Alias BEGIN = COMMIT -*/ -LS.begin = LS.commit; +LS.createDatabase = function(lsdbid, args, ifnotexists, databaseid, cb){ + var res = 1; + var ls = LS.get('alasql'); // Read list of all databases + if(!(ifnotexists && ls && ls.databases && ls.databases[lsdbid])) { + if(!ls) ls = {databases:{}}; // Empty record + if(ls.databases && ls.databases[lsdbid]) { + throw new Error('localStorage: Cannot create new database "'+lsdbid+'" because it already exists'); + } + ls.databases[lsdbid] = true; + LS.set('alasql',ls); + LS.set(lsdbid,{databaseid:lsdbid, tables:{}}); // Create database record + } else { + res = 0; + } + if(cb) cb(res); + return res; +}; -/** - ROLLBACK -*/ +/** + Drop external database + @param lsdbid {string} localStorage database id + @param ifexists {boolean} Check if database exists + @param cb {function} Callback +*/ +LS.dropDatabase = function(lsdbid, ifexists, cb){ + var res = 1; + var ls = LS.get('alasql'); + if(!(ifexists && ls && ls.databases && !ls.databases[lsdbid])) { + + // 1. Remove record from 'alasql' record + if(!ls) { + if(!ifexists) { + throw new Error('There is no any AlaSQL databases in localStorage'); + } else { + return 0; + } + }; + + if(ls.databases && !ls.databases[lsdbid]) { + throw new Error('localStorage: Cannot drop database "'+lsdbid+'" because there is no such database'); + } + delete ls.databases[lsdbid]; + LS.set('alasql',ls); + + // 2. Remove tables definitions + var db = LS.get(lsdbid); + for(var tableid in db.tables) { + localStorage.removeItem(lsdbid+'.'+tableid); + } + + // 3. Remove database definition + localStorage.removeItem(lsdbid); + } else { + res = 0; + } + if(cb) cb(res); + return res; +}; -LS.rollback = function(databaseid, cb) { +/** + Attach existing localStorage database to AlaSQL database + @param lsdibid {string} localStorage database id + @param +*/ - // This does not work and should be fixed - // Plus test 151 and 231 +LS.attachDatabase = function(lsdbid, databaseid, args, params, cb){ + var res = 1; + if(alasql.databases[databaseid]) { + throw new Error('Unable to attach database as "'+databaseid+'" because it already exists'); + }; + if(!databaseid) databaseid = lsdbid; + var db = new alasql.Database(databaseid); + db.engineid = "LOCALSTORAGE"; + db.lsdbid = lsdbid; + db.tables = LS.get(lsdbid).tables; + // IF AUTOCOMMIT IS OFF then copy data to memory + if(!alasql.options.autocommit) { + if(db.tables){ + for(var tbid in db.tables) { + LS.restoreTable(databaseid,tbid); + + } + } + } + if(cb) res = cb(res); + return res; +}; - return; +/** + Show list of databases from localStorage + @param like {string} Mathing pattern + @param cb {function} Callback +*/ +LS.showDatabases = function(like, cb) { + var res = []; + var ls = LS.get('alasql'); + if(like) { + // TODO: If we have a special function for LIKE patterns? + var relike = new RegExp(like.value.replace(/\%/g,'.*'),'g'); + } + if(ls && ls.databases) { + for(dbid in ls.databases) { + res.push({databaseid: dbid}); + }; + if(like && res && res.length > 0) { + res = res.filter(function(d){ + return d.databaseid.match(relike); + }); + } + }; + if(cb) cb(res); + return res; +}; - var db = alasql.databases[databaseid]; - db.dbversion++; +/** + Create table in localStorage database + @param databaseid {string} AlaSQL database id + @param tableid {string} Table id + @param ifnotexists {boolean} If not exists flag + @param cb {function} Callback +*/ - var lsdbid = alasql.databases[databaseid].lsdbid; - var lsdb = LS.get(lsdbid); -// if(!alasql.options.autocommit) { +LS.createTable = function(databaseid, tableid, ifnotexists, cb) { + var res = 1; + var lsdbid = alasql.databases[databaseid].lsdbid; + var tb = LS.get(lsdbid+'.'+tableid); + // Check if such record exists + if(tb && !ifnotexists) { + throw new Error('Table "'+tableid+'" alsready exists in localStorage database "'+lsdbid+'"'); + }; + var lsdb = LS.get(lsdbid); + var table = alasql.databases[databaseid].tables[tableid]; + + // TODO: Check if required + lsdb.tables[tableid] = true; + + LS.set(lsdbid, lsdb); + LS.storeTable(databaseid,tableid); + + if(cb) cb(res); + return res; +} - delete alasql.databases[databaseid]; - alasql.databases[databaseid] = new alasql.Database(databaseid); - extend(alasql.databases[databaseid], lsdb); - alasql.databases[databaseid].databaseid = databaseid; - alasql.databases[databaseid].engineid = 'LOCALSTORAGE'; +/** + Create table in localStorage database + @param databaseid {string} AlaSQL database id + @param tableid {string} Table id + @param ifexists {boolean} If exists flag + @param cb {function} Callback +*/ - if(lsdb.tables){ - for(var tbid in lsdb.tables) { +LS.dropTable = function (databaseid, tableid, ifexists, cb) { + var res = 1; + var lsdbid = alasql.databases[databaseid].lsdbid; + if(alasql.options.autocommit) { + var lsdb = LS.get(lsdbid); + } else { + var lsdb = alasql.databases[databaseid]; + } + if(!ifexists && !lsdb.tables[tableid]) { + throw new Error('Cannot drop table "'+tableid+'" in localStorage, because it does not exist'); + }; + delete lsdb.tables[tableid]; + LS.set(lsdbid, lsdb); +// localStorage.removeItem(lsdbid+'.'+tableid); + LS.removeTable(databaseid,tableid); + if(cb) cb(res); + return res; +} - LS.restoreTable(databaseid,tbid); +/** + Read all data from table +*/ - // index columns - // convert types - } - } -// } +LS.fromTable = function(databaseid, tableid, cb, idx, query) { -} + var lsdbid = alasql.databases[databaseid].lsdbid; +// var res = LS.get(lsdbid+'.'+tableid); -// -// 91websql.js -// WebSQL database support -// (c) 2014, Andrey Gershun -// + var res = LS.restoreTable(databaseid,tableid).data; -var SQLITE = alasql.engines.SQLITE = function (){}; + if(cb) res = cb(res, idx, query); + return res; +}; -SQLITE.createDatabase = function(wdbid, args, ifnotexists, dbid, cb){ - throw new Error('Connot create SQLITE database in memory. Attach it.'); -}; +/** + Insert data into the table + @param databaseid {string} Database id + @param tableid {string} Table id + @param value {array} Array of values + @param columns {array} Columns (not used) + @param cb {function} Callback +*/ -SQLITE.dropDatabase = function(databaseid){ - throw new Error('This is impossible to drop SQLite database. Detach it.'); -}; +LS.intoTable = function(databaseid, tableid, value, columns, cb) { -SQLITE.attachDatabase = function(sqldbid, dbid, args, params, cb){ - var res = 1; - if(alasql.databases[dbid]) { - throw new Error('Unable to attach database as "'+dbid+'" because it already exists'); - }; + var lsdbid = alasql.databases[databaseid].lsdbid; + var res = value.length; +// var tb = LS.get(lsdbid+'.'+tableid); + var tb = LS.restoreTable(databaseid,tableid); + if(!tb.data) tb.data = []; + tb.data = tb.data.concat(value); +// LS.set(lsdbid+'.'+tableid, tb); + LS.storeTable(databaseid,tableid); - if(args[0] && (args[0] instanceof yy.StringValue) - || (args[0] instanceof yy.ParamValue)) { + if(cb) cb(res); - if(args[0] instanceof yy.StringValue) { - var value = args[0].value; - } else if(args[0] instanceof yy.ParamValue) { - var value = params[args[0].param]; - } - alasql.utils.loadBinaryFile(value,true,function(data){ - var db = new alasql.Database(dbid || sqldbid); - db.engineid = "SQLITE"; - db.sqldbid = sqldbid; - var sqldb = db.sqldb = new SQL.Database(data); - db.tables = []; - var tables = sqldb.exec("SELECT * FROM sqlite_master WHERE type='table'")[0].values; - - tables.forEach(function(tbl){ - db.tables[tbl[1]] = {}; - var columns = db.tables[tbl[1]].columns = []; - var ast = alasql.parse(tbl[4]); - - var coldefs = ast.statements[0].columns; - if(coldefs && coldefs.length>0) { - coldefs.forEach(function(cd){ - columns.push(cd); - }); - } - - }); - - cb(1); - }, function(err){ - throw new Error('Cannot open SQLite database file "'+args[0].value+'"'); - }) - return res; - } else { - throw new Error('Cannot attach SQLite database without a file'); - }; + return res; +}; - return res; -} +/** + Laad data from table +*/ +LS.loadTableData = function(databaseid, tableid){ + var db = alasql.databases[databaseid]; + var lsdbid = alasql.databases[databaseid].lsdbid; + LS.restoreTable(databaseid,tableid); +// db.tables[tableid].data = LS.get(lsdbid+'.'+tableid); +} -SQLITE.fromTable = function(databaseid, tableid, cb, idx, query){ - var data = alasql.databases[databaseid].sqldb.exec("SELECT * FROM "+tableid); - var columns = query.sources[idx].columns = []; - if(data[0].columns.length > 0) { - data[0].columns.forEach(function(columnid) { - columns.push({columnid:columnid}); - }); - }; +/** + Save data to the table +*/ - var res = []; - if(data[0].values.length > 0) { - data[0].values.forEach(function(d){ - var r = {}; - columns.forEach(function(col,idx){ - r[col.columnid] = d[idx]; - }); - res.push(r); - }); - } - if(cb) cb(res, idx, query); -}; +LS.saveTableData = function(databaseid, tableid){ + var db = alasql.databases[databaseid]; + var lsdbid = alasql.databases[databaseid].lsdbid; + LS.storeTable(lsdbid,tableid); +// LS.set(lsdbid+'.'+tableid,db.tables[tableid].data); + db.tables[tableid].data = undefined; +} -SQLITE.intoTable = function(databaseid, tableid, value, columns, cb) { - var sqldb = alasql.databases[databaseid].sqldb; - for(var i=0, ilen = value.length;i0) { + coldefs.forEach(function(cd){ + columns.push(cd); + }); + } + + }); + + cb(1); + }, function(err){ + throw new Error('Cannot open SQLite database file "'+args[0].value+'"'); + }) + return res; + } else { + throw new Error('Cannot attach SQLite database without a file'); + }; + + return res; +} -FS.fromTable = function(databaseid, tableid, cb, idx, query) { +SQLITE.fromTable = function(databaseid, tableid, cb, idx, query){ + var data = alasql.databases[databaseid].sqldb.exec("SELECT * FROM "+tableid); + var columns = query.sources[idx].columns = []; + if(data[0].columns.length > 0) { + data[0].columns.forEach(function(columnid) { + columns.push({columnid:columnid}); + }); + }; + + var res = []; + if(data[0].values.length > 0) { + data[0].values.forEach(function(d){ + var r = {}; + columns.forEach(function(col,idx){ + r[col.columnid] = d[idx]; + }); + res.push(r); + }); + } + if(cb) cb(res, idx, query); +}; - var db = alasql.databases[databaseid]; - var res = db.data[tableid]; - if(cb) res = cb(res, idx, query); - return res; -}; +SQLITE.intoTable = function(databaseid, tableid, value, columns, cb) { + var sqldb = alasql.databases[databaseid].sqldb; + for(var i=0, ilen = value.length;i 1) { - var sql = 'REQUIRE ' + paths.map(function(p){ - return '"'+p+'"'; - }).join(","); - alasql(sql,[],cb); - } - - } else if(path === false) { - delete alasql.webworker; - return; - } - }; +/*if (typeof importScripts === 'function') { + // Nothing +} else */ +if(typeof exports !== 'object') { + + alasql.worker = function(path, paths, cb) { + // var path; + if(path === true){ + path = undefined; + } + + if (typeof path === "undefined") { + var sc = document.getElementsByTagName('script'); + for(var i=0;i 1) { + var sql = 'REQUIRE ' + paths.map(function(p){ + return '"'+p+'"'; + }).join(","); + alasql(sql,[],cb); + } + + } else if(path === false) { + delete alasql.webworker; + return; + } + }; -} +} diff --git a/dist/alasql.min.js b/dist/alasql.min.js old mode 100755 new mode 100644 index 7d1eed7502..ca52af0f32 --- a/dist/alasql.min.js +++ b/dist/alasql.min.js @@ -1,4 +1,4 @@ -!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.alasql=t()}(this,function(){function e(){if(T.path="","function"==typeof importScripts)T.path="";else if("undefined"!=typeof exports)T.path=__dirname;else if("object"==typeof Meteor&&Meteor.isClient)T.path="/packages/dist/";else if("object"==typeof Meteor&&Meteor.isServer)T.path="assets/packages/dist/";else if("undefined"!=typeof document)for(var e=document.getElementsByTagName("script"),t=0;t0;){var b=h.shift(),g=b.node,m=b.stack,c=r(l.args,0,g);if(c.length>0){if(n+1+1>e.length)return m;var v=[];return m&&m.length>0&&m.forEach(function(t){v=v.concat(r(e,n+1,t))}),v}"undefined"==typeof f[g.$id]&&(f[g.$id]=!0,g.$out&&g.$out.length>0&&g.$out.forEach(function(e){var t=p[e],n=m.concat(t);n.push(p[t.$out[0]]),h.push({node:p[t.$out[0]],stack:n})}))}return[]}if("NOT"===l.selid){var u=r(l.args,0,a);return u.length>0?[]:n+1+1>e.length?[a]:r(e,n+1,a)}if("DISTINCT"===l.selid){var u;if(u="undefined"==typeof l.args||0===l.args.length?V(a):r(l.args,0,a),0===u.length)return[];var E=V(u);return n+1+1>e.length?E:r(e,n+1,E)}if("AND"===l.selid){var E=!0;return l.args.forEach(function(e){E=E&&r(e,0,a).length>0}),E?n+1+1>e.length?[a]:r(e,n+1,a):[]}if("OR"===l.selid){var E=!1;return l.args.forEach(function(e){E=E||r(e,0,a).length>0}),E?n+1+1>e.length?[a]:r(e,n+1,a):[]}if("ALL"===l.selid){var u=r(l.args[0],0,a);return 0===u.length?[]:n+1+1>e.length?u:r(e,n+1,u)}if("ANY"===l.selid){var u=r(l.args[0],0,a);return 0===u.length?[]:n+1+1>e.length?[u[0]]:r(e,n+1,[u[0]])}if("UNIONALL"===l.selid){var u=[];return l.args.forEach(function(e){u=u.concat(r(e,0,a))}),0===u.length?[]:n+1+1>e.length?u:r(e,n+1,u)}if("UNION"===l.selid){var u=[];l.args.forEach(function(e){u=u.concat(r(e,0,a))});var u=V(u);return 0===u.length?[]:n+1+1>e.length?u:r(e,n+1,u)}if("IF"===l.selid){var u=r(l.args,0,a);return 0===u.length?[]:n+1+1>e.length?[a]:r(e,n+1,a)}if("REPEAT"===l.selid){var y,S,w=l.args[0].value;S=l.args[1]?l.args[1].value:w,l.args[2]&&(y=l.args[2].variable);var x=[];if(0===w&&(n+1+1>e.length?x=[a]:(y&&(T.vars[y]=0),x=x.concat(r(e,n+1,a)))),S>0)for(var A=[{value:a,lvl:1}],C=0;A.length>0;){var u=A[0];if(A.shift(),u.lvl<=S){y&&(T.vars[y]=u.lvl);var k=r(l.sels,0,u.value);k.forEach(function(e){A.push({value:e,lvl:u.lvl+1})}),u.lvl>=w&&(n+1+1>e.length?x=x.concat(k):k.forEach(function(t){x=x.concat(r(e,n+1,t))}))}if(C++,C>d)throw new Error("Security brake. Number of iterations = "+C)}return x}if("OF"===l.selid){if(n+1+1>e.length)return[a];var O=[];return Object.keys(a).forEach(function(t){T.vars[l.args[0].variable]=t,O=O.concat(r(e,n+1,a[t]))}),O}if("TO"===l.selid){var R=T.vars[l.args[0]],N=[];if(N=void 0!==R?R.slice(0):[],N.push(a),n+1+1>e.length)return[a];T.vars[l.args[0]]=N;var O=r(e,n+1,a);return T.vars[l.args[0]]=R,O}if("ARRAY"===l.selid){var u=r(l.args,0,a);return u.length>0?(o=u,n+1+1>e.length?[o]:r(e,n+1,o)):[]}if("SUM"===l.selid){var u=r(l.args,0,a);if(!(u.length>0))return[];var o=u.reduce(function(e,t){return e+t},0);return n+1+1>e.length?[o]:r(e,n+1,o)}if("AVG"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u.reduce(function(e,t){return e+t},0)/u.length,n+1+1>e.length?[o]:r(e,n+1,o)):[];if("COUNT"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u.length,n+1+1>e.length?[o]:r(e,n+1,o)):[];if("FIRST"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u[0],n+1+1>e.length?[o]:r(e,n+1,o)):[];if("LAST"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u[u.length-1],n+1+1>e.length?[o]:r(e,n+1,o)):[];if("MIN"===l.selid){if(u=r(l.args,0,a),0===u.length)return[];var o=u.reduce(function(e,t){return Math.min(e,t)},1/0);return n+1+1>e.length?[o]:r(e,n+1,o)}if("MAX"===l.selid){var u=r(l.args,0,a);if(0===u.length)return[];var o=u.reduce(function(e,t){return Math.max(e,t)},-(1/0));return n+1+1>e.length?[o]:r(e,n+1,o)}if("PLUS"===l.selid){var x=[],A=r(l.args,0,a).slice();n+1+1>e.length?x=x.concat(A):A.forEach(function(t){x=x.concat(r(e,n+1,t))});for(var C=0;A.length>0;){var u=A.shift();if(u=r(l.args,0,u),A=A.concat(u),n+1+1>e.length?x=x.concat(u):u.forEach(function(t){var a=r(e,n+1,t);x=x.concat(a)}),C++,C>d)throw new Error("Security brake. Number of iterations = "+C)}return x}if("STAR"===l.selid){var x=[];x=r(e,n+1,a);var A=r(l.args,0,a).slice();n+1+1>e.length?x=x.concat(A):A.forEach(function(t){x=x.concat(r(e,n+1,t))});for(var C=0;A.length>0;){var u=A[0];if(A.shift(),u=r(l.args,0,u),A=A.concat(u),n+1+1<=e.length&&u.forEach(function(t){x=x.concat(r(e,n+1,t))}),C++,C>d)throw new Error("Loop brake. Number of iterations = "+C)}return x}if("QUESTION"===l.selid){var x=[];x=x.concat(r(e,n+1,a));var u=r(l.args,0,a);return n+1+1<=e.length&&u.forEach(function(t){x=x.concat(r(e,n+1,t))}),x}if("WITH"!==l.selid){if("ROOT"===l.selid)return n+1+1>e.length?[a]:r(e,n+1,s);throw new Error("Wrong selector "+l.selid)}var u=r(l.args,0,a);if(0===u.length)return[];var c={status:1,values:u}}else{if(!l.srchid)throw new Error("Selector not found");var c=T.srch[l.srchid.toUpperCase()](a,l.args,i,t)}"undefined"==typeof c&&(c={status:1,values:[a]});var E=[];if(1===c.status){var $=c.values;if(n+1+1>e.length)E=$;else for(var C=0;C0&&(o&&o[0]&&"PROP"===o[0].srchid&&o[0].args&&o[0].args[0]&&("XML"===o[0].args[0].toUpperCase()?(i.mode="XML",o.shift()):"HTML"===o[0].args[0].toUpperCase()?(i.mode="HTML",o.shift()):"JSON"===o[0].args[0].toUpperCase()&&(i.mode="JSON",o.shift())),o.length>0&&"VALUE"===o[0].srchid&&(i.value=!0,o.shift())),this.from instanceof X.Column){var u=this.from.databaseid||e;s=T.databases[u].tables[this.from.columnid].data}else if(this.from instanceof X.FuncValue&&T.from[this.from.funcid.toUpperCase()]){var c=this.from.args.map(function(e){var n=e.toJS(),r=new Function("params,alasql","var y;return "+n).bind(this);return r(t,T)});s=T.from[this.from.funcid.toUpperCase()].apply(this,c)}else if("undefined"==typeof this.from)s=T.databases[e].objects;else{var l=new Function("params,alasql","var y;return "+this.from.toJS());s=l(t,T),"object"==typeof Mongo&&"object"!=typeof Mongo.Collection&&s instanceof Mongo.Collection&&(s=s.find().fetch())}if(a=void 0!==o&&o.length>0?r(o,0,s):s,this.into){var d,h;"undefined"!=typeof this.into.args[0]&&(d=new Function("params,alasql","var y;return "+this.into.args[0].toJS())(t,T)),"undefined"!=typeof this.into.args[1]&&(h=new Function("params,alasql","var y;return "+this.into.args[1].toJS())(t,T)),a=T.into[this.into.funcid.toUpperCase()](d,h,a,[],n)}else i.value&&a.length>0&&(a=a[0]),n&&(a=n(a));return a}function u(e,t,n,r,a){e.sources.length;e.sourceslen=e.sources.length;var s=e.sourceslen;e.query=e,e.A=r,e.B=a,e.cb=n,e.oldscope=t,e.queriesfn&&(e.sourceslen+=e.queriesfn.length,s+=e.queriesfn.length,e.queriesdata=[],e.queriesfn.forEach(function(t,n){t.query.params=e.params,c([],-n-1,e)}));var i;i=t?M(t):{},e.scope=i;var o;return e.sources.forEach(function(t,n){t.query=e;var r=t.datafn(e,e.params,c,n,T);void 0!==typeof r&&((e.intofn||e.intoallfn)&&r instanceof Array&&(r=r.length),o=r),t.queriesdata=e.queriesdata}),(0==e.sources.length||0===s)&&(o=l(e)),o}function c(e,t,n){if(t>=0){var r=n.sources[t];r.data=e,"function"==typeof r.data&&(r.getfn=r.data,r.dontcache=r.getfn.dontcache,("OUTER"==r.joinmode||"RIGHT"==r.joinmode||"ANTI"==r.joinmode)&&(r.dontcache=!1),r.data={})}else n.queriesdata[-t-1]=_(e);return n.sourceslen--,n.sourceslen>0?void 0:l(n)}function l(e){var t=e.scope;preIndex(e),e.data=[],e.xgroups={},e.groups=[];var n=0;if(f(e,t,n),e.groupfn){if(e.data=[],0===e.groups.length){var r={};e.selectGroup.length>0&&e.selectGroup.forEach(function(e){"COUNT"==e.aggregatorid||"SUM"==e.aggregatorid?r[e.nick]=0:r[e.nick]=void 0}),e.groups=[r]}if(e.aggrKeys.length>0){var a="";e.aggrKeys.forEach(function(e){a+="g['"+e.nick+"']=alasql.aggr['"+e.funcid+"'](undefined,g['"+e.nick+"'],3);"});var s=new Function("g,params,alasql","var y;"+a)}for(var i=0,o=e.groups.length;o>i;i++){var r=e.groups[i];if(s&&s(r,e.params,T),!e.havingfn||e.havingfn(r,e.params,T)){var u=e.selectgfn(r,e.params,T);e.data.push(u)}}}if(h(e),e.unionallfn){var c,l;if(e.corresponding)e.unionallfn.query.modifier||(e.unionallfn.query.modifier=void 0),c=e.unionallfn(e.params);else{e.unionallfn.query.modifier||(e.unionallfn.query.modifier="RECORDSET"),l=e.unionallfn(e.params),c=[],o=l.data.length;for(var i=0;o>i;i++){for(var p={},b=0,g=Math.min(e.columns.length,l.columns.length);g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}}e.data=e.data.concat(c)}else if(e.unionfn){if(e.corresponding)e.unionfn.query.modifier||(e.unionfn.query.modifier="ARRAY"),c=e.unionfn(e.params);else{e.unionfn.query.modifier||(e.unionfn.query.modifier="RECORDSET"),l=e.unionfn(e.params),c=[],o=l.data.length;for(var i=0;o>i;i++){p={},g=Math.min(e.columns.length,l.columns.length);for(var b=0;g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}}e.data=q(e.data,c)}else if(e.exceptfn){if(e.corresponding){e.exceptfn.query.modifier||(e.exceptfn.query.modifier="ARRAY");var c=e.exceptfn(e.params)}else{e.exceptfn.query.modifier||(e.exceptfn.query.modifier="RECORDSET");for(var l=e.exceptfn(e.params),c=[],i=0,o=l.data.length;o>i;i++){for(var p={},b=0,g=Math.min(e.columns.length,l.columns.length);g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}}e.data=U(e.data,c)}else if(e.intersectfn){if(e.corresponding)e.intersectfn.query.modifier||(e.intersectfn.query.modifier=void 0),c=e.intersectfn(e.params);else for(e.intersectfn.query.modifier||(e.intersectfn.query.modifier="RECORDSET"),l=e.intersectfn(e.params),c=[],o=l.data.length,i=0;o>i;i++){for(p={},g=Math.min(e.columns.length,l.columns.length),b=0;g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}e.data=F(e.data,c)}if(e.orderfn){if(e.explain)var m=Date.now();e.data=e.data.sort(e.orderfn),e.explain&&e.explaination.push({explid:e.explid++,description:"QUERY BY",ms:Date.now()-m})}if(d(e),"undefined"!=typeof angular&&e.removeKeys.push("$$hashKey"),e.removeKeys.length>0){var v=e.removeKeys;if(g=v.length,g>0)for(o=e.data.length,i=0;o>i;i++)for(b=0;g>b;b++)delete e.data[i][v[b]];e.columns.length>0&&(e.columns=e.columns.filter(function(e){var t=!1;return v.forEach(function(n){e.columnid==n&&(t=!0)}),!t}))}if("undefined"!=typeof e.removeLikeKeys&&e.removeLikeKeys.length>0){for(var E=e.removeLikeKeys,i=0,o=e.data.length;o>i;i++){p=e.data[i];for(var y in p)for(b=0;b0&&(e.columns=e.columns.filter(function(e){var t=!1;return E.forEach(function(n){T.utils.like(n,e.columnid)&&(t=!0)}),!t}))}if(e.pivotfn&&e.pivotfn(),e.unpivotfn&&e.unpivotfn(),e.intoallfn){var S=e.intoallfn(e.columns,e.cb,e.params,e.alasql);return S}if(e.intofn){for(o=e.data.length,i=0;o>i;i++)e.intofn(e.data[i],i,e.params,e.alasql);return e.cb&&e.cb(e.data.length,e.A,e.B),e.data.length}return S=e.data,e.cb&&(S=e.cb(e.data,e.A,e.B)),S}function d(e){if(e.limit){var t=0;e.offset&&(t=(0|e.offset)-1||0);var n;n=e.percent?(e.data.length*e.limit/100|0)+t:(0|e.limit)+t,e.data=e.data.slice(t,n)}}function h(e){if(e.distinct){for(var t={},n=0,r=e.data.length;r>n;n++){var a=Object.keys(e.data[n]).map(function(t){return e.data[n][t]}).join("`");t[a]=e.data[n]}e.data=[];for(var s in t)e.data.push(t[s])}}function f(e,t,n){if(n>=e.sources.length)e.wherefn(t,e.params,T)&&(e.groupfn?e.groupfn(t,e.params,T):e.data.push(e.selectfn(t,e.params,T)));else if(e.sources[n].applyselect){var r=e.sources[n];r.applyselect(e.params,function(a){if(a.length>0)for(var s=0;sc;)u||!r.getfn||r.dontcache||(o[c]=l),t[s]=l,r.onleftfn&&r.onleftfn(t,e.params,T)!=r.onrightfn(t,e.params,T)||r.onmiddlefn(t,e.params,T)&&("SEMI"!=r.joinmode&&"ANTI"!=r.joinmode&&f(e,t,n+1),"LEFT"!=r.joinmode&&"INNER"!=r.joinmode&&(l._rightjoin=!0),i=!0),c++;if("LEFT"!=r.joinmode&&"OUTER"!=r.joinmode&&"SEMI"!=r.joinmode||i||(t[s]={},f(e,t,n+1)),n+1h;)a.getfn&&!a.dontcache&&(a.data[h]=l),l._rightjoin?delete l._rightjoin:0==n&&(t[a.alias]=l,f(e,t,n+2)),h++}t[s]=void 0}}function p(e,t){if("undefined"==typeof t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)return t;var n=e.modifier||T.options.modifier,r=e.columns;if("undefined"==typeof r||0==r.length)if(t.length>0){for(var a={},s=0;s0){var i;i=r&&r.length>0?r[0].columnid:Object.keys(t[0])[0],t=t[0][i]}else t=void 0;else if("ROW"===n)if(t.length>0){var i,o=[];for(var i in t[0])o.push(t[0][i]);t=o}else t=void 0;else if("COLUMN"===n){var u=[];if(t.length>0){var i;i=r&&r.length>0?r[0].columnid:Object.keys(t[0])[0];for(var s=0,c=t.length;c>s;s++)u.push(t[s][i])}t=u}else if("MATRIX"===n){for(var u=[],s=0;s0)i=r[0].columnid,h=r[1].columnid;else{var f=Object.keys(t[0]);i=f[0],h=f[1]}for(var s=0,c=t.length;c>s;s++)u[t[s][i]]=t[s][h];t=u}else if("RECORDSET"===n)t=new T.Recordset({data:t,columns:r});else if("TEXTSTRING"===n){var i;i=r&&r.length>0?r[0].columnid:Object.keys(t[0])[0];for(var s=0,c=t.length;c>s;s++)t[s]=t[s][i];t=t.join("\n")}return t}function b(e,t,n){var r="",a=[];e.ixsources={},e.sources.forEach(function(t){e.ixsources[t.alias]=t});var s;if(e.ixsources[t])var s=e.ixsources[t].columns;return n&&"json"==T.options.joinstar&&(r+="r['"+t+"']={};"),s&&s.length>0?s.forEach(function(s){n&&"underscore"==T.options.joinstar?a.push("'"+t+"_"+s.columnid+"':p['"+t+"']['"+s.columnid+"']"):n&&"json"==T.options.joinstar?r+="r['"+t+"']['"+s.columnid+"']=p['"+t+"']['"+s.columnid+"'];":a.push("'"+s.columnid+"':p['"+t+"']['"+s.columnid+"']"),e.selectColumns[C(s.columnid)]=!0;var i={columnid:s.columnid,dbtypeid:s.dbtypeid,dbsize:s.dbsize,dbprecision:s.dbprecision,dbenum:s.dbenum};e.columns.push(i),e.xcolumns[i.columnid]=i}):(r+='var w=p["'+t+'"];for(var k in w){r[k]=w[k]};',e.dirtyColumns=!0),{s:a.join(","),sp:r}}function g(e,t){if(e instanceof Array){for(var n=[[]],r=0;ra;a++)t+=""+(a+1),n.forEach(function(n){t+=" ",+e[a][n]===+e[a][n]?(t+='
',t+="undefined"==typeof e[a][n]?"NULL":e[a][n],t+="
"):t+="undefined"==typeof e[a][n]?"NULL":"string"==typeof e[a][n]?e[a][n]:se(e[a][n])});t+=""}else t+="

"+se(e)+"

";return t}function y(e,t,n){if(!(0>=n)){var r=t-e.scrollTop,a=r/n*10;setTimeout(function(){e.scrollTop!==t&&(e.scrollTop=e.scrollTop+a,y(e,t,n-10))},10)}}function S(e,t,n,r,a,s){var i={};n=n||{},T.utils.extend(i,n),"undefined"==typeof i.headers&&(i.headers=!0);var o;return T.utils.loadBinaryFile(t,!!r,function(t){var n,o=e.read(t,{type:"binary"});n="undefined"==typeof i.sheetid?o.SheetNames[0]:i.sheetid;var u;"undefined"==typeof i.range?u=o.Sheets[n]["!ref"]:(u=i.range,o.Sheets[n][u]&&(u=o.Sheets[n][u]));for(var c=u.split(":"),l=c[0].match(/[A-Z]+/)[0],d=+c[0].match(/[0-9]+/)[0],h=c[1].match(/[A-Z]+/)[0],f=+c[1].match(/[0-9]+/)[0],p={},b=T.utils.xlscn(l);b<=T.utils.xlscn(h);b++){var g=T.utils.xlsnc(b);i.headers&&o.Sheets[n][g+""+d]?p[g]=o.Sheets[n][g+""+d].v:p[g]=g}var m=[];i.headers&&d++;for(var v=d;f>=v;v++){for(var E={},b=T.utils.xlscn(l);b<=T.utils.xlscn(h);b++){var g=T.utils.xlsnc(b);o.Sheets[n][g+""+v]&&(E[p[g]]=o.Sheets[n][g+""+v].v)}m.push(E)}m.length>0&&m[m.length-1]&&0==Object.keys(m[m.length-1]).length&&m.pop(),r&&(m=r(m,a,s))},function(e){throw e}),o}function w(e){function t(){return{declaration:n(),root:r()}}function n(){var e=o(/^<\?xml\s*/);if(e){for(var t={attributes:{}};!u()&&!c("?>");){var n=s();if(!n)return t;t.attributes[n.name]=n.value}return o(/\?>\s*/),t}}function r(){var e=o(/^<([\w-:.]+)\s*/);if(e){for(var t={name:e[1],attributes:{},children:[]};!(u()||c(">")||c("?>")||c("/>"));){var n=s();if(!n)return t;t.attributes[n.name]=n.value}if(o(/^\s*\/>\s*/))return t;o(/\??>\s*/),t.content=a();for(var i;i=r();)t.children.push(i);return o(/^<\/[\w-:.]+>\s*/),t}}function a(){var e=o(/^([^<]*)/);return e?e[1]:""}function s(){var e=o(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(e)return{name:e[1],value:i(e[2])}}function i(e){return e.replace(/^['"]|['"]$/g,"")}function o(t){var n=e.match(t);if(n)return e=e.slice(n[0].length),n}function u(){return 0==e.length}function c(t){return 0==e.indexOf(t)}return e=e.trim(),e=e.replace(//g,""),t()}var T=function fe(e,t,n,r){if("function"==typeof importScripts||!fe.webworker){if(0===arguments.length)return new X.Select({columns:[new X.Column({columnid:"*"})],from:[new X.ParamValue({param:0})]});if(1===arguments.length&&"object"==typeof e&&e instanceof Array){var a=new X.Select({columns:[new X.Column({columnid:"*"})],from:[new X.ParamValue({param:0})]});return a.preparams=[e],a}return"string"==typeof e&&"#"===e[0]&&"object"==typeof document?e=document.querySelector(e).textContent:"object"==typeof e&&e instanceof HTMLElement?e=e.textContent:"function"==typeof e&&(e=e.toString().slice(14,-3)),fe.exec(e,t,n,r)}var s=fe.lastid++;fe.buffer[s]=n,fe.webworker.postMessage({id:s,sql:e,params:t})};T.version="0.2.2-fix-delete-where-1156",T.debug=void 0,e();var x=function(){function e(){this.yy={}}var t=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},n=[2,10],r=[1,102],a=[1,103],s=[1,6],i=[1,42],o=[1,78],u=[1,75],c=[1,94],l=[1,93],d=[1,68],h=[1,101],f=[1,85],p=[1,70],b=[1,83],g=[1,65],m=[1,69],v=[1,63],E=[1,67],y=[1,60],S=[1,73],w=[1,61],x=[1,66],A=[1,82],C=[1,76],k=[1,84],R=[1,86],N=[1,87],$=[1,80],D=[1,81],I=[1,79],L=[1,88],q=[1,89],U=[1,90],F=[1,91],M=[1,92],j=[1,98],V=[1,64],P=[1,77],_=[1,71],B=[1,96],G=[1,97],J=[1,62],H=[1,72],W=[1,106],X=[1,107],Y=[8,297,509,510],K=[8,297,301,509,510],Q=[1,114],z=[1,115],Z=[1,116],ee=[1,117],te=[1,118],ne=[127,343,399],re=[1,126],ae=[1,125],se=[1,131],ie=[1,159],oe=[1,170],ue=[1,173],ce=[1,168],le=[1,176],de=[1,180],he=[1,177],fe=[1,164],pe=[1,166],be=[1,169],ge=[1,178],me=[1,161],ve=[1,187],Ee=[1,183],ye=[1,184],Se=[1,188],we=[1,189],Te=[1,190],xe=[1,191],Ae=[1,192],Ce=[1,193],ke=[1,194],Oe=[1,195],Re=[1,196],Ne=[1,171],$e=[1,172],De=[1,174],Ie=[1,175],Le=[1,181],qe=[1,179],Ue=[1,182],Fe=[1,165],Me=[1,167],je=[1,186],Ve=[1,197],Pe=[4,5],_e=[2,455],Be=[1,200],Ge=[1,205],Je=[1,214],He=[1,210],We=[8,69,75,90,95,115,125,159,165,166,180,195,229,242,244,297,301,509,510],Xe=[4,5,8,69,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,180,182,184,195,273,274,275,276,277,278,279,280,281,297,301,410,414,509,510],Ye=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ke=[1,244],Qe=[1,251],ze=[1,260],Ze=[1,265],et=[1,264],tt=[4,5,8,69,74,75,90,95,104,115,125,128,129,134,140,142,149,151,153,159,165,166,176,177,178,180,195,229,242,244,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,297,301,307,319,410,414,509,510],nt=[2,158],rt=[1,276],at=[8,71,75,297,301,496,509,510],st=[4,5,8,69,74,75,90,95,104,115,125,128,129,134,140,142,149,151,153,159,161,165,166,176,177,178,180,182,184,192,195,229,242,244,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,297,301,307,319,410,414,509,510],it=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,190,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,360,363,364,376,378,385,389,390,391,392,393,394,395,397,398,406,407,408,410,414,416,418,424,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,505,506,507,508,509,510],ot=[4,5,8,51,69,86,121,143,153,186,262,283,297,326,329,330,337,385,389,390,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,508,509,510],ut=[1,289],ct=[1,291],lt=[2,487],dt=[1,296],ht=[1,307],ft=[1,310],pt=[1,311],bt=[8,75,86,129,134,143,186,289,297,301,461,509,510],gt=[8,71,297,301,509,510],mt=[2,552],vt=[1,327],Et=[4,5,153],yt=[1,364],St=[1,336],wt=[1,370],Tt=[1,371],xt=[1,344],At=[1,355],Ct=[1,342],kt=[1,350],Ot=[1,343],Rt=[1,351],Nt=[1,353],$t=[1,345],Dt=[1,346],It=[1,365],Lt=[1,362],qt=[1,363],Ut=[1,339],Ft=[1,341],Mt=[1,334],jt=[1,335],Vt=[1,337],Pt=[1,338],_t=[1,340],Bt=[1,347],Gt=[1,348],Jt=[1,352],Ht=[1,354],Wt=[1,356],Xt=[1,357],Yt=[1,358],Kt=[1,359],Qt=[1,360],zt=[1,366],Zt=[1,367],en=[1,368],tn=[1,369],nn=[2,283],rn=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,363,364,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],an=[2,351],sn=[1,392],on=[1,402],un=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],cn=[1,418],ln=[1,426],dn=[1,425],hn=[4,5,8,69,71,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],fn=[8,69,71,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],pn=[2,198],bn=[1,448],gn=[8,69,75,90,95,115,125,159,165,166,180,229,242,244,297,301,509,510],mn=[2,159],vn=[1,451],En=[4,5,109],yn=[1,464],Sn=[1,483],wn=[1,463],Tn=[1,462],xn=[1,457],An=[1,458],Cn=[1,460],kn=[1,461],On=[1,465],Rn=[1,466],Nn=[1,467],$n=[1,468],Dn=[1,469],In=[1,470],Ln=[1,471],qn=[1,472],Un=[1,473],Fn=[1,474],Mn=[1,475],jn=[1,476],Vn=[1,477],Pn=[1,478],_n=[1,479],Bn=[1,480],Gn=[1,482],Jn=[1,484],Hn=[1,485],Wn=[1,486],Xn=[1,487],Yn=[1,488],Kn=[1,489],Qn=[1,490],zn=[1,493],Zn=[1,494],er=[1,495],tr=[1,496],nr=[1,497],rr=[1,498],ar=[1,499],sr=[1,500],ir=[1,501],or=[1,502],ur=[1,503],cr=[1,504],lr=[71,86,186],dr=[8,71,75,151,184,227,290,297,301,333,346,358,359,363,364,509,510],hr=[1,521],fr=[8,71,75,297,301,509,510],pr=[1,522],br=[1,530],gr=[4,5,74,128,129,134,140,142,149,151,153,176,177,178,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,307,319,410,414],mr=[8,69,75,90,95,104,115,125,159,165,166,180,195,229,242,244,297,301,509,510],vr=[4,5,129,289],Er=[1,564],yr=[8,71,73,75,297,301,509,510],Sr=[2,722],wr=[8,71,73,75,129,136,138,142,149,297,301,410,414,509,510],Tr=[2,878],xr=[8,71,73,75,136,138,142,149,297,301,410,414,509,510],Ar=[8,71,73,75,136,138,142,297,301,410,414,509,510],Cr=[8,71,75,136,138,297,301,509,510],kr=[8,75,86,129,143,186,289,297,301,461,509,510],Or=[326,329,330],Rr=[2,748],Nr=[1,589],$r=[1,590],Dr=[1,591],Ir=[1,592],Lr=[1,596],qr=[1,597],Ur=[161,163,325],Fr=[2,434],Mr=[1,651],jr=[4,5,74,128,153,283,284,285,286],Vr=[1,666],Pr=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],_r=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Br=[2,366],Gr=[1,673],Jr=[297,299,301],Hr=[71,418],Wr=[71,416,418],Xr=[1,680],Yr=[4,5,8,51,69,71,73,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Kr=[71,416],Qr=[8,69,75,90,95,115,125,159,165,166,229,242,244,297,301,509,510],zr=[1,717],Zr=[8,69,75,297,301,509,510],ea=[1,723],ta=[1,724],na=[1,725],ra=[4,5,8,69,71,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,195,273,274,275,276,277,278,279,280,281,297,301,410,414,509,510],aa=[1,775],sa=[1,774],ia=[1,788],oa=[8,69,71,75,90,95,104,115,125,159,165,166,180,195,229,242,244,297,301,509,510],ua=[1,819],ca=[8,75,86,143,186,297,301,461,509,510],la=[1,839],da=[1,838],ha=[1,837],fa=[1,850],pa=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],ba=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,305,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],ga=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,130,131,132,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],ma=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],va=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,115,119,121,125,126,127,128,129,131,132,134,136,137,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,304,310,311,312,313,314,315,316,321,322,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ea=[2,396],ya=[4,5,8,51,69,71,73,74,75,86,90,92,95,104,115,119,125,126,127,128,129,131,132,134,140,142,143,145,146,147,149,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,304,321,322,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Sa=[2,281],wa=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ta=[1,886],xa=[8,75,297,301,509,510],Aa=[1,897],Ca=[8,69,75,115,125,159,165,166,229,242,244,297,301,509,510],ka=[8,69,71,75,90,95,115,125,159,165,166,180,195,229,242,244,297,301,509,510],Oa=[4,5,69,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,182,184,273,274,275,276,277,278,279,280,281,410,414],Ra=[4,5,69,71,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,182,184,273,274,275,276,277,278,279,280,281,410,414],Na=[2,802],$a=[4,5,69,71,73,74,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,182,184,273,274,275,276,277,278,279,280,281,410,414],Da=[1,949],Ia=[8,71,75,125,297,299,301,455,509,510],La=[1,958],qa=[1,957],Ua=[2,569],Fa=[1,979],Ma=[73,136],ja=[2,708],Va=[1,996],Pa=[1,997],_a=[4,5,8,51,69,73,86,121,143,153,186,227,262,283,297,301,326,329,330,337,385,389,390,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,508,509,510],Ba=[1,1004],Ga=[1,1005],Ja=[2,322],Ha=[1,1023],Wa=[1,1033],Xa=[8,71,75,297,299,301,455,509,510],Ya=[1,1036],Ka=[8,69,71,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,229,242,244,297,301,509,510],Qa=[8,297,299,301,455,509,510],za=[8,69,75,115,159,165,166,229,242,244,297,301,509,510],Za=[1,1051],es=[1,1055],ts=[1,1056],ns=[1,1058],rs=[1,1059],as=[1,1060],ss=[1,1061],is=[1,1062],os=[1,1063],us=[1,1064],cs=[1,1065],ls=[1,1090],ds=[71,75],hs=[112,113,121],fs=[1,1149],ps=[8,69,75,115,159,165,166,242,244,297,301,509,510],bs=[8,69,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,229,242,244,297,301,509,510],gs=[1,1190],ms=[1,1192],vs=[4,5,74,140,142,149,153,178,283,284,285,286,293,410,414],Es=[1,1206],ys=[8,69,71,75,159,165,166,242,244,297,301,509,510],Ss=[1,1225],ws=[1,1227],Ts=[1,1228],xs=[1,1224],As=[1,1223],Cs=[1,1222],ks=[1,1229],Os=[1,1219],Rs=[1,1220],Ns=[1,1221],$s=[1,1246],Ds=[4,5,8,51,69,86,121,143,153,186,262,283,297,301,326,329,330,337,385,389,390,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,508,509,510],Is=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,363,364,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ls=[1,1260],qs=[1,1268],Us=[1,1267],Fs=[8,69,75,159,165,166,242,244,297,301,509,510],Ms=[8,69,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],js=[4,5,8,69,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],Vs=[1,1325],Ps=[1,1327],_s=[1,1324],Bs=[1,1326],Gs=[184,190,358,359,360,363],Js=[2,499],Hs=[1,1332],Ws=[1,1353],Xs=[8,69,75,159,165,166,297,301,509,510],Ys=[1,1363],Ks=[1,1364],Qs=[1,1365],zs=[1,1384],Zs=[4,8,240,297,301,333,346,509,510],ei=[1,1433],ti=[8,69,71,75,115,159,165,166,236,242,244,297,301,509,510],ni=[4,5,74],ri=[1,1527],ai=[1,1539],si=[1,1558],ii=[8,69,75,159,165,166,297,301,404,509,510],oi=[8,71,75,227,297,301,509,510],ui={ +!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.alasql=t()}(this,function(){function e(){if(T.path="","function"==typeof importScripts)T.path="";else if("undefined"!=typeof exports)T.path=__dirname;else if("object"==typeof Meteor&&Meteor.isClient)T.path="/packages/dist/";else if("object"==typeof Meteor&&Meteor.isServer)T.path="assets/packages/dist/";else if("undefined"!=typeof document)for(var e=document.getElementsByTagName("script"),t=0;t0;){var b=h.shift(),g=b.node,m=b.stack,c=r(l.args,0,g);if(c.length>0){if(n+1+1>e.length)return m;var v=[];return m&&m.length>0&&m.forEach(function(t){v=v.concat(r(e,n+1,t))}),v}"undefined"==typeof f[g.$id]&&(f[g.$id]=!0,g.$out&&g.$out.length>0&&g.$out.forEach(function(e){var t=p[e],n=m.concat(t);n.push(p[t.$out[0]]),h.push({node:p[t.$out[0]],stack:n})}))}return[]}if("NOT"===l.selid){var u=r(l.args,0,a);return u.length>0?[]:n+1+1>e.length?[a]:r(e,n+1,a)}if("DISTINCT"===l.selid){var u;if(u="undefined"==typeof l.args||0===l.args.length?V(a):r(l.args,0,a),0===u.length)return[];var E=V(u);return n+1+1>e.length?E:r(e,n+1,E)}if("AND"===l.selid){var E=!0;return l.args.forEach(function(e){E=E&&r(e,0,a).length>0}),E?n+1+1>e.length?[a]:r(e,n+1,a):[]}if("OR"===l.selid){var E=!1;return l.args.forEach(function(e){E=E||r(e,0,a).length>0}),E?n+1+1>e.length?[a]:r(e,n+1,a):[]}if("ALL"===l.selid){var u=r(l.args[0],0,a);return 0===u.length?[]:n+1+1>e.length?u:r(e,n+1,u)}if("ANY"===l.selid){var u=r(l.args[0],0,a);return 0===u.length?[]:n+1+1>e.length?[u[0]]:r(e,n+1,[u[0]])}if("UNIONALL"===l.selid){var u=[];return l.args.forEach(function(e){u=u.concat(r(e,0,a))}),0===u.length?[]:n+1+1>e.length?u:r(e,n+1,u)}if("UNION"===l.selid){var u=[];l.args.forEach(function(e){u=u.concat(r(e,0,a))});var u=V(u);return 0===u.length?[]:n+1+1>e.length?u:r(e,n+1,u)}if("IF"===l.selid){var u=r(l.args,0,a);return 0===u.length?[]:n+1+1>e.length?[a]:r(e,n+1,a)}if("REPEAT"===l.selid){var y,S,w=l.args[0].value;S=l.args[1]?l.args[1].value:w,l.args[2]&&(y=l.args[2].variable);var x=[];if(0===w&&(n+1+1>e.length?x=[a]:(y&&(T.vars[y]=0),x=x.concat(r(e,n+1,a)))),S>0)for(var A=[{value:a,lvl:1}],C=0;A.length>0;){var u=A[0];if(A.shift(),u.lvl<=S){y&&(T.vars[y]=u.lvl);var k=r(l.sels,0,u.value);k.forEach(function(e){A.push({value:e,lvl:u.lvl+1})}),u.lvl>=w&&(n+1+1>e.length?x=x.concat(k):k.forEach(function(t){x=x.concat(r(e,n+1,t))}))}if(C++,C>d)throw new Error("Security brake. Number of iterations = "+C)}return x}if("OF"===l.selid){if(n+1+1>e.length)return[a];var O=[];return Object.keys(a).forEach(function(t){T.vars[l.args[0].variable]=t,O=O.concat(r(e,n+1,a[t]))}),O}if("TO"===l.selid){var R=T.vars[l.args[0]],N=[];if(N=void 0!==R?R.slice(0):[],N.push(a),n+1+1>e.length)return[a];T.vars[l.args[0]]=N;var O=r(e,n+1,a);return T.vars[l.args[0]]=R,O}if("ARRAY"===l.selid){var u=r(l.args,0,a);return u.length>0?(o=u,n+1+1>e.length?[o]:r(e,n+1,o)):[]}if("SUM"===l.selid){var u=r(l.args,0,a);if(!(u.length>0))return[];var o=u.reduce(function(e,t){return e+t},0);return n+1+1>e.length?[o]:r(e,n+1,o)}if("AVG"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u.reduce(function(e,t){return e+t},0)/u.length,n+1+1>e.length?[o]:r(e,n+1,o)):[];if("COUNT"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u.length,n+1+1>e.length?[o]:r(e,n+1,o)):[];if("FIRST"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u[0],n+1+1>e.length?[o]:r(e,n+1,o)):[];if("LAST"===l.selid)return u=r(l.args,0,a),u.length>0?(o=u[u.length-1],n+1+1>e.length?[o]:r(e,n+1,o)):[];if("MIN"===l.selid){if(u=r(l.args,0,a),0===u.length)return[];var o=u.reduce(function(e,t){return Math.min(e,t)},1/0);return n+1+1>e.length?[o]:r(e,n+1,o)}if("MAX"===l.selid){var u=r(l.args,0,a);if(0===u.length)return[];var o=u.reduce(function(e,t){return Math.max(e,t)},-(1/0));return n+1+1>e.length?[o]:r(e,n+1,o)}if("PLUS"===l.selid){var x=[],A=r(l.args,0,a).slice();n+1+1>e.length?x=x.concat(A):A.forEach(function(t){x=x.concat(r(e,n+1,t))});for(var C=0;A.length>0;){var u=A.shift();if(u=r(l.args,0,u),A=A.concat(u),n+1+1>e.length?x=x.concat(u):u.forEach(function(t){var a=r(e,n+1,t);x=x.concat(a)}),C++,C>d)throw new Error("Security brake. Number of iterations = "+C)}return x}if("STAR"===l.selid){var x=[];x=r(e,n+1,a);var A=r(l.args,0,a).slice();n+1+1>e.length?x=x.concat(A):A.forEach(function(t){x=x.concat(r(e,n+1,t))});for(var C=0;A.length>0;){var u=A[0];if(A.shift(),u=r(l.args,0,u),A=A.concat(u),n+1+1<=e.length&&u.forEach(function(t){x=x.concat(r(e,n+1,t))}),C++,C>d)throw new Error("Loop brake. Number of iterations = "+C)}return x}if("QUESTION"===l.selid){var x=[];x=x.concat(r(e,n+1,a));var u=r(l.args,0,a);return n+1+1<=e.length&&u.forEach(function(t){x=x.concat(r(e,n+1,t))}),x}if("WITH"!==l.selid){if("ROOT"===l.selid)return n+1+1>e.length?[a]:r(e,n+1,s);throw new Error("Wrong selector "+l.selid)}var u=r(l.args,0,a);if(0===u.length)return[];var c={status:1,values:u}}else{if(!l.srchid)throw new Error("Selector not found");var c=T.srch[l.srchid.toUpperCase()](a,l.args,i,t)}"undefined"==typeof c&&(c={status:1,values:[a]});var E=[];if(1===c.status){var $=c.values;if(n+1+1>e.length)E=$;else for(var C=0;C0&&(o&&o[0]&&"PROP"===o[0].srchid&&o[0].args&&o[0].args[0]&&("XML"===o[0].args[0].toUpperCase()?(i.mode="XML",o.shift()):"HTML"===o[0].args[0].toUpperCase()?(i.mode="HTML",o.shift()):"JSON"===o[0].args[0].toUpperCase()&&(i.mode="JSON",o.shift())),o.length>0&&"VALUE"===o[0].srchid&&(i.value=!0,o.shift())),this.from instanceof X.Column){var u=this.from.databaseid||e;s=T.databases[u].tables[this.from.columnid].data}else if(this.from instanceof X.FuncValue&&T.from[this.from.funcid.toUpperCase()]){var c=this.from.args.map(function(e){var n=e.toJS(),r=new Function("params,alasql","var y;return "+n).bind(this);return r(t,T)});s=T.from[this.from.funcid.toUpperCase()].apply(this,c)}else if("undefined"==typeof this.from)s=T.databases[e].objects;else{var l=new Function("params,alasql","var y;return "+this.from.toJS());s=l(t,T),"object"==typeof Mongo&&"object"!=typeof Mongo.Collection&&s instanceof Mongo.Collection&&(s=s.find().fetch())}if(a=void 0!==o&&o.length>0?r(o,0,s):s,this.into){var d,h;"undefined"!=typeof this.into.args[0]&&(d=new Function("params,alasql","var y;return "+this.into.args[0].toJS())(t,T)),"undefined"!=typeof this.into.args[1]&&(h=new Function("params,alasql","var y;return "+this.into.args[1].toJS())(t,T)),a=T.into[this.into.funcid.toUpperCase()](d,h,a,[],n)}else i.value&&a.length>0&&(a=a[0]),n&&(a=n(a));return a}function u(e,t,n,r,a){e.sources.length;e.sourceslen=e.sources.length;var s=e.sourceslen;e.query=e,e.A=r,e.B=a,e.cb=n,e.oldscope=t,e.queriesfn&&(e.sourceslen+=e.queriesfn.length,s+=e.queriesfn.length,e.queriesdata=[],e.queriesfn.forEach(function(t,n){t.query.params=e.params,c([],-n-1,e)}));var i;i=t?M(t):{},e.scope=i;var o;return e.sources.forEach(function(t,n){t.query=e;var r=t.datafn(e,e.params,c,n,T);void 0!==typeof r&&((e.intofn||e.intoallfn)&&r instanceof Array&&(r=r.length),o=r),t.queriesdata=e.queriesdata}),(0==e.sources.length||0===s)&&(o=l(e)),o}function c(e,t,n){if(t>=0){var r=n.sources[t];r.data=e,"function"==typeof r.data&&(r.getfn=r.data,r.dontcache=r.getfn.dontcache,("OUTER"==r.joinmode||"RIGHT"==r.joinmode||"ANTI"==r.joinmode)&&(r.dontcache=!1),r.data={})}else n.queriesdata[-t-1]=_(e);return n.sourceslen--,n.sourceslen>0?void 0:l(n)}function l(e){var t=e.scope;preIndex(e),e.data=[],e.xgroups={},e.groups=[];var n=0;if(f(e,t,n),e.groupfn){if(e.data=[],0===e.groups.length){var r={};e.selectGroup.length>0&&e.selectGroup.forEach(function(e){"COUNT"==e.aggregatorid||"SUM"==e.aggregatorid?r[e.nick]=0:r[e.nick]=void 0}),e.groups=[r]}if(e.aggrKeys.length>0){var a="";e.aggrKeys.forEach(function(e){a+="g['"+e.nick+"']=alasql.aggr['"+e.funcid+"'](undefined,g['"+e.nick+"'],3);"});var s=new Function("g,params,alasql","var y;"+a)}for(var i=0,o=e.groups.length;o>i;i++){var r=e.groups[i];if(s&&s(r,e.params,T),!e.havingfn||e.havingfn(r,e.params,T)){var u=e.selectgfn(r,e.params,T);e.data.push(u)}}}if(h(e),e.unionallfn){var c,l;if(e.corresponding)e.unionallfn.query.modifier||(e.unionallfn.query.modifier=void 0),c=e.unionallfn(e.params);else{e.unionallfn.query.modifier||(e.unionallfn.query.modifier="RECORDSET"),l=e.unionallfn(e.params),c=[],o=l.data.length;for(var i=0;o>i;i++){for(var p={},b=0,g=Math.min(e.columns.length,l.columns.length);g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}}e.data=e.data.concat(c)}else if(e.unionfn){if(e.corresponding)e.unionfn.query.modifier||(e.unionfn.query.modifier="ARRAY"),c=e.unionfn(e.params);else{e.unionfn.query.modifier||(e.unionfn.query.modifier="RECORDSET"),l=e.unionfn(e.params),c=[],o=l.data.length;for(var i=0;o>i;i++){p={},g=Math.min(e.columns.length,l.columns.length);for(var b=0;g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}}e.data=q(e.data,c)}else if(e.exceptfn){if(e.corresponding){e.exceptfn.query.modifier||(e.exceptfn.query.modifier="ARRAY");var c=e.exceptfn(e.params)}else{e.exceptfn.query.modifier||(e.exceptfn.query.modifier="RECORDSET");for(var l=e.exceptfn(e.params),c=[],i=0,o=l.data.length;o>i;i++){for(var p={},b=0,g=Math.min(e.columns.length,l.columns.length);g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}}e.data=U(e.data,c)}else if(e.intersectfn){if(e.corresponding)e.intersectfn.query.modifier||(e.intersectfn.query.modifier=void 0),c=e.intersectfn(e.params);else for(e.intersectfn.query.modifier||(e.intersectfn.query.modifier="RECORDSET"),l=e.intersectfn(e.params),c=[],o=l.data.length,i=0;o>i;i++){for(p={},g=Math.min(e.columns.length,l.columns.length),b=0;g>b;b++)p[e.columns[b].columnid]=l.data[i][l.columns[b].columnid];c.push(p)}e.data=F(e.data,c)}if(e.orderfn){if(e.explain)var m=Date.now();e.data=e.data.sort(e.orderfn),e.explain&&e.explaination.push({explid:e.explid++,description:"QUERY BY",ms:Date.now()-m})}if(d(e),"undefined"!=typeof angular&&e.removeKeys.push("$$hashKey"),e.removeKeys.length>0){var v=e.removeKeys;if(g=v.length,g>0)for(o=e.data.length,i=0;o>i;i++)for(b=0;g>b;b++)delete e.data[i][v[b]];e.columns.length>0&&(e.columns=e.columns.filter(function(e){var t=!1;return v.forEach(function(n){e.columnid==n&&(t=!0)}),!t}))}if("undefined"!=typeof e.removeLikeKeys&&e.removeLikeKeys.length>0){for(var E=e.removeLikeKeys,i=0,o=e.data.length;o>i;i++){p=e.data[i];for(var y in p)for(b=0;b0&&(e.columns=e.columns.filter(function(e){var t=!1;return E.forEach(function(n){T.utils.like(n,e.columnid)&&(t=!0)}),!t}))}if(e.pivotfn&&e.pivotfn(),e.unpivotfn&&e.unpivotfn(),e.intoallfn){var S=e.intoallfn(e.columns,e.cb,e.params,e.alasql);return S}if(e.intofn){for(o=e.data.length,i=0;o>i;i++)e.intofn(e.data[i],i,e.params,e.alasql);return e.cb&&e.cb(e.data.length,e.A,e.B),e.data.length}return S=e.data,e.cb&&(S=e.cb(e.data,e.A,e.B)),S}function d(e){if(e.limit){var t=0;e.offset&&(t=(0|e.offset)-1||0);var n;n=e.percent?(e.data.length*e.limit/100|0)+t:(0|e.limit)+t,e.data=e.data.slice(t,n)}}function h(e){if(e.distinct){for(var t={},n=0,r=e.data.length;r>n;n++){var a=Object.keys(e.data[n]).map(function(t){return e.data[n][t]}).join("`");t[a]=e.data[n]}e.data=[];for(var s in t)e.data.push(t[s])}}function f(e,t,n){if(n>=e.sources.length)e.wherefn(t,e.params,T)&&(e.groupfn?e.groupfn(t,e.params,T):e.data.push(e.selectfn(t,e.params,T)));else if(e.sources[n].applyselect){var r=e.sources[n];r.applyselect(e.params,function(a){if(a.length>0)for(var s=0;sc;)u||!r.getfn||r.dontcache||(o[c]=l),t[s]=l,r.onleftfn&&r.onleftfn(t,e.params,T)!=r.onrightfn(t,e.params,T)||r.onmiddlefn(t,e.params,T)&&("SEMI"!=r.joinmode&&"ANTI"!=r.joinmode&&f(e,t,n+1),"LEFT"!=r.joinmode&&"INNER"!=r.joinmode&&(l._rightjoin=!0),i=!0),c++;if("LEFT"!=r.joinmode&&"OUTER"!=r.joinmode&&"SEMI"!=r.joinmode||i||(t[s]={},f(e,t,n+1)),n+1h;)a.getfn&&!a.dontcache&&(a.data[h]=l),l._rightjoin?delete l._rightjoin:0==n&&(t[a.alias]=l,f(e,t,n+2)),h++}t[s]=void 0}}function p(e,t){if("undefined"==typeof t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)return t;var n=e.modifier||T.options.modifier,r=e.columns;if("undefined"==typeof r||0==r.length)if(t.length>0){for(var a={},s=0;s0){var i;i=r&&r.length>0?r[0].columnid:Object.keys(t[0])[0],t=t[0][i]}else t=void 0;else if("ROW"===n)if(t.length>0){var i,o=[];for(var i in t[0])o.push(t[0][i]);t=o}else t=void 0;else if("COLUMN"===n){var u=[];if(t.length>0){var i;i=r&&r.length>0?r[0].columnid:Object.keys(t[0])[0];for(var s=0,c=t.length;c>s;s++)u.push(t[s][i])}t=u}else if("MATRIX"===n){for(var u=[],s=0;s0)i=r[0].columnid,h=r[1].columnid;else{var f=Object.keys(t[0]);i=f[0],h=f[1]}for(var s=0,c=t.length;c>s;s++)u[t[s][i]]=t[s][h];t=u}else if("RECORDSET"===n)t=new T.Recordset({data:t,columns:r});else if("TEXTSTRING"===n){var i;i=r&&r.length>0?r[0].columnid:Object.keys(t[0])[0];for(var s=0,c=t.length;c>s;s++)t[s]=t[s][i];t=t.join("\n")}return t}function b(e,t,n){var r="",a=[];e.ixsources={},e.sources.forEach(function(t){e.ixsources[t.alias]=t});var s;if(e.ixsources[t])var s=e.ixsources[t].columns;return n&&"json"==T.options.joinstar&&(r+="r['"+t+"']={};"),s&&s.length>0?s.forEach(function(s){n&&"underscore"==T.options.joinstar?a.push("'"+t+"_"+s.columnid+"':p['"+t+"']['"+s.columnid+"']"):n&&"json"==T.options.joinstar?r+="r['"+t+"']['"+s.columnid+"']=p['"+t+"']['"+s.columnid+"'];":a.push("'"+s.columnid+"':p['"+t+"']['"+s.columnid+"']"),e.selectColumns[C(s.columnid)]=!0;var i={columnid:s.columnid,dbtypeid:s.dbtypeid,dbsize:s.dbsize,dbprecision:s.dbprecision,dbenum:s.dbenum};e.columns.push(i),e.xcolumns[i.columnid]=i}):(r+='var w=p["'+t+'"];for(var k in w){r[k]=w[k]};',e.dirtyColumns=!0),{s:a.join(","),sp:r}}function g(e,t){if(e instanceof Array){for(var n=[[]],r=0;ra;a++)t+=""+(a+1),n.forEach(function(n){t+=" ",+e[a][n]===+e[a][n]?(t+='
',t+="undefined"==typeof e[a][n]?"NULL":e[a][n],t+="
"):t+="undefined"==typeof e[a][n]?"NULL":"string"==typeof e[a][n]?e[a][n]:se(e[a][n])});t+=""}else t+="

"+se(e)+"

";return t}function y(e,t,n){if(!(0>=n)){var r=t-e.scrollTop,a=r/n*10;setTimeout(function(){e.scrollTop!==t&&(e.scrollTop=e.scrollTop+a,y(e,t,n-10))},10)}}function S(e,t,n,r,a,s){var i={};n=n||{},T.utils.extend(i,n),"undefined"==typeof i.headers&&(i.headers=!0);var o;return T.utils.loadBinaryFile(t,!!r,function(t){var n,o=e.read(t,{type:"binary"});n="undefined"==typeof i.sheetid?o.SheetNames[0]:i.sheetid;var u;"undefined"==typeof i.range?u=o.Sheets[n]["!ref"]:(u=i.range,o.Sheets[n][u]&&(u=o.Sheets[n][u]));for(var c=u.split(":"),l=c[0].match(/[A-Z]+/)[0],d=+c[0].match(/[0-9]+/)[0],h=c[1].match(/[A-Z]+/)[0],f=+c[1].match(/[0-9]+/)[0],p={},b=T.utils.xlscn(l);b<=T.utils.xlscn(h);b++){var g=T.utils.xlsnc(b);i.headers&&o.Sheets[n][g+""+d]?p[g]=o.Sheets[n][g+""+d].v:p[g]=g}var m=[];i.headers&&d++;for(var v=d;f>=v;v++){for(var E={},b=T.utils.xlscn(l);b<=T.utils.xlscn(h);b++){var g=T.utils.xlsnc(b);o.Sheets[n][g+""+v]&&(E[p[g]]=o.Sheets[n][g+""+v].v)}m.push(E)}m.length>0&&m[m.length-1]&&0==Object.keys(m[m.length-1]).length&&m.pop(),r&&(m=r(m,a,s))},function(e){throw e}),o}function w(e){function t(){return{declaration:n(),root:r()}}function n(){var e=o(/^<\?xml\s*/);if(e){for(var t={attributes:{}};!u()&&!c("?>");){var n=s();if(!n)return t;t.attributes[n.name]=n.value}return o(/\?>\s*/),t}}function r(){var e=o(/^<([\w-:.]+)\s*/);if(e){for(var t={name:e[1],attributes:{},children:[]};!(u()||c(">")||c("?>")||c("/>"));){var n=s();if(!n)return t;t.attributes[n.name]=n.value}if(o(/^\s*\/>\s*/))return t;o(/\??>\s*/),t.content=a();for(var i;i=r();)t.children.push(i);return o(/^<\/[\w-:.]+>\s*/),t}}function a(){var e=o(/^([^<]*)/);return e?e[1]:""}function s(){var e=o(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(e)return{name:e[1],value:i(e[2])}}function i(e){return e.replace(/^['"]|['"]$/g,"")}function o(t){var n=e.match(t);if(n)return e=e.slice(n[0].length),n}function u(){return 0==e.length}function c(t){return 0==e.indexOf(t)}return e=e.trim(),e=e.replace(//g,""),t()}var T=function fe(e,t,n,r){if("function"==typeof importScripts||!fe.webworker){if(0===arguments.length)return new X.Select({columns:[new X.Column({columnid:"*"})],from:[new X.ParamValue({param:0})]});if(1===arguments.length&&"object"==typeof e&&e instanceof Array){var a=new X.Select({columns:[new X.Column({columnid:"*"})],from:[new X.ParamValue({param:0})]});return a.preparams=[e],a}return"string"==typeof e&&"#"===e[0]&&"object"==typeof document?e=document.querySelector(e).textContent:"object"==typeof e&&e instanceof HTMLElement?e=e.textContent:"function"==typeof e&&(e=e.toString().slice(14,-3)),fe.exec(e,t,n,r)}var s=fe.lastid++;fe.buffer[s]=n,fe.webworker.postMessage({id:s,sql:e,params:t})};T.version="0.2.3-develop-1164",T.debug=void 0,e();var x=function(){function e(){this.yy={}}var t=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},n=[2,10],r=[1,102],a=[1,103],s=[1,6],i=[1,42],o=[1,78],u=[1,75],c=[1,94],l=[1,93],d=[1,68],h=[1,101],f=[1,85],p=[1,70],b=[1,83],g=[1,65],m=[1,69],v=[1,63],E=[1,67],y=[1,60],S=[1,73],w=[1,61],x=[1,66],A=[1,82],C=[1,76],k=[1,84],R=[1,86],N=[1,87],$=[1,80],D=[1,81],I=[1,79],L=[1,88],q=[1,89],U=[1,90],F=[1,91],M=[1,92],j=[1,98],V=[1,64],P=[1,77],_=[1,71],B=[1,96],G=[1,97],J=[1,62],H=[1,72],W=[1,106],X=[1,107],Y=[8,297,509,510],K=[8,297,301,509,510],Q=[1,114],z=[1,115],Z=[1,116],ee=[1,117],te=[1,118],ne=[127,343,399],re=[1,126],ae=[1,125],se=[1,131],ie=[1,159],oe=[1,170],ue=[1,173],ce=[1,168],le=[1,176],de=[1,180],he=[1,177],fe=[1,164],pe=[1,166],be=[1,169],ge=[1,178],me=[1,161],ve=[1,187],Ee=[1,183],ye=[1,184],Se=[1,188],we=[1,189],Te=[1,190],xe=[1,191],Ae=[1,192],Ce=[1,193],ke=[1,194],Oe=[1,195],Re=[1,196],Ne=[1,171],$e=[1,172],De=[1,174],Ie=[1,175],Le=[1,181],qe=[1,179],Ue=[1,182],Fe=[1,165],Me=[1,167],je=[1,186],Ve=[1,197],Pe=[4,5],_e=[2,455],Be=[1,200],Ge=[1,205],Je=[1,214],He=[1,210],We=[8,69,75,90,95,115,125,159,165,166,180,195,229,242,244,297,301,509,510],Xe=[4,5,8,69,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,180,182,184,195,273,274,275,276,277,278,279,280,281,297,301,410,414,509,510],Ye=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ke=[1,244],Qe=[1,251],ze=[1,260],Ze=[1,265],et=[1,264],tt=[4,5,8,69,74,75,90,95,104,115,125,128,129,134,140,142,149,151,153,159,165,166,176,177,178,180,195,229,242,244,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,297,301,307,319,410,414,509,510],nt=[2,158],rt=[1,276],at=[8,71,75,297,301,496,509,510],st=[4,5,8,69,74,75,90,95,104,115,125,128,129,134,140,142,149,151,153,159,161,165,166,176,177,178,180,182,184,192,195,229,242,244,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,297,301,307,319,410,414,509,510],it=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,190,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,360,363,364,376,378,385,389,390,391,392,393,394,395,397,398,406,407,408,410,414,416,418,424,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,505,506,507,508,509,510],ot=[4,5,8,51,69,86,121,143,153,186,262,283,297,326,329,330,337,385,389,390,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,508,509,510],ut=[1,289],ct=[1,291],lt=[2,487],dt=[1,296],ht=[1,307],ft=[1,310],pt=[1,311],bt=[8,75,86,129,134,143,186,289,297,301,461,509,510],gt=[8,71,297,301,509,510],mt=[2,552],vt=[1,327],Et=[4,5,153],yt=[1,364],St=[1,336],wt=[1,370],Tt=[1,371],xt=[1,344],At=[1,355],Ct=[1,342],kt=[1,350],Ot=[1,343],Rt=[1,351],Nt=[1,353],$t=[1,345],Dt=[1,346],It=[1,365],Lt=[1,362],qt=[1,363],Ut=[1,339],Ft=[1,341],Mt=[1,334],jt=[1,335],Vt=[1,337],Pt=[1,338],_t=[1,340],Bt=[1,347],Gt=[1,348],Jt=[1,352],Ht=[1,354],Wt=[1,356],Xt=[1,357],Yt=[1,358],Kt=[1,359],Qt=[1,360],zt=[1,366],Zt=[1,367],en=[1,368],tn=[1,369],nn=[2,283],rn=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,363,364,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],an=[2,351],sn=[1,392],on=[1,402],un=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],cn=[1,418],ln=[1,426],dn=[1,425],hn=[4,5,8,69,71,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],fn=[8,69,71,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],pn=[2,198],bn=[1,448],gn=[8,69,75,90,95,115,125,159,165,166,180,229,242,244,297,301,509,510],mn=[2,159],vn=[1,451],En=[4,5,109],yn=[1,464],Sn=[1,483],wn=[1,463],Tn=[1,462],xn=[1,457],An=[1,458],Cn=[1,460],kn=[1,461],On=[1,465],Rn=[1,466],Nn=[1,467],$n=[1,468],Dn=[1,469],In=[1,470],Ln=[1,471],qn=[1,472],Un=[1,473],Fn=[1,474],Mn=[1,475],jn=[1,476],Vn=[1,477],Pn=[1,478],_n=[1,479],Bn=[1,480],Gn=[1,482],Jn=[1,484],Hn=[1,485],Wn=[1,486],Xn=[1,487],Yn=[1,488],Kn=[1,489],Qn=[1,490],zn=[1,493],Zn=[1,494],er=[1,495],tr=[1,496],nr=[1,497],rr=[1,498],ar=[1,499],sr=[1,500],ir=[1,501],or=[1,502],ur=[1,503],cr=[1,504],lr=[71,86,186],dr=[8,71,75,151,184,227,290,297,301,333,346,358,359,363,364,509,510],hr=[1,521],fr=[8,71,75,297,301,509,510],pr=[1,522],br=[1,530],gr=[4,5,74,128,129,134,140,142,149,151,153,176,177,178,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,307,319,410,414],mr=[8,69,75,90,95,104,115,125,159,165,166,180,195,229,242,244,297,301,509,510],vr=[4,5,129,289],Er=[1,564],yr=[8,71,73,75,297,301,509,510],Sr=[2,722],wr=[8,71,73,75,129,136,138,142,149,297,301,410,414,509,510],Tr=[2,878],xr=[8,71,73,75,136,138,142,149,297,301,410,414,509,510],Ar=[8,71,73,75,136,138,142,297,301,410,414,509,510],Cr=[8,71,75,136,138,297,301,509,510],kr=[8,75,86,129,143,186,289,297,301,461,509,510],Or=[326,329,330],Rr=[2,748],Nr=[1,589],$r=[1,590],Dr=[1,591],Ir=[1,592],Lr=[1,596],qr=[1,597],Ur=[161,163,325],Fr=[2,434],Mr=[1,651],jr=[4,5,74,128,153,283,284,285,286],Vr=[1,666],Pr=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],_r=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Br=[2,366],Gr=[1,673],Jr=[297,299,301],Hr=[71,418],Wr=[71,416,418],Xr=[1,680],Yr=[4,5,8,51,69,71,73,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Kr=[71,416],Qr=[8,69,75,90,95,115,125,159,165,166,229,242,244,297,301,509,510],zr=[1,717],Zr=[8,69,75,297,301,509,510],ea=[1,723],ta=[1,724],na=[1,725],ra=[4,5,8,69,71,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,195,273,274,275,276,277,278,279,280,281,297,301,410,414,509,510],aa=[1,775],sa=[1,774],ia=[1,788],oa=[8,69,71,75,90,95,104,115,125,159,165,166,180,195,229,242,244,297,301,509,510],ua=[1,819],ca=[8,75,86,143,186,297,301,461,509,510],la=[1,839],da=[1,838],ha=[1,837],fa=[1,850],pa=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],ba=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,305,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],ga=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,130,131,132,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],ma=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,115,119,121,125,126,127,128,129,131,132,134,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],va=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,115,119,121,125,126,127,128,129,131,132,134,136,137,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,304,310,311,312,313,314,315,316,321,322,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ea=[2,396],ya=[4,5,8,51,69,71,73,74,75,86,90,92,95,104,115,119,125,126,127,128,129,131,132,134,140,142,143,145,146,147,149,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,304,321,322,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Sa=[2,281],wa=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ta=[1,886],xa=[8,75,297,301,509,510],Aa=[1,897],Ca=[8,69,75,115,125,159,165,166,229,242,244,297,301,509,510],ka=[8,69,71,75,90,95,115,125,159,165,166,180,195,229,242,244,297,301,509,510],Oa=[4,5,69,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,182,184,273,274,275,276,277,278,279,280,281,410,414],Ra=[4,5,69,71,73,74,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,182,184,273,274,275,276,277,278,279,280,281,410,414],Na=[2,802],$a=[4,5,69,71,73,74,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,182,184,273,274,275,276,277,278,279,280,281,410,414],Da=[1,949],Ia=[8,71,75,125,297,299,301,455,509,510],La=[1,958],qa=[1,957],Ua=[2,569],Fa=[1,979],Ma=[73,136],ja=[2,708],Va=[1,996],Pa=[1,997],_a=[4,5,8,51,69,73,86,121,143,153,186,227,262,283,297,301,326,329,330,337,385,389,390,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,508,509,510],Ba=[1,1004],Ga=[1,1005],Ja=[2,322],Ha=[1,1023],Wa=[1,1033],Xa=[8,71,75,297,299,301,455,509,510],Ya=[1,1036],Ka=[8,69,71,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,229,242,244,297,301,509,510],Qa=[8,297,299,301,455,509,510],za=[8,69,75,115,159,165,166,229,242,244,297,301,509,510],Za=[1,1051],es=[1,1055],ts=[1,1056],ns=[1,1058],rs=[1,1059],as=[1,1060],ss=[1,1061],is=[1,1062],os=[1,1063],us=[1,1064],cs=[1,1065],ls=[1,1090],ds=[71,75],hs=[112,113,121],fs=[1,1149],ps=[8,69,75,115,159,165,166,242,244,297,301,509,510],bs=[8,69,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,229,242,244,297,301,509,510],gs=[1,1190],ms=[1,1192],vs=[4,5,74,140,142,149,153,178,283,284,285,286,293,410,414],Es=[1,1206],ys=[8,69,71,75,159,165,166,242,244,297,301,509,510],Ss=[1,1225],ws=[1,1227],Ts=[1,1228],xs=[1,1224],As=[1,1223],Cs=[1,1222],ks=[1,1229],Os=[1,1219],Rs=[1,1220],Ns=[1,1221],$s=[1,1246],Ds=[4,5,8,51,69,86,121,143,153,186,262,283,297,301,326,329,330,337,385,389,390,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,508,509,510],Is=[4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,363,364,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],Ls=[1,1260],qs=[1,1268],Us=[1,1267],Fs=[8,69,75,159,165,166,242,244,297,301,509,510],Ms=[8,69,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],js=[4,5,8,69,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],Vs=[1,1325],Ps=[1,1327],_s=[1,1324],Bs=[1,1326],Gs=[184,190,358,359,360,363],Js=[2,499],Hs=[1,1332],Ws=[1,1353],Xs=[8,69,75,159,165,166,297,301,509,510],Ys=[1,1363],Ks=[1,1364],Qs=[1,1365],zs=[1,1384],Zs=[4,8,240,297,301,333,346,509,510],ei=[1,1433],ti=[8,69,71,75,115,159,165,166,236,242,244,297,301,509,510],ni=[4,5,74],ri=[1,1527],ai=[1,1539],si=[1,1558],ii=[8,69,75,159,165,166,297,301,404,509,510],oi=[8,71,75,227,297,301,509,510],ui={ trace:function(){},yy:{},symbols_:{error:2,Literal:3,LITERAL:4,BRALITERAL:5,main:6,Statements:7,EOF:8,Statements_group0:9,AStatement:10,ExplainStatement:11,EXPLAIN:12,QUERY:13,PLAN:14,Statement:15,AlterTable:16,AttachDatabase:17,Call:18,CreateDatabase:19,CreateIndex:20,CreateGraph:21,CreateTable:22,CreateView:23,CreateEdge:24,CreateVertex:25,Declare:26,Delete:27,DetachDatabase:28,DropDatabase:29,DropIndex:30,DropTable:31,DropView:32,If:33,Insert:34,Merge:35,Reindex:36,RenameTable:37,Select:38,ShowCreateTable:39,ShowColumns:40,ShowDatabases:41,ShowIndex:42,ShowTables:43,TruncateTable:44,WithSelect:45,CreateTrigger:46,DropTrigger:47,BeginTransaction:48,CommitTransaction:49,RollbackTransaction:50,EndTransaction:51,UseDatabase:52,Update:53,Help:54,JavaScript:55,Source:56,Assert:57,While:58,Continue:59,Break:60,BeginEnd:61,Print:62,Require:63,SetVariable:64,ExpressionStatement:65,AddRule:66,Query:67,Echo:68,WITH:69,WithTablesList:70,COMMA:71,WithTable:72,AS:73,LPAR:74,RPAR:75,SelectClause:76,Select_option0:77,IntoClause:78,FromClause:79,Select_option1:80,WhereClause:81,GroupClause:82,OrderClause:83,LimitClause:84,UnionClause:85,SEARCH:86,Select_repetition0:87,Select_option2:88,PivotClause:89,PIVOT:90,Expression:91,FOR:92,PivotClause_option0:93,PivotClause_option1:94,UNPIVOT:95,IN:96,ColumnsList:97,PivotClause_option2:98,PivotClause2:99,AsList:100,AsLiteral:101,AsPart:102,RemoveClause:103,REMOVE:104,RemoveClause_option0:105,RemoveColumnsList:106,RemoveColumn:107,Column:108,LIKE:109,StringValue:110,ArrowDot:111,ARROW:112,DOT:113,SearchSelector:114,ORDER:115,BY:116,OrderExpressionsList:117,SearchSelector_option0:118,DOTDOT:119,CARET:120,EQ:121,SearchSelector_repetition_plus0:122,SearchSelector_repetition_plus1:123,SearchSelector_option1:124,WHERE:125,OF:126,CLASS:127,NUMBER:128,STRING:129,SLASH:130,VERTEX:131,EDGE:132,EXCLAMATION:133,SHARP:134,MODULO:135,GT:136,LT:137,GTGT:138,LTLT:139,DOLLAR:140,Json:141,AT:142,SET:143,SetColumnsList:144,TO:145,VALUE:146,ROW:147,ExprList:148,COLON:149,PlusStar:150,NOT:151,SearchSelector_repetition2:152,IF:153,SearchSelector_repetition3:154,Aggregator:155,SearchSelector_repetition4:156,SearchSelector_group0:157,SearchSelector_repetition5:158,UNION:159,SearchSelectorList:160,ALL:161,SearchSelector_repetition6:162,ANY:163,SearchSelector_repetition7:164,INTERSECT:165,EXCEPT:166,AND:167,OR:168,PATH:169,RETURN:170,ResultColumns:171,REPEAT:172,SearchSelector_repetition8:173,SearchSelectorList_repetition0:174,SearchSelectorList_repetition1:175,PLUS:176,STAR:177,QUESTION:178,SearchFrom:179,FROM:180,SelectModifier:181,DISTINCT:182,TopClause:183,UNIQUE:184,SelectClause_option0:185,SELECT:186,COLUMN:187,MATRIX:188,TEXTSTRING:189,INDEX:190,RECORDSET:191,TOP:192,NumValue:193,TopClause_option0:194,INTO:195,Table:196,FuncValue:197,ParamValue:198,VarValue:199,FromTablesList:200,JoinTablesList:201,ApplyClause:202,CROSS:203,APPLY:204,OUTER:205,FromTable:206,FromTable_option0:207,FromTable_option1:208,INDEXED:209,INSERTED:210,FromString:211,JoinTable:212,JoinMode:213,JoinTableAs:214,OnClause:215,JoinTableAs_option0:216,JoinTableAs_option1:217,JoinModeMode:218,NATURAL:219,JOIN:220,INNER:221,LEFT:222,RIGHT:223,FULL:224,SEMI:225,ANTI:226,ON:227,USING:228,GROUP:229,GroupExpressionsList:230,HavingClause:231,GroupExpression:232,GROUPING:233,ROLLUP:234,CUBE:235,HAVING:236,CORRESPONDING:237,OrderExpression:238,DIRECTION:239,COLLATE:240,NOCASE:241,LIMIT:242,OffsetClause:243,OFFSET:244,LimitClause_option0:245,FETCH:246,LimitClause_option1:247,LimitClause_option2:248,LimitClause_option3:249,ResultColumn:250,Star:251,AggrValue:252,Op:253,LogicValue:254,NullValue:255,ExistsValue:256,CaseValue:257,CastClause:258,NewClause:259,Expression_group0:260,CURRENT_TIMESTAMP:261,JAVASCRIPT:262,NEW:263,CAST:264,ColumnType:265,CONVERT:266,PrimitiveValue:267,OverClause:268,OVER:269,OverPartitionClause:270,OverOrderByClause:271,PARTITION:272,SUM:273,COUNT:274,MIN:275,MAX:276,AVG:277,FIRST:278,LAST:279,AGGR:280,ARRAY:281,FuncValue_option0:282,REPLACE:283,DATEADD:284,DATEDIFF:285,INTERVAL:286,TRUE:287,FALSE:288,NSTRING:289,NULL:290,EXISTS:291,ParamValue_group0:292,BRAQUESTION:293,CASE:294,WhensList:295,ElseClause:296,END:297,When:298,WHEN:299,THEN:300,ELSE:301,REGEXP:302,GLOB:303,ESCAPE:304,NOT_LIKE:305,BARBAR:306,MINUS:307,AMPERSAND:308,BAR:309,GE:310,LE:311,EQEQ:312,EQEQEQ:313,NE:314,NEEQEQ:315,NEEQEQEQ:316,CondOp:317,AllSome:318,TILDA:319,ColFunc:320,BETWEEN:321,NOT_BETWEEN:322,IS:323,DOUBLECOLON:324,SOME:325,UPDATE:326,SetColumn:327,SetColumn_group0:328,DELETE:329,INSERT:330,Into:331,ValuesListsList:332,DEFAULT:333,ValuesList:334,Value:335,DateValue:336,CREATE:337,TemporaryClause:338,TableClass:339,IfNotExists:340,CreateTableDefClause:341,CreateTableOptionsClause:342,TABLE:343,CreateTableOptions:344,CreateTableOption:345,IDENTITY:346,TEMP:347,ColumnDefsList:348,ConstraintsList:349,Constraint:350,ConstraintName:351,PrimaryKey:352,ForeignKey:353,UniqueKey:354,IndexKey:355,Check:356,CONSTRAINT:357,CHECK:358,PRIMARY:359,KEY:360,PrimaryKey_option0:361,ColsList:362,FOREIGN:363,REFERENCES:364,ForeignKey_option0:365,OnForeignKeyClause:366,ParColsList:367,OnDeleteClause:368,OnUpdateClause:369,NO:370,ACTION:371,UniqueKey_option0:372,UniqueKey_option1:373,ColumnDef:374,ColumnConstraintsClause:375,ColumnConstraints:376,NumberMax:377,ENUM:378,MAXNUM:379,ColumnConstraintsList:380,ColumnConstraint:381,ParLiteral:382,ColumnConstraint_option0:383,ColumnConstraint_option1:384,DROP:385,DropTable_group0:386,IfExists:387,TablesList:388,ALTER:389,RENAME:390,ADD:391,MODIFY:392,ATTACH:393,DATABASE:394,DETACH:395,AsClause:396,USE:397,SHOW:398,VIEW:399,CreateView_option0:400,CreateView_option1:401,SubqueryRestriction:402,READ:403,ONLY:404,OPTION:405,HELP:406,SOURCE:407,ASSERT:408,JsonObject:409,ATLBRA:410,JsonArray:411,JsonValue:412,JsonPrimitiveValue:413,LCUR:414,JsonPropertiesList:415,RCUR:416,JsonElementsList:417,RBRA:418,JsonProperty:419,OnOff:420,AtDollar:421,SetPropsList:422,SetProp:423,OFF:424,COMMIT:425,TRANSACTION:426,ROLLBACK:427,BEGIN:428,ElseStatement:429,WHILE:430,CONTINUE:431,BREAK:432,PRINT:433,REQUIRE:434,StringValuesList:435,PluginsList:436,Plugin:437,ECHO:438,DECLARE:439,DeclaresList:440,DeclareItem:441,TRUNCATE:442,MERGE:443,MergeInto:444,MergeUsing:445,MergeOn:446,MergeMatchedList:447,OutputClause:448,MergeMatched:449,MergeNotMatched:450,MATCHED:451,MergeMatchedAction:452,MergeNotMatchedAction:453,TARGET:454,OUTPUT:455,CreateVertex_option0:456,CreateVertex_option1:457,CreateVertex_option2:458,CreateVertexSet:459,SharpValue:460,CONTENT:461,CreateEdge_option0:462,GRAPH:463,GraphList:464,GraphVertexEdge:465,GraphElement:466,GraphVertexEdge_option0:467,GraphVertexEdge_option1:468,GraphElementVar:469,GraphVertexEdge_option2:470,GraphVertexEdge_option3:471,GraphVertexEdge_option4:472,GraphVar:473,GraphAsClause:474,GraphAtClause:475,GraphElement2:476,GraphElement2_option0:477,GraphElement2_option1:478,GraphElement2_option2:479,GraphElement2_option3:480,GraphElement_option0:481,GraphElement_option1:482,GraphElement_option2:483,SharpLiteral:484,GraphElement_option3:485,GraphElement_option4:486,GraphElement_option5:487,ColonLiteral:488,DeleteVertex:489,DeleteVertex_option0:490,DeleteEdge:491,DeleteEdge_option0:492,DeleteEdge_option1:493,DeleteEdge_option2:494,Term:495,COLONDASH:496,TermsList:497,QUESTIONDASH:498,CALL:499,TRIGGER:500,BeforeAfter:501,InsertDeleteUpdate:502,CreateTrigger_option0:503,CreateTrigger_option1:504,BEFORE:505,AFTER:506,INSTEAD:507,REINDEX:508,SEMICOLON:509,GO:510,PERCENT:511,ROWS:512,NEXT:513,FuncValue_option0_group0:514,$accept:0,$end:1},terminals_:{2:"error",4:"LITERAL",5:"BRALITERAL",8:"EOF",12:"EXPLAIN",13:"QUERY",14:"PLAN",51:"EndTransaction",69:"WITH",71:"COMMA",73:"AS",74:"LPAR",75:"RPAR",86:"SEARCH",90:"PIVOT",92:"FOR",95:"UNPIVOT",96:"IN",104:"REMOVE",109:"LIKE",112:"ARROW",113:"DOT",115:"ORDER",116:"BY",119:"DOTDOT",120:"CARET",121:"EQ",125:"WHERE",126:"OF",127:"CLASS",128:"NUMBER",129:"STRING",130:"SLASH",131:"VERTEX",132:"EDGE",133:"EXCLAMATION",134:"SHARP",135:"MODULO",136:"GT",137:"LT",138:"GTGT",139:"LTLT",140:"DOLLAR",142:"AT",143:"SET",145:"TO",146:"VALUE",147:"ROW",149:"COLON",151:"NOT",153:"IF",159:"UNION",161:"ALL",163:"ANY",165:"INTERSECT",166:"EXCEPT",167:"AND",168:"OR",169:"PATH",170:"RETURN",172:"REPEAT",176:"PLUS",177:"STAR",178:"QUESTION",180:"FROM",182:"DISTINCT",184:"UNIQUE",186:"SELECT",187:"COLUMN",188:"MATRIX",189:"TEXTSTRING",190:"INDEX",191:"RECORDSET",192:"TOP",195:"INTO",203:"CROSS",204:"APPLY",205:"OUTER",209:"INDEXED",210:"INSERTED",219:"NATURAL",220:"JOIN",221:"INNER",222:"LEFT",223:"RIGHT",224:"FULL",225:"SEMI",226:"ANTI",227:"ON",228:"USING",229:"GROUP",233:"GROUPING",234:"ROLLUP",235:"CUBE",236:"HAVING",237:"CORRESPONDING",239:"DIRECTION",240:"COLLATE",241:"NOCASE",242:"LIMIT",244:"OFFSET",246:"FETCH",261:"CURRENT_TIMESTAMP",262:"JAVASCRIPT",263:"NEW",264:"CAST",266:"CONVERT",269:"OVER",272:"PARTITION",273:"SUM",274:"COUNT",275:"MIN",276:"MAX",277:"AVG",278:"FIRST",279:"LAST",280:"AGGR",281:"ARRAY",283:"REPLACE",284:"DATEADD",285:"DATEDIFF",286:"INTERVAL",287:"TRUE",288:"FALSE",289:"NSTRING",290:"NULL",291:"EXISTS",293:"BRAQUESTION",294:"CASE",297:"END",299:"WHEN",300:"THEN",301:"ELSE",302:"REGEXP",303:"GLOB",304:"ESCAPE",305:"NOT_LIKE",306:"BARBAR",307:"MINUS",308:"AMPERSAND",309:"BAR",310:"GE",311:"LE",312:"EQEQ",313:"EQEQEQ",314:"NE",315:"NEEQEQ",316:"NEEQEQEQ",319:"TILDA",321:"BETWEEN",322:"NOT_BETWEEN",323:"IS",324:"DOUBLECOLON",325:"SOME",326:"UPDATE",329:"DELETE",330:"INSERT",333:"DEFAULT",336:"DateValue",337:"CREATE",343:"TABLE",346:"IDENTITY",347:"TEMP",357:"CONSTRAINT",358:"CHECK",359:"PRIMARY",360:"KEY",363:"FOREIGN",364:"REFERENCES",370:"NO",371:"ACTION",376:"ColumnConstraints",378:"ENUM",379:"MAXNUM",385:"DROP",389:"ALTER",390:"RENAME",391:"ADD",392:"MODIFY",393:"ATTACH",394:"DATABASE",395:"DETACH",397:"USE",398:"SHOW",399:"VIEW",403:"READ",404:"ONLY",405:"OPTION",406:"HELP",407:"SOURCE",408:"ASSERT",410:"ATLBRA",414:"LCUR",416:"RCUR",418:"RBRA",424:"OFF",425:"COMMIT",426:"TRANSACTION",427:"ROLLBACK",428:"BEGIN",430:"WHILE",431:"CONTINUE",432:"BREAK",433:"PRINT",434:"REQUIRE",438:"ECHO",439:"DECLARE",442:"TRUNCATE",443:"MERGE",451:"MATCHED",454:"TARGET",455:"OUTPUT",461:"CONTENT",463:"GRAPH",496:"COLONDASH",498:"QUESTIONDASH",499:"CALL",500:"TRIGGER",505:"BEFORE",506:"AFTER",507:"INSTEAD",508:"REINDEX",509:"SEMICOLON",510:"GO",511:"PERCENT",512:"ROWS",513:"NEXT"},productions_:[0,[3,1],[3,1],[6,2],[7,3],[7,1],[7,1],[11,2],[11,4],[10,1],[15,0],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[15,1],[45,3],[70,3],[70,1],[72,5],[38,10],[38,4],[89,8],[89,11],[99,4],[101,2],[101,1],[100,3],[100,1],[102,1],[102,3],[103,3],[106,3],[106,1],[107,1],[107,2],[111,1],[111,1],[114,1],[114,5],[114,5],[114,1],[114,2],[114,1],[114,2],[114,2],[114,3],[114,4],[114,4],[114,4],[114,4],[114,4],[114,1],[114,1],[114,1],[114,1],[114,1],[114,1],[114,2],[114,2],[114,2],[114,1],[114,1],[114,1],[114,1],[114,1],[114,1],[114,2],[114,3],[114,4],[114,3],[114,1],[114,4],[114,2],[114,2],[114,4],[114,4],[114,4],[114,4],[114,4],[114,5],[114,4],[114,4],[114,4],[114,4],[114,4],[114,4],[114,4],[114,4],[114,6],[160,3],[160,1],[150,1],[150,1],[150,1],[179,2],[76,4],[76,4],[76,4],[76,3],[181,1],[181,2],[181,2],[181,2],[181,2],[181,2],[181,2],[181,2],[183,3],[183,4],[183,0],[78,0],[78,2],[78,2],[78,2],[78,2],[78,2],[79,2],[79,3],[79,5],[79,0],[202,6],[202,7],[202,6],[202,7],[200,1],[200,3],[206,4],[206,5],[206,3],[206,3],[206,2],[206,3],[206,1],[206,3],[206,2],[206,3],[206,1],[206,1],[206,2],[206,3],[206,1],[206,1],[206,2],[206,3],[206,1],[206,2],[206,3],[211,1],[196,3],[196,1],[201,2],[201,2],[201,1],[201,1],[212,3],[214,1],[214,2],[214,3],[214,3],[214,2],[214,3],[214,4],[214,5],[214,1],[214,2],[214,3],[214,1],[214,2],[214,3],[213,1],[213,2],[218,1],[218,2],[218,2],[218,3],[218,2],[218,3],[218,2],[218,3],[218,2],[218,2],[218,2],[215,2],[215,2],[215,0],[81,0],[81,2],[82,0],[82,4],[230,1],[230,3],[232,5],[232,4],[232,4],[232,1],[231,0],[231,2],[85,0],[85,2],[85,3],[85,2],[85,2],[85,3],[85,4],[85,3],[85,3],[83,0],[83,3],[117,1],[117,3],[238,1],[238,2],[238,3],[238,4],[84,0],[84,3],[84,8],[243,0],[243,2],[171,3],[171,1],[250,3],[250,2],[250,3],[250,2],[250,3],[250,2],[250,1],[251,5],[251,3],[251,1],[108,5],[108,3],[108,3],[108,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,3],[91,3],[91,3],[91,1],[91,1],[55,1],[259,2],[259,2],[258,6],[258,8],[258,6],[258,8],[267,1],[267,1],[267,1],[267,1],[267,1],[267,1],[267,1],[252,5],[252,6],[252,6],[268,0],[268,4],[268,4],[268,5],[270,3],[271,3],[155,1],[155,1],[155,1],[155,1],[155,1],[155,1],[155,1],[155,1],[155,1],[197,5],[197,3],[197,4],[197,4],[197,8],[197,8],[197,8],[197,8],[197,3],[148,1],[148,3],[193,1],[254,1],[254,1],[110,1],[110,1],[255,1],[199,2],[256,4],[198,2],[198,2],[198,1],[198,1],[257,5],[257,4],[295,2],[295,1],[298,4],[296,2],[296,0],[253,3],[253,3],[253,3],[253,5],[253,3],[253,5],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,5],[253,3],[253,3],[253,3],[253,5],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,3],[253,6],[253,6],[253,3],[253,3],[253,2],[253,2],[253,2],[253,2],[253,2],[253,3],[253,5],[253,6],[253,5],[253,6],[253,4],[253,5],[253,3],[253,4],[253,3],[253,4],[253,3],[253,3],[253,3],[253,3],[253,3],[320,1],[320,1],[320,4],[317,1],[317,1],[317,1],[317,1],[317,1],[317,1],[318,1],[318,1],[318,1],[53,6],[53,4],[144,1],[144,3],[327,3],[327,4],[27,5],[27,3],[34,5],[34,7],[34,5],[34,5],[34,8],[34,4],[34,6],[34,7],[331,0],[331,1],[332,3],[332,1],[332,1],[332,5],[332,3],[332,3],[334,1],[334,3],[335,1],[335,1],[335,1],[335,1],[335,1],[335,1],[97,1],[97,3],[22,9],[22,5],[339,1],[339,1],[342,0],[342,1],[344,2],[344,1],[345,1],[345,3],[345,3],[345,3],[338,0],[338,1],[340,0],[340,3],[341,3],[341,1],[341,2],[349,1],[349,3],[350,2],[350,2],[350,2],[350,2],[350,2],[351,0],[351,2],[356,4],[352,6],[353,9],[367,3],[366,0],[366,2],[368,4],[369,4],[354,6],[355,5],[355,5],[362,1],[362,1],[362,3],[362,3],[348,1],[348,3],[374,3],[374,2],[374,1],[265,6],[265,7],[265,4],[265,5],[265,1],[265,2],[265,4],[377,1],[377,1],[375,0],[375,1],[380,2],[380,1],[382,3],[381,2],[381,5],[381,3],[381,6],[381,1],[381,2],[381,4],[381,2],[381,1],[381,2],[381,1],[381,1],[381,3],[381,5],[31,4],[388,3],[388,1],[387,0],[387,2],[16,6],[16,6],[16,6],[16,8],[16,6],[37,5],[17,4],[17,7],[17,6],[17,9],[28,3],[19,4],[19,6],[19,9],[19,6],[396,0],[396,2],[52,3],[52,2],[29,4],[29,5],[29,5],[20,8],[20,9],[30,3],[41,2],[41,4],[41,3],[41,5],[43,2],[43,4],[43,4],[43,6],[40,4],[40,6],[42,4],[42,6],[39,4],[39,6],[23,11],[23,8],[402,3],[402,3],[402,5],[32,4],[54,2],[54,1],[65,2],[56,2],[57,2],[57,2],[57,4],[141,4],[141,2],[141,2],[141,2],[141,2],[141,1],[141,2],[141,2],[412,1],[412,1],[413,1],[413,1],[413,1],[413,1],[413,1],[413,1],[413,1],[413,3],[409,3],[409,4],[409,2],[411,2],[411,3],[411,1],[415,3],[415,1],[419,3],[419,3],[419,3],[417,3],[417,1],[64,3],[64,5],[64,6],[421,1],[421,1],[422,3],[422,2],[423,1],[423,1],[423,3],[420,1],[420,1],[49,2],[50,2],[48,2],[33,4],[33,3],[429,2],[58,3],[59,1],[60,1],[61,3],[62,2],[62,2],[63,2],[63,2],[437,1],[437,1],[68,2],[435,3],[435,1],[436,3],[436,1],[26,2],[440,1],[440,3],[441,3],[441,4],[441,5],[441,6],[44,3],[35,6],[444,1],[444,2],[445,2],[446,2],[447,2],[447,2],[447,1],[447,1],[449,4],[449,6],[452,1],[452,3],[450,5],[450,7],[450,7],[450,9],[450,7],[450,9],[453,3],[453,6],[453,3],[453,6],[448,0],[448,2],[448,5],[448,4],[448,7],[25,6],[460,2],[459,0],[459,2],[459,2],[459,1],[24,8],[21,3],[21,4],[464,3],[464,1],[465,3],[465,7],[465,6],[465,3],[465,4],[469,1],[469,1],[473,2],[474,3],[475,2],[476,4],[466,4],[466,3],[466,2],[466,1],[488,2],[484,2],[484,2],[489,4],[491,6],[66,3],[66,2],[497,3],[497,1],[495,1],[495,4],[67,2],[18,2],[46,9],[46,8],[46,9],[501,0],[501,1],[501,1],[501,1],[501,2],[502,1],[502,1],[502,1],[47,3],[36,2],[9,1],[9,1],[77,0],[77,1],[80,0],[80,1],[87,0],[87,2],[88,0],[88,1],[93,0],[93,1],[94,0],[94,1],[98,0],[98,1],[105,0],[105,1],[118,0],[118,1],[122,1],[122,2],[123,1],[123,2],[124,0],[124,1],[152,0],[152,2],[154,0],[154,2],[156,0],[156,2],[157,1],[157,1],[158,0],[158,2],[162,0],[162,2],[164,0],[164,2],[173,0],[173,2],[174,0],[174,2],[175,0],[175,2],[185,0],[185,1],[194,0],[194,1],[207,0],[207,1],[208,0],[208,1],[216,0],[216,1],[217,0],[217,1],[245,0],[245,1],[247,0],[247,1],[248,0],[248,1],[249,0],[249,1],[260,1],[260,1],[514,1],[514,1],[282,0],[282,1],[292,1],[292,1],[328,1],[328,1],[361,0],[361,1],[365,0],[365,1],[372,0],[372,1],[373,0],[373,1],[383,0],[383,1],[384,0],[384,1],[386,1],[386,1],[400,0],[400,1],[401,0],[401,1],[456,0],[456,1],[457,0],[457,1],[458,0],[458,1],[462,0],[462,1],[467,0],[467,1],[468,0],[468,1],[470,0],[470,1],[471,0],[471,1],[472,0],[472,1],[477,0],[477,1],[478,0],[478,1],[479,0],[479,1],[480,0],[480,1],[481,0],[481,1],[482,0],[482,1],[483,0],[483,1],[485,0],[485,1],[486,0],[486,1],[487,0],[487,1],[490,0],[490,2],[492,0],[492,2],[493,0],[493,2],[494,0],[494,2],[503,0],[503,1],[504,0],[504,1]],performAction:function(e,t,n,r,a,s,i){var o=s.length-1;switch(a){case 1:r.casesensitive?this.$=s[o]:this.$=s[o].toLowerCase();break;case 2:this.$=O(s[o].substr(1,s[o].length-2));break;case 3:return new r.Statements({statements:s[o-1]});case 4:this.$=s[o-2],s[o]&&s[o-2].push(s[o]);break;case 5:case 6:case 66:case 76:case 81:case 139:case 173:case 201:case 202:case 238:case 257:case 269:case 346:case 363:case 441:case 458:case 459:case 463:case 471:case 512:case 513:case 551:case 636:case 643:case 667:case 669:case 671:case 685:case 686:case 716:case 740:this.$=[s[o]];break;case 7:this.$=s[o],s[o].explain=!0;break;case 8:this.$=s[o],s[o].explain=!0;break;case 9:this.$=s[o],r.exists&&(this.$.exists=r.exists),delete r.exists,r.queries&&(this.$.queries=r.queries),delete r.queries;break;case 10:case 158:case 168:case 233:case 234:case 236:case 244:case 246:case 255:case 263:case 266:case 366:case 475:case 485:case 487:case 499:case 505:case 506:case 552:this.$=void 0;break;case 64:this.$=new r.WithSelect({withs:s[o-1],select:s[o]});break;case 65:case 550:s[o-2].push(s[o]),this.$=s[o-2];break;case 67:this.$={name:s[o-4],select:s[o-1]};break;case 68:r.extend(this.$,s[o-9]),r.extend(this.$,s[o-8]),r.extend(this.$,s[o-7]),r.extend(this.$,s[o-6]),r.extend(this.$,s[o-5]),r.extend(this.$,s[o-4]),r.extend(this.$,s[o-3]),r.extend(this.$,s[o-2]),r.extend(this.$,s[o-1]),r.extend(this.$,s[o]),this.$=s[o-9];break;case 69:this.$=new r.Search({selectors:s[o-2],from:s[o]}),r.extend(this.$,s[o-1]);break;case 70:this.$={pivot:{expr:s[o-5],columnid:s[o-3],inlist:s[o-2],as:s[o]}};break;case 71:this.$={unpivot:{tocolumnid:s[o-8],forcolumnid:s[o-6],inlist:s[o-3],as:s[o]}};break;case 72:case 504:case 534:case 570:case 606:case 624:case 627:case 646:this.$=s[o-1];break;case 73:case 74:case 82:case 143:case 181:case 243:case 276:case 284:case 285:case 286:case 287:case 288:case 289:case 290:case 291:case 292:case 293:case 294:case 295:case 296:case 297:case 299:case 312:case 313:case 314:case 315:case 316:case 317:case 365:case 430:case 431:case 432:case 433:case 434:case 435:case 500:case 531:case 533:case 610:case 611:case 612:case 613:case 614:case 615:case 619:case 621:case 622:case 631:case 644:case 645:case 707:case 722:case 723:case 725:case 726:case 732:case 733:this.$=s[o];break;case 75:case 80:case 715:case 739:this.$=s[o-2],this.$.push(s[o]);break;case 77:this.$={expr:s[o]};break;case 78:this.$={expr:s[o-2],as:s[o]};break;case 79:this.$={removecolumns:s[o]};break;case 83:this.$={like:s[o]};break;case 86:case 100:this.$={srchid:"PROP",args:[s[o]]};break;case 87:this.$={srchid:"ORDERBY",args:s[o-1]};break;case 88:var u=s[o-1];u||(u="ASC"),this.$={srchid:"ORDERBY",args:[{expression:new r.Column({columnid:"_"}),direction:u}]};break;case 89:this.$={srchid:"PARENT"};break;case 90:this.$={srchid:"APROP",args:[s[o]]};break;case 91:this.$={selid:"ROOT"};break;case 92:this.$={srchid:"EQ",args:[s[o]]};break;case 93:this.$={srchid:"LIKE",args:[s[o]]};break;case 94:case 95:this.$={selid:"WITH",args:s[o-1]};break;case 96:this.$={srchid:s[o-3].toUpperCase(),args:s[o-1]};break;case 97:this.$={srchid:"WHERE",args:[s[o-1]]};break;case 98:this.$={selid:"OF",args:[s[o-1]]};break;case 99:this.$={srchid:"CLASS",args:[s[o-1]]};break;case 101:this.$={srchid:"NAME",args:[s[o].substr(1,s[o].length-2)]};break;case 102:this.$={srchid:"CHILD"};break;case 103:this.$={srchid:"VERTEX"};break;case 104:this.$={srchid:"EDGE"};break;case 105:this.$={srchid:"REF"};break;case 106:this.$={srchid:"SHARP",args:[s[o]]};break;case 107:this.$={srchid:"ATTR",args:"undefined"==typeof s[o]?void 0:[s[o]]};break;case 108:this.$={srchid:"ATTR"};break;case 109:this.$={srchid:"OUT"};break;case 110:this.$={srchid:"IN"};break;case 111:this.$={srchid:"OUTOUT"};break;case 112:this.$={srchid:"ININ"};break;case 113:this.$={srchid:"CONTENT"};break;case 114:this.$={srchid:"EX",args:[new r.Json({value:s[o]})]};break;case 115:this.$={srchid:"AT",args:[s[o]]};break;case 116:this.$={srchid:"AS",args:[s[o]]};break;case 117:this.$={srchid:"SET",args:s[o-1]};break;case 118:this.$={selid:"TO",args:[s[o]]};break;case 119:this.$={srchid:"VALUE"};break;case 120:this.$={srchid:"ROW",args:s[o-1]};break;case 121:this.$={srchid:"CLASS",args:[s[o]]};break;case 122:this.$={selid:s[o],args:[s[o-1]]};break;case 123:this.$={selid:"NOT",args:s[o-1]};break;case 124:this.$={selid:"IF",args:s[o-1]};break;case 125:this.$={selid:s[o-3],args:s[o-1]};break;case 126:this.$={selid:"DISTINCT",args:s[o-1]};break;case 127:this.$={selid:"UNION",args:s[o-1]};break;case 128:this.$={selid:"UNIONALL",args:s[o-1]};break;case 129:this.$={selid:"ALL",args:[s[o-1]]};break;case 130:this.$={selid:"ANY",args:[s[o-1]]};break;case 131:this.$={selid:"INTERSECT",args:s[o-1]};break;case 132:this.$={selid:"EXCEPT",args:s[o-1]};break;case 133:this.$={selid:"AND",args:s[o-1]};break;case 134:this.$={selid:"OR",args:s[o-1]};break;case 135:this.$={selid:"PATH",args:[s[o-1]]};break;case 136:this.$={srchid:"RETURN",args:s[o-1]};break;case 137:this.$={selid:"REPEAT",sels:s[o-3],args:s[o-1]};break;case 138:this.$=s[o-2],this.$.push(s[o]);break;case 140:this.$="PLUS";break;case 141:this.$="STAR";break;case 142:this.$="QUESTION";break;case 144:this.$=new r.Select({columns:s[o],distinct:!0}),r.extend(this.$,s[o-3]),r.extend(this.$,s[o-1]);break;case 145:this.$=new r.Select({columns:s[o],distinct:!0}),r.extend(this.$,s[o-3]),r.extend(this.$,s[o-1]);break;case 146:this.$=new r.Select({columns:s[o],all:!0}),r.extend(this.$,s[o-3]),r.extend(this.$,s[o-1]);break;case 147:s[o]?(this.$=new r.Select({columns:s[o]}),r.extend(this.$,s[o-2]),r.extend(this.$,s[o-1])):this.$=new r.Select({columns:[new r.Column({columnid:"_"})],modifier:"COLUMN"});break;case 148:"SELECT"==s[o]?this.$=void 0:this.$={modifier:s[o]};break;case 149:this.$={modifier:"VALUE"};break;case 150:this.$={modifier:"ROW"};break;case 151:this.$={modifier:"COLUMN"};break;case 152:this.$={modifier:"MATRIX"};break;case 153:this.$={modifier:"TEXTSTRING"};break;case 154:this.$={modifier:"INDEX"};break;case 155:this.$={modifier:"RECORDSET"};break;case 156:this.$={top:s[o-1],percent:"undefined"!=typeof s[o]?!0:void 0};break;case 157:this.$={top:s[o-1]};break;case 159:case 322:case 507:case 508:case 708:this.$=void 0;break;case 160:case 161:case 162:case 163:this.$={into:s[o]};break;case 164:var c=s[o];c=c.substr(1,c.length-2);var l=c.substr(-3).toUpperCase(),d=c.substr(-4).toUpperCase();"#"==c[0]?this.$={into:new r.FuncValue({funcid:"HTML",args:[new r.StringValue({value:c}),new r.Json({value:{headers:!0}})]})}:"XLS"==l||"CSV"==l||"TAB"==l?this.$={into:new r.FuncValue({funcid:l,args:[new r.StringValue({value:c}),new r.Json({value:{headers:!0}})]})}:("XLSX"==d||"JSON"==d)&&(this.$={into:new r.FuncValue({funcid:d,args:[new r.StringValue({value:c}),new r.Json({value:{headers:!0}})]})});break;case 165:this.$={from:s[o]};break;case 166:this.$={from:s[o-1],joins:s[o]};break;case 167:this.$={from:s[o-2],joins:s[o-1]};break;case 169:this.$=new r.Apply({select:s[o-2],applymode:"CROSS",as:s[o]});break;case 170:this.$=new r.Apply({select:s[o-3],applymode:"CROSS",as:s[o]});break;case 171:this.$=new r.Apply({select:s[o-2],applymode:"OUTER",as:s[o]});break;case 172:this.$=new r.Apply({select:s[o-3],applymode:"OUTER",as:s[o]});break;case 174:case 239:case 442:case 514:case 515:this.$=s[o-2],s[o-2].push(s[o]);break;case 175:this.$=s[o-2],this.$.as=s[o];break;case 176:this.$=s[o-3],this.$.as=s[o];break;case 177:this.$=s[o-1],this.$.as="default";break;case 178:this.$=new r.Json({value:s[o-2]}),s[o-2].as=s[o];break;case 179:this.$=s[o-1],s[o-1].as=s[o];break;case 180:this.$=s[o-2],s[o-2].as=s[o];break;case 182:case 625:case 628:this.$=s[o-2];break;case 183:case 187:case 191:case 194:this.$=s[o-1],s[o-1].as=s[o];break;case 184:case 188:case 192:case 195:this.$=s[o-2],s[o-2].as=s[o];break;case 185:case 186:case 190:case 193:this.$=s[o],s[o].as="default";break;case 189:this.$={inserted:!0},s[o].as="default";break;case 196:var c=s[o];c=c.substr(1,c.length-2);var h,l=c.substr(-3).toUpperCase(),d=c.substr(-4).toUpperCase();if("#"==c[0])h=new r.FuncValue({funcid:"HTML",args:[new r.StringValue({value:c}),new r.Json({value:{headers:!0}})]});else if("XLS"==l||"CSV"==l||"TAB"==l)h=new r.FuncValue({funcid:l,args:[new r.StringValue({value:c}),new r.Json({value:{headers:!0}})]});else{if("XLSX"!=d&&"JSON"!=d)throw new Error("Unknown string in FROM clause");h=new r.FuncValue({funcid:d,args:[new r.StringValue({value:c}),new r.Json({value:{headers:!0}})]})}this.$=h;break;case 197:"INFORMATION_SCHEMA"==s[o-2]?this.$=new r.FuncValue({funcid:s[o-2],args:[new r.StringValue({value:s[o]})]}):this.$=new r.Table({databaseid:s[o-2],tableid:s[o]});break;case 198:this.$=new r.Table({tableid:s[o]});break;case 199:case 200:this.$=s[o-1],s[o-1].push(s[o]);break;case 203:this.$=new r.Join(s[o-2]),r.extend(this.$,s[o-1]),r.extend(this.$,s[o]);break;case 204:this.$={table:s[o]};break;case 205:this.$={table:s[o-1],as:s[o]};break;case 206:this.$={table:s[o-2],as:s[o]};break;case 207:this.$={json:new r.Json({value:s[o-2],as:s[o]})};break;case 208:this.$={param:s[o-1],as:s[o]};break;case 209:this.$={param:s[o-2],as:s[o]};break;case 210:this.$={select:s[o-3],as:s[o]};break;case 211:this.$={select:s[o-4],as:s[o]};break;case 212:this.$={funcid:s[o],as:"default"};break;case 213:this.$={funcid:s[o-1],as:s[o]};break;case 214:this.$={funcid:s[o-2],as:s[o]};break;case 215:this.$={variable:s[o],as:"default"};break;case 216:this.$={variable:s[o-1],as:s[o]};break;case 217:this.$={variable:s[o-2],as:s[o]};break;case 218:this.$={joinmode:s[o]};break;case 219:this.$={joinmode:s[o-1],natural:!0};break;case 220:case 221:this.$="INNER";break;case 222:case 223:this.$="LEFT";break;case 224:case 225:this.$="RIGHT";break;case 226:case 227:this.$="OUTER";break;case 228:this.$="SEMI";break;case 229:this.$="ANTI";break;case 230:this.$="CROSS";break;case 231:this.$={on:s[o]};break;case 232:case 681:this.$={using:s[o]};break;case 235:this.$={where:new r.Expression({expression:s[o]})};break;case 237:this.$={group:s[o-1]},r.extend(this.$,s[o]);break;case 240:this.$=new r.GroupExpression({type:"GROUPING SETS",group:s[o-1]});break;case 241:this.$=new r.GroupExpression({type:"ROLLUP",group:s[o-1]});break;case 242:this.$=new r.GroupExpression({type:"CUBE",group:s[o-1]});break;case 245:this.$={having:s[o]};break;case 247:this.$={union:s[o]};break;case 248:this.$={unionall:s[o]};break;case 249:this.$={except:s[o]};break;case 250:this.$={intersect:s[o]};break;case 251:this.$={union:s[o],corresponding:!0};break;case 252:this.$={unionall:s[o],corresponding:!0};break;case 253:this.$={except:s[o],corresponding:!0};break;case 254:this.$={intersect:s[o],corresponding:!0};break;case 256:this.$={order:s[o]};break;case 258:this.$=s[o-2],s[o-2].push(s[o]);break;case 259:this.$=new r.Expression({expression:s[o],direction:"ASC"});break;case 260:this.$=new r.Expression({expression:s[o-1],direction:s[o].toUpperCase()});break;case 261:this.$=new r.Expression({expression:s[o-2],direction:"ASC",nocase:!0});break;case 262:this.$=new r.Expression({expression:s[o-3],direction:s[o].toUpperCase(),nocase:!0});break;case 264:this.$={limit:s[o-1]},r.extend(this.$,s[o]);break;case 265:this.$={limit:s[o-2],offset:s[o-6]};break;case 267:this.$={offset:s[o]};break;case 268:case 493:case 517:case 635:case 642:case 666:case 668:case 672:s[o-2].push(s[o]),this.$=s[o-2];break;case 270:case 272:case 274:s[o-2].as=s[o],this.$=s[o-2];break;case 271:case 273:case 275:s[o-1].as=s[o],this.$=s[o-1];break;case 277:this.$=new r.Column({columid:s[o],tableid:s[o-2],databaseid:s[o-4]});break;case 278:this.$=new r.Column({columnid:s[o],tableid:s[o-2]});break;case 279:this.$=new r.Column({columnid:s[o]});break;case 280:this.$=new r.Column({columnid:s[o],tableid:s[o-2],databaseid:s[o-4]});break;case 281:case 282:this.$=new r.Column({columnid:s[o],tableid:s[o-2]});break;case 283:this.$=new r.Column({columnid:s[o]});break;case 298:this.$=new r.Json({value:s[o]});break;case 300:case 301:case 302:r.queries||(r.queries=[]),r.queries.push(s[o-1]),s[o-1].queriesidx=r.queries.length,this.$=s[o-1];break;case 303:this.$=s[o];break;case 304:this.$=new r.FuncValue({funcid:"CURRENT_TIMESTAMP"});break;case 305:this.$=new r.JavaScript({value:s[o].substr(2,s[o].length-4)});break;case 306:this.$=new r.FuncValue({funcid:s[o],newid:!0});break;case 307:this.$=s[o],r.extend(this.$,{newid:!0});break;case 308:this.$=new r.Convert({expression:s[o-3]}),r.extend(this.$,s[o-1]);break;case 309:this.$=new r.Convert({expression:s[o-5],style:s[o-1]}),r.extend(this.$,s[o-3]);break;case 310:this.$=new r.Convert({expression:s[o-1]}),r.extend(this.$,s[o-3]);break;case 311:this.$=new r.Convert({expression:s[o-3],style:s[o-1]}),r.extend(this.$,s[o-5]);break;case 318:this.$=new r.FuncValue({funcid:"CURRENT_TIMESTAMP"});break;case 319:s[o-2].length>1&&("MAX"==s[o-4].toUpperCase()||"MIN"==s[o-4].toUpperCase())?this.$=new r.FuncValue({funcid:s[o-4],args:s[o-2]}):this.$=new r.AggrValue({aggregatorid:s[o-4].toUpperCase(),expression:s[o-2].pop(),over:s[o]});break;case 320:this.$=new r.AggrValue({aggregatorid:s[o-5].toUpperCase(),expression:s[o-2],distinct:!0,over:s[o]});break;case 321:this.$=new r.AggrValue({aggregatorid:s[o-5].toUpperCase(),expression:s[o-2],over:s[o]});break;case 323:case 324:this.$=new r.Over,r.extend(this.$,s[o-1]);break;case 325:this.$=new r.Over,r.extend(this.$,s[o-2]),r.extend(this.$,s[o-1]);break;case 326:this.$={partition:s[o]};break;case 327:this.$={order:s[o]};break;case 328:this.$="SUM";break;case 329:this.$="COUNT";break;case 330:this.$="MIN";break;case 331:case 529:this.$="MAX";break;case 332:this.$="AVG";break;case 333:this.$="FIRST";break;case 334:this.$="LAST";break;case 335:this.$="AGGR";break;case 336:this.$="ARRAY";break;case 337:var f=s[o-4],p=s[o-1];p.length>1&&("MIN"==f.toUpperCase()||"MAX"==f.toUpperCase())?this.$=new r.FuncValue({funcid:f,args:p}):T.aggr[s[o-4]]?this.$=new r.AggrValue({aggregatorid:"REDUCE",funcid:f,expression:p.pop(),distinct:"DISTINCT"==s[o-2]}):this.$=new r.FuncValue({funcid:f,args:p});break;case 338:this.$=new r.FuncValue({funcid:s[o-2]});break;case 339:this.$=new r.FuncValue({funcid:"IIF",args:s[o-1]});break;case 340:this.$=new r.FuncValue({funcid:"REPLACE",args:s[o-1]});break;case 341:this.$=new r.FuncValue({funcid:"DATEADD",args:[new r.StringValue({value:s[o-5]}),s[o-3],s[o-1]]});break;case 342:this.$=new r.FuncValue({funcid:"DATEADD",args:[s[o-5],s[o-3],s[o-1]]});break;case 343:this.$=new r.FuncValue({funcid:"DATEDIFF",args:[new r.StringValue({value:s[o-5]}),s[o-3],s[o-1]]});break;case 344:this.$=new r.FuncValue({funcid:"DATEDIFF",args:[s[o-5],s[o-3],s[o-1]] });break;case 345:this.$=new r.FuncValue({funcid:"INTERVAL",args:[s[o-1],new r.StringValue({value:s[o].toLowerCase()})]});break;case 347:s[o-2].push(s[o]),this.$=s[o-2];break;case 348:this.$=new r.NumValue({value:+s[o]});break;case 349:this.$=new r.LogicValue({value:!0});break;case 350:this.$=new r.LogicValue({value:!1});break;case 351:this.$=new r.StringValue({value:s[o].substr(1,s[o].length-2).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 352:this.$=new r.StringValue({value:s[o].substr(2,s[o].length-3).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 353:this.$=new r.NullValue({value:void 0});break;case 354:this.$=new r.VarValue({variable:s[o]});break;case 355:r.exists||(r.exists=[]),this.$=new r.ExistsValue({value:s[o-1],existsidx:r.exists.length}),r.exists.push(s[o-1]);break;case 356:case 357:this.$=new r.ParamValue({param:s[o]});break;case 358:"undefined"==typeof r.question&&(r.question=0),this.$=new r.ParamValue({param:r.question++});break;case 359:"undefined"==typeof r.question&&(r.question=0),this.$=new r.ParamValue({param:r.question++,array:!0});break;case 360:this.$=new r.CaseValue({expression:s[o-3],whens:s[o-2],elses:s[o-1]});break;case 361:this.$=new r.CaseValue({whens:s[o-2],elses:s[o-1]});break;case 362:case 683:case 684:this.$=s[o-1],this.$.push(s[o]);break;case 364:this.$={when:s[o-2],then:s[o]};break;case 367:this.$=new r.Op({left:s[o-2],op:"REGEXP",right:s[o]});break;case 368:this.$=new r.Op({left:s[o-2],op:"GLOB",right:s[o]});break;case 369:this.$=new r.Op({left:s[o-2],op:"LIKE",right:s[o]});break;case 370:this.$=new r.Op({left:s[o-4],op:"LIKE",right:s[o-2],escape:s[o]});break;case 371:this.$=new r.Op({left:s[o-2],op:"NOT LIKE",right:s[o]});break;case 372:this.$=new r.Op({left:s[o-4],op:"NOT LIKE",right:s[o-2],escape:s[o]});break;case 373:this.$=new r.Op({left:s[o-2],op:"||",right:s[o]});break;case 374:this.$=new r.Op({left:s[o-2],op:"+",right:s[o]});break;case 375:this.$=new r.Op({left:s[o-2],op:"-",right:s[o]});break;case 376:this.$=new r.Op({left:s[o-2],op:"*",right:s[o]});break;case 377:this.$=new r.Op({left:s[o-2],op:"/",right:s[o]});break;case 378:this.$=new r.Op({left:s[o-2],op:"%",right:s[o]});break;case 379:this.$=new r.Op({left:s[o-2],op:"^",right:s[o]});break;case 380:this.$=new r.Op({left:s[o-2],op:">>",right:s[o]});break;case 381:this.$=new r.Op({left:s[o-2],op:"<<",right:s[o]});break;case 382:this.$=new r.Op({left:s[o-2],op:"&",right:s[o]});break;case 383:this.$=new r.Op({left:s[o-2],op:"|",right:s[o]});break;case 384:case 385:case 387:this.$=new r.Op({left:s[o-2],op:"->",right:s[o]});break;case 386:this.$=new r.Op({left:s[o-4],op:"->",right:s[o-1]});break;case 388:case 389:case 391:this.$=new r.Op({left:s[o-2],op:"!",right:s[o]});break;case 390:this.$=new r.Op({left:s[o-4],op:"!",right:s[o-1]});break;case 392:this.$=new r.Op({left:s[o-2],op:">",right:s[o]});break;case 393:this.$=new r.Op({left:s[o-2],op:">=",right:s[o]});break;case 394:this.$=new r.Op({left:s[o-2],op:"<",right:s[o]});break;case 395:this.$=new r.Op({left:s[o-2],op:"<=",right:s[o]});break;case 396:this.$=new r.Op({left:s[o-2],op:"=",right:s[o]});break;case 397:this.$=new r.Op({left:s[o-2],op:"==",right:s[o]});break;case 398:this.$=new r.Op({left:s[o-2],op:"===",right:s[o]});break;case 399:this.$=new r.Op({left:s[o-2],op:"!=",right:s[o]});break;case 400:this.$=new r.Op({left:s[o-2],op:"!==",right:s[o]});break;case 401:this.$=new r.Op({left:s[o-2],op:"!===",right:s[o]});break;case 402:r.queries||(r.queries=[]),this.$=new r.Op({left:s[o-5],op:s[o-4],allsome:s[o-3],right:s[o-1],queriesidx:r.queries.length}),r.queries.push(s[o-1]);break;case 403:this.$=new r.Op({left:s[o-5],op:s[o-4],allsome:s[o-3],right:s[o-1]});break;case 404:"BETWEEN1"==s[o-2].op?"AND"==s[o-2].left.op?this.$=new r.Op({left:s[o-2].left.left,op:"AND",right:new r.Op({left:s[o-2].left.right,op:"BETWEEN",right1:s[o-2].right,right2:s[o]})}):this.$=new r.Op({left:s[o-2].left,op:"BETWEEN",right1:s[o-2].right,right2:s[o]}):"NOT BETWEEN1"==s[o-2].op?"AND"==s[o-2].left.op?this.$=new r.Op({left:s[o-2].left.left,op:"AND",right:new r.Op({left:s[o-2].left.right,op:"NOT BETWEEN",right1:s[o-2].right,right2:s[o]})}):this.$=new r.Op({left:s[o-2].left,op:"NOT BETWEEN",right1:s[o-2].right,right2:s[o]}):this.$=new r.Op({left:s[o-2],op:"AND",right:s[o]});break;case 405:this.$=new r.Op({left:s[o-2],op:"OR",right:s[o]});break;case 406:this.$=new r.UniOp({op:"NOT",right:s[o]});break;case 407:this.$=new r.UniOp({op:"-",right:s[o]});break;case 408:this.$=new r.UniOp({op:"+",right:s[o]});break;case 409:this.$=new r.UniOp({op:"~",right:s[o]});break;case 410:this.$=new r.UniOp({op:"#",right:s[o]});break;case 411:this.$=new r.UniOp({right:s[o-1]});break;case 412:r.queries||(r.queries=[]),this.$=new r.Op({left:s[o-4],op:"IN",right:s[o-1],queriesidx:r.queries.length}),r.queries.push(s[o-1]);break;case 413:r.queries||(r.queries=[]),this.$=new r.Op({left:s[o-5],op:"NOT IN",right:s[o-1],queriesidx:r.queries.length}),r.queries.push(s[o-1]);break;case 414:this.$=new r.Op({left:s[o-4],op:"IN",right:s[o-1]});break;case 415:this.$=new r.Op({left:s[o-5],op:"NOT IN",right:s[o-1]});break;case 416:this.$=new r.Op({left:s[o-3],op:"IN",right:[]});break;case 417:this.$=new r.Op({left:s[o-4],op:"NOT IN",right:[]});break;case 418:case 420:this.$=new r.Op({left:s[o-2],op:"IN",right:s[o]});break;case 419:case 421:this.$=new r.Op({left:s[o-3],op:"NOT IN",right:s[o]});break;case 422:this.$=new r.Op({left:s[o-2],op:"BETWEEN1",right:s[o]});break;case 423:this.$=new r.Op({left:s[o-2],op:"NOT BETWEEN1",right:s[o]});break;case 424:this.$=new r.Op({op:"IS",left:s[o-2],right:s[o]});break;case 425:this.$=new r.Op({op:"IS",left:s[o-2],right:new r.UniOp({op:"NOT",right:new r.NullValue({value:void 0})})});break;case 426:this.$=new r.Convert({expression:s[o-2]}),r.extend(this.$,s[o]);break;case 427:case 428:this.$=s[o];break;case 429:this.$=s[o-1];break;case 436:this.$="ALL";break;case 437:this.$="SOME";break;case 438:this.$="ANY";break;case 439:this.$=new r.Update({table:s[o-4],columns:s[o-2],where:s[o]});break;case 440:this.$=new r.Update({table:s[o-2],columns:s[o]});break;case 443:this.$=new r.SetColumn({column:s[o-2],expression:s[o]});break;case 444:this.$=new r.SetColumn({variable:s[o-2],expression:s[o],method:s[o-3]});break;case 445:this.$=new r.Delete({table:s[o-2],where:s[o]});break;case 446:this.$=new r.Delete({table:s[o]});break;case 447:this.$=new r.Insert({into:s[o-2],values:s[o]});break;case 448:case 449:this.$=new r.Insert({into:s[o-2],values:s[o],orreplace:!0});break;case 450:this.$=new r.Insert({into:s[o-2],"default":!0});break;case 451:this.$=new r.Insert({into:s[o-5],columns:s[o-3],values:s[o]});break;case 452:this.$=new r.Insert({into:s[o-1],select:s[o]});break;case 453:this.$=new r.Insert({into:s[o-1],select:s[o],orreplace:!0});break;case 454:this.$=new r.Insert({into:s[o-4],columns:s[o-2],select:s[o]});break;case 457:this.$=[s[o-1]];break;case 460:this.$=s[o-4],s[o-4].push(s[o-1]);break;case 461:case 462:case 464:case 472:this.$=s[o-2],s[o-2].push(s[o]);break;case 473:this.$=new r.CreateTable({table:s[o-4]}),r.extend(this.$,s[o-7]),r.extend(this.$,s[o-6]),r.extend(this.$,s[o-5]),r.extend(this.$,s[o-2]),r.extend(this.$,s[o]);break;case 474:this.$=new r.CreateTable({table:s[o]}),r.extend(this.$,s[o-3]),r.extend(this.$,s[o-2]),r.extend(this.$,s[o-1]);break;case 476:this.$={"class":!0};break;case 486:this.$={temporary:!0};break;case 488:this.$={ifnotexists:!0};break;case 489:this.$={columns:s[o-2],constraints:s[o]};break;case 490:this.$={columns:s[o]};break;case 491:this.$={as:s[o]};break;case 492:case 516:this.$=[s[o]];break;case 494:case 495:case 496:case 497:case 498:s[o].constraintid=s[o-1],this.$=s[o];break;case 501:this.$={type:"CHECK",expression:s[o-1]};break;case 502:this.$={type:"PRIMARY KEY",columns:s[o-1],clustered:(s[o-3]+"").toUpperCase()};break;case 503:this.$={type:"FOREIGN KEY",columns:s[o-5],fktable:s[o-2],fkcolumns:s[o-1]};break;case 509:this.$={type:"UNIQUE",columns:s[o-1],clustered:(s[o-3]+"").toUpperCase()};break;case 518:this.$=new r.ColumnDef({columnid:s[o-2]}),r.extend(this.$,s[o-1]),r.extend(this.$,s[o]);break;case 519:this.$=new r.ColumnDef({columnid:s[o-1]}),r.extend(this.$,s[o]);break;case 520:this.$=new r.ColumnDef({columnid:s[o],dbtypeid:""});break;case 521:this.$={dbtypeid:s[o-5],dbsize:s[o-3],dbprecision:+s[o-1]};break;case 522:this.$={dbtypeid:s[o-6]+(s[o-5]?" "+s[o-5]:""),dbsize:s[o-3],dbprecision:+s[o-1]};break;case 523:this.$={dbtypeid:s[o-3],dbsize:s[o-1]};break;case 524:this.$={dbtypeid:s[o-4]+(s[o-3]?" "+s[o-3]:""),dbsize:s[o-1]};break;case 525:this.$={dbtypeid:s[o]};break;case 526:this.$={dbtypeid:s[o-1]+(s[o]?" "+s[o]:"")};break;case 527:this.$={dbtypeid:"ENUM",enumvalues:s[o-1]};break;case 528:case 734:this.$=+s[o];break;case 530:this.$=void 0;break;case 532:r.extend(s[o-1],s[o]),this.$=s[o-1];break;case 535:this.$={primarykey:!0};break;case 536:case 537:this.$={foreignkey:{table:s[o-1],columnid:s[o]}};break;case 538:this.$={identity:{value:s[o-3],step:s[o-1]}};break;case 539:this.$={identity:{value:1,step:1}};break;case 540:case 542:this.$={"default":s[o]};break;case 541:this.$={"default":s[o-1]};break;case 543:this.$={"null":!0};break;case 544:this.$={notnull:!0};break;case 545:this.$={check:s[o]};break;case 546:this.$={unique:!0};break;case 547:this.$={onupdate:s[o]};break;case 548:this.$={onupdate:s[o-1]};break;case 549:this.$=new r.DropTable({tables:s[o],type:s[o-2]}),r.extend(this.$,s[o-1]);break;case 553:this.$={ifexists:!0};break;case 554:this.$=new r.AlterTable({table:s[o-3],renameto:s[o]});break;case 555:this.$=new r.AlterTable({table:s[o-3],addcolumn:s[o]});break;case 556:this.$=new r.AlterTable({table:s[o-3],modifycolumn:s[o]});break;case 557:this.$=new r.AlterTable({table:s[o-5],renamecolumn:s[o-2],to:s[o]});break;case 558:this.$=new r.AlterTable({table:s[o-3],dropcolumn:s[o]});break;case 559:this.$=new r.AlterTable({table:s[o-2],renameto:s[o]});break;case 560:this.$=new r.AttachDatabase({databaseid:s[o],engineid:s[o-2].toUpperCase()});break;case 561:this.$=new r.AttachDatabase({databaseid:s[o-3],engineid:s[o-5].toUpperCase(),args:s[o-1]});break;case 562:this.$=new r.AttachDatabase({databaseid:s[o-2],engineid:s[o-4].toUpperCase(),as:s[o]});break;case 563:this.$=new r.AttachDatabase({databaseid:s[o-5],engineid:s[o-7].toUpperCase(),as:s[o],args:s[o-3]});break;case 564:this.$=new r.DetachDatabase({databaseid:s[o]});break;case 565:this.$=new r.CreateDatabase({databaseid:s[o]}),r.extend(this.$,s[o]);break;case 566:this.$=new r.CreateDatabase({engineid:s[o-4].toUpperCase(),databaseid:s[o-1],as:s[o]}),r.extend(this.$,s[o-2]);break;case 567:this.$=new r.CreateDatabase({engineid:s[o-7].toUpperCase(),databaseid:s[o-4],args:s[o-2],as:s[o]}),r.extend(this.$,s[o-5]);break;case 568:this.$=new r.CreateDatabase({engineid:s[o-4].toUpperCase(),as:s[o],args:[s[o-1]]}),r.extend(this.$,s[o-2]);break;case 569:this.$=void 0;break;case 571:case 572:this.$=new r.UseDatabase({databaseid:s[o]});break;case 573:this.$=new r.DropDatabase({databaseid:s[o]}),r.extend(this.$,s[o-1]);break;case 574:case 575:this.$=new r.DropDatabase({databaseid:s[o],engineid:s[o-3].toUpperCase()}),r.extend(this.$,s[o-1]);break;case 576:this.$=new r.CreateIndex({indexid:s[o-5],table:s[o-3],columns:s[o-1]});break;case 577:this.$=new r.CreateIndex({indexid:s[o-5],table:s[o-3],columns:s[o-1],unique:!0});break;case 578:this.$=new r.DropIndex({indexid:s[o]});break;case 579:this.$=new r.ShowDatabases;break;case 580:this.$=new r.ShowDatabases({like:s[o]});break;case 581:this.$=new r.ShowDatabases({engineid:s[o-1].toUpperCase()});break;case 582:this.$=new r.ShowDatabases({engineid:s[o-3].toUpperCase(),like:s[o]});break;case 583:this.$=new r.ShowTables;break;case 584:this.$=new r.ShowTables({like:s[o]});break;case 585:this.$=new r.ShowTables({databaseid:s[o]});break;case 586:this.$=new r.ShowTables({like:s[o],databaseid:s[o-2]});break;case 587:this.$=new r.ShowColumns({table:s[o]});break;case 588:this.$=new r.ShowColumns({table:s[o-2],databaseid:s[o]});break;case 589:this.$=new r.ShowIndex({table:s[o]});break;case 590:this.$=new r.ShowIndex({table:s[o-2],databaseid:s[o]});break;case 591:this.$=new r.ShowCreateTable({table:s[o]});break;case 592:this.$=new r.ShowCreateTable({table:s[o-2],databaseid:s[o]});break;case 593:this.$=new r.CreateTable({table:s[o-6],view:!0,select:s[o-1],viewcolumns:s[o-4]}),r.extend(this.$,s[o-9]),r.extend(this.$,s[o-7]);break;case 594:this.$=new r.CreateTable({table:s[o-3],view:!0,select:s[o-1]}),r.extend(this.$,s[o-6]),r.extend(this.$,s[o-4]);break;case 598:this.$=new r.DropTable({tables:s[o],view:!0}),r.extend(this.$,s[o-1]);break;case 599:this.$=new r.Help({subject:s[o].value.toUpperCase()});break;case 600:this.$=new r.Help;break;case 601:case 744:this.$=new r.ExpressionStatement({expression:s[o]});break;case 602:this.$=new r.Source({url:s[o].value});break;case 603:this.$=new r.Assert({value:s[o]});break;case 604:this.$=new r.Assert({value:s[o].value});break;case 605:this.$=new r.Assert({value:s[o],message:s[o-2]});break;case 607:case 618:case 620:this.$=s[o].value;break;case 608:case 616:this.$=+s[o].value;break;case 609:this.$=!!s[o].value;break;case 617:this.$=""+s[o].value;break;case 623:this.$=s[o-1];break;case 626:this.$={};break;case 629:this.$=[];break;case 630:r.extend(s[o-2],s[o]),this.$=s[o-2];break;case 632:this.$={},this.$[s[o-2].substr(1,s[o-2].length-2)]=s[o];break;case 633:case 634:this.$={},this.$[s[o-2]]=s[o];break;case 637:this.$=new r.SetVariable({variable:s[o-1].toLowerCase(),value:s[o]});break;case 638:this.$=new r.SetVariable({variable:s[o-2],expression:s[o],method:s[o-3]});break;case 639:this.$=new r.SetVariable({variable:s[o-3],props:s[o-2],expression:s[o],method:s[o-4]});break;case 640:this.$="@";break;case 641:this.$="$";break;case 647:this.$=!0;break;case 648:this.$=!1;break;case 649:this.$=new r.CommitTransaction;break;case 650:this.$=new r.RollbackTransaction;break;case 651:this.$=new r.BeginTransaction;break;case 652:this.$=new r.If({expression:s[o-2],thenstat:s[o-1],elsestat:s[o]}),s[o-1].exists&&(this.$.exists=s[o-1].exists),s[o-1].queries&&(this.$.queries=s[o-1].queries);break;case 653:this.$=new r.If({expression:s[o-1],thenstat:s[o]}),s[o].exists&&(this.$.exists=s[o].exists),s[o].queries&&(this.$.queries=s[o].queries);break;case 654:this.$=s[o];break;case 655:this.$=new r.While({expression:s[o-1],loopstat:s[o]}),s[o].exists&&(this.$.exists=s[o].exists),s[o].queries&&(this.$.queries=s[o].queries);break;case 656:this.$=new r.Continue;break;case 657:this.$=new r.Break;break;case 658:this.$=new r.BeginEnd({statements:s[o-1]});break;case 659:this.$=new r.Print({exprs:s[o]});break;case 660:this.$=new r.Print({select:s[o]});break;case 661:this.$=new r.Require({paths:s[o]});break;case 662:this.$=new r.Require({plugins:s[o]});break;case 663:case 664:this.$=s[o].toUpperCase();break;case 665:this.$=new r.Echo({expr:s[o]});break;case 670:this.$=new r.Declare({declares:s[o]});break;case 673:this.$={variable:s[o-1]},r.extend(this.$,s[o]);break;case 674:this.$={variable:s[o-2]},r.extend(this.$,s[o]);break;case 675:this.$={variable:s[o-3],expression:s[o]},r.extend(this.$,s[o-2]);break;case 676:this.$={variable:s[o-4],expression:s[o]},r.extend(this.$,s[o-2]);break;case 677:this.$=new r.TruncateTable({table:s[o]});break;case 678:this.$=new r.Merge,r.extend(this.$,s[o-4]),r.extend(this.$,s[o-3]),r.extend(this.$,s[o-2]),r.extend(this.$,{matches:s[o-1]}),r.extend(this.$,s[o]);break;case 679:case 680:this.$={into:s[o]};break;case 682:this.$={on:s[o]};break;case 687:this.$={matched:!0,action:s[o]};break;case 688:this.$={matched:!0,expr:s[o-2],action:s[o]};break;case 689:this.$={"delete":!0};break;case 690:this.$={update:s[o]};break;case 691:case 692:this.$={matched:!1,bytarget:!0,action:s[o]};break;case 693:case 694:this.$={matched:!1,bytarget:!0,expr:s[o-2],action:s[o]};break;case 695:this.$={matched:!1,bysource:!0,action:s[o]};break;case 696:this.$={matched:!1,bysource:!0,expr:s[o-2],action:s[o]};break;case 697:this.$={insert:!0,values:s[o]};break;case 698:this.$={insert:!0,values:s[o],columns:s[o-3]};break;case 699:this.$={insert:!0,defaultvalues:!0};break;case 700:this.$={insert:!0,defaultvalues:!0,columns:s[o-3]};break;case 702:this.$={output:{columns:s[o]}};break;case 703:this.$={output:{columns:s[o-3],intovar:s[o],method:s[o-1]}};break;case 704:this.$={output:{columns:s[o-2],intotable:s[o]}};break;case 705:this.$={output:{columns:s[o-5],intotable:s[o-3],intocolumns:s[o-1]}};break;case 706:this.$=new r.CreateVertex({"class":s[o-3],sharp:s[o-2],name:s[o-1]}),r.extend(this.$,s[o]);break;case 709:this.$={sets:s[o]};break;case 710:this.$={content:s[o]};break;case 711:this.$={select:s[o]};break;case 712:this.$=new r.CreateEdge({from:s[o-3],to:s[o-1],name:s[o-5]}),r.extend(this.$,s[o]);break;case 713:this.$=new r.CreateGraph({graph:s[o]});break;case 714:this.$=new r.CreateGraph({from:s[o]});break;case 717:this.$=s[o-2],s[o-1]&&(this.$.json=new r.Json({value:s[o-1]})),s[o]&&(this.$.as=s[o]);break;case 718:this.$={source:s[o-6],target:s[o]},s[o-3]&&(this.$.json=new r.Json({value:s[o-3]})),s[o-2]&&(this.$.as=s[o-2]),r.extend(this.$,s[o-4]);break;case 719:this.$={source:s[o-5],target:s[o]},s[o-2]&&(this.$.json=new r.Json({value:s[o-3]})),s[o-1]&&(this.$.as=s[o-2]);break;case 720:this.$={source:s[o-2],target:s[o]};break;case 724:this.$={vars:s[o],method:s[o-1]};break;case 727:case 728:var b=s[o-1];this.$={prop:s[o-3],sharp:s[o-2],name:"undefined"==typeof b?void 0:b.substr(1,b.length-2),"class":s[o]};break;case 729:var g=s[o-1];this.$={sharp:s[o-2],name:"undefined"==typeof g?void 0:g.substr(1,g.length-2),"class":s[o]};break;case 730:var m=s[o-1];this.$={name:"undefined"==typeof m?void 0:m.substr(1,m.length-2),"class":s[o]};break;case 731:this.$={"class":s[o]};break;case 737:this.$=new r.AddRule({left:s[o-2],right:s[o]});break;case 738:this.$=new r.AddRule({right:s[o]});break;case 741:this.$=new r.Term({termid:s[o]});break;case 742:this.$=new r.Term({termid:s[o-3],args:s[o-1]});break;case 745:this.$=new r.CreateTrigger({trigger:s[o-6],when:s[o-5],action:s[o-4],table:s[o-2],statement:s[o]}),s[o].exists&&(this.$.exists=s[o].exists),s[o].queries&&(this.$.queries=s[o].queries);break;case 746:this.$=new r.CreateTrigger({trigger:s[o-5],when:s[o-4],action:s[o-3],table:s[o-1],funcid:s[o]});break;case 747:this.$=new r.CreateTrigger({trigger:s[o-6],when:s[o-4],action:s[o-3],table:s[o-5],statement:s[o]}),s[o].exists&&(this.$.exists=s[o].exists),s[o].queries&&(this.$.queries=s[o].queries);break;case 748:case 749:case 751:this.$="AFTER";break;case 750:this.$="BEFORE";break;case 752:this.$="INSTEADOF";break;case 753:this.$="INSERT";break;case 754:this.$="DELETE";break;case 755:this.$="UPDATE";break;case 756:this.$=new r.DropTrigger({trigger:s[o]});break;case 757:this.$=new r.Reindex({indexid:s[o]});break;case 764:case 784:case 786:case 788:case 792:case 794:case 796:case 798:case 800:case 802:this.$=[];break;case 765:case 779:case 781:case 785:case 787:case 789:case 793:case 795:case 797:case 799:case 801:case 803:s[o-1].push(s[o]);break;case 778:case 780:this.$=[s[o]]}},table:[t([8,509,510],n,{6:1,7:2,10:3,11:4,15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,4:r,5:a,12:s,51:i,69:o,86:u,121:c,143:l,153:d,186:h,262:f,283:p,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),{1:[3]},{8:[1,104],9:105,509:W,510:X},t(Y,[2,5]),t(Y,[2,6]),t(K,[2,9]),t(Y,n,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,10:108,4:r,5:a,13:[1,109],51:i,69:o,86:u,121:c,143:l,153:d,186:h,262:f,283:p,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),t(K,[2,11]),t(K,[2,12]),t(K,[2,13]),t(K,[2,14]),t(K,[2,15]),t(K,[2,16]),t(K,[2,17]),t(K,[2,18]),t(K,[2,19]),t(K,[2,20]),t(K,[2,21]),t(K,[2,22]),t(K,[2,23]),t(K,[2,24]),t(K,[2,25]),t(K,[2,26]),t(K,[2,27]),t(K,[2,28]),t(K,[2,29]),t(K,[2,30]),t(K,[2,31]),t(K,[2,32]),t(K,[2,33]),t(K,[2,34]),t(K,[2,35]),t(K,[2,36]),t(K,[2,37]),t(K,[2,38]),t(K,[2,39]),t(K,[2,40]),t(K,[2,41]),t(K,[2,42]),t(K,[2,43]),t(K,[2,44]),t(K,[2,45]),t(K,[2,46]),t(K,[2,47]),t(K,[2,48]),t(K,[2,49]),t(K,[2,50]),t(K,[2,51]),t(K,[2,52]),t(K,[2,53]),t(K,[2,54]),t(K,[2,55]),t(K,[2,56]),t(K,[2,57]),t(K,[2,58]),t(K,[2,59]),t(K,[2,60]),t(K,[2,61]),t(K,[2,62]),t(K,[2,63]),{343:[1,110]},{3:111,4:r,5:a},{3:113,4:r,5:a,153:Q,197:112,283:z,284:Z,285:ee,286:te},t(ne,[2,485],{3:120,338:124,4:r,5:a,131:re,132:ae,184:[1,122],190:[1,121],347:[1,128],394:[1,119],463:[1,123],500:[1,127]}),{142:se,440:129,441:130},{180:[1,132]},{394:[1,133]},{3:135,4:r,5:a,127:[1,141],190:[1,136],343:[1,140],386:137,394:[1,134],399:[1,138],500:[1,139]},{3:163,4:r,5:a,55:160,74:ie,91:142,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(Pe,_e,{331:198,168:[1,199],195:Be}),t(Pe,_e,{331:201,195:Be}),{3:213,4:r,5:a,74:Ge,129:Je,140:le,141:206,142:de,149:he,153:Q,178:ge,195:[1,204],196:207,197:209,198:208,199:211,206:203,210:He,211:212,283:z,284:Z,285:ee,286:te,293:qe,409:185,410:je,414:Ve,444:202},{3:215,4:r,5:a},{343:[1,216]},t(We,[2,760],{77:217,103:218,104:[1,219]}),t(Xe,[2,764],{87:220}),{3:224,4:r,5:a,187:[1,222],190:[1,225],337:[1,221],343:[1,226],394:[1,223]},{343:[1,227]},{3:230,4:r,5:a,70:228,72:229},t([297,509,510],n,{10:3,11:4,15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,7:232,4:r,5:a,12:s,51:i,69:o,86:u,121:c,143:l,153:d,186:h,262:f,283:p,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,426:[1,231],427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),{426:[1,233]},{426:[1,234]},{3:236,4:r,5:a,394:[1,235]},{3:238,4:r,5:a,196:237},t(K,[2,600],{110:239,129:ue,289:De}),t(Ye,[2,305]),{110:240,129:ue,289:De},{3:113,4:r,5:a,110:246,128:oe,129:[1,243],140:le,141:241,142:Ke,149:he,153:Q,178:ge,193:245,197:250,198:249,254:247,255:248,261:Qe,267:242,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,293:qe,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:252,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(K,[2,656]),t(K,[2,657]),{3:163,4:r,5:a,38:254,55:160,74:ie,76:74,86:u,91:255,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,148:253,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,181:99,186:h,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:261,4:r,5:a,110:258,129:ue,289:De,435:256,436:257,437:259,438:ze},{3:262,4:r,5:a,140:Ze,142:et,421:263},{3:163,4:r,5:a,55:160,74:ie,91:266,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{496:[1,267]},{3:100,4:r,5:a,495:269,497:268},{3:113,4:r,5:a,153:Q,197:270,283:z,284:Z,285:ee,286:te},{3:163,4:r,5:a,55:160,74:ie,91:271,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(tt,nt,{183:275,161:[1,274],182:[1,272],184:[1,273],192:rt}),t(at,[2,741],{74:[1,277]}),t(st,[2,148],{146:[1,278],147:[1,279],187:[1,280],188:[1,281],189:[1,282],190:[1,283],191:[1,284]}),t(it,[2,1]),t(it,[2,2]),{1:[2,3]},t(Y,n,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,10:285,4:r,5:a,51:i,69:o,86:u,121:c,143:l,153:d,186:h,262:f,283:p,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),t(ot,[2,758]),t(ot,[2,759]),t(Y,[2,7]),{14:[1,286]},{3:238,4:r,5:a,196:287},{394:[1,288]},t(K,[2,744]),{74:ut},{74:[1,290]},{74:ct},{74:[1,292]},{74:[1,293]},{3:163,4:r,5:a,55:160,74:ie,91:294,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(Pe,lt,{340:295,153:dt}),{394:[1,297]},{3:298,4:r,5:a},{190:[1,299]},{3:305,4:r,5:a,129:ht,134:ft,140:Ze,142:et,149:pt,180:[1,301],421:312,464:300,465:302,466:303,469:304,473:309,484:306,488:308},{127:[1,316],339:313,343:[1,315],399:[1,314]},{110:318,129:ue,180:[2,858],289:De,462:317},t(bt,[2,852],{456:319,3:320,4:r,5:a}),{3:321,4:r,5:a},t(ne,[2,486]),t(K,[2,670],{71:[1,322]}),t(gt,[2,671]),{3:323,4:r,5:a},{3:238,4:r,5:a,196:324},{3:325,4:r,5:a},t(Pe,mt,{387:326,153:vt}),{394:[1,328]},{3:329,4:r,5:a},t(Pe,mt,{387:330,153:vt}),t(Pe,mt,{387:331,153:vt}),{3:332,4:r,5:a},t(Et,[2,846]),t(Et,[2,847]),t(K,n,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,10:333,111:349,317:361,4:r,5:a,51:i,69:o,86:u,96:yt,109:St,112:wt,113:Tt,120:xt,121:At,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,143:l,151:It,153:d,167:Lt,168:qt,176:Ut,177:Ft,186:h,262:f,283:p,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,321:zt,322:Zt,323:en,324:tn,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),t(Ye,[2,284]),t(Ye,[2,285]),t(Ye,[2,286]),t(Ye,[2,287]),t(Ye,[2,288]),t(Ye,[2,289]),t(Ye,[2,290]),t(Ye,[2,291]),t(Ye,[2,292]),t(Ye,[2,293]),t(Ye,[2,294]),t(Ye,[2,295]),t(Ye,[2,296]),t(Ye,[2,297]),t(Ye,[2,298]),t(Ye,[2,299]),{3:163,4:r,5:a,24:378,25:377,34:373,38:372,55:160,74:ie,76:74,86:u,91:375,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,181:99,186:h,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,260:374,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:[1,376],284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,330:m,337:[1,379],409:185,410:je,414:Ve},t(Ye,[2,303]),t(Ye,[2,304]),{74:[1,380]},t([4,5,8,51,69,71,73,75,86,90,92,95,96,104,109,112,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],nn,{74:ut,113:[1,381]}),{3:163,4:r,5:a,55:160,74:ie,91:382,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:383,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:384,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:385,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:386,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185, 410:je,414:Ve},t(Ye,[2,279]),t([4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,246,261,262,263,264,266,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,293,294,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,319,321,322,323,324,326,329,330,333,337,346,358,359,363,364,385,389,390,393,395,397,398,404,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510,511,512],[2,348]),t(rn,[2,349]),t(rn,[2,350]),t(rn,an),t(rn,[2,352]),t([4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,290,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,333,337,346,358,359,363,364,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],[2,353]),{3:388,4:r,5:a,128:[1,389],292:387},{3:390,4:r,5:a},t(rn,[2,358]),t(rn,[2,359]),{3:391,4:r,5:a,74:sn,110:393,128:oe,129:ue,140:le,149:he,178:ge,193:394,198:396,254:395,287:Ne,288:$e,289:De,293:qe,409:397,414:Ve},{74:[1,398]},{3:163,4:r,5:a,55:160,74:ie,91:399,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,295:400,298:401,299:on,307:Fe,319:Me,409:185,410:je,414:Ve},{74:[1,403]},{74:[1,404]},t(un,[2,611]),{3:419,4:r,5:a,74:cn,108:414,110:412,128:oe,129:ue,140:le,141:409,142:Ke,149:he,153:Q,178:ge,193:411,197:417,198:416,254:413,255:415,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,293:qe,409:185,410:je,411:405,412:408,413:410,414:Ve,417:406,418:[1,407]},{3:420,4:r,5:a,153:Q,197:421,283:z,284:Z,285:ee,286:te},{74:[2,328]},{74:[2,329]},{74:[2,330]},{74:[2,331]},{74:[2,332]},{74:[2,333]},{74:[2,334]},{74:[2,335]},{74:[2,336]},{3:427,4:r,5:a,128:ln,129:dn,415:422,416:[1,423],419:424},{3:238,4:r,5:a,196:428},{283:[1,429]},t(Pe,[2,456]),{3:238,4:r,5:a,196:430},{228:[1,432],445:431},{228:[2,679]},{3:213,4:r,5:a,74:Ge,129:Je,140:le,141:206,142:de,149:he,153:Q,178:ge,196:207,197:209,198:208,199:211,206:433,210:He,211:212,283:z,284:Z,285:ee,286:te,293:qe,409:185,410:je,414:Ve},{38:434,76:74,86:u,181:99,186:h},t(hn,[2,808],{207:435,73:[1,436]}),t(fn,[2,181],{3:437,4:r,5:a,73:[1,438],151:[1,439]}),t(fn,[2,185],{3:440,4:r,5:a,73:[1,441]}),t(fn,[2,186],{3:442,4:r,5:a,73:[1,443]}),t(fn,[2,189]),t(fn,[2,190],{3:444,4:r,5:a,73:[1,445]}),t(fn,[2,193],{3:446,4:r,5:a,73:[1,447]}),t([4,5,8,69,71,73,75,90,95,115,125,151,159,165,166,180,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],pn,{74:ut,113:bn}),t([4,5,8,69,71,73,75,90,95,115,125,159,165,166,203,205,219,220,221,222,223,224,225,226,227,228,229,242,244,297,301,509,510],[2,196]),t(K,[2,757]),{3:238,4:r,5:a,196:449},t(gn,mn,{78:450,195:vn}),t(We,[2,761]),t(En,[2,774],{105:452,187:[1,453]}),t([8,75,180,297,301,509,510],mn,{409:185,78:454,114:455,3:456,111:459,141:481,155:491,157:492,4:r,5:a,69:yn,73:Sn,74:wn,109:Tn,112:wt,113:Tt,115:xn,119:An,120:Cn,121:kn,125:On,126:Rn,127:Nn,128:$n,129:Dn,130:In,131:Ln,132:qn,133:Un,134:Fn,135:Mn,136:jn,137:Vn,138:Pn,139:_n,140:Bn,142:Gn,143:Jn,145:Hn,146:Wn,147:Xn,149:Yn,151:Kn,153:Qn,159:zn,161:Zn,163:er,165:tr,166:nr,167:rr,168:ar,169:sr,170:ir,172:or,182:ur,184:cr,195:vn,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,410:je,414:Ve}),{343:[1,505]},{180:[1,506]},t(K,[2,579],{109:[1,507]}),{394:[1,508]},{180:[1,509]},t(K,[2,583],{109:[1,510],180:[1,511]}),{3:238,4:r,5:a,196:512},{38:513,71:[1,514],76:74,86:u,181:99,186:h},t(lr,[2,66]),{73:[1,515]},t(K,[2,651]),{9:105,297:[1,516],509:W,510:X},t(K,[2,649]),t(K,[2,650]),{3:517,4:r,5:a},t(K,[2,572]),{143:[1,518]},t([4,5,8,51,69,71,73,74,75,86,92,121,125,143,145,146,151,153,180,184,186,227,262,283,290,297,301,326,329,330,333,337,346,358,359,363,364,385,389,390,391,392,393,395,397,398,406,407,408,425,427,428,430,431,432,433,434,438,439,442,443,496,498,499,505,506,507,508,509,510],pn,{113:bn}),t(K,[2,599]),t(K,[2,602]),t(K,[2,603]),t(K,[2,604]),t(K,an,{71:[1,519]}),{74:sn,110:393,128:oe,129:ue,140:le,149:he,178:ge,193:394,198:396,254:395,287:Ne,288:$e,289:De,293:qe,409:397,414:Ve},t(dr,[2,312]),t(dr,[2,313]),t(dr,[2,314]),t(dr,[2,315]),t(dr,[2,316]),t(dr,[2,317]),t(dr,[2,318]),t(K,n,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,111:349,317:361,10:520,4:r,5:a,51:i,69:o,86:u,96:yt,109:St,112:wt,113:Tt,120:xt,121:At,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,143:l,151:It,153:d,167:Lt,168:qt,176:Ut,177:Ft,186:h,262:f,283:p,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,321:zt,322:Zt,323:en,324:tn,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),t(K,[2,659],{71:hr}),t(K,[2,660]),t(fr,[2,346],{111:349,317:361,96:yt,109:St,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,151:It,167:Lt,168:qt,176:Ut,177:Ft,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,321:zt,322:Zt,323:en,324:tn}),t(K,[2,661],{71:[1,523]}),t(K,[2,662],{71:[1,524]}),t(gt,[2,667]),t(gt,[2,669]),t(gt,[2,663]),t(gt,[2,664]),{227:[1,526],420:525,424:[1,527]},{3:528,4:r,5:a},t(Pe,[2,640]),t(Pe,[2,641]),t(K,[2,601],{111:349,317:361,96:yt,109:St,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,151:It,167:Lt,168:qt,176:Ut,177:Ft,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,321:zt,322:Zt,323:en,324:tn}),{3:100,4:r,5:a,495:269,497:529},t(K,[2,738],{71:br}),t(fr,[2,740]),t(K,[2,743]),t(K,[2,665],{111:349,317:361,96:yt,109:St,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,151:It,167:Lt,168:qt,176:Ut,177:Ft,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,321:zt,322:Zt,323:en,324:tn}),t(gr,nt,{183:531,192:rt}),t(gr,nt,{183:532,192:rt}),t(gr,nt,{183:533,192:rt}),t(mr,[2,804],{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,185:534,171:535,250:536,91:537,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),{74:[1,539],128:oe,193:538},{3:100,4:r,5:a,495:269,497:540},t(st,[2,149]),t(st,[2,150]),t(st,[2,151]),t(st,[2,152]),t(st,[2,153]),t(st,[2,154]),t(st,[2,155]),t(Y,[2,4]),t(Y,n,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,47:38,48:39,49:40,50:41,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,65:56,66:57,67:58,68:59,76:74,495:95,181:99,3:100,10:541,4:r,5:a,51:i,69:o,86:u,121:c,143:l,153:d,186:h,262:f,283:p,326:b,329:g,330:m,337:v,385:E,389:y,390:S,393:w,395:x,397:A,398:C,406:k,407:R,408:N,425:$,427:D,428:I,430:L,431:q,432:U,433:F,434:M,438:j,439:V,442:P,443:_,496:B,498:G,499:J,508:H}),{385:[1,545],390:[1,542],391:[1,543],392:[1,544]},{3:546,4:r,5:a},t(gr,[2,828],{282:547,514:549,75:[1,548],161:[1,551],182:[1,550]}),{3:163,4:r,5:a,55:160,74:ie,91:255,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,148:552,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:255,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,148:553,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:554,4:r,5:a,129:[1,555]},{3:556,4:r,5:a,129:[1,557]},{3:558,4:r,5:a,96:yt,109:St,111:349,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,151:It,167:Lt,168:qt,176:Ut,177:Ft,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,317:361,321:zt,322:Zt,323:en,324:tn},{3:559,4:r,5:a},{151:[1,560]},t(vr,lt,{340:561,153:dt}),{227:[1,562]},{3:563,4:r,5:a},t(K,[2,713],{71:Er}),{3:163,4:r,5:a,55:160,74:ie,91:565,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(fr,[2,716]),t(yr,[2,860],{409:185,467:566,141:567,136:Sr,138:Sr,142:Ke,410:je,414:Ve}),{136:[1,568],138:[1,569]},t(wr,Tr,{481:571,484:572,74:[1,570],134:ft}),t(xr,[2,884],{485:573,129:[1,574]}),t(Ar,[2,888],{487:575,488:576,149:pt}),t(Ar,[2,731]),t(Cr,[2,723]),{3:577,4:r,5:a,128:[1,578]},{3:579,4:r,5:a},{3:580,4:r,5:a},t(Pe,lt,{340:581,153:dt}),t(Pe,lt,{340:582,153:dt}),t(Et,[2,475]),t(Et,[2,476]),{180:[1,583]},{180:[2,859]},t(kr,[2,854],{457:584,460:585,134:[1,586]}),t(bt,[2,853]),t(Or,Rr,{501:587,92:Nr,227:[1,588],505:$r,506:Dr,507:Ir}),{142:se,441:593},{4:Lr,73:[1,595],265:594,378:qr},t(K,[2,446],{125:[1,598]}),t(K,[2,564]),{3:599,4:r,5:a},{291:[1,600]},t(vr,mt,{387:601,153:vt}),t(K,[2,578]),{3:238,4:r,5:a,196:603,388:602},{3:238,4:r,5:a,196:603,388:604},t(K,[2,756]),t(Y,[2,653],{429:605,301:[1,606]}),{3:163,4:r,5:a,55:160,74:ie,91:607,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:608,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:609,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:610,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:611,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:612,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:613,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:614,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:615,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:616,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:617,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:618,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:619,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:620,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:621,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:622,4:r,5:a,74:[1,624],128:oe,153:Q,193:623,197:625,283:z,284:Z,285:ee,286:te},{3:626,4:r,5:a,74:[1,628],128:oe,153:Q,193:627,197:629,283:z,284:Z,285:ee,286:te},t(Ur,[2,430],{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,91:630,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),t(Ur,[2,431],{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,91:631,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),t(Ur,[2,432],{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,91:632,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),t(Ur,[2,433],{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,91:633,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),t(Ur,Fr,{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,91:634,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),{3:163,4:r,5:a,55:160,74:ie,91:635,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:636,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(Ur,[2,435],{252:143,197:144,253:145,108:146,251:147,193:148,254:149,110:150,255:151,198:152,199:153,256:154,257:155,258:156,141:157,259:158,55:160,155:162,3:163,409:185,91:637,4:r,5:a,74:ie,128:oe,129:ue,134:ce,140:le,142:de,149:he,151:fe,153:Q,176:pe,177:be,178:ge,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,410:je,414:Ve}),{3:163,4:r,5:a,55:160,74:ie,91:638,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:639,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{161:[1,641],163:[1,643],318:640,325:[1,642]},{3:163,4:r,5:a,55:160,74:ie,91:644,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:645,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:419,4:r,5:a,74:[1,646],108:649,142:Mr,153:Q,197:650,199:648,283:z,284:Z,285:ee,286:te,320:647},{96:[1,652],290:[1,653]},{3:163,4:r,5:a,55:160,74:ie,91:654,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:655,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:656,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{4:Lr,265:657,378:qr},t(jr,[2,84]),t(jr,[2,85]),{75:[1,658]},{75:[1,659]},{75:[1,660]},{75:[1,661],96:yt,109:St,111:349,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,151:It,167:Lt,168:qt,176:Ut,177:Ft,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,317:361,321:zt,322:Zt,323:en,324:tn},t(Pe,_e,{331:201,74:ct,195:Be}),{75:[2,824]},{75:[2,825]},{131:re,132:ae},{3:163,4:r,5:a,55:160,74:ie,91:255,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,148:662,149:he,151:fe,153:Q,155:162,161:[1,664],176:pe,177:be,178:ge,182:[1,663],193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:665,4:r,5:a,146:Vr,177:[1,667]},t([4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,115,119,125,126,127,128,129,131,132,134,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,304,321,322,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],[2,406],{111:349,317:361,109:St,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,176:Ut,177:Ft,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,323:en}),t(Pr,[2,407],{111:349,317:361,112:wt,113:Tt,120:xt,130:Ct,133:kt,135:Ot,177:Ft,306:Pt}),t(Pr,[2,408],{111:349,317:361,112:wt,113:Tt,120:xt,130:Ct,133:kt,135:Ot,177:Ft,306:Pt}),t(_r,[2,409],{111:349,317:361,306:Pt}),t(_r,[2,410],{111:349,317:361,306:Pt}),t(rn,[2,356]),t(rn,[2,830]),t(rn,[2,831]),t(rn,[2,357]),t([4,5,8,51,69,71,73,74,75,86,90,92,95,96,104,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,227,228,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],[2,354]),{3:163,4:r,5:a,55:160,74:ie,91:668,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t(un,[2,607]),t(un,[2,608]),t(un,[2,609]),t(un,[2,610]),t(un,[2,612]),{38:669,76:74,86:u,181:99,186:h},{96:yt,109:St,111:349,112:wt,113:Tt,120:xt,121:pr,130:Ct,133:kt,135:Ot,136:Rt,137:Nt,138:$t,139:Dt,151:It,167:Lt,168:qt,176:Ut,177:Ft,295:670,298:401,299:on,302:Mt,303:jt,305:Vt,306:Pt,307:_t,308:Bt,309:Gt,310:Jt,311:Ht,312:Wt,313:Xt,314:Yt,315:Kt,316:Qt,317:361,321:zt,322:Zt,323:en,324:tn},{296:671,297:Br,298:672,299:on,301:Gr},t(Jr,[2,363]),{3:163,4:r,5:a,55:160,74:ie,91:674,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{3:163,4:r,5:a,55:160,74:ie,91:675,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},{4:Lr,265:676,378:qr},t(un,[2,613]),{71:[1,678],418:[1,677]},t(un,[2,629]),t(Hr,[2,636]),t(Wr,[2,614]),t(Wr,[2,615]),t(Wr,[2,616]),t(Wr,[2,617]),t(Wr,[2,618]),t(Wr,[2,619]),t(Wr,[2,620]),t(Wr,[2,621]),t(Wr,[2,622]),{3:163,4:r,5:a,55:160,74:ie,91:679,108:146,110:150,128:oe,129:ue,134:ce,140:le,141:157,142:de,149:he,151:fe,153:Q,155:162,176:pe,177:be,178:ge,193:148,197:144,198:152,199:153,251:147,252:143,253:145,254:149,255:151,256:154,257:155,258:156,259:158,261:me,262:f,263:ve,264:Ee,266:ye,273:Se,274:we,275:Te,276:xe,277:Ae,278:Ce,279:ke,280:Oe,281:Re,283:z,284:Z,285:ee,286:te,287:Ne,288:$e,289:De,290:Ie,291:Le,293:qe,294:Ue,307:Fe,319:Me,409:185,410:je,414:Ve},t([4,5,8,51,69,71,73,75,86,90,92,95,96,104,109,112,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,186,195,203,205,219,220,221,222,223,224,225,226,229,236,239,240,242,244,262,273,274,275,276,277,278,279,280,281,283,289,297,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,321,322,323,324,326,329,330,337,385,389,390,393,395,397,398,406,407,408,410,414,416,418,425,427,428,430,431,432,433,434,438,439,442,443,455,461,496,498,499,508,509,510],nn,{74:ut,113:Xr}),t(Yr,[2,306],{74:ut}),t(Ye,[2,307]),{71:[1,682],416:[1,681]},t(un,[2,626]),t(Kr,[2,631]),{149:[1,683]},{149:[1,684]},{149:[1,685]},{38:689,74:[1,688],76:74,86:u,146:[1,686],181:99,186:h,333:[1,687]},t(Pe,_e,{331:690,195:Be}),{146:[1,691]},{227:[1,693],446:692},{3:213,4:r,5:a,74:Ge,129:Je,140:le,141:206,142:de,149:he,153:Q,178:ge,196:207,197:209,198:208,199:211,206:694,210:He,211:212,283:z,284:Z,285:ee,286:te,293:qe,409:185,410:je,414:Ve},{228:[2,680]},{75:[1,695]},t(fn,[2,810],{208:696,3:697,4:r,5:a}),t(hn,[2,809]),t(fn,[2,179]),{3:698,4:r,5:a},{209:[1,699]},t(fn,[2,183]),{3:700,4:r,5:a},t(fn,[2,187]),{3:701,4:r,5:a},t(fn,[2,191]),{3:702,4:r,5:a},t(fn,[2,194]),{3:703,4:r,5:a},{3:704,4:r,5:a},{145:[1,705]},t(Qr,[2,168],{79:706,180:[1,707]}),{3:213,4:r,5:a,129:[1,712],140:le,142:[1,713],149:he,153:Q,178:ge,196:708,197:709,198:710,199:711,283:z,284:Z,285:ee,286:te,293:qe},{3:718,4:r,5:a,106:714,107:715,108:716,109:zr},t(En,[2,775]),t(Zr,[2,766],{88:719,179:720,180:[1,721]}),t(Xe,[2,765],{150:722,176:ea,177:ta,178:na}),t([4,5,8,69,71,73,75,109,112,113,115,119,120,121,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,145,146,147,149,151,153,159,161,163,165,166,167,168,169,170,172,176,177,178,180,182,184,195,273,274,275,276,277,278,279,280,281,297,301,410,414,509,510],[2,86],{ diff --git a/package.json b/package.json index 65b176a3e9..30c4cae2ba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alasql", "description": "Versatile SQL database for browser or node. Handles relational data and nested JSON (noSQL). Export to and import from Excel, localStorage or IndexedDB", - "version": "0.2.2", + "version": "0.2.3", "author": "Andrey Gershun ", "contributors": [ { diff --git a/partners/meteor/.versions b/partners/meteor/.versions index 04f2bacdd5..786471c9f6 100644 --- a/partners/meteor/.versions +++ b/partners/meteor/.versions @@ -1,4 +1,4 @@ -agershun:alasql@0.2.2 -local-test:agershun:alasql@0.2.2 +agershun:alasql@0.2.3 +local-test:agershun:alasql@0.2.3 meteor@1.1.6 underscore@1.0.3 diff --git a/partners/meteor/package.js b/partners/meteor/package.js index b60e427db5..45a7336fad 100644 --- a/partners/meteor/package.js +++ b/partners/meteor/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'agershun:alasql', - version: '0.2.2', + version: '0.2.3', // Brief, one-line summary of the package. summary: 'AlaSQL - JavaScript SQL database library', // URL to the Git repository containing the source code for this package. diff --git a/test/test429.json b/test/test429.json index 7171bd0597..65d69d0ddb 100644 --- a/test/test429.json +++ b/test/test429.json @@ -1,3 +1,14 @@ { - "alasql": "{\"databases\":{}}" -} + "alasql": "{\"databases\":{\"test267\":true,\"Atlas\":true,\"test\":true,\"ls429\":true,\"test430g1\":true,\"ls379\":true}}", + "test267": "{\"databaseid\":\"test267\",\"tables\":{\"test\":true}}", + "test267.test": "{\"columns\":[],\"data\":[],\"identities\":{}}", + "Atlas": "{\"databaseid\":\"Atlas\",\"tables\":{\"transactions\":true}}", + "Atlas.transactions": "{\"columns\":[{\"columnid\":\"transid\",\"dbtypeid\":\"\"},{\"columnid\":\"payee\",\"dbtypeid\":\"\"},{\"columnid\":\"amount\",\"dbtypeid\":\"\"}],\"data\":[],\"identities\":{}}", + "test": "{\"databaseid\":\"test\",\"tables\":{\"one\":true}}", + "test.one": "{\"columns\":[{\"columnid\":\"a\",\"dbtypeid\":\"INT\",\"identity\":{\"value\":1,\"step\":1}},{\"columnid\":\"b\",\"dbtypeid\":\"STRING\"}],\"data\":[{\"b\":\"one\"},{\"b\":\"two\"},{\"b\":\"three\"},{\"b\":\"four\"},{\"b\":\"one\"},{\"b\":\"two\"},{\"b\":\"three\"},{\"b\":\"four\"},{\"b\":\"one\"},{\"b\":\"two\"},{\"b\":\"three\"},{\"b\":\"four\"},{\"b\":\"one\"},{\"b\":\"two\"},{\"b\":\"three\"},{\"b\":\"four\"}],\"identities\":{\"a\":{\"value\":1,\"step\":1}}}", + "ls429": "{\"databaseid\":\"ls429\",\"tables\":{\"one\":true}}", + "ls429.one": "{\"columns\":[{\"columnid\":\"str\",\"dbtypeid\":\"STRING\"}],\"data\":[[\"a\"],[\"a\"],[\"a\"],[\"a\"],[\"a\"],[\"a\"],{\"str\":\"b\"}],\"identities\":{}}", + "test430g1": "{\"databaseid\":\"test430g1\",\"tables\":{}}", + "ls379": "{\"databaseid\":\"ls379\",\"tables\":{\"one\":true}}", + "ls379.one": "{\"columns\":[{\"columnid\":\"a\",\"dbtypeid\":\"INT\"},{\"columnid\":\"b\",\"dbtypeid\":\"STRING\"}],\"data\":[],\"identities\":{}}" +} \ No newline at end of file